Example #1
0
void
  Network::AddArc(sqlite3_int64 rowid, sqlite3_int64 id_from,
                  sqlite3_int64 id_to, double node_from_x, double node_from_y,
                  double node_to_x, double node_to_y, double cost)
{
//
// inserting an arc into the memory structures 
//
  NetNode *pFrom;
  NetNode *pTo;
  NetNode *pN2;
  NetArc *pA;
  pFrom = ProcessNode(id_from, node_from_x, node_from_y, &pN2);
  if (pN2)
    Error = true;
  pTo = ProcessNode(id_to, node_to_x, node_to_y, &pN2);
  if (pN2)
    Error = true;
  if (!pFrom)
    Error = true;
  if (!pTo)
    Error = true;
  if (pFrom == pTo)
    Error = true;
  if (Error == true)
    return;
  pA = new NetArc(rowid, pFrom, pTo, cost);
  if (!FirstArc)
    FirstArc = pA;
  if (LastArc)
    LastArc->SetNext(pA);
  LastArc = pA;
// updating Node connections 
  pFrom->AddOutcoming(pA);
}
Example #2
0
void FBXScene::ProcessScene(FbxScene* pScene)
{
	if ( m_pSkeleton ) delete m_pSkeleton, m_pSkeleton = 0;

	FbxAxisSystem SceneAxisSystem = pScene->GetGlobalSettings().GetAxisSystem();
	FbxAxisSystem OurAxisSystem(FbxAxisSystem::Motionbuilder);

	if( SceneAxisSystem != OurAxisSystem )
	{
		OurAxisSystem.ConvertScene(pScene);
	}
	
	ProcessMaterials(pScene);
	ProcessNode(pScene->GetRootNode(), FbxNodeAttribute::eSkeleton);
	ProcessNode(pScene->GetRootNode(), FbxNodeAttribute::eMesh);	// takes time, guesstimate 50% of it
	ProcessNode(pScene->GetRootNode(), FbxNodeAttribute::eNurbsCurve); 

	if(m_pSkeleton)
		m_pSkeleton->BuildBoneHierarchy();

	ProcessBlendWeights();
	ProcessSkeleteonBoundingBoxes();

	ProcessAnimations(pScene);	// takes time too, other 50%
}
Example #3
0
void wxSFLayoutHorizontalTree::ProcessNode(wxSFShapeBase* node, double x)
{
	wxASSERT( node );
	
	if( node )
	{
		node->MoveTo( x, m_nMinY );
		
		wxRect rctBB = node->GetBoundingBox();
		if( rctBB.GetHeight() > m_nCurrMaxHeight ) m_nCurrMaxHeight = rctBB.GetHeight();
		
		ShapeList lstNeighbours;
		node->GetNeighbours( lstNeighbours, CLASSINFO(wxSFShapeBase), wxSFShapeBase::lineSTARTING );

		if( lstNeighbours.IsEmpty() )
		{
			m_nMinY += m_nCurrMaxHeight + m_VSpace;
		}
		else
		{
			for( ShapeList::iterator it = lstNeighbours.begin(); it != lstNeighbours.end(); ++it )
			{
				if( ! (*it)->GetParentShape() )	ProcessNode( *it, x + rctBB.GetWidth() + m_HSpace );
			}
		}
	}
}
    void PlainBvhTranslator::UpdateTopLevel(Bvh const& bvh)
    {
        nodecnt_ = root_;

        // Process root
        ProcessNode(bvh.m_root);

        // Set next ptr
        nodes_[root_].bounds.pmax.w = -1;

        for (int j = root_; j < root_ + bvh.m_nodecnt; ++j)
        {
            if (nodes_[j].bounds.pmin.w != -1.f)
            {
                nodes_[j + 1].bounds.pmax.w = nodes_[j].bounds.pmin.w;
                nodes_[(int)(nodes_[j].bounds.pmin.w)].bounds.pmax.w = nodes_[j].bounds.pmax.w;
            }
        }

        for (int j = root_; j < root_ + bvh.m_nodecnt; ++j)
        {
            if (nodes_[j].bounds.pmin.w == -1.f)
            {
                nodes_[j].bounds.pmin.w = (float)extra_[j];
            }
            else
            {
                nodes_[j].bounds.pmin.w = -1.f;
            }
        }

    }
Example #5
0
void FBXSceneInstance::ProcessNode(FbxNode* pNode, FbxNodeAttribute::EType attributeType)
{
	if( !pNode )
		return;

	FbxNodeAttribute* pNodeAttribute = pNode->GetNodeAttribute();
	if (pNodeAttribute)
	{
		if( pNodeAttribute->GetAttributeType() == attributeType )
		{
			switch(pNodeAttribute->GetAttributeType())
			{
			case FbxNodeAttribute::EType::eSkeleton:
				{
					ProcessSkeleton(pNode);
					break;
				}

			default:
				break;
			};
		}
	}

	for( int i = 0; i < pNode->GetChildCount(); ++i )
	{
		ProcessNode(pNode->GetChild(i), attributeType);
	}
}
Example #6
0
//----------------------------
// АПДЕЙТ
//----------------------------
ERRCODE CRenderer::Update()
{
	if(msg.message==WM_QUIT)
		running = false;
	if(!running)
		PostQuitMessage(0);
	if(PeekMessage(&msg, 0, 0, 0, PM_REMOVE))
	{
		TranslateMessage(&msg);
		DispatchMessage(&msg);
	}
	else
	{
		//Проверяем есть ли что на загрузку в VBO и загружаем, если есть
		ProcessBufferQueue();
		glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
		glTranslatef(0.0f, 0.0f, -6.0f);
		glRotatef(-55, 1, 0, 0);
		glRotatef(-45, 0, 0, 1);

		glMatrixMode(GL_MODELVIEW);
		ProcessNode(rootNode);

		glLoadIdentity();
		if(!SwapBuffers(hDC))
			return ERR_CANTSWAPBUFFERS;
	}
	return ERR_OK;
}
	//FbxManager* lSdkManager = FbxManager::Create();
	sb7fbxmodel::sb7fbxmodel(char *fileName)
	{
		FbxManager* lSdkManager = FbxManager::Create();

		// Create the IO settings object.
		FbxIOSettings *ios = FbxIOSettings::Create(lSdkManager, IOSROOT);
		lSdkManager->SetIOSettings(ios);

		// Create an importer using the SDK manager.
		FbxImporter* lImporter = FbxImporter::Create(lSdkManager,"");

		// Use the first argument as the filename for the importer.
		if(!lImporter->Initialize(fileName, -1, lSdkManager->GetIOSettings())) { 
			printf("Call to FbxImporter::Initialize() failed.\n"); 
			printf("Error returned: %s\n\n", lImporter->GetStatus().GetErrorString()); 
			exit(-1); 
		}

		// Create a new scene so that it can be populated by the imported file.
		FbxScene* lScene = FbxScene::Create(lSdkManager,"myScene");

		// Import the contents of the file into the scene.
		lImporter->Import(lScene);
		ProcessNode(lScene->GetRootNode());

		// The file is imported; so get rid of the importer.
		lImporter->Destroy();
	}
	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));
		}
	}
Example #9
0
int	MaxExportPlugin::DoExport(const TCHAR* name, ExpInterface* /*ei*/, Interface* ip, BOOL suppressPrompts, DWORD /*options*/)
{
	#pragma message(TODO("Implement the actual file Export here and"))
	IP = ip;

	if(!suppressPrompts)
		DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_PANEL), GetActiveWindow(), MaxExportPluginOptionsDlgProc, (LPARAM)this);

	meshFile = new MeshIO::MeshIO();

	//Пишем в файл
	//file.open(name, std::ios::out | std::ios::binary);

	INode* rootNode = ip->GetRootNode();
	MessageBox(0, L"Processing nodes", 0, 0);
	ProcessNode(rootNode, 0);
	MessageBox(0, L"Processing TriObjects", 0, 0);
	ProcessTriObjects();
	
	MessageBox(0, L"Writing", 0, 0);
	//file.close();
	meshFile->SwapYZ();
	meshFile->Write(std::wstring(name), MeshIO::MSH_BIN);
	delete meshFile;
	
	#pragma message(TODO("return TRUE If the file is exported properly"))
	return TRUE;
}
Example #10
0
/* user context or dag-exec-thread context:
 * This is the first step in post-processing a newly-completed node.
 * This routine is called by each node execution function to mark the node
 * as complete and fire off any successors that have been enabled.
 */
int
rf_FinishNode(RF_DagNode_t *node, int context)
{
	int     retcode = RF_FALSE;
	node->dagHdr->numNodesCompleted++;
	ProcessNode(node, context);

	return (retcode);
}
Example #11
0
void Model::LoadFromFile(String path)
{
	Assimp::Importer importer;

	const aiScene* scene = importer.ReadFile(path, aiProcess_Triangulate | aiProcess_ConvertToLeftHanded);

	ProcessNode(scene->mRootNode, scene);

}
status_t Converter::ConvertPDoc2FreeMind()
{
	status_t		err					= B_OK;
	BMessage		*inMessage			= new BMessage();
	BMessage		*tmpMessage			= new BMessage();
	void			*id					= NULL;

 	allConnections	= new BMessage();
	selected		= new BMessage();
	allNodes		= new BMessage();


	err = inMessage->Unflatten(in);
	if (err == B_OK)
	{
		inMessage->FindMessage("PDocument::allConnections",allConnections);
		inMessage->FindMessage("PDocument::selected",selected);
		inMessage->FindMessage("PDocument::allNodes",allNodes);
		int32 i = 0;
		while(allNodes->FindMessage("node",i,tmpMessage)==B_OK)
		{
			tmpMessage->FindPointer("this",&id);
			nodes[(int32)id]=tmpMessage;
			tmpMessage = new BMessage();
-			i++;
		}
		i = 0;
		while(allConnections->FindMessage("node",i,tmpMessage)==B_OK)
		{
			tmpMessage->FindPointer("this",&id);
			connections[(int32)id]=tmpMessage;
			tmpMessage = new BMessage();
			i++;
		}

		BMessage	*node= GuessStartNode();
		TiXmlDocument	doc;
		TiXmlElement	freeMap("map");
		freeMap.SetAttribute("version","0.9.0");
		freeMap.SetAttribute("background_color","#ffffff");
		TiXmlComment	comment("this File was gernerated by ProjectConceptor! - To view this file, download free mind mapping software FreeMind from http://freemind.sourceforge.net");
		freeMap.InsertEndChild(comment);

		tmpMessage=GuessStartNode();
	//	tmpMessage = nodes.begin()->second;
		freeMap.InsertEndChild(ProcessNode(tmpMessage));
		doc.InsertEndChild(freeMap);
		TiXmlPrinter	printer;
//		printer.SetStreamPrinting();
//		printer.SetLineBreak("\n");
//		printer.SetIndent("\t");
		doc.Accept( &printer );
		out->Write(printer.CStr(),strlen(printer.CStr()));
	}
	return err;
}
Example #13
0
void CRenderer::ProcessNode(CNode* node)
{
	std::vector<CNode*> *vec = node->GetNodeVector();

	//Обновляем нод, рендерим сущности
	//Log("Node is updated\n");
	glTranslatef(node->GetPosX(), node->GetPosY(), node->GetPosZ());

	for(int i = 0; i < node->GetObjVector()->size(); i++)
	{
		if(node->GetObjVector()->at(i)->GetType()==OBJECT_ENTITY)
		{
			//TO DO:
			//Берем шейдер, соотвутствующий сущности и активируем его
			//-----
			CMaterial* mat;
			CShader* sh;
			if((mat = ((CEntity*)node->GetObjVector()->at(i))->GetMaterial())!=0)
			{
				if((sh = mat->GetShader())!=0)
				{
					if(sh->IsCompiled())
					{
						glUseProgram(sh->GetProgramId());
					}
				}
			}
			DrawMesh(((CEntity*)node->GetObjVector()->at(i))->GetMesh());
			glUseProgram(0);
		}
	}
	
	glDisable(GL_DEPTH_TEST);
	glBegin(GL_LINES);
	glColor3f(0.5, 1, 0.5);
	glVertex3f(0, 0, 0);
	glVertex3f(0, 1, 0);
	glColor3f(1, 0.5, 0.5);
	glVertex3f(0, 0, 0);
	glVertex3f(1, 0, 0);
	glColor3f(0.5, 0.5, 1);
	glVertex3f(0, 0, 0);
	glVertex3f(0, 0, 1);
	glColor3f(1,1,1);
	glEnd();
	glEnable(GL_DEPTH_TEST);

	for(int i = 0; i < vec->size(); i++)
	{
		ProcessNode(vec->at(i));	
	}
	glTranslatef(-node->GetPosX(), -node->GetPosY(), -node->GetPosZ());
}
Example #14
0
void KDTree::Build(Scene* scene)
{
	TriangleList *triangles= scene->GetTriangles();
	aabb box = scene->GetBoundingBox();
	Subdivide(*m_Root,triangles,box,0);

	//Build the ropes in the kdtree
	KDTreeNode* RS[6];
	for(int i=0; i<6; i++)
		RS[i] = NULL;
	ProcessNode(m_Root,RS);
}
Example #15
0
void ModelResource::Load()
{
	Assimp::Importer importer;
	const aiScene* scene = importer.ReadFile(Path.FullPath.c_str(), aiProcess_Triangulate | aiProcess_FlipUVs | aiProcess_CalcTangentSpace);
	if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
	{
		std::cout << "ERROR::ASSIMP:: " << importer.GetErrorString() << std::endl;
		return;
	}

	ProcessNode(scene->mRootNode, scene);
}
Example #16
0
void FbxParser::ProcessScene(std::vector<GS::BaseMesh*>& meshs, std::vector<GS::Light*>& lights,GS::Camera& camera)
{
	int i;
    FbxNode* lNode = mpFbxScene->GetRootNode();
    if(lNode)
    {
        for(i = 0; i < lNode->GetChildCount(); i++)
        {
            ProcessNode(lNode->GetChild(i),meshs,lights, camera);
        }
    }
}
Example #17
0
void ModelResource::ProcessNode(aiNode *node, const aiScene *scene)
{
	for (unsigned int i = 0; i < node->mNumMeshes; i++)
	{
		aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
		Meshes.push_back(ProcessMesh(mesh, scene));
	}

	for (unsigned int i = 0; i < node->mNumChildren; i++)
	{
		ProcessNode(node->mChildren[i], scene);
	}
}
    int PlainBvhTranslator::ProcessNode(Bvh::Node const* n, int offset)
    {
        int idx = nodecnt_;
        //std::cout << "Index " << idx << "\n";
        Node& node = nodes_[nodecnt_];
        node.bounds = n->bounds;
        int& extra = extra_[nodecnt_++];

        if (n->type == Bvh::kLeaf)
        {
            int startidx = n->startidx + offset;
            extra = (startidx << 4) | (n->numprims & 0xF);
            node.bounds.pmin.w = -1.f;
        }
        else
        {
            ProcessNode(n->lc, offset);
            node.bounds.pmin.w = (float)ProcessNode(n->rc, offset);
        }

        return idx;
    }
Example #19
0
void KDTree::ProcessNode(KDTreeNode* N,KDTreeNode *RS[])
{
	if(N->Type==LEFT)
	{
		for(int i=0;i<6;i++)
			N->ropes[i] = RS[i];
		return ;
	}
	for(int i=0; i< 6; i++)
	{
		Optimize(RS[i],(Side)i,N->box);
	}
	Side  SL=Left,SR = Right;
	if(N->m_Axis==1)
	{
		SL = Bottom;
		SR =Top;
	}else if(N->m_Axis==2)
	{
		SL = Back;
		SR = Front;
	}

	float V = N->m_Split;

	KDTreeNode* RSL[6];
	for(int i=0;i<6;i++)
		RSL[i] = RS[i];
	RSL[SR] = N->m_rchild;
	ProcessNode(N->m_lchild,RSL);

	KDTreeNode* RSR[6];
	for(int i=0; i<6; i++)
		RSR[i] = RS[i];
	RSR[SL] = N->m_lchild;
	ProcessNode(N->m_rchild,RSR);
}
Example #20
0
File: Model.cpp Project: amxxL/Game
void Model::ProcessNode(aiNode* node, aiScene const* scene, DirectX::XMMATRIX const& parentTransformMatrix)
{
    DirectX::XMMATRIX nodeTransformMatrix = DirectX::XMMatrixTranspose(DirectX::XMMATRIX(&node->mTransformation.a1)) * parentTransformMatrix;

    for (uint32 i = 0; i < node->mNumMeshes; ++i)
    {
        aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
        meshes.push_back(ProcessMesh(mesh, scene, nodeTransformMatrix));
    }

    for (uint32 i = 0; i < node->mNumChildren; ++i)
    {
        ProcessNode(node->mChildren[i], scene, nodeTransformMatrix);
    }
}
Example #21
0
bool Permutator::VisualizeGraph(Node* n)
{
	try
	{
		gvFile.open("graph.dot", std::ios::out);
	}
	catch (std::fstream::failure e)
	{
		std::cerr << "VisualizeGraph: Unable to open output file for graphviz: " << e.what() << std::endl;
		return false;
	}

	std::string digraphStart = "digraph g {\n"
		"graph [fontsize=12 labelloc=\"t\" label=\"\" splines=true overlap=false];\n"
		"ratio = auto;\n";
	std::string digraphEnd = "}";

	try
	{
		gvFile.write(digraphStart.c_str(), digraphStart.length());
	}
	catch (std::fstream::failure e)
	{
		std::cerr << "VisualizeGraph: Unable to write graph prologue to graphviz output file: " << e.what() << std::endl;
		return false;
	}
	
	//Node* n = graph.GetRoot();

	ProcessNode(n, gvFile);
	CreatePath(n, gvFile);

	try
	{
		gvFile.write(digraphEnd.c_str(), digraphEnd.length());
		gvFile.flush();
		gvFile.close();
	}
	catch (std::fstream::failure e)
	{
		std::cerr << "VisualizeGraph: Error while writing graph epilogue to graphviz output file: " << e.what() << std::endl;
		return false;
	}
	
	return true;
}
Example #22
0
void Model::ProcessNode(aiNode* node, const aiScene* scene)
{
	// Process each mesh located at the current node
	for (GLuint i = 0; i < node->mNumMeshes; i++)
	{
		// The node object only contains indices to index the actual objects in the scene. 
		// The scene contains all the data, node is just to keep stuff organized (like relations between nodes).
		aiMesh* mesh = scene->mMeshes[node->mMeshes[i]];
		meshes.push_back(ProcessMesh(mesh, scene));
	}
	// After we've processed all of the meshes (if any) we then recursively process each of the children nodes
	for (GLuint i = 0; i < node->mNumChildren; i++)
	{
		ProcessNode(node->mChildren[i], scene);
	}

}
Example #23
0
void Model::LoadModel(string path)
{
	// Read file via ASSIMP
	Assimp::Importer importer;
	const aiScene* scene = importer.ReadFile(path, aiProcess_GenSmoothNormals | aiProcess_Triangulate | aiProcess_FlipUVs | aiProcess_CalcTangentSpace);
	// Check for errors
	if (!scene || scene->mFlags == AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode) 
	{
		std::cout << "ERROR::ASSIMP:: " << importer.GetErrorString() << std::endl;
		return;
	}
	// Retrieve the directory path of the filepath
	directory = path.substr(0, path.find_last_of('/'));

	// Process ASSIMP's root node recursively
	ProcessNode(scene->mRootNode, scene);
}
// Recursive Function for Importing Script Sections
bool WPDefManager::ImportSections( const QString& FileName )
{    
	QDomDocument Document( "definitions" );
	QFile File( FileName );

    if ( !File.open( IO_ReadOnly ) )
	{
		clConsole.ProgressFail();
	
		clConsole.send( "Unable to open " );
		clConsole.send( FileName );
		clConsole.send( "!\n" );
		return false;
	}

	QString errorMessage;
	int errorLine, errorColumn;
	
	if( !Document.setContent( &File, &errorMessage, &errorLine, &errorColumn ) ) 
	{
        File.close();
        
		clConsole.ProgressFail();
		clConsole.send( QString("Unable to parse file %1\nError:%2(%3:%4)\n").arg(FileName).arg(errorMessage).arg(errorLine).arg(errorColumn) );

		return false;
	}

    File.close();

	// Get the first document node and start to process it
	QDomElement Definitions = Document.documentElement();
	QDomNodeList NodeList = Definitions.childNodes();

	// Process all nodes
	for( UI32 i = 0; i < NodeList.count(); i++ )
	{
		if( NodeList.item( i ).isElement() )
		{
			ProcessNode( NodeList.item( i ).toElement() );
		}
	}

	return true;
}
    void PlainBvhTranslator::Process(Bvh& bvh)
    {
        // WARNING: this is crucial in order for the nodes not to migrate in memory as push_back adds nodes
        nodecnt_ = 0;
        int newsize = bvh.m_nodecnt;
        nodes_.resize(newsize);
        extra_.resize(newsize);

        // Check if we have been initialized
        assert(bvh.m_root);

        // Save current root position
        int rootidx = 0;

        // Process root
        ProcessNode(bvh.m_root);

        // Set next ptr
        nodes_[rootidx].bounds.pmax.w = -1;

        //
        for (int i = rootidx; i < (int)nodes_.size(); ++i)
        {
            if (nodes_[i].bounds.pmin.w != -1.f)
            {
                nodes_[i + 1].bounds.pmax.w = nodes_[i].bounds.pmin.w;
                nodes_[(int)(nodes_[i].bounds.pmin.w)].bounds.pmax.w = nodes_[i].bounds.pmax.w;
            }
        }

        for (int i = rootidx; i < (int)nodes_.size(); ++i)
        {
            if (nodes_[i].bounds.pmin.w == -1.f)
            {
                nodes_[i].bounds.pmin.w = (float)extra_[i];
            }
            else
            {
                nodes_[i].bounds.pmin.w = -1.f;
            }
        }
    }
Example #26
0
void MaxExportPlugin::ProcessNode(INode* node, int depth)
{
	depth++;
	//dududu
	BOOL deleteIt = false;
	TriObject* TObj = 0;
	if (!node->IsRootNode())
		TObj = GetTriObjFromNode(node, deleteIt);

	if (TObj)
	{
		triObjects.push_back(TObj);
		nodeList.push_back(node);
		deleteTriObj.push_back(deleteIt);
	}

	for (int i = 0; i < node->NumberOfChildren(); i++)
	{
		ProcessNode(node->GetChildNode(i), depth);
	}
}
Example #27
0
void wxSFLayoutHorizontalTree::DoLayout(ShapeList& shapes)
{
	ShapeList lstConnections;
	ShapeList lstRoots;
	
	wxRealPoint nStart = GetTopLeft( shapes );
	m_nMinY = nStart.y;
	
	// find root items
	for( ShapeList::iterator it = shapes.begin(); it != shapes.end(); ++ it )
	{
		wxSFShapeBase *pShape = *it;
		
		lstConnections.Clear();
		pShape->GetAssignedConnections( CLASSINFO(wxSFLineShape), wxSFShapeBase::lineENDING, lstConnections );
		
		if( lstConnections.IsEmpty() )
		{
			m_nCurrMaxHeight = 0;
			ProcessNode( pShape, nStart.x );
		}
	}
}
Example #28
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);
    }
}
Example #29
0
/**
 ************************************************************
 * Deals with putting back settings we muck with and checking
 * for possible window resize.
 ************************************************************/
static void
DoBinaryswap(WindowInfo * window)
{
	static int first_time = 1;

	/* values used to restore state we change */
	GLint super_packAlignment, super_unpackAlignment;
	GLint child_unpackAlignment;
	GLboolean super_blend = GL_FALSE;
	GLint super_blend_dst = 0, super_blend_src = 0;
	GLboolean super_color_writemask[4];
	GLint super_depth_func = 0, super_stencil_func = 0, super_stencil_ref = 0;
	GLint super_stencil_value_mask = 0, super_stencil_fail = 0;
	GLint super_stencil_pass_depth_fail = 0, super_stencil_pass_depth_pass = 0;
	GLboolean super_stencil_test = GL_FALSE, super_depth_test = GL_FALSE;

	if (first_time || window->width < 1 || window->height < 1)
	{
		CheckWindowSize(window);
	}

	if (first_time)
	{
		/* one-time initializations */
		binaryswap_spu.child.BarrierCreateCR(CLEAR_BARRIER, 0);
		binaryswap_spu.child.BarrierCreateCR(SWAP_BARRIER, 0);
		binaryswap_spu.child.BarrierCreateCR(POST_SWAP_BARRIER, 0);
		binaryswap_spu.child.SemaphoreCreateCR(MUTEX_SEMAPHORE, 1);
		((BinarySwapMsg *) window->msgBuffer)->header.type = CR_MESSAGE_OOB;
		binaryswap_spu.offset = sizeof(BinarySwapMsg);
		first_time = 0;
	}
	else if (binaryswap_spu.resizable)
	{
		/* check if window size changed, reallocate buffers if needed */
		CheckWindowSize(window);
	}

	/*
	 * Save pack/unpack alignments, and set to one.
	 */
	binaryswap_spu.super.GetIntegerv(GL_PACK_ALIGNMENT, &super_packAlignment);
	binaryswap_spu.super.GetIntegerv(GL_UNPACK_ALIGNMENT,
																	 &super_unpackAlignment);
	binaryswap_spu.child.GetIntegerv(GL_UNPACK_ALIGNMENT,
																	 &child_unpackAlignment);
	binaryswap_spu.super.PixelStorei(GL_PACK_ALIGNMENT, 1);
	binaryswap_spu.super.PixelStorei(GL_UNPACK_ALIGNMENT, 1);
	binaryswap_spu.child.PixelStorei(GL_UNPACK_ALIGNMENT, 1);

	/* Things alpha compositing mucks with */
	if (binaryswap_spu.alpha_composite)
	{
		super_blend = binaryswap_spu.super.IsEnabled(GL_BLEND);
		binaryswap_spu.super.GetIntegerv(GL_BLEND_DST, &super_blend_dst);
		binaryswap_spu.super.GetIntegerv(GL_BLEND_SRC, &super_blend_src);
	}

	/* Things depth compositing mucks with */
	if (binaryswap_spu.depth_composite)
	{
		binaryswap_spu.super.GetBooleanv(GL_COLOR_WRITEMASK,
																		 super_color_writemask);
		binaryswap_spu.super.GetIntegerv(GL_DEPTH_FUNC, &super_depth_func);
		binaryswap_spu.super.GetIntegerv(GL_STENCIL_FUNC, &super_stencil_func);
		binaryswap_spu.super.GetIntegerv(GL_STENCIL_REF, &super_stencil_ref);
		binaryswap_spu.super.GetIntegerv(GL_STENCIL_VALUE_MASK,
																		 &super_stencil_value_mask);
		binaryswap_spu.super.GetIntegerv(GL_STENCIL_FAIL, &super_stencil_fail);
		binaryswap_spu.super.GetIntegerv(GL_STENCIL_PASS_DEPTH_FAIL,
																		 &super_stencil_pass_depth_fail);
		binaryswap_spu.super.GetIntegerv(GL_STENCIL_PASS_DEPTH_PASS,
																		 &super_stencil_pass_depth_pass);
		super_stencil_test = binaryswap_spu.super.IsEnabled(GL_STENCIL_TEST);
		super_depth_test = binaryswap_spu.super.IsEnabled(GL_DEPTH_TEST);
	}

	ProcessNode(window);

	/*
	 * Restore pack/unpack alignments
	 */
	binaryswap_spu.super.PixelStorei(GL_PACK_ALIGNMENT, super_packAlignment);
	binaryswap_spu.super.PixelStorei(GL_UNPACK_ALIGNMENT,
																	 super_unpackAlignment);
	binaryswap_spu.child.PixelStorei(GL_UNPACK_ALIGNMENT,
																	 child_unpackAlignment);

	/* Restore GL state we may have changed */
	if (binaryswap_spu.alpha_composite)
	{
		if (super_blend)
			binaryswap_spu.super.Enable(GL_BLEND);
		else
			binaryswap_spu.super.Disable(GL_BLEND);

		binaryswap_spu.super.BlendFunc(super_blend_src, super_blend_dst);
	}
	if (binaryswap_spu.depth_composite)
	{
		if (super_depth_test)
			binaryswap_spu.super.Enable(GL_DEPTH_TEST);
		else
			binaryswap_spu.super.Disable(GL_DEPTH_TEST);

		if (super_stencil_test)
			binaryswap_spu.super.Enable(GL_STENCIL_TEST);
		else
			binaryswap_spu.super.Disable(GL_STENCIL_TEST);

		binaryswap_spu.super.ColorMask(super_color_writemask[0],
																	 super_color_writemask[1],
																	 super_color_writemask[2],
																	 super_color_writemask[3]);
		binaryswap_spu.super.DepthFunc(super_depth_func);
		binaryswap_spu.super.StencilFunc(super_stencil_func,
																		 super_stencil_ref,
																		 super_stencil_value_mask);
		binaryswap_spu.super.StencilOp(super_stencil_fail,
																	 super_stencil_pass_depth_fail,
																	 super_stencil_pass_depth_pass);
	}
}
TiXmlElement Converter::ProcessNode(BMessage *node)
{
	int32			i = 0;
	void			*tmpNode		= NULL;
	void			*fromNode		= NULL;
	void			*toNode			= NULL;
	BMessage		*connection		= NULL;
	BMessage		*data			= new BMessage();
	BMessage		*attrib			= new BMessage();

	bool			found			= false;
	char			*name			= NULL;

	TiXmlElement	xmlNode("node");
	node->FindPointer("this", &tmpNode);
	//add this node to the processed List
	processedIDs.insert((int32)tmpNode);
	//find the data field where name and attributes are stored
	node->FindMessage("Node::Data",data);
	data->FindString("Name",(const char **)&name);

	xmlNode.SetAttribute("ID",(int32)tmpNode);
	xmlNode.SetAttribute("TEXT",(const char *)name);
	//add all Attributes
	type_code	type	= 0;
	int32		count	= 0;
	#ifdef B_ZETA_VERSION_1_0_0
		while (data->GetInfo(B_MESSAGE_TYPE,i ,(const char **)&name, &type, &count) == B_OK)
	#else
		while (data->GetInfo(B_MESSAGE_TYPE,i ,(char **)&name, &type, &count) == B_OK)
	#endif
	{
		if ( (data->FindMessage(name,count-1,attrib) == B_OK) && (attrib) )
		{
			char *attribName	= NULL;
			char *value			= NULL;
			attrib->FindString("Name",(const char **)&attribName);
			attrib->FindString("Value",(const char **)&value);
			//**need to hanlde bool
			TiXmlElement	xmlAttrib("attribute");
			xmlAttrib.SetAttribute("NAME",attribName);
			if(value)
				xmlAttrib.SetAttribute("VALUE",value);
			xmlNode.InsertEndChild(xmlAttrib);
		}
		i++;
	}
	//find all outgoing connections
	map<int32,BMessage*>::iterator iter;
	iter = connections.begin();
	while (iter!=connections.end())
	{
		connection=(*iter).second;
		connection->FindPointer("Node::from",&fromNode);
		connection->FindPointer("Node::to", &toNode);
		if ((fromNode == tmpNode) && (processedIDs.find((*iter).first) == processedIDs.end()))
		{
			//check if the node was already insert if so we "connect via a arrowlink
			if (processedIDs.find((int32)toNode) != processedIDs.end())
			{
				TiXmlElement	xmlLink("arrowlink");
				xmlLink.SetAttribute("ID",(*iter).first);
				xmlLink.SetAttribute("DESTINATION",(int32)toNode);
				xmlNode.InsertEndChild(xmlLink);
				processedIDs.insert((*iter).first);
			}
			else
			{
				map<int32,BMessage*>::iterator	found;
				found = nodes.find((int32)toNode);
				if (found!=nodes.end())
				{
					processedIDs.insert((*iter).first);
					xmlNode.InsertEndChild(ProcessNode((*found).second));
				}
			}
		}
		else if ((toNode == tmpNode) && (processedIDs.find((*iter).first)==processedIDs.end()))
		{
			//check if the node was already insert if so we "connect via a arrowlink
			if (processedIDs.find((int32)fromNode)!=processedIDs.end())
			{
				TiXmlElement	xmlLink("arrowlink");
				xmlLink.SetAttribute("ID",(*iter).first);
				xmlLink.SetAttribute("DESTINATION",(int32)fromNode);
				xmlNode.InsertEndChild(xmlLink);
			}
		}
		iter++;
	}
	return xmlNode;
}