Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
EldarMuradov committed Jul 25, 2024
1 parent 0cb42f5 commit 36147b8
Show file tree
Hide file tree
Showing 64 changed files with 114,941 additions and 566 deletions.
4 changes: 4 additions & 0 deletions modules/core/src/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ namespace era_engine
// addRaytracingComponentAsync(en, mesh);
//}

#if PX_BLAST_ENABLE

{
if (auto mesh = loadMeshFromFileAsync(getAssetPath("/resources/assets/obj/untitled.obj")))
{
Expand All @@ -339,6 +341,8 @@ namespace era_engine
}
}

#endif

/*{
model_asset ass = load3DModelFromFile(getAssetPath("/resources/assets/box.fbx"));
auto px_sphere_entt1 = scene.createEntity("SpherePXTest", (entity_handle)60)
Expand Down
2 changes: 2 additions & 0 deletions modules/core/src/editor/editor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@
#include "application.h"

#include "imgui/imgui_internal.h"

#include "scripting/script.h"
#include "scripting/native_scripting_linker.h"

#include "px/blast/px_blast_destructions.h"
#include "px/physics/px_soft_body.h"
Expand Down
3 changes: 2 additions & 1 deletion modules/core/src/px/blast/px_blast_destructions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

#include "px/blast/px_blast_destructions.h"

#if !_DEBUG
#if PX_BLAST_ENABLE

namespace era_engine::physics
{
eentity buildChunk(const trs& transform, ref<pbr_material> insideMaterial, ref<pbr_material> outsideMaterial, std::pair<ref<submesh_asset>, ref<nvmesh>> mesh, float mass, uint32 generation)
Expand Down
5 changes: 3 additions & 2 deletions modules/core/src/px/blast/px_blast_destructions.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
#pragma once

#include "px/core/px_physics_engine.h"

#if PX_BLAST_ENABLE

#include "px/core/px_extensions.h"
#include "px/physics/px_joint.h"
#include "px/blast/px_blast_utils.h"
Expand All @@ -19,8 +22,6 @@

#include "application.h"

#if !_DEBUG

#include <NvBlast.h>

namespace era_engine::physics
Expand Down
7 changes: 6 additions & 1 deletion modules/core/src/px/blast/px_blast_fracture.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright (c) 2023-present Eldar Muradov. All rights reserved.

#include "px/blast/px_blast_fracture.h"

#if PX_BLAST_ENABLE

#include "px/blast/px_nvmesh.h"
#include "px/blast/px_blast_destructions.h"
#include "px/core/px_extensions.h"
Expand Down Expand Up @@ -403,4 +406,6 @@ namespace era_engine::physics
}
}
}
}
}

#endif
7 changes: 5 additions & 2 deletions modules/core/src/px/blast/px_blast_fracture.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

#include "px/blast/px_blast_utils.h"

#if PX_BLAST_ENABLE

#include <NvBlastExtAuthoringFractureTool.h>

namespace era_engine
Expand Down Expand Up @@ -62,5 +64,6 @@ namespace era_engine::physics

std::unordered_set<chunkPair> jointPairs;
};

}
}

#endif
8 changes: 6 additions & 2 deletions modules/core/src/px/blast/px_blast_utils.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

#include "px/blast/px_blast_utils.h"

#if PX_BLAST_ENABLE

#include "px/blast/px_nvmesh.h"

#include "asset/mesh_postprocessing.h"
Expand Down Expand Up @@ -214,4 +216,6 @@ namespace era_engine::physics

return indices;
}
}
}

#endif
11 changes: 8 additions & 3 deletions modules/core/src/px/blast/px_blast_utils.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
#pragma once

#include "scene/scene.h"

#include "px/core/px_physics_engine.h"

#if PX_BLAST_ENABLE

#include "px/core/px_extensions.h"

#include "scene/scene.h"

namespace era_engine::physics
{
struct chunkPair
Expand Down Expand Up @@ -94,4 +97,6 @@ namespace era_engine::physics
{
return (static_cast<char>(lhs) & static_cast<char>(rhs));
}
}
}

#endif
6 changes: 4 additions & 2 deletions modules/core/src/px/blast/px_nvmesh.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

#include "px/blast/px_nvmesh.h"

#if PX_BLAST_ENABLE

namespace era_engine::physics
{
nvmesh::nvmesh(std::vector<physx::PxVec3> verts, std::vector<physx::PxVec3> norms, std::vector<physx::PxVec2> uvis, std::vector<uint32_t> inds)
Expand Down Expand Up @@ -61,5 +62,6 @@ namespace era_engine::physics
cleaner->release();
}
}
}

}
#endif
6 changes: 5 additions & 1 deletion modules/core/src/px/blast/px_nvmesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

#include "px/core/px_physics_engine.h"

#if PX_BLAST_ENABLE

#include <NvBlast.h>

#include <NvBlastExtAuthoring.h>
Expand Down Expand Up @@ -45,4 +47,6 @@ namespace era_engine::physics

ref<nvmesh> mesh = nullptr;
};
}
}

#endif
6 changes: 3 additions & 3 deletions modules/core/src/px/core/px_physics_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ namespace era_engine
ASSERT(omniPvd->startSampling());
}

PxPvdSceneClient* client = scene->getScenePvdClient();
/*PxPvdSceneClient* client = scene->getScenePvdClient();
if (client)
{
Expand All @@ -283,7 +283,7 @@ namespace era_engine
}
if (pvd->isConnected())
std::cout << "Physics> PVD Connection enabled.\n";
std::cout << "Physics> PVD Connection enabled.\n";*/
#endif

dispatcher = PxDefaultCpuDispatcherCreate(nbCPUDispatcherThreads);
Expand Down Expand Up @@ -425,7 +425,7 @@ namespace era_engine

void physics::px_physics_engine::endSimulation()
{
#if PX_GPU_BROAD_PHASE
#if !PX_GPU_BROAD_PHASE
stepper.wait(scene);
#endif
{
Expand Down
8 changes: 8 additions & 0 deletions modules/core/src/px/core/px_physics_engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@

#define PX_VEHICLE 0

#if DEBUG
#define PX_BLAST_ENABLE 0
#elif _DEBUG
#define PX_BLAST_ENABLE 0
#else
#define PX_BLAST_ENABLE 1
#endif

#ifndef PX_RELEASE
#define PX_RELEASE(x) if(x) { x->release(); x = nullptr;}
#endif
Expand Down
107 changes: 0 additions & 107 deletions modules/thirdparty_ext/directxtex/DirectXTex_Desktop_2019.sln

This file was deleted.

This file was deleted.

Loading

0 comments on commit 36147b8

Please sign in to comment.