Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

McZ

BSP & object class?!

This topic is 5479 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 read alot about the BSP tree and I want to have it in my engine.. but I can''t understand how to store the objects I have in a scene? I understand how to split and create nodes and so.. but how to store the object and material data? should I have list with objects in the nodes? or should I store it some other way.. if I understand it right Quake BSP files doesn''t store objects they just have an vertexlist and so directly on the node leaf. but then I can''t understand how to sort things with different material/textures? I want to create a GeometryChunk class that stores the vertex data and material data for the current STATIC(non moving) object in the node this way I can send in a list of objects and convert them to a GeometryChunk and if needed I split them into two GeometryChunks with the same material data. and then I have different list that stores Dynamic(moving) objects every time they are moved they call a function in the node tree that checks only the center position of the object if it is on the wrong side of the plane of this node it will be removed from the node and that node will pass it on to it''s parent and there it will do the same check until it finds or create an own node for the new position. example:
class cGeometryChunk {

 float *Vertices;
 float *Normals
 float *TexCoords;

 cMaterial *Material;

};

class cBSP_Tree {

 std::list<cGeometryChunk*> Geometry;
 std::list<cEntity*> DynamicObjects;

 cBSP_Tree *Parent;
 cBSP_Tree *Front;
 cBSP_Tree *Back;

 void InsertDynamicObject(cVertex3f vCenter, cEntity *entity);
};

Share this post


Link to post
Share on other sites
Advertisement

  • 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!