Material
Type | Name | Interface Description |
---|---|---|
Variables | mainPass: Pass | The first Pass. |
Example
const mainPass = material.mainPass;
Type | Name | Interface Description |
---|---|---|
Variables | passes: Pass[] | Pass List |
Example
const passes = material.passes;
const pass0 = passes[0];
Type | Name | Interface Description |
---|---|---|
Variables | renderQueue: number | Rendering order value. The smaller the value, the earlier the rendering; conversely, the larger the value, the later the drawing. |
Example
material.renderQueue = 2;
Type | Name | Interface Description |
---|---|---|
Functions | clone(): Material | Material Clone |
Example
const newMaterial = srcMaterial.clone();
Type | Name | Interface Description |
---|---|---|
Functions | setFloat(name: string, value: number): void | Set the Float property of the material. Currently, the name of uniform can only be obtained through third-party software such as BlenderLender. |
Example
material.setFloat('_Custom_Float', 0.1);
Type | Name | Interface Description |
---|---|---|
Functions | setVector(name:string, value: Vector2|Vector3|Vector4): void | Set the Vector property of the material |
Example
material.setVector('_Custom_Vec2', new APJS.Vector2f(1.0, 1.0));
Type | Name | Interface Description |
---|---|---|
Functions | setColor(name:string, value: Color): void | Set the Color property of the material |
Example
material.setColor('_Custom_Color', new APJS.Color(1.0, 0.0, 0.0, 1.0));
Type | Name | Interface Description |
---|---|---|
Functions | setMatrix(name:string, value:Matrix4x4): void | Set the Color property of the material |
Example
const mat = new APJS.Matrix4x4f();
material.setMatrix('_Custom_Mat4', mat);
Type | Name | Interface Description |
---|---|---|
Functions | setTexture(name:string, texture:Texture):void | Set the Texture property of the material |
Example
material.setTexture('_Custom_Sampler2D', tex);
Type | Name | Interface Description |
---|---|---|
Functions | getFloat(name:string):number | undefined | Get the Float property of the material |
Example
const value = material.getFloat('_Custom_Float');
Type | Name | Interface Description |
---|---|---|
Functions | getVector(name:string):Vector2|Vector3|Vector4|undefined | Get the Vector property of the material |
Example
const value = material.getVector('_Custom_Vec2');
Type | Name | Interface Description |
---|---|---|
Functions | getMatrix(name:string):Matrix4x4 | undefined | Get the Matrix property of the material |
Example
const eulerAngles = rotation.toEulerAngles();
Type | Name | Interface Description |
---|---|---|
Functions | getColor(name: string): Color | undefined | Get the Color property of the material |
Example
const value = material.getColor('_Custom_Color');
Type | Name | Interface Description |
---|---|---|
Functions | getTexture(name:string):Texture | undefined | Get the Texture property of the material |
Example
const tex = material.getTexture('_Custom_Sampler2D') as APJS.Texture;