From c0b72b6a55097e0926c107c405362c2b86e7c61c Mon Sep 17 00:00:00 2001 From: David Williams Date: Sun, 3 Jan 2016 17:49:59 +0000 Subject: [PATCH] Tidying up comments. --- examples/DecodeOnGPU/main.cpp | 5 ----- include/PolyVox/CubicSurfaceExtractor.h | 13 ++++++++----- include/PolyVox/MarchingCubesSurfaceExtractor.h | 15 ++++++++------- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/examples/DecodeOnGPU/main.cpp b/examples/DecodeOnGPU/main.cpp index 222f5a5d..49d57ad2 100644 --- a/examples/DecodeOnGPU/main.cpp +++ b/examples/DecodeOnGPU/main.cpp @@ -99,13 +99,8 @@ protected: createSphereInVolume(volData, 30); // Extract the surface for the specified region of the volume. Uncomment the line for the kind of surface extraction you want to see. - //auto mesh = extractCubicMesh(&volData, volData.getEnclosingRegion()); auto mesh = extractMarchingCubesMesh(&volData, volData.getEnclosingRegion()); - // The surface extractor outputs the mesh in an efficient compressed format which is not directly suitable for rendering. The easiest approach is to - // decode this on the CPU as shown below, though more advanced applications can upload the compressed mesh to the GPU and decompress in shader code. - //auto decodedMesh = decodeMesh(mesh); - //Pass the surface to the OpenGL window OpenGLMeshData meshData = buildOpenGLMeshData(mesh); addMeshData(meshData); diff --git a/include/PolyVox/CubicSurfaceExtractor.h b/include/PolyVox/CubicSurfaceExtractor.h index 16279dcc..d0499b80 100644 --- a/include/PolyVox/CubicSurfaceExtractor.h +++ b/include/PolyVox/CubicSurfaceExtractor.h @@ -35,16 +35,19 @@ namespace PolyVox { + /// A specialised vertex format which encodes the data from the cubic extraction algorithm in a very + /// compact way. You will probably want to use the decodeVertex() function to turn it into a regular + /// Vertex for rendering, but advanced users should also be able to decode it on the GPU (not tested). template struct CubicVertex { typedef _DataType DataType; - // Each component of the position is stored as a single unsigned byte. - // The true position is found by offseting each component by 0.5f. + /// Each component of the position is stored as a single unsigned byte. + /// The true position is found by offseting each component by 0.5f. Vector3DUint8 encodedPosition; - // User data + /// A copy of the data which was stored in the voxel which generated this vertex. DataType data; }; @@ -60,11 +63,11 @@ namespace PolyVox template Vertex decodeVertex(const CubicVertex& cubicVertex); - // Generates a cubic-style mesh from the voxel data. + /// Generates a cubic-style mesh from the voxel data. template > void extractCubicMeshCustom(VolumeType* volData, Region region, MeshType* result, IsQuadNeeded isQuadNeeded = IsQuadNeeded(), bool bMergeQuads = true); - // Generates a cubic-style mesh from the voxel data, placing the result into a user-provided Mesh. + /// Generates a cubic-style mesh from the voxel data, placing the result into a user-provided Mesh. template > Mesh > extractCubicMesh(VolumeType* volData, Region region, IsQuadNeeded isQuadNeeded = IsQuadNeeded(), bool bMergeQuads = true); diff --git a/include/PolyVox/MarchingCubesSurfaceExtractor.h b/include/PolyVox/MarchingCubesSurfaceExtractor.h index ccd4cb82..ef672aae 100644 --- a/include/PolyVox/MarchingCubesSurfaceExtractor.h +++ b/include/PolyVox/MarchingCubesSurfaceExtractor.h @@ -40,17 +40,18 @@ namespace PolyVox /// Vertex for rendering, but advanced users can also decode it on the GPU (see PolyVox examples). template struct MarchingCubesVertex - { + { typedef _DataType DataType; - // Each component of the position is stored using 8.8 fixed-point encoding. + /// Each component of the position is stored using 8.8 fixed-point encoding. Vector3DUint16 encodedPosition; - // The normal is encoded as a 16-bit unsigned integer using the 'oct16' - // encoding described here: http://jcgt.org/published/0003/02/01/ + /// The normal is encoded as a 16-bit unsigned integer using the 'oct16' + /// encoding described here: http://jcgt.org/published/0003/02/01/ uint16_t encodedNormal; - // User data + /// The interpolated voxel data from the neighbouring voxels which generated this + /// vertex (every vertex is placed between two voxels by the MArching Cubes algorithm) DataType data; }; @@ -63,11 +64,11 @@ namespace PolyVox template Vertex decodeVertex(const MarchingCubesVertex& marchingCubesVertex); - // Generates a mesh from the voxel data using the Marching Cubes algorithm. + /// Generates a mesh from the voxel data using the Marching Cubes algorithm. template< typename VolumeType, typename ControllerType = DefaultMarchingCubesController > Mesh > extractMarchingCubesMesh(VolumeType* volData, Region region, ControllerType controller = ControllerType()); - // Generates a mesh from the voxel data using the Marching Cubes algorithm, placing the result into a user-provided Mesh. + /// Generates a mesh from the voxel data using the Marching Cubes algorithm, placing the result into a user-provided Mesh. template< typename VolumeType, typename MeshType, typename ControllerType = DefaultMarchingCubesController > void extractMarchingCubesMeshCustom(VolumeType* volData, Region region, MeshType* result, ControllerType controller = ControllerType()); }