/// <summary> /// Libera los recursos de la malla. /// Si la malla es una instancia se deshabilita pero no se liberan recursos. /// Si la malla es el original y tiene varias instancias adjuntadas, se hace dispose() tambiƩn de las instancias. /// </summary> public void Dispose() { enabled = false; if (boundingBox != null) { boundingBox.Dispose(); } //Si es una instancia no liberar nada, lo hace el original. if (parentInstance != null) { parentInstance = null; return; } //hacer dispose de instancias if (meshInstances != null) { foreach (var meshInstance in meshInstances) { meshInstance.Dispose(); } meshInstances = null; } //Dispose de mesh d3dMesh.Dispose(); d3dMesh = null; //Dispose de texturas if (diffuseMaps != null) { for (var i = 0; i < diffuseMaps.Length; i++) { if (diffuseMaps[i] != null) { diffuseMaps[i].dispose(); } } diffuseMaps = null; } if (lightMap != null) { lightMap.dispose(); lightMap = null; } //VertexDeclaration vertexDeclaration.Dispose(); vertexDeclaration = null; }
/// <summary> /// Libera los recursos de la malla /// </summary> public void Dispose() { Enabled = false; if (boundingBox != null) { boundingBox.Dispose(); } //dejar de utilizar originalData originalData = null; //Si es una instancia no liberar nada, lo hace el original. if (ParentInstance != null) { ParentInstance = null; return; } //hacer dispose de instancias foreach (var meshInstance in MeshInstances) { meshInstance.Dispose(); } MeshInstances = null; //Dispose de mesh d3dMesh.Dispose(); d3dMesh = null; //Dispose de texturas if (DiffuseMaps != null) { for (var i = 0; i < DiffuseMaps.Length; i++) { DiffuseMaps[i].dispose(); } DiffuseMaps = null; } //VertexDeclaration VertexDeclaration.Dispose(); VertexDeclaration = null; }
/// <summary> /// Libera los recursos de la malla /// </summary> public void Dispose() { enabled = false; if (boundingBox != null) { boundingBox.Dispose(); } //Si es una instancia no liberar nada, lo hace el original. if (parentInstance != null) { parentInstance = null; return; } //hacer dispose de instancias foreach (var meshInstance in meshInstances) { meshInstance.Dispose(); } meshInstances = null; //Dispose de mesh d3dMesh.Dispose(); d3dMesh = null; //Dispose de texturas if (diffuseMaps != null) { for (var i = 0; i < diffuseMaps.Length; i++) { diffuseMaps[i].dispose(); } diffuseMaps = null; } //Dispose de Box de joints if (skeletonRenderJoints != null) { foreach (var jointBox in skeletonRenderJoints) { jointBox.Dispose(); } skeletonRenderJoints = null; } //Dispose de lineas de Bones if (skeletonRenderBones != null) { foreach (var boneLine in skeletonRenderBones) { if (boneLine != null) { boneLine.Dispose(); } } skeletonRenderBones = null; } //Liberar attachments foreach (var attach in attachments) { attach.Mesh.Dispose(); } attachments = null; //VertexDeclaration vertexDeclaration.Dispose(); vertexDeclaration = null; }