[API-REVIEW] RT-33211 - Fix TriangleMesh API to support a range of vertex format in the future

Chien Yang chien.yang at oracle.com
Wed Oct 16 15:30:02 PDT 2013


Hi all,

We realized the existing TriangleMesh API is too restrictive to support 
additional vertex formats in the future, for examples, user specified 
normal and multi-texture units. We will need to make at least 2 changes 
to allow TriangleMesh be used for a range of vertex formats in the future:

1) The  faces of TriangleMesh needs to be a new class that extends 
ObservableIntegerArray. We can then add methods (in the future) to 
provide views to the different components of the faces.

2) The following constants in TriangleMesh need to turn into instance 
methods:
public static final int NUM_COMPONENTS_PER_POINT = 3;
public static final int NUM_COMPONENTS_PER_TEXCOORD = 2;
public static final int NUM_COMPONENTS_PER_FACE = 6;


Changes made to TriangleMesh:

-    public static final int NUM_COMPONENTS_PER_POINT = 3;
-    public static final int NUM_COMPONENTS_PER_TEXCOORD = 2;
-    public static final int NUM_COMPONENTS_PER_FACE = 6;

-    public final ObservableIntegerArray getFaces()
+    public final ObservableFaceArray getFaces()


Methods added to TriangleMesh:

     /**
      * Returns the number of elements that represents a Point.
      *
      * @return number of elements
      */
     public final int getPointElementSize()

     /**
      * Returns the number of elements that represents a TexCoord.
      *
      * @return number of elements
      */
     public final int getTexCoordElementSize()

     /**
      * Returns the number of elements that represents a Face.
      *
      * @return number of elements
      */
     public final int getFaceElementSize()


New Class:

      public interface ObservableFaceArray extends ObservableIntegerArray
      Note: This class adds no new methods or fields in JavaFX 8.

Thanks,
- Chien



More information about the openjfx-dev mailing list