Click or drag to resize
Ab4d.SharpEngine logo

GroupNodeDisposeWithAllChildren Method

DisposeWithAllChildren method disposes all child SceneNodes (and their child SceneNode objects), disposes this GroupNode and removes it from its parent GroupNode (if any). When disposeMeshes and disposeMaterials parameters are true, then also all meshes and materials are disposed. When runSceneCleanup is true, this method also calls the Cleanup(Boolean, Boolean, Boolean, Boolean, Boolean) method to clean the released objects. To dispose only some children call DisposeChildren(Int32, Int32, Boolean, Boolean, Boolean, Boolean) method. See remarks for more info.

Namespace: Ab4d.SharpEngine.SceneNodes
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public void DisposeWithAllChildren(
	bool disposeMeshes,
	bool disposeMaterials,
	bool disposeTextures = true,
	bool runSceneCleanup = false
)

Parameters

disposeMeshes  Boolean
when true then all meshes that are used by child SceneNodes are disposed; when false then only meshes that were created by SceneNode are disposed
disposeMaterials  Boolean
when true then all materials that are used by child SceneNodes are disposed; when false then only materials that were created by SceneNode are disposed
disposeTextures  Boolean  (Optional)
when true (by default) and when the material defines a texture (GpuImage), then it is also disposed (if it is not cached by the Scene).
runSceneCleanup  Boolean  (Optional)
when true (false by default) then also Cleanup(Boolean, Boolean, Boolean, Boolean, Boolean) method is called with its default parameter values
Remarks

DisposeWithAllChildren method disposes all child SceneNodes objects. If child is a GroupNode, then its children will be also disposed.

This method also disposes this GroupNode. This also removes this GroupNode from its parent GroupNode (if any). Therefore it is NOT allowed to call this method on RootNode. To prevent disposal of this GroupNode, call the DisposeAllChildren(Boolean, Boolean, Boolean, Boolean) method instead.

When disposeMeshes and disposeMaterials parameters are true, then also all meshes and materials are disposed.

When runSceneCleanup parameter is true (false by default), this method also calls the Cleanup(Boolean, Boolean, Boolean, Boolean, Boolean) method with default parameters to clean the released objects.

To dispose only some children call DisposeChildren(Int32, Int32, Boolean, Boolean, Boolean, Boolean) method that takes startIndex and count as parameters.

The difference between this method and the standard Dispose(Boolean) method is that with standard dispose method you cannot force mesh and material disposal. In this case the mesh is disposed only when it is created by the SceneNode (for example in PyramidModelNode or LineNode) and not when it is set to the MeshModelNode (for example with ReaderObj or Assimp importer). Also Material and BackMaterial are disposed only when they are created by the SceneNode (for example when LineNode is created by specifying the line color) and not when new StandardMaterial is created and set to ModelNode's Material property.

See Also