public virtual void CleanUp(bool removeFromParent) { ReadyToRender = false; DemData = null; demFile = null; demDownloading = false; texReady = false; DemReady = false; errored = false; if (this.texture != null) { this.texture = null; } RenderTriangleLists = new List <RenderTriangle> [4]; GeometryCreated = false; if (removeFromParent && Parent != null) { Parent.RemoveChild(this); Parent = null; } if (PrepDevice != null) { foreach (WebGLBuffer buf in IndexBuffers) { PrepDevice.deleteBuffer(buf); } IndexBuffers = new WebGLBuffer[4]; if (VertexBuffer != null) { PrepDevice.deleteBuffer(VertexBuffer); VertexBuffer = null; } if (texture2d != null) { PrepDevice.deleteTexture(texture2d); texture2d = null; } } }