C# Class open3mod.Scene

Represents a 3D scene/asset loaded through assimp. This class contains the aiScene plus some auxiliary structures for drawing. Since assimp is the only source for model data and this is only a viewer, we ignore the recommendation of the assimp docs and use its data structures (almost) directly for rendering.
Inheritance: IDisposable
显示文件 Open project: acgessler/open3mod Class Usage Examples

Public Methods

Method Description
Dispose ( ) : void

Dispose

GetOverrideMesh ( Mesh mesh ) : Mesh
RecreateRenderingBackend ( ) : void

Recreates the rendering backend if needed. This is called after the global rendering backend setting is changed.

Render ( open3mod.UiState state, ICameraController cam, open3mod.Renderer target ) : void

Call once per frame to render the scene to the current viewport.

RequestReconfigureTextures ( ) : void

Requests that texture filters be re-configured as soon as possible. This is called when the texture settings are changed. This method may only be called from the UI thread.

RequestRenderRefresh ( ) : void

Requests the renderer to update next frame even if it seems as if nothing changed. This method may only be called from the UI thread.

RequestReuploadTextures ( ) : void

Requests that all textures be re-uploaded as soon as possible. This is called when the texture settings are changed. This method may only be called from the UI thread.

Scene ( string file ) : System

Construct a scene given a file name, throw if loading fails

SetOverrideMesh ( Mesh mesh, Mesh overrideMesh ) : void

Replace a given mesh with another when drawing. This has immediate effect. Editing tools use this to temporarily replace the mesh being rendered with a preview of the action. Pass null to revert to the original mesh.

SetPivot ( Assimp.Node node, bool realCenter = true ) : void

Set the pivot point for the scene to be at the world position of a given node.

SetSkeletonVisibleOverride ( bool overrideSkeleton ) : void

Turns skeleton visualization on even if it is off in the UI.

SetVisibleNodes ( Dictionary meshFilter ) : void

Sets which parts of the scene are visible. See ISceneRenderer.Render (visibleNodesByMesh parameters) for a description of how the visible set is determined.

Update ( double delta, bool silent = false ) : void

To be called once per frame to do non-rendering jobs such as updating animations.

Private Methods

Method Description
ComputeBoundingBox ( Assimp.Node node, Vector3 &min, Vector3 &max, Matrix4 &trafo ) : void

Helper for ComputeBoundingBox(out Vector3 sceneMin, out Vector3 sceneMax)

ComputeBoundingBox ( Vector3 &sceneMin, Vector3 &sceneMax, Vector3 &sceneCenter, Assimp.Node node = null, bool omitRootNodeTrafo = false ) : void

Calculates the smallest AABB that encloses the scene.

CountVertsAndFaces ( int &totalVertexCount, int &totalTriangleCount, int &totalLineCount, int &totalPointCount ) : void

Counts vertices, points, lines and triangles in the scene.

CreateRenderingBackend ( ) : void
GetPostProcessStepsFlags ( ) : PostProcessSteps
LoadTextures ( ) : void

Populates the TextureSet with all the textures required for the scene.

SetTexturesChangedFlag ( ) : void

Sets a flag for the renderer that at least one of the textures in the scene was changed and needs to be updated. This method may be called from any thread.

Method Details

Dispose() public method

Dispose
public Dispose ( ) : void
return void

GetOverrideMesh() public method

public GetOverrideMesh ( Mesh mesh ) : Mesh
mesh Assimp.Mesh
return Assimp.Mesh

RecreateRenderingBackend() public method

Recreates the rendering backend if needed. This is called after the global rendering backend setting is changed.
public RecreateRenderingBackend ( ) : void
return void

Render() public method

Call once per frame to render the scene to the current viewport.
public Render ( open3mod.UiState state, ICameraController cam, open3mod.Renderer target ) : void
state open3mod.UiState
cam ICameraController
target open3mod.Renderer
return void

RequestReconfigureTextures() public method

Requests that texture filters be re-configured as soon as possible. This is called when the texture settings are changed. This method may only be called from the UI thread.
public RequestReconfigureTextures ( ) : void
return void

RequestRenderRefresh() public method

Requests the renderer to update next frame even if it seems as if nothing changed. This method may only be called from the UI thread.
public RequestRenderRefresh ( ) : void
return void

RequestReuploadTextures() public method

Requests that all textures be re-uploaded as soon as possible. This is called when the texture settings are changed. This method may only be called from the UI thread.
public RequestReuploadTextures ( ) : void
return void

Scene() public method

Construct a scene given a file name, throw if loading fails
public Scene ( string file ) : System
file string File name to be loaded
return System

SetOverrideMesh() public method

Replace a given mesh with another when drawing. This has immediate effect. Editing tools use this to temporarily replace the mesh being rendered with a preview of the action. Pass null to revert to the original mesh.
public SetOverrideMesh ( Mesh mesh, Mesh overrideMesh ) : void
mesh Assimp.Mesh
overrideMesh Assimp.Mesh
return void

SetPivot() public method

Set the pivot point for the scene to be at the world position of a given node.
public SetPivot ( Assimp.Node node, bool realCenter = true ) : void
node Assimp.Node Node to place the pivot at. Pass null to reset the /// pivot to be the (natural) center of the scene
realCenter bool Whether to compute the real center of the node (by getting /// the mid point of the geometric bounds or whether the origin of the local coordinate /// space is used.
return void

SetSkeletonVisibleOverride() public method

Turns skeleton visualization on even if it is off in the UI.
public SetSkeletonVisibleOverride ( bool overrideSkeleton ) : void
overrideSkeleton bool true to always show skeleton /// visualization, false to take the UI's settings
return void

SetVisibleNodes() public method

Sets which parts of the scene are visible. See ISceneRenderer.Render (visibleNodesByMesh parameters) for a description of how the visible set is determined.
public SetVisibleNodes ( Dictionary meshFilter ) : void
meshFilter Dictionary See ISceneRenderer.Render (visibleNodesByMesh parameter)
return void

Update() public method

To be called once per frame to do non-rendering jobs such as updating animations.
public Update ( double delta, bool silent = false ) : void
delta double Real-world time delta in seconds
silent bool True if the scene is in background and won't /// be rendered this frame. It may then be possible to implement /// a cheaper update.
return void