Jump to content
  • Advertisement
Sign in to follow this  
redas

Problem geting full data from custom template X file

This topic is 4215 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!