aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--www/j3d1_4/api-changes.html4
-rw-r--r--www/j3d1_4/shaders.html107
2 files changed, 84 insertions, 27 deletions
diff --git a/www/j3d1_4/api-changes.html b/www/j3d1_4/api-changes.html
index bae0731..86efaa1 100644
--- a/www/j3d1_4/api-changes.html
+++ b/www/j3d1_4/api-changes.html
@@ -67,6 +67,10 @@ III. New classes and interfaces (in javax.media.j3d)
----------------
public class ShaderAppearance extends Appearance
+ ShaderAttributes
+ ----------------
+ public class ShaderAttributes extends NodeComponent
+
Shader
------
public abstract class Shader extends NodeComponent
diff --git a/www/j3d1_4/shaders.html b/www/j3d1_4/shaders.html
index 9bd46f5..cf6c91e 100644
--- a/www/j3d1_4/shaders.html
+++ b/www/j3d1_4/shaders.html
@@ -6,26 +6,16 @@
<title>Java 3D 1.4 Shaders</title>
</head>
<body>
-<h2>Shaders in Java 3D<sup><font size="-2">TM</font></sup> 1.4</h2>
+<h2>Shaders in Java&nbsp;3D<sup><font size="-2">TM</font></sup> 1.4</h2>
<h4>Introduction and pointer to discussion forum</h4>
-<p>If you wandered over here looking for a completed draft
-programmable shading specification for
-Java&nbsp;3D<sup><font size="-2">TM</font></sup> 1.4 that you can
-review, you are in the wrong place; or more accurately, the right
-place at the wrong time. Come back in about 1-2 months and things should
-be in state where you can review a fairly complete draft
-specification. If, on the other hand, you'd like to help us define and
-evolve the programmable shading API in Java&nbsp;3D 1.4, please read
-on.
-</p>
-
-<p>This is a rough first draft of what we are thinking in terms
-of programmable shader support in Java 3D&nbsp;1.4. As we mentioned at
-JavaOne, we plan to do the 1.4 API specification under the auspices of
-the Java Community Process (JCP). However, we very much want to
-involve the larger community in API discussions for programmable
-shaders, so please join in the discussion.
+<p>Here is the latest rough first draft of what we are thinking in
+terms of programmable shader support in Java&nbsp;3D<sup><font
+size="-2">TM</font></sup> for 1.4. We plan to formalize the 1.4 API
+specification under the auspices of the Java Community Process
+(JCP). However, we very much want to involve the larger community in
+API discussions for programmable shaders, so please join in the
+discussion.
</p>
<p>We have created a thread on the Java&nbsp;3D discussion forum for
@@ -78,14 +68,31 @@ public abstract class CgShader extends Shader
method: validate(Canvas3D) ???
</pre>
</ul>
-<li>Changes to existing Appearance class (or maybe create new
-ShaderAppearance subclass):</li>
+<li>New ShaderAppearance class:</li>
<ul>
-<pre>public class Appearance extends NodeComponent
- ...
+<pre>public class ShaderAppearance extends Appearance
method: set/getShaderProgram(ShaderProgram)
+ method: set/getShaderAttributes(ShaderAttributes)
</pre>
</ul>
+
+<li>New SystemAttributes class:</li>
+<ul>
+<pre>public class SystemAttributes extends NodeComponent
+ method: put/getAttribute(String,Object)
+ method: putAllAttributes(Map)
+ method: removeAttribute(String)
+ method: clearAttributes()
+ method: getAttributesMap()
+
+ method: put/getSystemAttribute(String,String)
+ method: putAllSystemAttributes(Map)
+ method: removeSystemAttribute(String)
+ method: clearSystemAttributes()
+ method: getSystemAttributesMap()
+</pre>
+</ul>
+
</ul>
<p>Click on the following link for a preliminary look at the <a
@@ -124,6 +131,12 @@ shaderAppearance.setShaderProgram(shaderProgram);
</ul>
<h4>Shader Parameters</h4>
+<p>NOTE: This section is under construction. For the most up to date
+API definition, please see the javadoc for the new <a
+href="http://javadesktop.org/java3d/javadoc/1.4.0-latest/javax/media/j3d/ShaderAttributes.html">ShaderAttributes</a>
+class.
+</p>
+
<p>Programmable shaders define two types of parameters: uniform and
varying. As the names imply, uniform parameters are constant (within a
primitive), while varying parameters can vary on per-vertex or
@@ -138,16 +151,56 @@ may change from primitive to primitive, but are constant for each
vertex (for vertex shaders) or fragment (for fragment shaders) of a
single primitive. Examples of uniform parameters include a
transformation matrix, a texture map, lights, lookup tables,
-etc. Several Java&nbsp;3D state attributes are automatically available
+etc.<br>
+
+
+<br>
+We have created a new ShaderAttributes object with following new attributes:
+
+<ul>
+ <li>Attributes Map, expressed as (attrName,value) pairs, for
+ explicitly defined attributes</li>
+
+ <li>SystemAttributes Map, expressed as (attrName,j3dAttrName) pairs,
+ for implicitly defined attributes</li>
+</ul>
+
+See the javadoc for the new <a
+href="http://javadesktop.org/java3d/javadoc/1.4.0-latest/javax/media/j3d/ShaderAttributes.html">ShaderAttributes</a>
+class for more details.
+
+<b>Issues</b><br>
+
+<ul>
+
+<li>Should j3dAttrName be specified as a type-safe enum or object
+instead of a String?</li>
+
+<li>How do we handle passing arrays to the shader, especially for
+system parameters such as lights? One possibility is:
+
+<ul>
+ "var" - scalar variable "var"<br>
+ "arr[0]" - array element 0 of "arr"<br>
+ "arr[1,3]" - subarray composed of elements 1 through 3 of "arr"<br>
+ "arr[]" - entire array "arr"<br>
+</ul>
+
+Alternatively, an object with a string or type-safe enum, a state
+(scalar, array element, subarray, or entire array), and indices (as
+needed).
+</li>
+</ul>
+
+<br>
+<b>Automatic variables</b><br>
+Several Java&nbsp;3D state attributes are automatically available
to the shader program as pre-defined uniform parameters. The
application doesn't need to do anything to pass these parameters in to
the shader program. The implementation of each shader language (e.g.,
Cg, GLSL) defines its own mapping from Java&nbsp;3D attribute to uniform
variable name.<br>
-<br>
-We need additional API to allow applications to pass in uniform
-parameters that do not correspond to a pre-defined Java&nbsp;3D
-attribute...<br> TODO: Finish this...<br>
+
<br>
A partial list of Java&nbsp;3D attributes that are mapped to shader
attributes follows: