How to access boolean* space = (boolean*)malloc( 640*480*100*sizeof(boolean));
How do I define points in this 3d space true and false?
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-
|
And that''s it.
Be aware, if sizeof(boolean) is 1 byte, that structure will take up about 30 MB of memory...
War Worlds - A 3D Real-Time Strategy game in development.
Thanks. Is this btw the usual way of defining a 3d space (with malloc() I mean)? In what kind of variable would pros store a 3d map for example?
Edited by - Afterlife on July 14, 2001 9:35:44 AM
Edited by - Afterlife on July 14, 2001 9:35:44 AM
------------------------------If there be no heaven,may there atleast be a hell.-------------------------------Afterlife-
You probably should look into
Binary Trees ( Binary Space Partition BSP ) or Oct Trees for storking information like that. Both are methods of storing that king od data effeciently based on the fact that there will be large chunks of space that are normally empty all of the time.
Good luck.
Binary Trees ( Binary Space Partition BSP ) or Oct Trees for storking information like that. Both are methods of storing that king od data effeciently based on the fact that there will be large chunks of space that are normally empty all of the time.
Good luck.
July 14, 2001 12:54 PM
Afterlife:
Sorry, but you are approaching this all wrong. What is normally done is you have an object. This object is made up of a bunch of polygons, usually triangles. The triangles are stored as a set of three 3D coordinates. Here is a very basic idea:
|
Then you make a 3D object out of a bunch of Triangle3D structs.
You most definitely do not make a big 3D array (unless you are doing something with VOXELS) for normal 3D work.
If you needed to define points in a 3D space as true or false, just store a list (1D array) of "true" points.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement