BBMOD_Material

A constructor defined in BBMOD_Material.gml

Extends BBMOD_Resource
Implements BBMOD_IMaterial

new BBMOD_Material([_shader])

Description

Base class for materials.

Arguments

Name Type Description
_shader Struct.BBMOD_Shader A shader that the material uses in the BBMOD_ERenderPass.Forward pass. Leave undefined if you would like to use BBMOD_Material.set_shader to specify shaders used in specific render passes.

Properties

Name Description
AlphaBlend Use true to enable alpha blending. This can have negative effect on performance, therefore it should be used only when necessary. Default value is false.
AlphaTest Discard pixels with alpha less than this value. Use values in range 0..1.
Anisotropy The maximum level of anisotropy when BBMOD_Material.MipFilter is set to tf_anisotropic. Must be in range 1..16. Default value is 16.
BaseOpacity A texture with a base color in the RGB channels and opacity in the alpha channel.
BlendMode A blend mode. Default value is bm_normal.
Culling A culling mode. Default value is cull_counterclockwise.
Filtering Use false to disable linear texture filtering for this material. Default value is true.
MipBias Defines a bias for which mip level is used. Can be also negative values to select lower mip levels. E.g. if mip level 2 would be normally selected and bias was -1, then level 1 would be selected instead and if it was 1, then level 3 would be selected instead. Default value is 0.
MipFilter The mip filter mode used for the material. Use one of the tf_ constants. Default value is tf_anisotropic.
MipMax The maximum mip level used, where 0 is the highest resolution, 1 is the first mipmap, 2 is the second etc. Default value is 16.
MipMin The minimum mip level used, where 0 is the highest resolution, 1 is the first mipmap, 2 is the second etc. Default value is 0.
Mipmapping Use one of the mip_ constants. Default value is mip_markedonly.
OnApply A function that is executed when the shader is applied. Must take the material as the first argument. Use undefined if you do not want to execute any function. Defaults to undefined.
RenderPass Render passes in which is the material rendered. Defaults to 0 (no passes).
RenderQueue The render queue used by this material. Defaults to the default BBMOD render queue.
Repeat Use true to enable texture repeat for this material. Default value is false.
ZFunc The function used for depth testing when BBMOD_Material.ZTest is enabled. Default value is cmpfunc_lessequal.
ZTest If true then models using this material should be tested against the depth buffer. Defaults value is true.
ZWrite If true then models using this material should write to the depth buffer. Default value is true.

Inherited properties

Name Description
IsLoaded If false then the resource has not been loaded yet.
Path The path to the file from which was the resource loaded, or undefined if the resource does not come from a file.
Persistent If true then the resource is persistent and it is not destroyed when method free is used. Default value is false.

Methods

Name Description
apply Makes this material the current one.
clone Creates a clone of the material.
copy Copies properties of this material into another material.
from_json Loads material properties from a JSON object.
get_shader Retrieves a shader used in a specific render pass.
has_shader Checks whether the material has a shader for the render pass.
remove_shader Removes a shader used in a specific render pass.
reset Resets the current material to undefined.
set_base_opacity Changes the base color and opacity to a uniform value for the entire material.
set_shader Defines a shader used in a specific render pass.
to_json Saves material properties to a JSON object.

Inherited methods

Name Description
destroy Frees memory used by the struct.
free Releases a reference to the resource.
from_buffer Loads the resource from a buffer.
from_file Loads the resource from a file.
from_file_async Asynchronnously loads the resource from a file.
ref Retrieves a reference to the resource.
to_buffer Writes the resource to a buffer.
to_file Writes a resource to a file.

Child structs

BBMOD_BaseMaterial

See also

BBMOD_MaterialPropertyBlock, BBMOD_Shader

Do you find this page helpful?

Copyright © 2024, BlueBurn. Built on January 21, 2024 using GMDoc.