Beispiel #1
0
void SceneNode::Draw(SceneManager *sceneManager, Mesh* debugMesh)
{
	sceneManager->PreRender(true);

	if (gameObject3D != NULL)
	{
		sceneManager->RenderPush(gameObject3D->getProperties().modelProperties);

#if _DEBUG
		if (debugMesh != NULL)
		{
			MS modelStack;
			modelStack.LoadIdentity();
			modelStack.PushMatrix();
			modelStack.Translate(gameObject3D->getHitbox().getMidPoint().x, gameObject3D->getHitbox().getMidPoint().y, gameObject3D->getHitbox().getMidPoint().z);
			modelStack.MultMatrix(gameObject3D->getProperties().rotation);
			modelStack.Scale(gameObject3D->getHitbox().getLength(), gameObject3D->getHitbox().getHeight(), gameObject3D->getHitbox().getDepth());
			sceneManager->Render3DMesh(debugMesh, false);
			modelStack.PopMatrix();
		}
#endif
		sceneManager->Render3DMesh(gameObject3D->getMesh(), gameObject3D->getReflectLight());
	}

	for (unsigned i = 0; i < childNodes.size(); ++i)
	{
		this->childNodes[i]->DrawChild(sceneManager, debugMesh);
	}

	if (gameObject3D != NULL)
	{
		sceneManager->RenderPop();
	}
}