Object hierarchy in my 3d engine
Hi all,
At the moment I'm coding an OpenGL 3d engine (my first one),
I now use the hollowing object hierarchy:
classes:
---------------
GLobject
GLtexture
GLmaterial
GLlight
GLfog
GLinput (directinput)
GLsystem
structs:
---------------
vertex (x, y, z)
color (r, g, b, a)
and some math stuff for normals etc.
Main class: GLscene
which contains instances of the above classes)
In my main function I usually have one:
- GLsystem, GLscene, GLinput and GLfog
At the moment I use my own ASCII file format, which says how much objects and which object.3d files it should read, number of lights with there values, materials (also with their values).
I also use a seperate 1stperson.com (ASCII) file, which holds the definitions of the camera (in my main scene (ASCII) file I refer to the correct .cam (ASCII) camera file.
I doubt if this hierarchy will get me far when I want to use 3ds or ase 3d models for example.
Can someone give some hints, about what I should change in my model hierarchy (maybe nodes, maybe one big scene file with ALL information, including all information about the objects etc.)
Thank you very much.
[Edited by - cozzie on October 14, 2004 7:40:21 AM]
Crealysm game & engine development: http://www.crealysm.com
Looking for a passionate, disciplined and structured producer? PM me
Quote: Original post by cozzie
classes:
Personally the last version of my engine prototype dropped most GL conventions. Just in case I'll want to port to some specific console which doesn't have GL (yet).
While I was doing that, I realized there are good reasons to not consider too much the API I am using in the basement.
Quote: Original post by cozzie
structs:
Looks fine for a beginner engine.
Quote: Original post by cozzie
In my main function I usually have one:
- GLsystem, GLscene, GLinput and GLfog
I don't understand the meaning of those structs but that's the beauty of your design.
Quote: Original post by cozzieThat's good provided you can parse it nicely. I dropped ASCII files some time ago because they were way too complex to handle in most cases. Data explosion is sometimes an issue.
At the moment I use my own ASCII file format, which says how much objects and which object.3d files it should read, number of lights with there values, materials (also with their values).
I would raccomand to use a binary file. In fact, having the readable data on the fly really does not help too much. When developing you can enable an on-the-fly text-to-binary compiler and then turn it off.
I don't raccomand to use text files for everyday use. Use binary for daily work, text for out of ordinary work and possibly XML when component intercommunication is a necessary evil.
Quote: Original post by cozzieWhat does this mean? A file to store the FOV or the camera movement? What's that?
I also use a seperate 1stperson.com (ASCII) file, which holds the definitions of the camera (in my main scene (ASCII) file I refer to the correct .cam (ASCII) camera file.
Quote: Original post by cozzie
I doubt if this hierarchy will get me far when I want to use 3ds or ase 3d models for example.
I don't see an issue here, provided you pay some attentions.
Quote: Original post by cozzie
Can someone give some hints, about ...
Way too generic question for me.
I personally like to put everything in "containers". Often those containers are tree-like. Some times they are lists. Other times I have a dinamic array.
Previously "Krohm"
Hi,
sorry for the unclear questions,
maybe I can paste down some source in this topic, so it's more clear. I'm now at work, so what I'll do is bring the source to work monday and place some off it in this topic.
Maybe can give me some nice hints/tips then.
greets
sorry for the unclear questions,
maybe I can paste down some source in this topic, so it's more clear. I'm now at work, so what I'll do is bring the source to work monday and place some off it in this topic.
Maybe can give me some nice hints/tips then.
greets
Crealysm game & engine development: http://www.crealysm.com
Looking for a passionate, disciplined and structured producer? PM me
Hi all,
Sorry for the late reaction.
I've placed the source with working test scene/demo on:
www.sierracosworth.nl/3dengine.
Maybe you can give me some advice about my object hierarchy.
Sorry for the late reaction.
I've placed the source with working test scene/demo on:
www.sierracosworth.nl/3dengine.
Maybe you can give me some advice about my object hierarchy.
Crealysm game & engine development: http://www.crealysm.com
Looking for a passionate, disciplined and structured producer? PM me
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement