mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Texture inheritance for materials, also script access
This commit is contained in:
@@ -8,11 +8,16 @@ namespace GlitchyEngine.Graphics;
|
||||
public class MeshRenderer : Component
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the Material of this <see cref="MeshRenderer"/>.
|
||||
/// Gets or sets the instance Material of this <see cref="MeshRenderer"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// If you get the <see cref="Material"/> and it is not yet a runtime-instance,
|
||||
/// a new runtime-instance will be created and returned in its place.
|
||||
/// If you get the <see cref="GlitchyEngine.Graphics.Material"/> and it is not yet a runtime-instance,
|
||||
/// a new runtime-instance will be created and returned in its place. If you want to get the actual material instance,
|
||||
/// use <see cref="SharedMaterial"/> instead.
|
||||
/// <para>
|
||||
/// <b>Note:</b> While the behaviour differs for getting <see cref="SharedMaterial"/> and <see cref="Material"/>,
|
||||
/// the setter behaves identical for both properties.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public Material Material
|
||||
{
|
||||
@@ -24,4 +29,30 @@ public class MeshRenderer : Component
|
||||
}
|
||||
set => ScriptGlue.MeshRenderer_SetMaterial(_uuid, value._uuid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the shared Material of this <see cref="MeshRenderer"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>
|
||||
/// In contrast to the <see cref="Material"/>-property this will not create a new runtime-instance and instead
|
||||
/// always return the actual Material-Asset.
|
||||
/// Making changes to the instance returned by this property will have global effect.
|
||||
/// <see cref="GlitchyEngine.Graphics.Material"/> is used (and obviously instances/children of it).
|
||||
/// </para>
|
||||
/// <para>
|
||||
/// <b>Note:</b> While the behaviour differs for getting <see cref="SharedMaterial"/> and <see cref="Material"/>,
|
||||
/// the setter behaves identical for both properties.
|
||||
/// </para>
|
||||
/// </remarks>
|
||||
public Material SharedMaterial
|
||||
{
|
||||
get
|
||||
{
|
||||
ScriptGlue.MeshRenderer_GetSharedMaterial(_uuid, out UUID materialHandle);
|
||||
|
||||
return new Material { _uuid = materialHandle };
|
||||
}
|
||||
set => ScriptGlue.MeshRenderer_SetMaterial(_uuid, value._uuid);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user