public void UpdateDirty() { if (!dirty) { return; } dirty = false; ((HermiteDataGrid)grid).Save(TWDir.Test.CreateSubdirectory("DualContouring").CreateFile("InteractiveGrid.txt")); lastSurfaceExtractionTime = PerformanceHelper.Measure(() => { surfaceMesh = dcMeshBuilder.buildRawMesh(grid); }); if (meshElement != null) { meshElement.Delete(); } meshElement = surfaceRenderer.CreateSurface(grid, Matrix.Identity); meshElement.WorldMatrix = Matrix.Scaling(new Vector3(CellSize)); this.lines.ClearAllLines(); addHermiteVertices(grid, CellSize, this.lines); addQEFPoints(surfaceMesh, CellSize, this.lines); addHermiteNormals(grid, CellSize, this.lines); lines.AddBox(new BoundingBox(new Vector3(), grid.Dimensions.ToVector3() * cellSize), Color.Black); }
public void UpdateSurface(VoxelCustomRenderer customRenderer) { if (surface != null) { surface.Delete(); } surface = customRenderer.CreateSurface(Grid, Matrix.Scaling(new Vector3(BuilderConfiguration.VoxelSize)) * Matrix.Translation(ChunkCoord.ToVector3() * BuilderConfiguration.VoxelSize * BuilderConfiguration.ChunkNumVoxels)); SurfaceDirty = false; }