3D architecture
-
Hello, For this project I'm going to develop, I have to implement the base structure of a system that holds data taken from 3D files. The basic structure I've implemented is: class 3DPoint { //Point data } class 3DLine { List<3DPoint>... // class methods } class 3DModel { List<3DLine>... // class methods } So far this works well, and it suits my needs. Now I want to derive these classes to allow drawing with OpenGl, because I need some specific fields like "visibility, selected, ...", and that's when I ran into some troubles, because when I derive 3DModel (gl3DModel), I'm forced to use the class 3DLine, and not the derived class (gl3DLine), and the same with 3DPoint. Does any of you have any suggestion on how to do this? Thanks!
-
Hello, For this project I'm going to develop, I have to implement the base structure of a system that holds data taken from 3D files. The basic structure I've implemented is: class 3DPoint { //Point data } class 3DLine { List<3DPoint>... // class methods } class 3DModel { List<3DLine>... // class methods } So far this works well, and it suits my needs. Now I want to derive these classes to allow drawing with OpenGl, because I need some specific fields like "visibility, selected, ...", and that's when I ran into some troubles, because when I derive 3DModel (gl3DModel), I'm forced to use the class 3DLine, and not the derived class (gl3DLine), and the same with 3DPoint. Does any of you have any suggestion on how to do this? Thanks!
I think you should seperate the functionality from the data objects, similar to the way you would seperate database records from the actual database provider logic / queries. Instead, implement a renderer base class that takes the above primitives, then derive that for OpenGL / D3D. That way you could do: Renderer r = new D3DRenderer(); r.Render(myModels); Hope that helps Tris
------------------------------- Carrier Bags - 21st Century Tumbleweed.