Click or drag to resize
Ab4d.SharpEngine logo

GroupNodeDisposeAllChildren Method

DisposeAllChildren method disposes all child SceneNodes (and their child SceneNode objects) but does not dispose this GroupNode. 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 DisposeAllChildren(
	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

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

This method does not dispose this GroupNode. Therefore it is allowed to call this method on RootNode. To also dispose this GroupNode, call the DisposeWithAllChildren(Boolean, Boolean, Boolean, Boolean) method instead.

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

When disposeThisGroupNode is true (false by default), then this GroupNode is also disposed. When GroupNode does not have any children it does not have any resources and therefore in this case it is not needed to dispose the GroupNode. Note that RootNode must not be 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