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

Commit

Permalink
belt shape
Browse files Browse the repository at this point in the history
  • Loading branch information
malytomas committed Jan 9, 2024
1 parent 2b0875b commit 96e86d3
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 67 deletions.
2 changes: 1 addition & 1 deletion externals/cage
Submodule cage updated 70 files
+1 −1 data/cage/shader/engine/engine.assets
+1 −2 data/cage/shader/engine/engine.pack
+48 −0 data/cage/shader/engine/font.glsl
+4 −6 data/cage/shader/gui/font.glsl
+1 −1 externals/avir/avir
+1 −1 externals/cubeb/cubeb
+1 −1 externals/dr_libs/dr_libs
+1 −1 externals/fastnoise/fastnoise
+13 −0 externals/fetch_latest.sh
+1 −1 externals/glfw/glfw
+1 −1 externals/glm/glm
+1 −1 externals/jpeg/jpeg
+1 −1 externals/msdfgen/msdfgen
+1 −1 externals/openxr-sdk/OpenXR-SDK
+1 −1 externals/plf/plf_colony
+1 −1 externals/plf/plf_list
+1 −1 externals/plf/plf_stack
+1 −1 externals/pmp/pmp
+1 −1 externals/png/png
+1 −1 externals/samplerate/libsamplerate
+1 −1 externals/stb/stb
+1 −1 externals/tiff/tiff
+1 −1 externals/unordered_dense/unordered_dense
+1 −1 externals/utfcpp/utfcpp
+1 −1 externals/zlib-ng/zlib-ng
+1 −1 externals/zstd/zstd
+7 −0 sources/CMakeLists.txt
+4 −4 sources/asset-processor/animation.cpp
+5 −5 sources/asset-processor/collider.cpp
+28 −28 sources/asset-processor/font.cpp
+7 −11 sources/asset-processor/main.cpp
+26 −26 sources/asset-processor/model.cpp
+0 −2 sources/asset-processor/processor.h
+5 −5 sources/asset-processor/raw.cpp
+7 −7 sources/asset-processor/shader.cpp
+2 −2 sources/asset-processor/skeleton.cpp
+14 −14 sources/asset-processor/sound.cpp
+5 −5 sources/asset-processor/textPack.cpp
+29 −29 sources/asset-processor/texture.cpp
+8 −49 sources/include/cage-core/entities.h
+5 −0 sources/include/cage-core/entitiesCopy.h
+4 −8 sources/include/cage-core/entitiesVisitor.h
+14 −0 sources/include/cage-core/memoryAllocators.h
+3 −3 sources/include/cage-core/skeletalAnimationPreparator.h
+1 −1 sources/include/cage-core/string.h
+1 −0 sources/include/cage-engine/assetStructs.h
+1 −2 sources/include/cage-engine/font.h
+1 −0 sources/include/cage-engine/guiComponents.h
+1 −0 sources/include/cage-engine/model.h
+86 −335 sources/libcore/entities.cpp
+58 −0 sources/libcore/entitiesCopy.cpp
+71 −2 sources/libcore/memory/allocators.cpp
+3 −0 sources/libcore/mesh/importAssimp.cpp
+0 −1 sources/libcore/mesh/importConvert.cpp
+20 −18 sources/libcore/mesh/skeletalAnimation.cpp
+13 −9 sources/libcore/mesh/skeletalAnimationPreparator.cpp
+1 −0 sources/libengine/assets/model.cpp
+3 −12 sources/libengine/graphics/font.cpp
+12 −10 sources/libengine/graphics/renderPipeline.cpp
+8 −6 sources/libengine/gui/graphics.cpp
+17 −8 sources/libengine/gui/gui.cpp
+2 −0 sources/libengine/gui/private.h
+12 −3 sources/libengine/gui/tooltips.cpp
+1 −1 sources/libsimple/gameloop.cpp
+3 −1 sources/libsimple/statisticsGui.cpp
+9 −36 sources/test-core/entities.cpp
+2 −1 sources/test-core/entitiesSerialization.cpp
+27 −0 sources/test-core/flatSet.cpp
+114 −0 sources/test-core/memoryAllocators.cpp
+523 −0 sources/test-entities/main.cpp
92 changes: 48 additions & 44 deletions sources/modesConfiguration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,72 +38,74 @@ namespace unnatural
void chooseShapeFunction()
{
static constexpr TerrainFunctor shapeModeFunctions[] = {
&sdfHexagon,
&sdfSquare,
&sdfSphere,
&sdfTorus,
&sdfTube,
&sdfDisk,
&sdfCapsule,
&sdfAsteroid,
&sdfBelt,
&sdfBowl,
&sdfBox,
&sdfBunny,
&sdfCapsule,
&sdfCube,
&sdfTetrahedron,
&sdfOctahedron,
&sdfKnot,
&sdfMobiusStrip,
&sdfDisk,
&sdfDoubleTorus,
&sdfFibers,
&sdfGear,
&sdfH2O,
&sdfH3O,
&sdfH4O,
&sdfTriangularPrism,
&sdfHexagon,
&sdfHexagonalPrism,
&sdfGear,
&sdfInsideCube,
&sdfKnot,
&sdfMandelbulb,
&sdfTwistedHexagonalPrism,
&sdfBunny,
&sdfMobiusStrip,
&sdfMonkeyHead,
&sdfDoubleTorus,
&sdfTorusCross,
&sdfBowl,
&sdfInsideCube,
&sdfAsteroid,
&sdfOctahedron,
&sdfPipe,
&sdfSphere,
&sdfSquare,
&sdfTetrahedron,
&sdfTorus,
&sdfTorusCross,
&sdfTriangularPrism,
&sdfTube,
&sdfTwistedHexagonalPrism,
&sdfTwistedPlane,
};

static constexpr uint32 shapeModesCount = sizeof(shapeModeFunctions) / sizeof(shapeModeFunctions[0]);

static constexpr const char *const shapeModeNames[] = {
"hexagon",
"square",
"sphere",
"torus",
"tube",
"disk",
"capsule",
"asteroid",
"belt",
"bowl",
"box",
"bunny",
"capsule",
"cube",
"tetrahedron",
"octahedron",
"knot",
"mobiusstrip",
"disk",
"doubletorus",
"fibers",
"gear",
"h2o",
"h3o",
"h4o",
"triangularprism",
"hexagon",
"hexagonalprism",
"gear",
"insidecube",
"knot",
"mandelbulb",
"twistedhexagonalprism",
"bunny",
"mobiusstrip",
"monkeyhead",
"doubletorus",
"toruscross",
"bowl",
"insidecube",
"asteroid",
"octahedron",
"pipe",
"sphere",
"square",
"tetrahedron",
"torus",
"toruscross",
"triangularprism",
"tube",
"twistedhexagonalprism",
"twistedplane",
};

Expand Down Expand Up @@ -132,16 +134,18 @@ namespace unnatural

doubleSided = [&]() -> bool
{
if (name == "belt")
return true;
if (name == "bowl")
return true;
if (name == "hexagon")
return true;
if (name == "insidecube")
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;
Expand Down
8 changes: 8 additions & 0 deletions sources/sdf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,4 +371,12 @@ namespace unnatural
const Rads angle = Degs(sign(p[2]) * rot * 35);
return p[1] * cos(angle) + p[0] * sin(angle);
}

Real sdfBelt(const Vec3 &p)
{
static constexpr Real Radius = 1800;
if (p[0] > 0)
return sdfCylinder(Vec3(p[0], p[2], p[1]), 10000, Radius) * -1;
return Radius - abs(p[2]);
}
}
43 changes: 22 additions & 21 deletions sources/sdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,36 +7,37 @@ namespace unnatural
{
using namespace cage;

Real sdfHexagon(const Vec3 &pos);
Real sdfSquare(const Vec3 &pos);
Real sdfSphere(const Vec3 &pos);
Real sdfCapsule(const Vec3 &pos);
Real sdfTube(const Vec3 &pos);
Real sdfDisk(const Vec3 &pos);
Real sdfAsteroid(const Vec3 &p);
Real sdfBelt(const Vec3 &p);
Real sdfBowl(const Vec3 &p);
Real sdfBox(const Vec3 &pos);
Real sdfBunny(const Vec3 &p);
Real sdfCapsule(const Vec3 &pos);
Real sdfCube(const Vec3 &pos);
Real sdfTetrahedron(const Vec3 &pos);
Real sdfOctahedron(const Vec3 &pos);
Real sdfTriangularPrism(const Vec3 &pos);
Real sdfHexagonalPrism(const Vec3 &pos);
Real sdfTorus(const Vec3 &pos);
Real sdfKnot(const Vec3 &pos);
Real sdfMobiusStrip(const Vec3 &pos);
Real sdfDisk(const Vec3 &pos);
Real sdfDoubleTorus(const Vec3 &p);
Real sdfFibers(const Vec3 &pos);
Real sdfGear(const Vec3 &pos);
Real sdfH2O(const Vec3 &pos);
Real sdfH3O(const Vec3 &pos);
Real sdfH4O(const Vec3 &pos);
Real sdfGear(const Vec3 &pos);
Real sdfHexagon(const Vec3 &pos);
Real sdfHexagonalPrism(const Vec3 &pos);
Real sdfInsideCube(const Vec3 &p);
Real sdfKnot(const Vec3 &pos);
Real sdfMandelbulb(const Vec3 &pos);
Real sdfTwistedHexagonalPrism(const Vec3 &pos);
Real sdfBunny(const Vec3 &p);
Real sdfMobiusStrip(const Vec3 &pos);
Real sdfMonkeyHead(const Vec3 &p);
Real sdfDoubleTorus(const Vec3 &p);
Real sdfTorusCross(const Vec3 &p);
Real sdfBowl(const Vec3 &p);
Real sdfInsideCube(const Vec3 &p);
Real sdfAsteroid(const Vec3 &p);
Real sdfOctahedron(const Vec3 &pos);
Real sdfPipe(const Vec3 &p);
Real sdfSphere(const Vec3 &pos);
Real sdfSquare(const Vec3 &pos);
Real sdfTetrahedron(const Vec3 &pos);
Real sdfTorus(const Vec3 &pos);
Real sdfTorusCross(const Vec3 &p);
Real sdfTriangularPrism(const Vec3 &pos);
Real sdfTube(const Vec3 &pos);
Real sdfTwistedHexagonalPrism(const Vec3 &pos);
Real sdfTwistedPlane(const Vec3 &p);
}

Expand Down
2 changes: 1 addition & 1 deletion sources/startingPositions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ namespace unnatural
for (uint32 i : spatQuery->result())
if (tiles[i].buildable)
b++;
static constexpr uint32 Threshold = CAGE_DEBUG_BOOL ? 400 : 2500;
static constexpr uint32 Threshold = CAGE_DEBUG_BOOL ? 400 : 2000;
return b < Threshold;
});
}
Expand Down

0 comments on commit 96e86d3

Please sign in to comment.