CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
Transvoxel.hpp
Go to the documentation of this file.
1//
2// CeresEngine - A game development framework
3//
4// Created by Rogiel Sulzbach.
5// Copyright (c) 2018-2022 Rogiel Sulzbach. All rights reserved.
6//
7
8#pragma once
9
11
13
16
18
19namespace CeresEngine {
20
21 class Transvoxel {
22 private:
23 public:
24 static MeshPtr voxelize(Int32 x, Int32 y, Int32 z);
25
26 private:
28 UInt8 geometryCounts; // High nibble is vertex count, low nibble is triangle count.
29 UInt8 vertexIndex[15]; // Groups of 3 indexes giving the triangulation.
30
31 [[nodiscard]] long getVertexCount(void) const { return (geometryCounts >> 4); }
32 [[nodiscard]] long getTriangleCount(void) const { return (geometryCounts & 0x0F); }
33 };
34
39 UInt64 geometryCounts; // High nibble is vertex count, low nibble is triangle count.
40 UInt8 vertexIndex[36]; // Groups of 3 indexes giving the triangulation.
41
42 [[nodiscard]] UInt32 getVertexCount(void) const { return UInt32(geometryCounts >> 4); }
43 [[nodiscard]] UInt32 getTriangleCount(void) const { return UInt32(geometryCounts & 0x0F); }
44 };
45
52 static const UInt8 regularCellClass[256];
53
58
67
76 static const UInt8 transitionCellClass [[maybe_unused]][512];
77
83
87
95 static const UInt16 transitionVertexData [[maybe_unused]][512][12];
96 };
97
98} // namespace CeresEngine
Definition Transvoxel.hpp:21
static const TransitionCellData transitionCellData[56]
The transitionCellData table holds the triangulation data for all 56 distinct classes to which a case...
Definition Transvoxel.hpp:82
static const UInt8 transitionCornerData[13]
The transitionCornerData table contains the transition cell corner reuse data shown in Figure 4....
Definition Transvoxel.hpp:86
static const RegularCellData regularCellData[16]
The regularCellData table holds the triangulation data for all 16 distinct classes to which a case ca...
Definition Transvoxel.hpp:57
static const UInt16 transitionVertexData[512][12]
The transitionVertexData table gives the vertex locations for every one of the 512 possible cases in ...
Definition Transvoxel.hpp:95
static MeshPtr voxelize(Int32 x, Int32 y, Int32 z)
static const Array< UInt16, 12 > regularVertexData[256]
The regularVertexData table gives the vertex locations for every one of the 256 possible cases in the...
Definition Transvoxel.hpp:66
static const UInt8 regularCellClass[256]
The regularCellClass table maps an 8-bit regular Marching Cubes case index to an equivalence class in...
Definition Transvoxel.hpp:52
static const UInt8 transitionCellClass[512]
The transitionCellClass table maps a 9-bit transition cell case index to an equivalence class index.
Definition Transvoxel.hpp:76
Definition Application.hpp:19
SPtr< Mesh > MeshPtr
Definition Forward.hpp:17
std::uint64_t UInt64
Definition DataTypes.hpp:26
std::int32_t Int32
Definition DataTypes.hpp:21
std::uint16_t UInt16
Definition DataTypes.hpp:20
std::uint8_t UInt8
Definition DataTypes.hpp:17
std::array< T, N > Array
Array is a container that encapsulates fixed size arrays.
Definition Array.hpp:17
std::uint32_t UInt32
Definition DataTypes.hpp:23
constexpr size_t hash(const T &v)
Generates a hash for the provided type.
Definition Hash.hpp:25
Definition Transvoxel.hpp:27
long getVertexCount(void) const
Definition Transvoxel.hpp:31
long getTriangleCount(void) const
Definition Transvoxel.hpp:32
UInt8 geometryCounts
Definition Transvoxel.hpp:28
UInt8 vertexIndex[15]
Definition Transvoxel.hpp:29
The TransitionCellData structure holds information about the triangulation used for a single equivale...
Definition Transvoxel.hpp:38
UInt8 vertexIndex[36]
Definition Transvoxel.hpp:40
UInt32 getTriangleCount(void) const
Definition Transvoxel.hpp:43
UInt32 getVertexCount(void) const
Definition Transvoxel.hpp:42
UInt64 geometryCounts
Definition Transvoxel.hpp:39