Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Make collision generation dynamic #278

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
2 changes: 2 additions & 0 deletions Terrain3D.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@
<ClInclude Include="src\register_types.h" />
<ClInclude Include="src\terrain_3d.h" />
<ClInclude Include="src\terrain_3d_asset_resource.h" />
<ClInclude Include="src\terrain_3d_collision.h" />
<ClInclude Include="src\terrain_3d_data.h" />
<ClInclude Include="src\terrain_3d_editor.h" />
<ClInclude Include="src\logger.h" />
Expand All @@ -161,6 +162,7 @@
<ClCompile Include="src\geoclipmap.cpp" />
<ClCompile Include="src\register_types.cpp" />
<ClCompile Include="src\terrain_3d.cpp" />
<ClCompile Include="src\terrain_3d_collision.cpp" />
<ClCompile Include="src\terrain_3d_data.cpp" />
<ClCompile Include="src\terrain_3d_editor.cpp" />
<ClCompile Include="src\terrain_3d_instancer.cpp" />
Expand Down
6 changes: 6 additions & 0 deletions Terrain3D.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@
<ClInclude Include="src\terrain_3d_data.h">
<Filter>5. Headers</Filter>
</ClInclude>
<ClInclude Include="src\terrain_3d_collision.h">
<Filter>5. Headers</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\geoclipmap.cpp">
Expand Down Expand Up @@ -113,6 +116,9 @@
<ClCompile Include="src\terrain_3d_data.cpp">
<Filter>6. C++</Filter>
</ClCompile>
<ClCompile Include="src\terrain_3d_collision.cpp">
<Filter>6. C++</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include=".github\actions\build-cache\action.yml">
Expand Down
13 changes: 12 additions & 1 deletion src/constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ using namespace godot;
// Constants

#define RS RenderingServer::get_singleton()
#define PS PhysicsServer3D::get_singleton()
#define IS_EDITOR Engine::get_singleton()->is_editor_hint()

#define COLOR_NAN Color(NAN, NAN, NAN, NAN)
Expand All @@ -18,12 +19,16 @@ using namespace godot;
#define COLOR_NORMAL Color(0.5f, 0.5f, 1.0f, 1.0f)
#define COLOR_CONTROL Color(as_float(enc_auto(true)), 0.f, 0.f, 1.0f)

#ifndef FLT_MAX
// For consistency between MSVC, gcc, clang
#ifndef FLT_MAX
#define FLT_MAX __FLT_MAX__
#endif
#ifndef FLT_MIN
#define FLT_MIN __FLT_MIN__
#endif

#define V2(x) Vector2(x, x)
#define V2I(x) Vector2i(x, x)
#define V2_ZERO Vector2(0.f, 0.f)
#define V2I_ZERO Vector2i(0, 0)
#define V2_MAX Vector2(FLT_MAX, FLT_MAX)
Expand All @@ -47,6 +52,12 @@ using namespace godot;

// Validation macros

#define ASSERT(cond, ret) \
if (!(cond)) { \
UtilityFunctions::push_error("Assertion '", #cond, "' failed at ", __FILE__, ":", __LINE__); \
return ret; \
}

#define VOID // a return value for void, to avoid compiler warnings

#define IS_INIT(ret) \
Expand Down
1 change: 1 addition & 0 deletions src/register_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ void initialize_terrain_3d(ModuleInitializationLevel p_level) {
ClassDB::register_class<Terrain3DAssets>();
ClassDB::register_class<Terrain3DData>();
ClassDB::register_class<Terrain3DEditor>();
ClassDB::register_class<Terrain3DCollision>();
ClassDB::register_class<Terrain3DInstancer>();
ClassDB::register_class<Terrain3DMaterial>();
ClassDB::register_class<Terrain3DMeshAsset>();
Expand Down
Loading