ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > irrEdit
forum topic indicator Using irredit for my game
person icon
Sudi
Registered User
Quote
2007-04-22 19:11:15

Ok irredit looks really nice and the lightining system is pretty cool so i thought it might be a good leveleditor.
But the problem is when loading an irredit file directly with irrlicht it simply loads all scenenodes without providing acces to the meshdata or pointers to specific nodes. that is a problem because my gameengine uses an entity system in which every scenenode is linked to an entity.(for interaction and stuff like that)
And honestly i don't want to write a write my own .irr loader....so my question is if there is some interface in development for this or is there already one?

PS: if there is no other way than writing my own parser could u guide me a place where i find the full irr-format specs

person icon
niko
Moderator
Quote
2007-04-23 17:18:29

After you have loaded the scene, you can easily access the scene graph and access your nodes and meshes. You can either use the name of the scene node or the id for this. Take a look at getSceneNodeFromId() and getSceneNodeFromName(). Based on the type of a scene node (getType()) you can then access the mesh for example.

person icon
Sudi
Registered User
Quote
2007-04-23 22:54:45

really? i remember that i couldn'T acces the mesh from a scenenode.....many things changed i guess....i should upgrade to a newer version of irrlicht...lol
thanks for ur help niko

person icon
Christian Clavet
Registered User
Quote
2007-09-05 05:33:08

Hi, Vitek helped me a lot with this. I define the static mesh (buildings and other non-moving things that I want in my level as OCCTREE) Then I load my IRRscene. After loading I can process the entine scene graphs. Most of the codes where provided By Vitek, And I adapted it to my need.

First you define that procedure
I've defined this globally first:
IrrlichtDevice *intro = 0;
video::IVideoDriver* driver = 0;
scene::ISceneManager* smgr;
scene::IMetaTriangleSelector* metaSelector;
scene::ISceneNodeAnimatorCollisionResponse* anim;
ICameraSceneNode* camera = 0;


Then this procedure that will parse the node tree (Thanks to Vitek)

[code]void recursiveFillMetaSelector(scene::ISceneNode* node, scene::IMetaTriangleSelector* meta )
{
  //
  // the following if is basically the same as ISceneNode_assignTriangleSelector
  //
  printf ("Node name is: %s \n",node->getName());
  printf ("Node id is: %d \n",node->getID());
  printf ("Node type:");
  //  printf ("Node type: %s=",smgr->getSceneNodeTypeName());
  if (node->getType() ==   ESNT_UNKNOWN) printf("Unknown mesh type \n\n");
  if (node->getType() ==   ESNT_MESH) printf("Standard Mesh \n\n");
  if (node->getType() ==   ESNT_ANIMATED_MESH) printf("Animated Mesh! \n\n");
  if (node->getType() ==   ESNT_SKY_BOX) printf("SkyBox! \n\n");
  if (node->getType() ==   ESNT_CAMERA_FPS) printf("Fps Camera! \n\n");
  if (node->getType() ==   ESNT_CAMERA_MAYA ) printf("Maya Camera! \n\n");
  if (node->getType() ==   ESNT_CAMERA )
  { printf("STD Camera! \n");
   printf ("The current position of this camera is: %f,%f,%f\n\n",node->getPosition().X,node->getPosition().Y,node->getPosition().Z);
   camera->setPosition(node->getPosition());
  }
  if (node->getType() ==   ESNT_PARTICLE_SYSTEM ) printf("Particles! \n\n");
  if (node->getType() ==   ESNT_LIGHT  ) printf("Light! \n\n");
  if (node->getType() ==   ESNT_OCT_TREE)
  {
      // Occ Trees are for land
      printf("Occtree! \n");
      io::IAttributes* attribs = intro->getFileSystem()->createEmptyAttributes();
      if (attribs)
        {// get the mesh name out
         node->serializeAttributes(attribs);
         core::stringc name = attribs->getAttributeAsString("Mesh");
         attribs->drop();
         // get the animated mesh for the object
         scene::IAnimatedMesh* mesh = smgr->getMesh(name.c_str());
         if (mesh)
         {
            scene::ITriangleSelector* selector =
            smgr->createOctTreeTriangleSelector(mesh->getMesh(0), node, 128);
            node->setTriangleSelector(selector);
          &n


Create reply:










 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






Copyright© Ambiera e.U. all rights reserved.
Contact | Imprint | Products | Privacy Policy | Terms and Conditions |