Sign in to follow this  
redas

Problem geting full data from custom template X file

Recommended Posts

I have created template with one string and three float variables but I can read only string. Heres what I have. My X file loos like this
xof 0302txt 0032
template Entity
{
   <12408343-3651-4bb9-B5C1-100902956ACC>
   string File;
   float X;
   float Y;
   float Z;
}

Entity tigras
{
   "tiger.x";
   10.000000;
   0.000000;
   20.000000;
}

Entity katinas
{
   "airplane 2.x";
   10.000000;
   0.000000;
   -100.000000;
}
Now the parser :)
struct Entity
{
   char *filename;
   float x;
   float y;
   float z;
};

void LevelLoader(char * filename)
{
   ID3DXFile * d3dFile = NULL;
   ID3DXFileEnumObject * d3dEnumObject = NULL;

   D3DXFileCreate(&d3dFile);

   d3dFile->CreateEnumObject((LPVOID)filename,DXFILELOAD_FROMFILE,&d3dEnumObject);

   unsigned long objCounter,tmpSize;
   d3dEnumObject->GetChildren(&objCounter);

   for(unsigned long i=0; i<objCounter; i++)
   {
      ID3DXFileData * d3dFileData = NULL;
      Entity entData;
      d3dEnumObject->GetChild(i,&d3dFileData);


      d3dFileData->Lock(&tmpSize, (const void**)&entData);
      entity * ent = new entity(entData.filename,entData.x,entData.y,entData.z);
      d3dFileData->Unlock();

   }
}
This function should read data from .x file and create models in level but function acts very strange it loads models but ignores position parameters and all meshes are loaded at world orign not for example at (10,0,20) in other words all three position parameters are equal zero :/ I realy have no ideas what I am doing wrong. Can anyone halp me with this [Edited by - redas on March 7, 2007 1:50:04 PM]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this