using GlitchyEngine.Core;
namespace GlitchyEngine.Graphics;
///
/// Renders a Mesh. The Mesh can be specified by adding a component to the same .
///
[EngineClass("GlitchyEngine.World.MeshRendererComponent")]
public class MeshRenderer : Component
{
///
/// Gets or sets the instance Material of this .
///
///
/// If you get the 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 instead.
///
/// Note: While the behaviour differs for getting and ,
/// the setter behaves identical for both properties.
///
///
public Material Material
{
get
{
ScriptGlue.MeshRenderer_GetMaterial(_uuid, out UUID materialHandle);
return new Material { _uuid = materialHandle };
}
set => ScriptGlue.MeshRenderer_SetMaterial(_uuid, value._uuid);
}
///
/// Gets or sets the shared Material of this .
///
///
///
/// In contrast to the -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.
/// is used (and obviously instances/children of it).
///
///
/// Note: While the behaviour differs for getting and ,
/// the setter behaves identical for both properties.
///
///
public Material SharedMaterial
{
get
{
ScriptGlue.MeshRenderer_GetSharedMaterial(_uuid, out UUID materialHandle);
return new Material { _uuid = materialHandle };
}
set => ScriptGlue.MeshRenderer_SetMaterial(_uuid, value._uuid);
}
}