01: /*
02: * $RCSfile: ShaderAttribute.java,v $
03: *
04: * Copyright 2005-2008 Sun Microsystems, Inc. All Rights Reserved.
05: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
06: *
07: * This code is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License version 2 only, as
09: * published by the Free Software Foundation. Sun designates this
10: * particular file as subject to the "Classpath" exception as provided
11: * by Sun in the LICENSE file that accompanied this code.
12: *
13: * This code is distributed in the hope that it will be useful, but WITHOUT
14: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
16: * version 2 for more details (a copy is included in the LICENSE file that
17: * accompanied this code).
18: *
19: * You should have received a copy of the GNU General Public License version
20: * 2 along with this work; if not, write to the Free Software Foundation,
21: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
22: *
23: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
24: * CA 95054 USA or visit www.sun.com if you need additional information or
25: * have any questions.
26: *
27: * $Revision: 1.5 $
28: * $Date: 2008/02/28 20:17:29 $
29: * $State: Exp $
30: */
31:
32: package javax.media.j3d;
33:
34: import javax.vecmath.*;
35:
36: /**
37: * The ShaderAttribute object encapsulates a uniform attribute for a
38: * shader programs. Uniform attributes (variables) are those
39: * attributes whose values are constant during the rendering of a
40: * primitive. Their values may change from primitive to primitive, but
41: * are constant for each vertex (for vertex shaders) or fragment (for
42: * fragment shaders) of a single primitive. Examples of uniform
43: * attributes include a transformation matrix, a texture map, lights,
44: * lookup tables, etc.
45: *
46: * <p>
47: * There are two ways in which values can be specified for uniform
48: * attributes: explicitly, by providing a value; and implicitly, by
49: * defining a binding between a Java 3D system attribute and a uniform
50: * attribute. This functionality is provided by two subclasses of
51: * ShaderAttribute as follows:
52: *
53: * <ul>
54: * <li>ShaderAttributeObject, in which attributes are expressed as
55: * <code>(attrName, value)</code> pairs, is used for explicitly
56: * defined attributes</li>
57: * <li>ShaderAttributeBinding, in which attributes are expressed as
58: * <code>(attrName, j3dAttrName)</code> pairs, is used for
59: * implicitly defined, automatically tracked attributes</li>
60: * </ul>
61: *
62: * @see ShaderAttributeSet
63: * @see ShaderProgram
64: *
65: * @since Java 3D 1.4
66: */
67:
68: public abstract class ShaderAttribute extends NodeComponent {
69: /**
70: * Name of the shader attribute (immutable)
71: */
72:
73: /**
74: * Package scope constructor
75: *
76: */
77: ShaderAttribute(String attrName) {
78: if (attrName == null) {
79: throw new NullPointerException();
80: }
81:
82: ((ShaderAttributeRetained) this .retained)
83: .initializeAttrName(attrName);
84: }
85:
86: /**
87: * Retrieves the name of this shader attribute.
88: *
89: * @return the name of this shader attribute
90: */
91: public String getAttributeName() {
92:
93: return ((ShaderAttributeRetained) this.retained)
94: .getAttributeName();
95:
96: }
97:
98: }
|