Пример #1
0
	void sb7fbxmodel::ProcessNode(FbxNode* pNode)
	{
		if(pNode->GetNodeAttribute())
		{
			switch(pNode->GetNodeAttribute()->GetAttributeType())
			{
			case FbxNodeAttribute::eMesh:
				ProcessMesh(pNode);
				break;
			case FbxNodeAttribute::eSkeleton:
				ProcessSkeleton(pNode);
				break;
			case FbxNodeAttribute::eLight:
				ProcessLight(pNode);
				break;
			case FbxNodeAttribute::eCamera:
				ProcessCamera();
				break;
			}
		}

		for(int i = 0 ; i < pNode->GetChildCount() ; ++i)
		{
			ProcessNode(pNode->GetChild(i));
		}
	}
Пример #2
0
	void Rendering::Render(void)
	{
		auto cameraIter = cameras.begin();
		auto cameraEnd = cameras.end();


		for(unsigned int i = 0; i < 32 && cameraIter != cameraEnd; ++i)
		{
			currentCamera = *cameraIter;

			ProcessCamera();

			//- For each visible renderer
			//	- PrelitProcess
			if( renderableTree.GetRoot() != 0 )
				PreLitTraversal( *cameraIter, renderableTree.GetRoot() );

			ProcessPreLitVisibleSet();

			//- For each visible light
			//	- Build visible renderer set
			//	- ProcessLight
			if( lightTree.GetRoot() != 0 )
				LightTraversal( *cameraIter, lightTree.GetRoot() );

			auto directionalIter = directionalLightList.begin();
			auto directionalEnd = directionalLightList.end();
			for(; directionalIter != directionalEnd; ++directionalIter)
			{
				IDirectionalLight* directionalLight = *directionalIter;

				if( !currentCamera->CullLight( directionalLight ) )
					continue;

				directionalLight->visibleSetHead = 0;
				directionalLight->SetAabb( currentCamera->GetFrustumAabb() );
				
				LightSubTraversal( directionalLight, renderableTree.GetRoot() );
				ProcessLight( directionalLight );
			}

			ProcessVisibleLightSet();

			//- For each visible renderer
			//	- PostLitProcess
			if( renderableTree.GetRoot() != 0 )
				PostLitTraversal( *cameraIter, renderableTree.GetRoot() );

			ProcessPostLitVisibleSet();

			PostProcessCamera();

			++cameraIter;
		}

		currentCamera = 0;
	}
Пример #3
0
	void Rendering::LightTraversal(Camera* camera, EDSpatial::DynAabbTree::Node* node )
	{
		const Float4x4& worldMatrix = camera->GetTransform()->GetWorldMatrix();

		const EDMath::Aabb& aabb = node->GetAabb();

		for(int i = 0; i < 6; ++i)
		{
			float r = aabb.extents.x * abs(camera->frustum[i].normal.x) + 
				aabb.extents.y * abs(camera->frustum[i].normal.y) +
				aabb.extents.z * abs(camera->frustum[i].normal.z);

			float d = DotProduct(camera->frustum[i].normal, aabb.center) - camera->frustum[i].distance;

			if( d < -r )
				return;
		}
		
		VisibleTreeBranch* branch = (VisibleTreeBranch*)node->asBranch();
		LightTreeLeaf* leaf = (LightTreeLeaf*)node->asLeaf();
		if( branch )
		{
			LightTraversal( camera, branch->leftChild );
			LightTraversal( camera, branch->rightChild );
		}
		else if( leaf )
		{
			if( camera->CullLight( leaf->object ) )
			{
				leaf->object->visibleSetHead = 0;
				
				LightSubTraversal( leaf->object, renderableTree.GetRoot() );

				ProcessLight( leaf->object );
			}
		}
	}
Пример #4
0
void FbxParser::ProcessNode(FbxNode* pNode,std::vector<GS::BaseMesh*>& meshs, 
							std::vector<GS::Light*>& lights, GS::Camera& camera)
{
    FbxNodeAttribute::EType lAttributeType;
    int i;

    if(pNode->GetNodeAttribute() == NULL)
    {
         return ;
    }
    else
    {
        lAttributeType = (pNode->GetNodeAttribute()->GetAttributeType());

        switch (lAttributeType)
        {
	    default:
	        break;
        //case FbxNodeAttribute::eMarker:  
        //    DisplayMarker(pNode);
        //    break;

        //case FbxNodeAttribute::eSkeleton:  
        //    DisplaySkeleton(pNode);
        //    break;

        case FbxNodeAttribute::eMesh:      
            ProcessMesh(pNode, meshs);
            break;

        //case FbxNodeAttribute::eNurbs:      
        //    DisplayNurb(pNode);
        //    break;

        //case FbxNodeAttribute::ePatch:     
        //    DisplayPatch(pNode);
        //    break;

        case FbxNodeAttribute::eCamera:    
            ProcessCamera(pNode, camera);
            break;

        case FbxNodeAttribute::eLight:     
            ProcessLight(pNode, lights);
            break;

        //case FbxNodeAttribute::eLODGroup:
        //    DisplayLodGroup(pNode);
        //    break;
        }   
    }

   /* DisplayUserProperties(pNode);
    DisplayTarget(pNode);
    DisplayPivotsAndLimits(pNode);
    DisplayTransformPropagation(pNode);
    DisplayGeometricTransform(pNode);*/

    for(i = 0; i < pNode->GetChildCount(); i++)
    {
        ProcessNode(pNode->GetChild(i), meshs, lights, camera);
    }
}