diff options
author | Kevin Rushforth <[email protected]> | 2005-03-04 20:46:33 +0000 |
---|---|---|
committer | Kevin Rushforth <[email protected]> | 2005-03-04 20:46:33 +0000 |
commit | e4a3b1190ac1ccb5d20c9127ad8ef710a83c0b66 (patch) | |
tree | 998b8af039248f80839f3f0b59a1907ba4375c11 /www/j3d1_4/shaders.html | |
parent | 2ed639a05224739cd8dfe586810ce5e8a5d91091 (diff) |
Updated web pages.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@144 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'www/j3d1_4/shaders.html')
-rw-r--r-- | www/j3d1_4/shaders.html | 82 |
1 files changed, 36 insertions, 46 deletions
diff --git a/www/j3d1_4/shaders.html b/www/j3d1_4/shaders.html index cf6c91e..fadfde0 100644 --- a/www/j3d1_4/shaders.html +++ b/www/j3d1_4/shaders.html @@ -72,30 +72,21 @@ public abstract class CgShader extends Shader <ul> <pre>public class ShaderAppearance extends Appearance method: set/getShaderProgram(ShaderProgram) - method: set/getShaderAttributes(ShaderAttributes) + method: set/getShaderAttributeSet(ShaderAttributeSet) </pre> </ul> -<li>New SystemAttributes class:</li> +<li>New ShaderAttributeSet 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>public class ShaderAttributeSet extends NodeComponent + method: put/get(ShaderAttribute) + ... </pre> </ul> </ul> -<p>Click on the following link for a preliminary look at the <a +<p>Click on the following link for a current look at the <a href="http://javadesktop.org/java3d/javadoc/1.4.0-latest/index.html">javadoc-generated API definitions</a> for the proposed 1.4 API. </p> @@ -111,8 +102,8 @@ String vertexShaderSource; String fragmentShaderSource; // Read GLSL vertex and fragment shader source code from text files -vertexShaderSource = TextFileUtils.readFully(vertexShaderFile); -fragmentShaderSource = TextFileUtils.readFully(fragmentShaderSource); +vertexShaderSource = StringIO.readFully(vertexShaderFile); +fragmentShaderSource = StringIO.readFully(fragmentShaderSource); // Create GLSL vertex and fragment shader objects using the given source code GLSLVertexShader vertexShader = new GLSLVertexShader(vertexShaderSource); @@ -131,12 +122,6 @@ 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 @@ -152,29 +137,31 @@ 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.<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. +We have created a new ShaderAttributeSet for allowing applications to +specify uniform shader attributes. There are two ways in which values +can be specified for uniform attributes: explicitly, by providing a +value; and implicitly, by defining a binding between a Java 3D system +attribute and a uniform attribute. This functionality is provided by +two subclasses of ShaderAttribute: ShaderAttributeObject, which is +used to specify explicitly defined attributes; and +ShaderAttributeBinding, which is used to specify implicitly defined, +automatically tracked attributes. See the javadoc for the new <a +href="http://javadesktop.org/java3d/javadoc/1.4.0-latest/javax/media/j3d/ShaderAttributeSet.html">ShaderAttributeSet</a> +and <a +href="http://javadesktop.org/java3d/javadoc/1.4.0-latest/javax/media/j3d/ShaderAttribute.html">ShaderAttribute</a> +classes for more details.<br> +<br> <b>Issues</b><br> <ul> <li>Should j3dAttrName be specified as a type-safe enum or object -instead of a String?</li> +instead of a String? + <ul><font color="gray"><li>No; we will use a String</li></font> +</ul></li> <li>How do we handle passing arrays to the shader, especially for system parameters such as lights? One possibility is: @@ -185,23 +172,26 @@ system parameters such as lights? One possibility is: "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><font color="gray"><li>TBD, but since they will be String objects, we will probably +do something like the first suggestion</li></font> +</ul></li> </ul> <br> <b>Automatic variables</b><br> -Several Java 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 3D attribute to uniform -variable name.<br> +Depending on the shading language (and profile) being used, several +Java 3D state attributes are automatically made available to the +shader program as pre-defined uniform attributes. The application +doesn't need to do anything to pass these attributes in to the shader +program. The implementation of each shader language (e.g., Cg, GLSL) +defines its own mapping from Java 3D attribute to uniform +variable name.<br> <br> + A partial list of Java 3D attributes that are mapped to shader attributes follows: </li> |