3D graphics support
The J3D and JX3D libraries provide 3D graphics support via the Mesa implementation of OpenGL. Ideally, J3D will eventually be independent of the 3D rendering engine so only JGL* and JXMesa* will actually depend on OpenGL.
Since we are not 3D graphics experts, please contact us if you can help with design or debugging. The design of Java3D provides a lot of good ideas.
J3DObject is the base container class. Eventually, this will provide the following functionality:
- Show/Hide
- Place/Rotate/Scale
- Material properties
- Activate/Deactivate
- Hit detection for mouse clicks
- Selection and dragging
Animation will be provided via a base class J3DTask. This defines a virtual function that is called with a time value. A task is only performed when its activation region intersects the camera volume. This is why it must be passed an absolute time value. It has to be able to update itself after an arbitrary amount of time has passed.
Composite objects are derived from J3DGroup. The overall container, J3DUniverse, also derives from J3DGroup since it contains everything.
Primitives are derived from J3DObject:
- J3DLight
- J3DSound
- J3DText
- J3DLine
- J3DPlane
- J3DRhomboid
- J3DEllipsoid
- J3DToroid
- J3DCone
- etc, etc, etc
By separating the concepts of groups and primitives, we simplify the code. Groups compute the coverage of their children's bounding cubes and optimize to only draw anything if this intersects the camera volume.
To view the J3DUniverse, one uses J3DViewPlatform. This defines a mapping between the user's reality (distance from screen, size of window) and the virtual reality (position and scale of ViewPlatform). There can obviously be multiple ViewPlatforms in each Universe. Each one uses a class derived from J3DCamera. Currently, JXMesaCamera is the only available option.
JX3DWidget derives from JXWidget and owns a J3DViewPlatform to render the Universe.
J3DPainter will ideally abstract all the functionality to make J3D independent of the 3D rendering engine. All J3DObject's will talk to this Painter. Currently, JXMesaCamera inherits from J3DPainter to provide what little there is.
Sound should ideally be "surround" so it can take advantage of multiple speakers, given their configuration in real space. If nothing else, it can easily be localized, so it fades as one moves away.