Class ModelSceneNode
Namespace: ValveResourceFormat.Renderer.SceneNodes
Assembly: Renderer.dll
Scene node for rendering animated models with skeletal animation and morph targets.
public class ModelSceneNode : MeshCollectionNodeInheritance
object ← SceneNode ← MeshCollectionNode ← ModelSceneNode
Inherited Members
MeshCollectionNode.Tint, MeshCollectionNode.RenderableMeshes, MeshCollectionNode.Delete(), SceneNode.Transform, SceneNode.LayerName, SceneNode.LayerEnabled, SceneNode.BoundingBox, SceneNode.LocalBoundingBox, SceneNode.Name, SceneNode.Id, SceneNode.IsSelected, SceneNode.Flags, SceneNode.Scene, SceneNode.EnvMaps, SceneNode.ShaderEnvMapVisibility, SceneNode.LightingOrigin, SceneNode.OverlayRenderOrder, SceneNode.CubeMapPrecomputedHandshake, SceneNode.LightProbeVolumePrecomputedHandshake, SceneNode.LightProbeBinding, SceneNode.EntityData, SceneNode.Update(Scene.UpdateContext), SceneNode.Render(Scene.RenderContext), SceneNode.GetSupportedRenderModes(), SceneNode.SetRenderMode(string), SceneNode.Delete(), SceneNode.GetCameraDistance(Camera)
Constructors
ModelSceneNode(Scene, Model, string?, bool)
Initializes a new instance of the class and loads its meshes and animations.
public ModelSceneNode(Scene scene, Model model, string? skin = null, bool isWorldPreview = false)Parameters
scene Scene
The scene this node belongs to.
model Model
The model resource to render.
skin string?
The material group (skin) name to activate, or null for the default.
isWorldPreview bool
When true, only embedded animations are loaded.
Properties
ActiveMaterialGroup
Gets the name of the currently active material group (skin).
public string ActiveMaterialGroup { get; }Property Value
AnimationController
Gets the animation controller managing skeletal pose and flex data for this model.
public AnimationController AnimationController { get; }Property Value
HasMeshes
Gets whether this model has at least one mesh renderer loaded.
public bool HasMeshes { get; }Property Value
IsAnimated
Gets whether this model has an active GPU bone matrix buffer (i.e., has animations loaded).
public bool IsAnimated { get; }Property Value
Tint
Gets or sets the tint color applied to all meshes in this node.
public override Vector4 Tint { get; set; }Property Value
Methods
Delete()
Releases resources held by this node.
public override void Delete()GetActiveMeshGroups()
Returns the set of currently active mesh group names.
public ICollection<string> GetActiveMeshGroups()Returns
GetLod1RefMeshes()
Returns the external reference mesh names and their LoD masks for LoD level 1.
public IEnumerable<(int MeshIndex, string MeshName, long LoDMask)> GetLod1RefMeshes()Returns
IEnumerable<(int MeshIndex, string MeshName, long LoDMask)>
GetMeshBoneIndex(int, RenderableMesh)
Returns the mesh-local bone index for the given model-level bone index within the specified mesh's remapping table slice.
public int GetMeshBoneIndex(int modelBoneIndex, RenderableMesh mesh)Parameters
modelBoneIndex int
mesh RenderableMesh
Returns
GetMeshGroups()
Returns all mesh group names defined by this model.
public IEnumerable<string> GetMeshGroups()Returns
GetSupportedAnimationNames()
Returns the names of all animations available on this model.
public IEnumerable<string> GetSupportedAnimationNames()Returns
GetSupportedRenderModes()
Returns the render modes supported by this node.
public override IEnumerable<string> GetSupportedRenderModes()Returns
SetActiveMeshGroups(IEnumerable<string>)
Sets which mesh groups are active, rebuilding the renderable mesh list accordingly.
public void SetActiveMeshGroups(IEnumerable<string> setMeshGroups)Parameters
setMeshGroups IEnumerable<string>
SetAnimation(string)
Activates the animation with the given name, or stops animation if not found.
public void SetAnimation(string animationName)Parameters
animationName string
SetAnimation(Animation?)
Activates the given animation instance, or clears the active animation when null.
public void SetAnimation(Animation? activeAnimation)Parameters
activeAnimation Animation?
SetAnimationForWorldPreview(string)
Activates the named animation for world preview mode.
public bool SetAnimationForWorldPreview(string animationName)Parameters
animationName string
Returns
true if the animation was found and activated; otherwise false.
SetCharacterEyeRenderParams()
Detects eye materials on this model and injects bone index and bind-pose uniforms for eyeball rendering.
public void SetCharacterEyeRenderParams()SetMaterialGroup(string)
Activates the named material group (skin), remapping all mesh materials accordingly.
public void SetMaterialGroup(string name)Parameters
name string
Update(UpdateContext)
Called each frame to update this node's state.
public override void Update(Scene.UpdateContext context)Parameters
context Scene.UpdateContext
The current update context.

