Urho.Scene Class

Root scene node, represents the whole scene.

See Also: Scene


public class Scene : Node


When you create a Scene, it is automatically attached to the specified context (or the default as exposed by Application.CurrentContext).   The Scene is just the toplevel Node and it holds the various nodes for your application.   

In general, you will want to add an Octree component to your scene, without it, none of the visual components will be shown.  The default Octree component volume goes from (-1000,-1000,-1000) to (1000,1000,1000) in world coordinates.

C# Example

scene.CreateComponent<Octree> ();

// Create a child scene node (at world origin) and a StaticModel
// component into it. Set the StaticModel to show a simple plane mesh
// with a "stone" material. Note that naming the scene nodes is
// optional. Scale the scene node larger (100 x 100 world units)
var planeNode = scene.CreateChild("Plane");
planeNode.Scale = new Vector3 (100, 1, 100);
var planeObject = planeNode.CreateComponent<StaticModel> ();
planeObject.Model = cache.GetModel ("Models/Plane.mdl");

// Create a directional light to the world so that we can see something. The
// light scene node's orientation controls the light direction; we will use
// the SetDirection() function which calculates the orientation from a forward
// direction vector.
// The light will use default settings (white light, no shadows)
var lightNode = scene.CreateChild("DirectionalLight");
lightNode.SetDirection (new Vector3(0.6f, -1.0f, 0.8f));


Namespace: Urho
Assembly: Urho (in Urho.dll)
Assembly Versions:

The members of Urho.Scene are listed below.

See Also: Node

Public Constructors

Constructs a new instance of Urho.Scene which is tied to the Application.CurrentContext.
Constructs a new instance of Urho.Scene, given a raw pointer to an unmanaged object
Constructs a new instance of Urho.Scene linked to a specific Context.

Protected Constructors

Empty constructor, chain to this constructor when you provide your own constructor that sets the handle field.

Public Properties

AsyncLoadingBoolean. Return whether an asynchronous loading operation is in progress.
AsyncLoadingMsInt32. Return maximum milliseconds per frame to spend on async loading. Or Set maximum milliseconds per frame to spend on async scene loading.
AsyncLoadModeLoadMode. Return the load mode of the current asynchronous loading operation.
AsyncProgressSingle. Return asynchronous loading progress between 0.0 and 1.0, or 1.0 if not in progress.
ChecksumUInt32. Return source file checksum.
ElapsedTimeSingle. Return elapsed time in seconds. Or Set elapsed time in seconds. This can be used to prevent inaccuracy in the timer if the scene runs for a long time.
FileNameString. Return source file name.
RequiredPackageFilesIReadOnlyList<Urho.IO.PackageFile>. Return required package files.
SmoothingConstantSingle. Return motion smoothing constant. Or Set network client motion smoothing constant.
SnapThresholdSingle. Return motion smoothing snap threshold. Or Set network client motion smoothing snap threshold.
ThreadedUpdateBoolean. Return threaded update flag.
TimeScaleSingle. Return update time scale. Or Set update time scale. 1.0 = real time (default.)
TypeStringHash. Urho's type system type.
TypeNameString. Urho's low-level type name.
TypeNameStaticString. Urho's low-level type name, accessible as a static method.
TypeStaticStringHash. Urho's low-level type, accessible as a static method.
UpdateEnabledBoolean. Controls whether updates to the scene are enabled or disabled.
VarNamesAttrString. Return node user variable reverse mappings.

Public Methods

Add a required package file for networking. To be called on the server.
Begin a threaded update. During threaded update components can choose to delay dirty processing.
Clean up all references to a network connection that is about to be removed.
Clear(Boolean, Boolean)
Clear scene completely of either replicated, local or all nodes and components.
Clear required package files.
Add a component to the delayed dirty notify queue. Is thread-safe.
End a threaded update. Notify components that marked themselves for delayed dirty processing.
GetComponent(UInt32) : Component
Return component from the whole scene by ID, or null if not found.
GetFreeComponentID(CreateMode) : UInt32
Get free component ID, either non-local or local.
GetFreeNodeID(CreateMode) : UInt32
Get free node ID, either non-local or local.
GetNode(UInt32) : Node
Return node from the whole scene by ID, or null if not found.
GetVarName(StringHash) : String
Return a node user variable name, or empty if not registered.
Instantiate(File, Vector3, Quaternion, CreateMode) : Node
Instantiate(MemoryBuffer, Vector3, Quaternion, CreateMode) : Node
InstantiateJson(File, Vector3, Quaternion, CreateMode) : Node
Instantiate scene content from JSON data. 
InstantiateJson(MemoryBuffer, Vector3, Quaternion, CreateMode) : Node
InstantiateXml(File, Vector3, Quaternion, CreateMode) : Node
Instantiate scene content from serialized XML data.
InstantiateXml(MemoryBuffer, Vector3, Quaternion, CreateMode) : Node
InstantiateXml(XmlElement, Vector3, Quaternion, CreateMode) : Node
Instantiate scene content from serialized XML data.
Load(File, Boolean) : Boolean
Load(MemoryBuffer, Boolean) : Boolean
LoadAsync(File, LoadMode) : Boolean
Load from a binary file asynchronously. Return true if started successfully. The LOAD_RESOURCES_ONLY mode can also be used to preload resources from object prefab files.
LoadAsyncJson(File, LoadMode) : Boolean
LoadAsyncXml(File, LoadMode) : Boolean
LoadJson(File) : Boolean
LoadJson(MemoryBuffer) : Boolean
LoadXml(String) : Boolean
LoadXml(File) : Boolean
LoadXml(MemoryBuffer) : Boolean
LoadXml(XmlElement, Boolean) : Boolean
LoadXmlFromCache(ResourceCache, String) : Boolean
Mark for attribute check on the next network update.
Mark a comoponent for attribute check on the next network update.
Mark a node for attribute check on the next network update.
Mark a node dirty in scene replication states. The node does not need to have own replication state yet.
NodeTagAdded(Node, String)
NodeTagRemoved(Node, String)
Prepare network update by comparing attributes and marking replication states dirty as necessary.
Register object factory. Node must be registered first.
Register a node user variable hash reverse mapping (for editing.)
Save(File) : Boolean
Save(MemoryBuffer) : Boolean
SaveJson(File, String) : Boolean
SaveJson(MemoryBuffer, String) : Boolean
SaveXml(String, String) : Boolean
SaveXml(File, String) : Boolean
SaveXml(MemoryBuffer, String) : Boolean
Set node user variable reverse mappings.
Stop asynchronous loading.
SubscribeToAsyncLoadFinished(Action<AsyncLoadFinishedEventArgs>) : Subscription
Subscribes to the AsyncLoadFinished event raised by the Scene.
SubscribeToAsyncLoadProgress(Action<AsyncLoadProgressEventArgs>) : Subscription
Subscribes to the AsyncLoadProgress event raised by the Scene.
SubscribeToAttributeAnimationUpdate(Action<AttributeAnimationUpdateEventArgs>) : Subscription
Subscribes to the AttributeAnimationUpdate event raised by the Scene.
SubscribeToComponentAdded(Action<ComponentAddedEventArgs>) : Subscription
Subscribes to the ComponentAdded event raised by the Scene.
SubscribeToComponentCloned(Action<ComponentClonedEventArgs>) : Subscription
SubscribeToComponentEnabledChanged(Action<ComponentEnabledChangedEventArgs>) : Subscription
Subscribes to the ComponentEnabledChanged event raised by the Scene.
SubscribeToComponentRemoved(Action<ComponentRemovedEventArgs>) : Subscription
Subscribes to the ComponentRemoved event raised by the Scene.
SubscribeToNodeAdded(Action<NodeAddedEventArgs>) : Subscription
Subscribes to the NodeAdded event raised by the Scene.
SubscribeToNodeCloned(Action<NodeClonedEventArgs>) : Subscription
SubscribeToNodeEnabledChanged(Action<NodeEnabledChangedEventArgs>) : Subscription
Subscribes to the NodeEnabledChanged event raised by the Scene.
SubscribeToNodeNameChanged(Action<NodeNameChangedEventArgs>) : Subscription
Subscribes to the NodeNameChanged event raised by the Scene.
SubscribeToNodeRemoved(Action<NodeRemovedEventArgs>) : Subscription
Subscribes to the NodeRemoved event raised by the Scene.
SubscribeToSceneDrawableUpdateFinished(Action<SceneDrawableUpdateFinishedEventArgs>) : Subscription
Subscribes to the SceneDrawableUpdateFinished event raised by the Scene.
SubscribeToScenePostUpdate(Action<ScenePostUpdateEventArgs>) : Subscription
Subscribes to the ScenePostUpdate event raised by the Scene.
SubscribeToSceneSubsystemUpdate(Action<SceneSubsystemUpdateEventArgs>) : Subscription
Subscribes to the SceneSubsystemUpdate event raised by the Scene.
SubscribeToSceneUpdate(Action<SceneUpdateEventArgs>) : Subscription
Subscribes to the SceneUpdate event raised by the Scene.
SubscribeToUpdateSmoothing(Action<UpdateSmoothingEventArgs>) : Subscription
Subscribes to the UpdateSmoothing event raised by the Scene.
Clear all registered node user variable hash reverse mappings.
Unregister a node user variable hash reverse mapping.
Update scene. Called by HandleUpdate.

Protected Methods


Public Events