Scene Graph - Compiling

This is a discussion on Scene Graph - Compiling within the Game Programming forums, part of the General Programming Boards category; Okay, So I can understand this part Code: ObjectInfo { int ObjectID; int NumGeometryNodes; int NumDOFNodes; // any other nodes ...

  1. #16
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Okay, So I can understand this part
    Code:
    ObjectInfo
    {
    int ObjectID;
    int NumGeometryNodes;
    int NumDOFNodes;
    // any other nodes we might have
    }

    But what about the more complex issues, such as, linking the nodes together properly?

    I'm thinking we could have an array of integers, and we could use that in some way to just iterate through the children and link em together that way, but this is really getting too nitpicky for my programming style..

    Any thoughts anyone?
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

  2. #17
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Code:
    ObjectInfo
    {
    int ObjectID;
    int NumGeometryNodes;
    int NumDOFNodes;
    
    ObjectInfo *m_pNextNode;
    ObjectInfo *m_pPrevNode;
    
    
    
    // any other nodes we might have
    };
    Or use the STL list, vector, etc.

    For example a quadtree structure:

    Code:
    struct QuadTreeNode
    {
      int m_iType;    //Node or leaf?
    
      QuadTreeNode *m_pUL;  //Upper left child
      QuadTreeNode *m_pUR; //Upper right child
      QuadTreeNode *m_pLL; //Lower left child
      QuadTreeNode *m_pLR; //Lower right child
    
      D3DXVECTOR3 m_vecMin,m_vecMax;  //Bounding box
    
      Object *m_pObjectArray;   //Objects in this node
      int m_iNumObjects;            //Number of objects in node
    };
    Code:
    class CTerrain
    {
      QuadTreeNode *m_pRoot;       //Start of quad tree
      ....
      ....
    };
    Last edited by VirtualAce; 03-05-2006 at 12:09 AM.

  3. #18
    Absent Minded Programmer
    Join Date
    May 2005
    Posts
    964
    Nice, so the final structure we pass to the add to scene function will just hold a pointer to the root node, which will point to the next node, which will point to the next node, etc etc...

    Like a linked list?

    Hmm, this is nifty, All I gotta do is create the stuff, and set the pointers, I can do that in the editor!

    Question: Where do BSP trees come into play here?


    EDIT:

    Now I understand *how* the stuff is linked together, But I'm still unsure what to put in the file I create with my editor, to, well, have the program interpret it and know what to do?

    The root node holds a vector of children, each child of the root holds its own vector of children. So in theory I'll be able to simply add a base node to my tree and the rest will kinda just, follow.

    But lets see, if, in an editor, we set the hierarchy up, so that the truck is the base node, and has 4 children, for the 4 wheels...

    How do we hold this information in a file, ready to be converted to hard code in my project? I understand how the stuff is linked together, but how do I interpret a file to create the links and link them in the right way?
    Last edited by Shamino; 03-05-2006 at 11:39 AM.
    Sometimes I forget what I am doing when I enter a room, actually, quite often.

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Screwy Linker Error - VC2005
    By Tonto in forum C++ Programming
    Replies: 5
    Last Post: 06-19-2007, 02:39 PM
  2. error help making no sense
    By tunerfreak in forum C++ Programming
    Replies: 5
    Last Post: 04-17-2007, 07:55 PM
  3. scene graph rendering techniques
    By ichijoji in forum Game Programming
    Replies: 7
    Last Post: 03-18-2006, 11:17 PM
  4. open scene graph compile issues
    By ichijoji in forum Game Programming
    Replies: 1
    Last Post: 08-04-2005, 12:31 PM
  5. Possible circular definition with singleton objects
    By techrolla in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2004, 09:46 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21