Click or drag to resize
Ab4d.SharpEngine logo

GroupNodeDisposeChildren Method

DisposeChildren method disposes the child SceneNodes objects defined by the startIndex and count. 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 all children call DisposeAllChildren(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 DisposeChildren(
	int startIndex,
	int count,
	bool disposeMeshes,
	bool disposeMaterials,
	bool disposeTextures = true,
	bool runSceneCleanup = false
)

Parameters

startIndex  Int32
index of the first child SceneNode object that will be disposed
count  Int32
number of SceneNode objects to dispose
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.

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