void CModelExporter::Export(const char* pszFileName)
{
    m_serializer.Reset();
    size_t uTotalRootNodeCnt = m_pIGameScene->GetTopLevelNodeCount();
    std::vector<IGameNode*> meshNodeVector;
    for(size_t x = 0; x < uTotalRootNodeCnt; x++)
    {
        IGameNode* pNode = m_pIGameScene->GetTopLevelNode(x);
        IGameObject* pObject = pNode->GetIGameObject();

        IGameObject::ObjectTypes gameType = pObject->GetIGameType();

        if(gameType == IGameObject::IGAME_MESH)
        {
            meshNodeVector.push_back(pNode);
        }
    }

    int uMeshNodeCount = meshNodeVector.size();
    m_serializer << uMeshNodeCount;

    for(auto pNode : meshNodeVector)
    {
        ExportMesh(pNode);
    }

    m_serializer.Deserialize(pszFileName);
}
Beispiel #2
0
// 輸出檔案
int GmodelExp::DoExport(const TCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts, DWORD options) 
{
	// Set a global prompt display switch
	showPrompts = suppressPrompts ? FALSE : TRUE;
	exportSelected = (options & SCENE_EXPORT_SELECTED) ? TRUE : FALSE;

	// Grab the interface pointer.
	ip = i;

	if(showPrompts)
	{
		// Prompt the user with our dialogbox, and get all the options.
		if (!DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_GMODELEXPORT_DLG),
			ip->GetMAXHWnd(), ExportDlgProc, (LPARAM)this)) 
		{
			return 1;
		}
	}

	// Open the stream
	m_pFile = _tfopen(name,_T("wt"));
	if ( !m_pFile ) 
	{
		return 0;
	}

	// Startup the progress bar.
	ip->ProgressStart(GetString(IDS_PROGRESS_MSG), TRUE, fn, NULL);

	// Get node & material list
	BuildTable();

	// Export file header
	ExportHeader();

	// Material
	//if ( m_bExportMaterial )
	ExportMaterial();

	// Mesh
	//if ( m_bExportMesh )
	ExportMesh();

	// Done :) Finish the progress bar.
	ip->ProgressEnd();

	// Close the stream
	fclose(m_pFile);

	return 1;
}
Beispiel #3
0
void XsiExp::ExportMeshObject( INode * node, int indentLevel)
{
	Object * obj = node->EvalWorldState(GetStaticFrame()).obj;
	if (!obj || obj->ClassID() == Class_ID(TARGET_CLASS_ID, 0))
  {
		return;
  }
	TSTR indent = GetIndent(indentLevel);
	
	ExportNodeHeader(node, "Frame", indentLevel);
	
	ExportNodeTM(node, indentLevel);
	
	ExportMesh(node, GetStaticFrame(), indentLevel);
}
Beispiel #4
0
void Exporter::ExportGeomObject(INode* node, int indentLevel)
{
	ObjectState os = node->EvalWorldState(GetStaticFrame());
	if (!os.obj)
		return;
	
	// Targets are actually geomobjects, but we will export them
	// from the camera and light objects, so we skip them here.
	if (os.obj->ClassID() == Class_ID(TARGET_CLASS_ID, 0))
		return;
	
	
	ExportNodeHeader(node);
	ExportNodeTM(node, indentLevel,&rsm->mesh->mat);
	ExportMesh(node, GetStaticFrame(), indentLevel);
	ExportMaterial(node, indentLevel);
}
Beispiel #5
0
 void DiMeshSerializer::ExportMesh( const DiString& meshName, const DiString& filename )
 {
     DiMeshPtr md = DiAssetManager::GetInstance().GetAsset<DiMesh>(meshName);
     ExportMesh(md,filename);
 }
Beispiel #6
0
 void DiMeshSerializer::ExportMesh( const DiMeshPtr pMesh, const DiString& filename )
 {
     FILE* fp = fopen(filename.c_str(),"wb");
     DiDataStreamPtr ds(DI_NEW DiFileHandleDataStream(fp,DiDataStream::WRITE));
     ExportMesh(pMesh,ds);
 }