Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 100 additions & 2 deletions away3d/materials/compilation/ShaderRegisterData.hx
Original file line number Diff line number Diff line change
@@ -1,32 +1,130 @@
package away3d.materials.compilation;

/**
* ShaderRegisterData contains the "named" registers, generated by the compiler and to be passed on to the methods.
* A number of commonly-available registers, generated by the compiler and made
* available to the methods.
*/
class ShaderRegisterData
{
/**
* Varying. Contains `animatedNormal`, converted to world space. Not assumed
* to be normalized.
*/
public var normalVarying:ShaderRegisterElement;

/**
* Single-pass only. Varying. Contains the tangent to the vertex, in local
* space. To use this, set `needsTangents`.
*/
public var tangentVarying:ShaderRegisterElement;

/**
* Single-pass only. Varying. Contains a vector orthogonal to both
* `animatedNormal` and `animatedTangent`, in world space.
*
* To use this, set `methodSetup.normalMethod.normalMap`.
*/
public var bitangentVarying:ShaderRegisterElement;

/**
* Varying. Contains the UV coordinates, with any animations applied. To use
* this, set `needsUV`.
*/
public var uvVarying:ShaderRegisterElement;

/**
* Varying. Contains the secondary UV coordinates, with any animations
* applied. To use this, set `needsSecondaryUV`.
*/
public var secondaryUVVarying:ShaderRegisterElement;

/**
* Varying. Contains the direction the camera to the vertex. Not normalized.
* To use this, set `needsView`.
*/
public var viewDirVarying:ShaderRegisterElement;

/**
* Fragment temp. Contains the final shaded color, to be written to
* `fragmentOutputRegister`.
*/
public var shadedTarget:ShaderRegisterElement;

/**
* Vertex temp. Contains the vertex position in world space. To use this,
* set either `needsGlobalVertexPos` or `needsGlobalFragmentPos`.
*
* Multi-pass: may be freed before methods run; do not rely on it.
*/
public var globalPositionVertex:ShaderRegisterElement;

/**
* Varying. Contains the vertex position in world space. To use this, set
* `needsGlobalFragmentPos`.
*/
public var globalPositionVarying:ShaderRegisterElement;

/**
* Vertex temp. Contains the vertex position in local space.
*/
public var localPosition:ShaderRegisterElement;

/**
* Vertex attribute. Contains the normal to the vertex, in local space. Not
* assumed to be normalized.
*/
public var normalInput:ShaderRegisterElement;

/**
* Vertex attribute. Contains the tangent to the vertex, in local space. Not
* assumed to be normalized.
*/
public var tangentInput:ShaderRegisterElement;

/**
* Vertex temp. Contains `normalInput.xyz`, normalized.
*
* Single-pass: uses world space. Multi-pass: uses local space.
*/
public var animatedNormal:ShaderRegisterElement;

/**
* Vertex temp. Contains `tangentInput.xyz`, normalized.
*
* Single-pass: uses world space. Multi-pass: uses local space.
*/
public var animatedTangent:ShaderRegisterElement;

/**
* Fragment constant. Contains (0.5, 0, 1/255, 1).
*/
public var commons:ShaderRegisterElement;

/**
* Varying. Contains the vertex position in screen space. To use this, set
* `needsProjection`.
*/
public var projectionFragment:ShaderRegisterElement;

/**
* Fragment temp. Contains `normalVarying.xyz`, normalized.
*/
public var normalFragment:ShaderRegisterElement;

/**
* Fragment temp. Contains the direction from the camera to the fragment.
* Normalized. To use this, set `needsView`.
*/
public var viewDirFragment:ShaderRegisterElement;

/**
* Multi-pass only. Vertex temp. Contains a vector orthogonal to both
* `animatedNormal` and `animatedTangent`, in local space.
*/
public var bitangent:ShaderRegisterElement;

public function new()
{

}
}
}