コード例 #1
0
ファイル: Camera.cpp プロジェクト: elf11/newRepo
void Camera::Update(void)
{
	UpdateWindowData(GAME->WindowWidth,GAME->WindowHeight);
	
	Matrix::CreatePerspective(Math::PiOver4,((float)(windowx)) / windowy, 1.0f, 40000.f, &PerspectiveMat);

	UpdateOrient();
	UpdatePosition();
}
コード例 #2
0
ファイル: CrtNode.cpp プロジェクト: mDibyo/docker-files
void 	CrtNode::Update( CrtFloat time)
{
	// skip this node if it is controlled by physics engine.
	if (UpdateLocalMatrix == CrtFalse && UpdateLocalToWorldMatrix == CrtFalse)
		return;

	// Update orientation matrices for this node

	UpdateOrient( time);

	// Update all the child nodes

	CrtNode * kids = Children;

	while( kids )
	{
		kids->Update( time ); 
		kids = kids->GetNext(); 
	}

/*#if 0
	// !!!GAC EXPERIMENTAL code to find the closest light to a node containing geometry
	// Doing it this way the light positions will be one frame behind all the other objects.
	// Avoiding this requires an extra scene-graph traversal

	// Only do this if there is geometry in this node
	if(Geometry)
	{
		float nearistLightInstanceDistance = FLT_MAX;
		NearistInstanceLight = 0;
		CrtScene *theScene = _CrtRender.GetScene();
		for(CrtInt i=0; i < theScene->NumLightInstances; i++)
		{
			CrtInstanceLight *instanceLight = theScene->GetLightInstances()[i];
			float *lightMatrix = (float *)instanceLight->Parent->GetLocalToWorldMatrix();
			float a = LocalToWorldMatrix[12] - lightMatrix[12];
			float b = LocalToWorldMatrix[13] - lightMatrix[13];
			float c = LocalToWorldMatrix[14] - lightMatrix[14];
			a = (a*a) + (b*b) + (c*c);
			if(a < nearistLightInstanceDistance)
			{
				NearistInstanceLight = instanceLight;
			}
		}
	}
#endif
*/
	// Create matrices that are later used by shaders, these updates should probably eventually be made lazy
	// NOTE: Because CrtMatrix3x4Invert doesn't copy over the last row to the output matrix, we have to do it.
	InverseLocalToWorldMatrix[M30] = InverseLocalToWorldMatrix[M31] = InverseLocalToWorldMatrix[M32] = 0.0;
	InverseLocalToWorldMatrix[M33] = 1.0;
	CrtMatrix3x4Invert( LocalToWorldMatrix, InverseLocalToWorldMatrix);
	CrtMatrixTranspose( InverseLocalToWorldMatrix, InverseTransposeLocalToWorldMatrix );
}