
Would like to hear your opinion...
Hi
I used to store all vertex and stuff in the polygon class.. something like this:
class CPolygon
{
public:
CVertex *Vertex;
CVector Normal;
....
I’m using an octree for collision detection and at the moment for visibility too(frustum culling).
For visibility I first put all polygons that are visible in a list and then I sort them by texture and lightmap.
The problem is that I have to do some copying of the polygons and with the polygon structure above it cant be good…
I’m now trying a different approach…. I use vertexarrays so I already have all vertex, normal and texcoord data stored in arrays.So now I thought I make a polygon structure that looks something like this:
class CPolygon
{
public:
unsigned int *VertexIndex;
unsigned int NormalIndex;
....
Now the polygon just store the position(in the vertexarray) of the vertices instead of the vertex data. Hmm.. I hope you understand what I’m trying to say...
Now it should be quicker to copy the polygons(just a couple of uint’s ). How does this sound…good/bad?
I would like to hear what you guys think…
Thanks!
Edited by - RZ on October 8, 2001 6:52:50 PM

Why just one Normal in your Poly ?
Where do you store the VertexIndices ? Do you create an array of vertices ?
Well when you copy the CPolygons around you should overload the Copy Constructor to avoid flat copies... of your Vertexindex pointer
Edited by - TheMummy on October 9, 2001 10:24:32 AM
Where do you store the VertexIndices ? Do you create an array of vertices ?
Well when you copy the CPolygons around you should overload the Copy Constructor to avoid flat copies... of your Vertexindex pointer
Edited by - TheMummy on October 9, 2001 10:24:32 AM
Normal in CPolygon is the face normal...it is used for collision detection (ellipsoid) and other things.
Like I said I’m using vertexarrays... I have one array for vertices, one for vertexnormals, one for texture coordinates and one for lightmap coordinates. So all data is stored in these arrays.
The VertexIndices are stored in VertexIndex… its an array of unsigned ints.
For example VertexIndex = 0,1,2 means that this polygon is made up by the first, second and third vertices in the vertexarray.
And I have overloaded the Copy Constructor...
Like I said I’m using vertexarrays... I have one array for vertices, one for vertexnormals, one for texture coordinates and one for lightmap coordinates. So all data is stored in these arrays.
The VertexIndices are stored in VertexIndex… its an array of unsigned ints.
For example VertexIndex = 0,1,2 means that this polygon is made up by the first, second and third vertices in the vertexarray.
And I have overloaded the Copy Constructor...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement