Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
some planets are double sided
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Dec 28, 2023
1 parent ad6e5ce commit a878889
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 5 deletions.
10 changes: 6 additions & 4 deletions sources/generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
namespace unnatural
{
void terrainPreseed();
bool terrainDoublesided();
Holder<Mesh> meshGenerateBaseLand();
Holder<Mesh> meshGenerateBaseWater();
Holder<Mesh> meshGenerateBaseNavigation();
Expand Down Expand Up @@ -74,13 +75,14 @@ namespace unnatural
f->writeLine(Stringizer() + "special = " + pbr);
if (!normal.empty())
f->writeLine(Stringizer() + "normal = " + normal);
f->writeLine("[render]");
if (transparency)
{
f->writeLine("[render]");
f->writeLine("shader = /unnatural/core/shaders/water.glsl");
f->writeLine("[flags]");
f->writeLine("[flags]");
if (transparency)
f->writeLine("transparent");
}
else if (terrainDoublesided())
f->writeLine("twoSided");
f->close();
}
};
Expand Down
24 changes: 24 additions & 0 deletions sources/modesConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace unnatural
using ColoringFunctor = void (*)(Tile &tile);
ColoringFunctor coloringFnc = 0;

bool doubleSided = false;

void chooseShapeFunction()
{
static constexpr TerrainFunctor shapeModeFunctions[] = {
Expand Down Expand Up @@ -127,6 +129,23 @@ namespace unnatural
}
CAGE_LOG(SeverityEnum::Info, "configuration", Stringizer() + "using shape mode: '" + name + "'");
}

doubleSided = [&]() -> bool
{
if (name == "hexagon")
return true;
if (name == "square")
return true;
if (name == "tube")
return true;
if (name == "bowl")
return true;
if (name == "insidecube")
return true;
if (name == "twistedplane")
return true;
return false;
}();
}

void chooseElevationFunction()
Expand Down Expand Up @@ -290,4 +309,9 @@ namespace unnatural
f->writeLine(Stringizer() + "coloring: " + (String)configColoringMode);
f->writeLine(Stringizer() + "poles: " + (bool)configPolesEnable);
}

bool terrainDoublesided()
{
return doubleSided;
}
}

0 comments on commit a878889

Please sign in to comment.