new AxMaterial(context)
Creates a new material
Parameters:
Name | Type | Description |
---|---|---|
context |
Axis | The context to use for the material |
Methods
AddShadingLayer(shadingOp, colorOp) → {Integer}
Adds a shading layer to the material
Parameters:
Name | Type | Description |
---|---|---|
shadingOp |
AxShadingOperation | The shading operation to insert |
colorOp |
AxColorOperation | The color operation to use with the shading operation |
Returns:
The index at which the added shading layer can be found. Practically, this is the last index in the material's shading layers collection
- Type
- Integer
ApplyBones()
Sets the context's current bone transformations to the material's shader
ApplyLights(location)
If the material has light sources, sets them, choosing from the lights in the scene, which are closest to the given location
The location should generally be the place where the object rendered with this material is located in the scene
Parameters:
Name | Type | Description |
---|---|---|
location |
AxVector3 | Location in relation to which to select the closest lights in the scene |
ApplyProperties()
Applies all material property values to the shader
ApplyProperty(materialProperty, shaderAddress)
Applies a material property's value to the shader
Parameters:
Name | Type | Description |
---|---|---|
materialProperty |
AxProperty | The prperty, whose value is to be applied to the shader |
shaderAddress |
Integer | The address of the property in terms of the material's shader |
ClearShadingLayers()
Removes all shading layers from the material
CommitRenderStates()
Applies the material's render states
Deserialize(source) → {Boolean}
Deserializes the material from a given stream
Parameters:
Name | Type | Description |
---|---|---|
source |
AxStream | The stream holding the serialized data |
Returns:
True if the deserialization was successfull
- Type
- Boolean
DeserializeChunk(reader) → {Boolean}
Reads the data of a chunk. The chunk header is already read by the reader and this method deserializes the contents of the chunk. Called continuously for each of the mesh's chunks
Parameters:
Name | Type | Description |
---|---|---|
reader |
AxHierarchyStreamReader | Reader to use for reading the serialized data. |
Returns:
True if a chunk was successfully deserialized
- Type
- Boolean
InsertShadingLayer(shadingOp, colorOp, index)
Inserts a shading layer at a given position
Parameters:
Name | Type | Description |
---|---|---|
shadingOp |
AxShadingOperation | The shading operation to insert |
colorOp |
AxColorOperation | The color operation to use with the shading operation |
index |
Integer | The index at which to insert the shading operation |
MoveShadingLayer(originalIndex, newIndex)
Moves a shading layer from one position to another in the material's shading layers collection
Parameters:
Name | Type | Description |
---|---|---|
originalIndex |
Integer | The original index of the shading layer which is to be moved |
newIndex |
Integer | The index to which the shading layer should be moved to |
RemoveShadingLayer(index)
Removes a shading layer at specified location
Parameters:
Name | Type | Description |
---|---|---|
index |
Integer | The index of the shading layer to remove |
SerializeChunks(writer)
Writes chunks for all the data which is needed to serialize the material.
Parameters:
Name | Type | Description |
---|---|---|
writer |
AxHierarchyStreamWriter | Writer to use for writing the serialization data |
UpdateShader() → {Boolean}
Updates the material shader according to the material's shading layers
Returns:
True if the shader was successfully updated
- Type
- Boolean