Skip to content

Commit 696eea3

Browse files
player-03joshtynjala
authored andcommitted
Document common registers.
1 parent d9858b6 commit 696eea3

File tree

1 file changed

+100
-2
lines changed

1 file changed

+100
-2
lines changed
Lines changed: 100 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,130 @@
11
package away3d.materials.compilation;
22

33
/**
4-
* ShaderRegisterData contains the "named" registers, generated by the compiler and to be passed on to the methods.
4+
* A number of commonly-available registers, generated by the compiler and made
5+
* available to the methods.
56
*/
67
class ShaderRegisterData
78
{
9+
/**
10+
* Varying. Contains `animatedNormal`, converted to world space. Not assumed
11+
* to be normalized.
12+
*/
813
public var normalVarying:ShaderRegisterElement;
14+
15+
/**
16+
* Single-pass only. Varying. Contains the tangent to the vertex, in local
17+
* space. To use this, set `needsTangents`.
18+
*/
919
public var tangentVarying:ShaderRegisterElement;
20+
21+
/**
22+
* Single-pass only. Varying. Contains a vector orthogonal to both
23+
* `animatedNormal` and `animatedTangent`, in world space.
24+
*
25+
* To use this, set `methodSetup.normalMethod.normalMap`.
26+
*/
1027
public var bitangentVarying:ShaderRegisterElement;
28+
29+
/**
30+
* Varying. Contains the UV coordinates, with any animations applied. To use
31+
* this, set `needsUV`.
32+
*/
1133
public var uvVarying:ShaderRegisterElement;
34+
35+
/**
36+
* Varying. Contains the secondary UV coordinates, with any animations
37+
* applied. To use this, set `needsSecondaryUV`.
38+
*/
1239
public var secondaryUVVarying:ShaderRegisterElement;
40+
41+
/**
42+
* Varying. Contains the direction the camera to the vertex. Not normalized.
43+
* To use this, set `needsView`.
44+
*/
1345
public var viewDirVarying:ShaderRegisterElement;
46+
47+
/**
48+
* Fragment temp. Contains the final shaded color, to be written to
49+
* `fragmentOutputRegister`.
50+
*/
1451
public var shadedTarget:ShaderRegisterElement;
52+
53+
/**
54+
* Vertex temp. Contains the vertex position in world space. To use this,
55+
* set either `needsGlobalVertexPos` or `needsGlobalFragmentPos`.
56+
*
57+
* Multi-pass: may be freed before methods run; do not rely on it.
58+
*/
1559
public var globalPositionVertex:ShaderRegisterElement;
60+
61+
/**
62+
* Varying. Contains the vertex position in world space. To use this, set
63+
* `needsGlobalFragmentPos`.
64+
*/
1665
public var globalPositionVarying:ShaderRegisterElement;
66+
67+
/**
68+
* Vertex temp. Contains the vertex position in local space.
69+
*/
1770
public var localPosition:ShaderRegisterElement;
71+
72+
/**
73+
* Vertex attribute. Contains the normal to the vertex, in local space. Not
74+
* assumed to be normalized.
75+
*/
1876
public var normalInput:ShaderRegisterElement;
77+
78+
/**
79+
* Vertex attribute. Contains the tangent to the vertex, in local space. Not
80+
* assumed to be normalized.
81+
*/
1982
public var tangentInput:ShaderRegisterElement;
83+
84+
/**
85+
* Vertex temp. Contains `normalInput.xyz`, normalized.
86+
*
87+
* Single-pass: uses world space. Multi-pass: uses local space.
88+
*/
2089
public var animatedNormal:ShaderRegisterElement;
90+
91+
/**
92+
* Vertex temp. Contains `tangentInput.xyz`, normalized.
93+
*
94+
* Single-pass: uses world space. Multi-pass: uses local space.
95+
*/
2196
public var animatedTangent:ShaderRegisterElement;
97+
98+
/**
99+
* Fragment constant. Contains (0.5, 0, 1/255, 1).
100+
*/
22101
public var commons:ShaderRegisterElement;
102+
103+
/**
104+
* Varying. Contains the vertex position in screen space. To use this, set
105+
* `needsProjection`.
106+
*/
23107
public var projectionFragment:ShaderRegisterElement;
108+
109+
/**
110+
* Fragment temp. Contains `normalVarying.xyz`, normalized.
111+
*/
24112
public var normalFragment:ShaderRegisterElement;
113+
114+
/**
115+
* Fragment temp. Contains the direction from the camera to the fragment.
116+
* Normalized. To use this, set `needsView`.
117+
*/
25118
public var viewDirFragment:ShaderRegisterElement;
119+
120+
/**
121+
* Multi-pass only. Vertex temp. Contains a vector orthogonal to both
122+
* `animatedNormal` and `animatedTangent`, in local space.
123+
*/
26124
public var bitangent:ShaderRegisterElement;
27125

28126
public function new()
29127
{
30128

31129
}
32-
}
130+
}

0 commit comments

Comments
 (0)