Using models seems to be harder than just generating the chunk manually. So to make this possible and less tedious and time consuming I'm now going to move to place models on top of a marching cube terrain using a triangulation table.
This commit is contained in:
parent
5ece3c455f
commit
0b62550f54
2 changed files with 84 additions and 16 deletions
|
|
@ -64,18 +64,78 @@ const std::map<int, CubeData> MarchingCubeChunkRenderer::RenderMap = {
|
||||||
{-1.000000, 0.000000, -0.000000, 0.000000},
|
{-1.000000, 0.000000, -0.000000, 0.000000},
|
||||||
{0.000000, 0.000000, 0.000000, 1.000000}),
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
3}},
|
3}},
|
||||||
{11, {glm::mat4(0.0f), 0}},
|
{11,
|
||||||
{12, {glm::mat4(0.0f), 0}},
|
{glm::mat4({-0.000000, -1.000000, 0.000000, 0.000000},
|
||||||
{13, {glm::mat4(0.0f), 0}},
|
{-0.000000, 0.000000, -1.000000, 0.000000},
|
||||||
{14, {glm::mat4(0.0f), 0}},
|
{1.000000, -0.000000, -0.000000, 0.000000},
|
||||||
{15, {glm::mat4(0.0f), 0}},
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
{16, {glm::mat4(0.0f), 0}},
|
5}},
|
||||||
{17, {glm::mat4(0.0f), 0}},
|
{12,
|
||||||
{18, {glm::mat4(0.0f), 0}},
|
{glm::mat4({-0.000000, 0.000000, 1.000000, 0.000000},
|
||||||
{19, {glm::mat4(0.0f), 0}},
|
{0.000000, 1.000000, 0.000000, 0.000000},
|
||||||
{20, {glm::mat4(0.0f), 0}},
|
{-1.000000, 0.000000, -0.000000, 0.000000},
|
||||||
{21, {glm::mat4(0.0f), 0}},
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
{22, {glm::mat4(0.0f), 0}},
|
2}},
|
||||||
|
{13,
|
||||||
|
{glm::mat4({1.000000, 0.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, -0.000000, -1.000000, 0.000000},
|
||||||
|
{0.000000, 1.000000, -0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
5}},
|
||||||
|
{14,
|
||||||
|
{glm::mat4({-0.000000, 1.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, -1.000000, 0.000000},
|
||||||
|
{-1.000000, -0.000000, -0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
5}},
|
||||||
|
{15,
|
||||||
|
{glm::mat4({1.000000, 0.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, -0.000000, -1.000000, 0.000000},
|
||||||
|
{0.000000, 1.000000, -0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
8}},
|
||||||
|
{16,
|
||||||
|
{glm::mat4({0.000000, 1.000000, -0.000000, 0.000000},
|
||||||
|
{1.000000, -0.000000, -0.000000, 0.000000},
|
||||||
|
{-0.000000, 0.000000, -1.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
1}},
|
||||||
|
{17,
|
||||||
|
{glm::mat4({-1.000000, -0.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, -1.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 1.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
2}},
|
||||||
|
{18,
|
||||||
|
{glm::mat4({-0.000000, 1.000000, 0.000000, 0.000000},
|
||||||
|
{-1.000000, -0.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 1.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
3}},
|
||||||
|
{19,
|
||||||
|
{glm::mat4({1.000000, 0.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, -1.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, -1.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
5}},
|
||||||
|
{20,
|
||||||
|
{glm::mat4({1.000000, 0.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 1.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 1.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
4}},
|
||||||
|
{21,
|
||||||
|
{glm::mat4({-0.000000, 1.000000, 0.000000, 0.000000},
|
||||||
|
{1.000000, 0.000000, -0.000000, 0.000000},
|
||||||
|
{-0.000000, -0.000000, -1.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
6}},
|
||||||
|
{22,
|
||||||
|
{glm::mat4({-0.000000, 0.000000, 1.000000, 0.000000},
|
||||||
|
{-1.000000, -0.000000, -0.000000, 0.000000},
|
||||||
|
{0.000000, -1.000000, 0.000000, 0.000000},
|
||||||
|
{0.000000, 0.000000, 0.000000, 1.000000}),
|
||||||
|
6}},
|
||||||
{23, {glm::mat4(0.0f), 0}},
|
{23, {glm::mat4(0.0f), 0}},
|
||||||
{24, {glm::mat4(0.0f), 0}},
|
{24, {glm::mat4(0.0f), 0}},
|
||||||
{25, {glm::mat4(0.0f), 0}},
|
{25, {glm::mat4(0.0f), 0}},
|
||||||
|
|
|
||||||
16
src/main.cpp
16
src/main.cpp
|
|
@ -90,14 +90,22 @@ int main(int argc, char **argv) {
|
||||||
Model debugSphere =
|
Model debugSphere =
|
||||||
Model(ROOT_DIR "data/game-models/DebugSphere/DebugSphere.obj");
|
Model(ROOT_DIR "data/game-models/DebugSphere/DebugSphere.obj");
|
||||||
debugSphere.resize(glm::vec3(0.1f));
|
debugSphere.resize(glm::vec3(0.1f));
|
||||||
bool index[8] = {false, false, false, false, true, false, true, false};
|
bool index[8] = {false, false, false, true, false, true, true, true};
|
||||||
// bool index[8] = {true, true, true, true, true, true, true, true};
|
// bool index[8] = {true, true, true, true, true, true, true, true};
|
||||||
Model debugMCsegment = Model(ROOT_DIR "data/game-models/3/MetalFloor.obj");
|
Model debugMCsegment = Model(ROOT_DIR "data/game-models/14/MetalFloor.obj");
|
||||||
|
|
||||||
// debugMCsegment.worldRotate(180.0f, glm::vec3(1, 0, 1));
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(1, 0, 1));
|
||||||
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(0, 1, 0));
|
||||||
|
debugMCsegment.worldRotate(90.0f, glm::vec3(0, 1, 0));
|
||||||
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(0, 0, 1));
|
||||||
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(0, 0, 1));
|
||||||
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(0, 1, 0));
|
||||||
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(1, 0, 0));
|
||||||
|
// debugMCsegment.worldRotate(-90.0f, glm::vec3(0, 0, 1));
|
||||||
|
// debugMCsegment.worldRotate(-90.0f, glm::vec3(0, 1, 0));
|
||||||
|
// debugMCsegment.worldRotate(90.0f, glm::vec3(0, 0, 1));
|
||||||
|
// debugMCsegment.worldRotate(180.0f, glm::vec3(1, 0, 0));
|
||||||
// debugMCsegment.worldRotate(-90.0f, glm::vec3(0, 1, 0));
|
// debugMCsegment.worldRotate(-90.0f, glm::vec3(0, 1, 0));
|
||||||
// debugMCsegment.worldRotate(90.0f, glm::vec3(1, 0, 0));
|
|
||||||
debugMCsegment.worldRotate(-90.0f, glm::vec3(0, 1, 0));
|
|
||||||
|
|
||||||
debugMCsegment.printModel();
|
debugMCsegment.printModel();
|
||||||
// Game loop
|
// Game loop
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue