Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[gef3d-dev] org.lwjgl.util.vector replaced with org.eclipse.draw3d.geometry

For reducing dependencies to the LWJGL library, we (Matthias and I) have replaced the package org.lwjgl.util.vector with org.eclipse.draw3d.geometry. That is instead of LWJGL's Vector3f implementation, we are now providing and using our own one.
The new package was designed with LWJGL's package in mind in order to keep changes low. For further design decisions and their reasons read the package description of org.eclipse.draw3d.geometry.

If you have to adapt existing code, here are some hints:
  • Instead of ReadableVector*f, use IVector3f. While LWJGL requires mutable versions in most operations, our operations can handle immutable classes where ever possible
  • Most mathematical functions are implemented in Math3D. So instead of Vector3f.add(..) and other static methods, use Math3D.add(..). The method signature are very similar to the LWJGL's method signatures. For each function, there exists exactly ONE operation. I.e. there is no a.invers() but only a Math3D.invers(a).
  • all TransformableAdapter were removed, since Vector3f, Vector4f and BoundingBox implement this interface. The methods declared in this interface are the only mathematical functions implemented directly by the classes themselves. This is for keeping Transformable (and its usage) similar to draw2d's Translatable.
  • The geometry package has no dependencies to other plugins, even not to draw2d. The classes depending on draw2d can be found in draw3d.geometryext (in the draw3d plugin)
  • Some methods formerly implemented in o.e.draw3d.geometryext.TempVectors are now implemented in Math3D, same is true for a very few other methods.

The best way to convert your code is as follow:
  1. automatically: Search and replace "org.lwjgl.util.vector" with "org.eclipse.draw3d.geometry".
  2. automatically: Search and replace "ReadableVector" with "IVector"
  3. manually: Search and replace "new Vector3f(" with "new Vector3fImpl(", in some cases it makes sense to change class to "Vector3fImpl" if you need fast access to the fields.
  4. manually: Search and replace all TransformableAdapters, simply use the geometry instance itself.
  5. if you find more problems you cannot easily solve yourself, post a question in gef3d (developer) mailing list or newsgroup.

We are now going to replace all GL11 static methods with an interface Graphics3D (and an Graphics3DLWJGL implementation). Stay tuned!

Cheers,

Jens

Back to the top