*
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
// LifeExportInternal.cpp : Defines the exported functions for the DLL application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "LifeExportInternal.h"
|
||||
#include "IGame/IGame.h"
|
||||
#include "IGame/IGameObject.h"
|
||||
#include <max.h>
|
||||
//#include "IGame/IGameFX.h"
|
||||
|
||||
#include "3dsmaxport.h"
|
||||
#include <stdio.h>
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
Point3 Position;
|
||||
Point3 Normal;
|
||||
Point3 Tangent;
|
||||
Point3 Binormal;
|
||||
Point2 Texcoord1;
|
||||
Point2 Texcoord2;
|
||||
};
|
||||
|
||||
LIFEEXPORTINTERNAL_API int DoExport(const MCHAR *name,ExpInterface *ei,Interface *i, BOOL suppressPrompts=FALSE, DWORD options=0)
|
||||
{
|
||||
IGameScene * pIgame = GetIGameInterface();
|
||||
|
||||
IGameConversionManager * cm = GetConversionManager();
|
||||
cm->SetCoordSystem(IGameConversionManager::IGAME_D3D);
|
||||
bool exportSelected = (options & SCENE_EXPORT_SELECTED) ? true : false;
|
||||
|
||||
pIgame->InitialiseIGame(exportSelected);
|
||||
pIgame->SetStaticFrame(0);
|
||||
|
||||
FILE* f = fopen("C:\\#export_internal.txt", "wb");
|
||||
|
||||
int nodeCount = pIgame->GetTopLevelNodeCount();
|
||||
|
||||
for(int i = 0; i < nodeCount; i++)
|
||||
{
|
||||
IGameNode* node = pIgame->GetTopLevelNode(i);
|
||||
|
||||
if(node->IsTarget())
|
||||
continue;
|
||||
|
||||
IGameObject* obj = node->GetIGameObject();
|
||||
|
||||
switch(obj->GetIGameType())
|
||||
{
|
||||
case IGameObject::IGAME_MESH:
|
||||
{
|
||||
IGameMesh* mesh = (IGameMesh*)obj;
|
||||
|
||||
mesh->SetCreateOptimizedNormalList();
|
||||
if(mesh->InitializeData())
|
||||
{
|
||||
int faceCount = mesh->GetNumberOfFaces();
|
||||
|
||||
//mesh->GetNormal()
|
||||
|
||||
std::wstring nodeName(node->GetName());
|
||||
char nameSrc[512];
|
||||
wcstombs(nameSrc, nodeName.c_str(), 512);
|
||||
nameSrc[nodeName.length()] = 0;
|
||||
std::string realName(nameSrc);
|
||||
|
||||
sprintf(nameSrc, "NodeName: %s, FaceCount: %i\n", realName.c_str(), faceCount);
|
||||
fwrite(nameSrc, 1,strlen(nameSrc), f);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
char buf[128];
|
||||
sprintf(buf, "Objects count: %i", nodeCount);
|
||||
|
||||
fwrite(buf, 1,strlen(buf), f);
|
||||
fclose(f);
|
||||
return 1;
|
||||
}
|
||||
Reference in New Issue
Block a user