示例#1
0
	void MeshSceneNode::render(Renderer *renderer, Program *program, Camera *cam, 
		const glm::mat4 &current, const glm::mat4 &currentRotation)
	{
		auto material=getMaterial();
		const glm::mat4 tmpMatrix=current*m_relative.getMatrix();
		const glm::mat4 tmpRotation=currentRotation*m_relative.getRotationMatrix();
		if(m_last != tmpMatrix)
			transformAABB(tmpMatrix);
		Frustum frustum = cam->getFrustum();
		if((frustum.AABBinFrustum(m_aabb)) && material)
		{
			program->setUniform("mvp", cam->getVPMatrix()*tmpMatrix);
			program->setUniform("model", tmpMatrix);
			program->setUniform("nmat", tmpRotation);
			program->setUniform("eyePos", cam->getPos());
			renderer->drawElements(program, m_vao, PT_TRIANGLES, m_indicesCount);
		}
	}