Click or drag to resize
Ab4d.SharpEngine logo

Scene Methods

The Scene type exposes the following members.

Methods
 NameDescription
Public methodAddAnimation Adds the specified animation to the list of animations that are updated in each update phase.
Public methodAddRenderingLayerAfter Adds the newRenderLayer after the already registered afterRenderLayer. If rendering layer is MaterialSortedRenderingLayer or CameraDistanceSortedRenderingLayer, then also its IsSortingEnabled property is set according to the current settings.
Public methodAddRenderingLayerBefore Adds the newRenderLayer before the already registered afterRenderLayer
Public methodCacheObject CacheObject sets the specified objectToCache to the specified key in the cache. The value can be retrieved by GetCachedObjectT(String) or removed by RemoveCachedObject(String) method. When a Mesh object is cached, this will set IsSceneCached to true and prevent disposing the mesh (by calling Dispose method) before the Scene is disposed or before the mesh is removed from the cache. Mesh and GpuImage objects can be cached only in one Scene object. This method is thread safe and can be called from any thread.
Public methodCleanup Cleanup method can perform various cleanup actions. It can dispose the SceneNodes (and their meshes and materials) that were removed from the RootNode. It can dispose GPU resources that were scheduled to be disposed after a frame has been rendered. It can also check all memory blocks and free those that are empty (if freeEmptyMemoryBlocks is true or when it empty for at least EngineRuntimeOptions.FramesCountToReleaseEmptyMemoryBlock frames).
Public methodStatic memberCollectAmbientLightColor CollectAmbientLightColor returns a Color3 that specifies the ambient color (can be combined by multiple AmbientLight objects).
Public methodCreateBackgroundSpriteBatch Creates a SpriteBatch that will be rendered before the objects in this Scene are rendered. SpriteBatch that is created from Scene object can use only relative coordinates. To use absolute coordinates, call SceneView.CreateBackgroundSpriteBatch(String) or SceneView.CreateOverlaySpriteBatch(String) methods. To remove the created SpriteBatch call the RemoveSpriteBatch(SpriteBatch, Boolean) or RemoveAllSpriteBatches(Boolean) methods. It is also possible to add sprites that are rendered only with a specific SceneView - in this case call SceneView.CreateBackgroundSpriteBatch(String) or SceneView.CreateOverlaySpriteBatch(String) methods.
Public methodCreateOverlaySpriteBatch Creates a SpriteBatch that will be rendered after the objects in this Scene are rendered. SpriteBatch that is created from Scene object can use only relative coordinates. To use absolute coordinates, call SceneView.CreateBackgroundSpriteBatch(String) or SceneView.CreateOverlaySpriteBatch(String) methods. To remove the created SpriteBatch call the RemoveSpriteBatch(SpriteBatch, Boolean) or RemoveAllSpriteBatches(Boolean) methods. It is also possible to add sprites that are rendered only with a specific SceneView - in this case call SceneView.CreateBackgroundSpriteBatch(String) or SceneView.CreateOverlaySpriteBatch(String) methods.
Public methodDispose Dispose
Protected methodDispose(Boolean) Releases unmanaged and managed resources (when disposing is true). This method may be called only from the CheckAndDispose(Boolean) method and must not be called manually by the user.
(Overrides ComponentBaseDispose(Boolean))
Public methodDumpFullMemoryUsage Writes string that shows full memory usage for this Scene, its GpuDevice and all used effects to the console (when the application is debugged in Visual Studio the result is written to Output window or Immediate Window if started from there; in Rider the result is written to Debug Output window).
Public methodDumpRenderingLayers Writes string that contains details about each RenderingItem in all RenderingLayers to the console (when the application is debugged in Visual Studio the result is written to Output window or Immediate Window if started from there; in Rider the result is written to Debug Output window).
Public methodDumpSceneNodes Writes string that contains details about all SceneNodes and their hierarchy to the console (when the application is debugged in Visual Studio the result is written to Output window or Immediate Window if started from there; in Rider the result is written to Debug Output window).
Public methodDumpUsedMaterials Writes string that provides details about used materials to the console (when the application is debugged in Visual Studio the result is written to Output window or Immediate Window if started from there; in Rider the result is written to Debug Output window).
Public methodGetAllHitObjects GetAllHitObjects method executes a hit testing on the SceneNodes in this Scene (or when specified on rootSceneNode and its children) and returns a list of RayHitTestResult objects sorted from the closest to the farthest object. When no object is hit, an empty list is returned.
Public methodGetAmbientLightColor Returns the Color3 of the ambient light that is used in this scene. When Black is returned, then no ambient light is used. When multiple AmbientLight objects are added to the Light collection, then their colors are summed.
Public methodGetAmbientLightIntensity Returns the float that represents the intensity of the ambient light that is used in this scene. The returned value is between 0 (no ambient light) and 1 (full ambient light). When multiple AmbientLight objects are added to the Light collection, then their intensities are summed.
Public methodGetCachedObjectT GetCachedObject gets the object that was previously stored by the CacheObject(String, Object) method. If the key is not found a default value of T (null for reference types) is returned. This method is thread safe and can be called from any thread.
Public methodGetCachedObjectsReportString Returns a string that shows which objects are cached by this Scene.
Public methodGetClosestHitObject GetClosestHitObject method executes a hit testing on the SceneNodes in this Scene (or when specified on rootSceneNode and its children) and returns a RayHitTestResult object with the closest triangle hit by the specified ray. When no triangle is hit, null is returned.
Public methodGetCoordinateSystem Gets the currently selected coordinate system.
Public methodGetCoordinateSystemInvertedTransform Get null when YUpRightHanded coordinate system is used. Otherwise a MatrixTransform that has an inverted global transform matrix is returned.
Public methodGetCoordinateSystemTransform Get null when YUpRightHanded coordinate system is used. Otherwise a MatrixTransform is assigned to RootNode.Transform is returned. That MatrixTransform converts all the positions in the Scene from the selected coordinate system to YUpRightHanded is returned. Note that it is not allowed to change the returned MatrixTransform.
Public methodGetFullMemoryUsageInfo Returns a string that shows full memory usage for this Scene, its GpuDevice and all used effects.
Public methodGetHitSceneNodeBounds GetHitSceneNodeBounds returns a List of SceneNode objects where the ray intersects the BoundingBox of the SceneNode.
Public methodGetIntoTheScreenVector Returns the vector that points into the screen. This vector is based on the current coordinate system. When using default (YUpRightHanded) then (0, 0, -1) is returned.
Public methodGetRegisteredEffectsInfo Returns a string that contains details about all registered effects.
Public methodGetRenderingLayersInfo Returns string that describes each RenderingItem in all RenderingLayers.
Public methodGetRightDirectionVector Returns the vector that points to the right in the current coordinate system. (1, 0, 0) is returned for all coordinate systems.
Public methodGetSceneMemoryInfo Returns string that shows memory usage for MatricesMemoryBlocks that are used in this Scene.
Public methodGetSceneNodesInfo Returns string that contains details about all SceneNodes and their hierarchy.
Public methodGetUpVector Returns the vector that points up. This vector is based on the current coordinate system. When using default (YUpRightHanded) then (0, 1, 0) is returned.
Public methodGetUsedMaterialsInfo Returns a string that provides details about used materials
Public methodHitTestSceneNode Returns RayHitTestResult if the specified ray hits the specified sceneNode. Otherwise, null is returned. Child SceneNodes are not tested.
Public methodInitialize Initialized the Scene by using the specified VulkanDevice.
Public methodNotifyChange NotifyChange method adds the specified ChangeNotifications to the changes flags of this Scene.
Protected methodOnSceneInitialized OnSceneInitialized
Public methodRemoveAllSpriteBatches Removes all SpriteBatches.
Public methodRemoveAnimation Remove the specified animation from the list of animations.
Public methodRemoveCachedObject RemoveCachedObject removes the specified key from the cache. When a Mesh object is removed from the cache, this will set IsSceneCached to false and allow disposing the mesh by calling the Dispose method. This method is thread safe and can be called from any thread.
Public methodRemoveRenderingLayer Removes the renderingLayer that was added before by the AddRenderingLayerAfter(RenderingLayer, RenderingLayer) or AddRenderingLayerBefore(RenderingLayer, RenderingLayer) methods.
Public methodRemoveSpriteBatch Removes the specified SpriteBatch from the list of SpriteBatches associated to this Scene (created by CreateBackgroundSpriteBatch(String) or CreateOverlaySpriteBatch(String) methods).
Public methodSetAmbientLight(Color3) Sets the ambient light for this scene to the specified color.
Public methodSetAmbientLight(Single) Sets the ambient light for this scene to the specified intensity (from 0 to 1).
Public methodSetCoordinateSystem SetCoordinateSystem method can be used to change the coordinate system from the default YUpRightHanded coordinate system (y up, x to the right, z out of the screen) to some other coordinate system, for example to ZUpRightHanded that is usually used for CAD applications.
Public methodSortRenderingLayers SortRenderingLayers method performs sorting of items in the rendering layers that support sorting
Public methodToString
(Overrides ObjectToString)
Public methodUpdate Update method can be called to update the changed materials and SceneNodes that are attached to the RootNode. This method also clears the DirtyFlags. This method is usually called from SceneView's Render(Boolean, Boolean, Boolean) method. It can be also called before hit-testing to update the scene.
Public methodUpdateAnimations Update all animations that are added by calling the AddAnimation(IAnimation) (this is done automatically by the animation classes).
Public methodUpdateGpuBuffers UpdateGpuBuffers method checks if the scene, camera, lights or matrices data were changed and in this case updates the appropriate buffer based on the swapChainImageIndex parameter. This method must be called before each rendering (especially when swapChainImageIndex is changing).
Public methodUpdateSceneAndLightsData UpdateSceneAndLightsData method updated the scene, camera and lights data structures and marks scene and lights buffers as dirty. This method can be called only when there are any camera or light changed. The actual buffers are updated in the UpdateGpuBuffers(RenderingContext) method.
Public methodUpdateSceneNodeWorldMatrixData UpdateSceneNodeWorldMatrixData method get the World matrix from the specified SceneNode and updates the matrix data in the GPU buffers.
Top
See Also