aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorCurtis Rueden <[email protected]>2015-04-09 13:43:15 -0500
committerCurtis Rueden <[email protected]>2015-11-25 14:09:52 -0600
commitcaec6bfe7cfdb3652e5f95c22870cf0e5057890b (patch)
treeffda9fe83ddc4bbcd64c6a39ccab30ea0eb9e950 /src
parenta67d7b847a21150a2f19968ee7e2ed85513481da (diff)
Add a service interface for external routines
In particular, Font3D's triangulateGlyphs routine relies on the classes GeometryInfo and NormalGenerator of package com.sun.j3d.utils.geometry, which lives in the j3d-core-utils project, under a different license. This means that historically, j3d-core and j3d-core-utils were mutually dependent. We avoid the situation by using a service interface instead.
Diffstat (limited to 'src')
-rw-r--r--src/javax/media/j3d/GeometryService.java40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/javax/media/j3d/GeometryService.java b/src/javax/media/j3d/GeometryService.java
new file mode 100644
index 0000000..346087c
--- /dev/null
+++ b/src/javax/media/j3d/GeometryService.java
@@ -0,0 +1,40 @@
+
+package javax.media.j3d;
+
+import java.util.ArrayList;
+
+import javax.vecmath.Point3f;
+
+/**
+ * A service interface for certain geometric operations that are not available
+ * in core Java 3D.
+ * <p>
+ * In particular, the {@code j3d-core-utils} project provides additional
+ * functionality under a different license, which is needed in some
+ * circumstances by core Java 3D. Thus, historically, these two projects have
+ * been co-dependent. This interface breaks the circular dependency by using
+ * Java's service discovery mechanism: if {@code j3d-core-utils} is present on
+ * the classpath, its {@code GeometryServiceImpl} will provide the functionality
+ * defined here. Or if not (i.e., no suitable {@code GeometryService}
+ * implementation can be discovered and instantiated}), then the Java3D core
+ * will fail as gracefully as possible.
+ * </p>
+ *
+ * @see Font3D#triangulateGlyphs
+ */
+public interface GeometryService {
+
+ /**
+ * Loops through each island, calling triangulator once per island. Combines
+ * triangle data for all islands together in one object.
+ *
+ * @param islandCounts TODO
+ * @param outVerts TODO
+ * @param contourCounts TODO
+ * @param triangData TODO
+ * @return total vertex count of the combined array
+ */
+ int triangulateIslands(int[][] islandCounts, Point3f[][] outVerts,
+ int[] contourCounts, ArrayList<GeometryArray> triangData);
+
+}