A constructor defined in BBMOD_MaterialPropertyBlock.gml
new BBMOD_MaterialPropertyBlock()
A collection of material properties. Useful in case you want to use the same material when rendering multiple models and only change some of its properties for each model.
Name | Description |
---|---|
apply | Applies properties to a shader. |
clear | Removes all properties. |
clone | Creates a shallow clone of the material property block. |
copy | Shallowly copies properties into another material property block. |
get | Retrieves a value of a property. |
get_names | Retreives an array of names of properties that the material property block has. |
has | Checks whether the material property block has a property with given name. |
remove | Removes a property with given name. |
set | Sets a property to given value. |
set_color | Sets a value of a BBMOD_EShaderUniformType.Color property. |
set_float | Sets a value of a BBMOD_EShaderUniformType.Float property. |
set_float2 | Sets a value of a BBMOD_EShaderUniformType.Float2 property. |
set_float3 | Sets a value of a BBMOD_EShaderUniformType.Float3 property. |
set_float4 | Sets a value of a BBMOD_EShaderUniformType.Float4 property. |
set_float_array | Sets a value of a BBMOD_EShaderUniformType.FloatArray property. |
set_int | Sets a value of a BBMOD_EShaderUniformType.Int property. |
set_int2 | Sets a value of a BBMOD_EShaderUniformType.Int2 property. |
set_int3 | Sets a value of a BBMOD_EShaderUniformType.Int3 property. |
set_int4 | Sets a value of a BBMOD_EShaderUniformType.Int4 property. |
set_int_array | Sets a value of a BBMOD_EShaderUniformType.IntArray property. |
set_matrix | Sets a value of a BBMOD_EShaderUniformType.Matrix property. |
set_matrix_array | Sets a value of a BBMOD_EShaderUniformType.MatrixArray property. |
set_sampler | Sets a value of a BBMOD_EShaderUniformType.Sampler property. |
/// @desc Create event
// Controls for silhouette effect
silhouetteColor = BBMOD_C_RED;
silhouetteStrength = 1.0;
// Create a new material property block
materialProps = new BBMOD_MaterialPropertyBlock();
/// @desc Step event
// Update material property block's properties using the local variables
materialProps.set_color("u_vSilhouetteColor", silhouetteColor);
materialProps.set_float("u_fSilhouetteStrength", silhouetteStrength);
/// @desc Draw event
// Set the material property block as the current one
bbmod_material_props_set(materialProps);
// Render a model using the properties
model.render();
// Unset the properties so they aren't applied to other models too
bbmod_material_props_reset();
// Note: This works with method submit too, e.g.:
//bbmod_material_props_set(materialProps);
//model.submit();
//bbmod_material_props_reset();
//bbmod_material_reset();
bbmod_material_props_get, bbmod_material_props_reset, bbmod_material_props_set
Copyright © 2025, BlueBurn. Built on January 04, 2025 using GMDoc.