src/renderer.cpp
void Renderer::renderNode(const Matrix44& prefab_model, GTR::Node* node, Camera* camera)
{
	if (!node->visible)
		return;

	//compute global matrix
	Matrix44 node_model = node->getGlobalMatrix(true) * prefab_model;

	//does this node have a mesh? then we must render it
	if (node->mesh && node->material)
	{
		//compute the bounding box of the object in world space (by using the mesh bounding box transformed to world space)
		BoundingBox world_bounding = transformBoundingBox(node_model,node->mesh->box);
		
		//if bounding box is inside the camera frustum then the object is probably visible
		if (camera->testBoxInFrustum(world_bounding.center, world_bounding.halfsize) )
		{
			//render node mesh
			renderMeshWithMaterial( node_model, node->mesh, node->material, camera );
			//node->mesh->renderBounding(node_model, true);
		}
	}

	//iterate recursively with children
	for (int i = 0; i < node->children.size(); ++i)
		renderNode(prefab_model, node->children[i], camera);
}
//renders a node of the prefab and its children

renders a node of the prefab and its children
renders a node of the prefab and its children
void Renderer::renderNode(const Matrix44& prefab_model, GTR::Node* node, Camera* camera)
{
	if (!node->visible)
		return;
	Matrix44 node_model = node->getGlobalMatrix(true) * prefab_model;
	if (node->mesh && node->material)
	{
		BoundingBox world_bounding = transformBoundingBox(node_model,node->mesh->box);
		if (camera->testBoxInFrustum(world_bounding.center, world_bounding.halfsize) )
		{
			renderMeshWithMaterial( node_model, node->mesh, node->material, camera );
		}
	}
	for (int i = 0; i < node->children.size(); ++i)
		renderNode(prefab_model, node->children[i], camera);
}
void Renderer :: renderNode ( const Matrix44 & prefab_model , GTR :: Node * node , Camera * camera ) { if ( ! node -> visible ) return ; Matrix44 node_model = node -> getGlobalMatrix ( true ) * prefab_model ; if ( node -> mesh && node -> material ) { BoundingBox world_bounding = transformBoundingBox ( node_model , node -> mesh -> box ) ; if ( camera -> testBoxInFrustum ( world_bounding . center , world_bounding . halfsize ) ) { renderMeshWithMaterial ( node_model , node -> mesh , node -> material , camera ) ; } } for ( int i = 0 ; i < node -> children . size ( ) ; ++ i ) renderNode ( prefab_model , node -> children [ i ] , camera ) ; }
renders a node of the prefab and its children
renders a node of the prefab and its children
//compute global matrix
 //does this node have a mesh? then we must render it
 //compute the bounding box of the object in world space (by using the mesh bounding box transformed to world space)
 //if bounding box is inside the camera frustum then the object is probably visible
 //render node mesh
 //node->mesh->renderBounding(node_model, true);
 //iterate recursively with children
