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 c10629b commit 31d6ace
Show file tree
Hide file tree
Showing 78 changed files with 31 additions and 35,288 deletions.
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ era_begin(EraEngine)
add_subdirectory(modules/EraScriptingCPPDecls)

# programs
add_subdirectory(programs/EraEditor)
add_subdirectory(programs/EraRuntime)
add_subdirectory(programs/EraUnitTests)
add_subdirectory(programs/EraLauncher)
add_subdirectory(apps/EraEditor)
add_subdirectory(apps/EraRuntime)
add_subdirectory(apps/EraUnitTests)
add_subdirectory(apps/EraLauncher)
era_end(EraEngine)


Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ mkdir _build

echo Copiyng external resources...

xcopy resources\imgui.ini _build\programs\EraEditor\ /Q
xcopy resources\imgui.ini _build\programs\EraRuntime\ /Q
xcopy resources\imgui.ini _build\apps\EraEditor\ /Q
xcopy resources\imgui.ini _build\apps\EraRuntime\ /Q
xcopy resources\imgui.ini _build\ /Q

xcopy /s /i resources\bin\Debug _build\Debug /Q
Expand Down
17 changes: 7 additions & 10 deletions cmake/era_engine_common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,9 @@ ${ERA_ENGINE_PATH}/resources/lib/Release/libxml2.lib
${ERA_ENGINE_PATH}/resources/lib/Release/yaml-cpp.lib
${ERA_ENGINE_PATH}/resources/lib/Release/DirectXTex.lib
${ERA_ENGINE_PATH}/resources/lib/Release/nvsdk_ngx_d.lib
${ERA_ENGINE_PATH}/resources/lib/Release/nvsdk_ngx_d_dbg.lib
${ERA_ENGINE_PATH}/resources/lib/Release/nvsdk_ngx_s.lib
${ERA_ENGINE_PATH}/resources/lib/Release/nvsdk_ngx_s_dbg.lib
${ERA_ENGINE_PATH}/resources/lib/Release/nethost.lib
${ERA_ENGINE_PATH}/resources/lib/Release/libnethost.lib
${ERA_ENGINE_PATH}/modules/thirdparty_ext/CUDA/lib/x64/cuda.lib)
${ERA_ENGINE_PATH}/resources/lib/Release/cuda.lib)

function(assign_source_group)
foreach(_source IN ITEMS ${ARGN})
Expand Down Expand Up @@ -189,15 +186,15 @@ function(declare_module module_name)
endfunction()

function(declare_engine_program program_name)
file(GLOB_RECURSE SOURCES_${program_name} ${ERA_ENGINE_PATH}/programs/${program_name}/src/*.cpp ${ERA_ENGINE_PATH}/modules/core/src/*.cpp)
file(GLOB_RECURSE SOURCES_${program_name} ${ERA_ENGINE_PATH}/apps/${program_name}/src/*.cpp ${ERA_ENGINE_PATH}/modules/core/src/*.cpp)

file(GLOB_RECURSE HEADERS_${program_name} ${ERA_ENGINE_PATH}/programs/${program_name}/src/*.h ${ERA_ENGINE_PATH}/modules/core/src/*.h)
file(GLOB_RECURSE HEADERS_${program_name} ${ERA_ENGINE_PATH}/apps/${program_name}/src/*.h ${ERA_ENGINE_PATH}/modules/core/src/*.h)

set(sources_${program_name} ${SOURCES_${program_name}})
set(headers_${program_name} ${HEADERS_${program_name}})
set_source_files_properties(${SOURCES_${program_name}} ${HEADERS_${program_name}} PROPERTIES COMPILE_FLAGS -Od)
add_executable(${program_name} ${SOURCES_${program_name}} ${HEADERS_${program_name}})
target_include_directories(${program_name} PRIVATE ${ERA_ENGINE_PATH}/programs/${program_name}/src)
target_include_directories(${program_name} PRIVATE ${ERA_ENGINE_PATH}/apps/${program_name}/src)
target_include_directories(${program_name} PRIVATE ${ERA_ENGINE_PATH}/modules/core/src)
target_link_directories(${program_name} PUBLIC ${ERA_ENGINE_PATH}/_build/Release)

Expand All @@ -223,15 +220,15 @@ function(declare_engine_program program_name)
endfunction()

function(declare_support_program program_name)
file(GLOB_RECURSE SOURCES_${program_name} ${ERA_ENGINE_PATH}/programs/${program_name}/src/*.cpp)
file(GLOB_RECURSE SOURCES_${program_name} ${ERA_ENGINE_PATH}/apps/${program_name}/src/*.cpp)

file(GLOB_RECURSE HEADERS_${program_name} ${ERA_ENGINE_PATH}/programs/${program_name}/src/*.h)
file(GLOB_RECURSE HEADERS_${program_name} ${ERA_ENGINE_PATH}/apps/${program_name}/src/*.h)

set(sources_${program_name} ${SOURCES_${program_name}})
set(headers_${program_name} ${HEADERS_${program_name}})
set_source_files_properties(${SOURCES_${program_name}} ${HEADERS_${program_name}} PROPERTIES COMPILE_FLAGS -Od)
add_executable(${program_name} ${SOURCES_${program_name}} ${HEADERS_${program_name}})
target_include_directories(${program_name} PRIVATE ${ERA_ENGINE_PATH}/programs/${program_name}/src)
target_include_directories(${program_name} PRIVATE ${ERA_ENGINE_PATH}/apps/${program_name}/src)
target_link_directories(${program_name} PUBLIC ${ERA_ENGINE_PATH}/_build/Release)
set_target_properties(${program_name} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${ERA_ENGINE_PATH}/_build)
set_target_properties(${program_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${ERA_ENGINE_PATH}/_build)
Expand Down
40 changes: 18 additions & 22 deletions modules/core/src/px/core/px_physics_engine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ namespace era_engine
if (!foundation)
throw std::exception("Failed to create {PxFoundation}. Error in {PhysicsEngine} ctor.");

#if PX_GPU_BROAD_PHASE
if (PxGetSuggestedCudaDeviceOrdinal(foundation->getErrorCallback()) < 0)
throw std::exception("Failed to create {PxFoundation}. Error in {PhysicsEngine} ctor.");
#endif

pvd = PxCreatePvd(*foundation);

Expand All @@ -254,13 +256,6 @@ namespace era_engine
fStream->setFileName(omniPvdPath);
omniWriter->setWriteStream(static_cast<OmniPvdWriteStream&>(*fStream));

//PxPvdTransport* transport = PxDefaultPvdSocketTransportCreate(PVD_HOST, 5425, 10);
//if (transport == NULL)
// throw std::exception("Failed to create {PxPvdTransport}. Error in {PhysicsEngine} ctor.");

//if (pvd->connect(*transport, PxPvdInstrumentationFlag::eALL))
// std::cout << "Physics> PVD Connected.\n";

#endif

toleranceScale.length = 1.0f;
Expand All @@ -278,35 +273,35 @@ namespace era_engine
ASSERT(omniPvd->startSampling());
}

//PxPvdSceneClient* client = scene->getScenePvdClient();
PxPvdSceneClient* client = scene->getScenePvdClient();

//if (client)
//{
// client->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true);
// client->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true);
// client->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true);
//}
if (client)
{
client->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONSTRAINTS, true);
client->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_CONTACTS, true);
client->setScenePvdFlag(PxPvdSceneFlag::eTRANSMIT_SCENEQUERIES, true);
}

//if (pvd->isConnected())
//std::cout << "Physics> PVD Connection enabled.\n";
if (pvd->isConnected())
std::cout << "Physics> PVD Connection enabled.\n";
#endif

PxCudaContextManagerDesc cudaContextManagerDesc;
cudaContextManagerDesc.graphicsDevice = dxContext.device.Get();
cudaContextManager = PxCreateCudaContextManager(*foundation, cudaContextManagerDesc, &profilerCallback);
dispatcher = PxDefaultCpuDispatcherCreate(nbCPUDispatcherThreads);

PxSceneDesc sceneDesc(physics->getTolerancesScale());
sceneDesc.gravity = gravity;
dispatcher = PxDefaultCpuDispatcherCreate(nbCPUDispatcherThreads);
sceneDesc.cpuDispatcher = dispatcher;
sceneDesc.solverType = PxSolverType::eTGS;
sceneDesc.cudaContextManager = cudaContextManager;
sceneDesc.flags |= PxSceneFlag::eENABLE_CCD;
sceneDesc.flags |= PxSceneFlag::eENABLE_ACTIVE_ACTORS;
sceneDesc.flags |= PxSceneFlag::eENABLE_ENHANCED_DETERMINISM;
sceneDesc.flags |= PxSceneFlag::eENABLE_STABILIZATION;
sceneDesc.flags |= PxSceneFlag::eENABLE_PCM;
#if PX_GPU_BROAD_PHASE
PxCudaContextManagerDesc cudaContextManagerDesc;
cudaContextManagerDesc.graphicsDevice = dxContext.device.Get();
cudaContextManager = PxCreateCudaContextManager(*foundation, cudaContextManagerDesc, &profilerCallback);
sceneDesc.cudaContextManager = cudaContextManager;
sceneDesc.broadPhaseType = physx::PxBroadPhaseType::eGPU;
sceneDesc.flags |= PxSceneFlag::eENABLE_GPU_DYNAMICS;
sceneDesc.gpuMaxNumPartitions = 8;
Expand Down Expand Up @@ -430,8 +425,9 @@ namespace era_engine

void physics::px_physics_engine::endSimulation()
{
#if PX_GPU_BROAD_PHASE
stepper.wait(scene);

#endif
{
CPU_PROFILE_BLOCK("PhysX process simulation event callbacks steps");
processSimulationEventCallbacks();
Expand Down
Binary file removed resources/bin/Debug/apphost.exe
Binary file not shown.
Binary file removed resources/bin/Debug/libhostfxr.pdb
Binary file not shown.
Binary file removed resources/bin/Debug/libnethost.pdb
Binary file not shown.
Binary file removed resources/bin/Debug/singlefilehost.exe
Binary file not shown.
Binary file removed resources/bin/Release/ApexImporter_x64.exe
Binary file not shown.
Binary file removed resources/bin/Release/AuthoringTool_x64.exe
Binary file not shown.
Binary file removed resources/bin/Release/LegacyConverter_x64.exe
Binary file not shown.
Binary file removed resources/bin/Release/LowLevelAABB_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/LowLevelDynamics_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/LowLevel_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/NvBlastExtUnity_x64.dll
Binary file not shown.
Binary file removed resources/bin/Release/PVDRuntime_64.pdb
Binary file not shown.
Binary file not shown.
Binary file removed resources/bin/Release/PhysXCommon_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXCooking_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXExtensions_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXFoundation_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXPvdSDK_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXTask_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXVehicle2_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysXVehicle_static_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/PhysX_64.pdb
Binary file not shown.
Binary file removed resources/bin/Release/SceneQuery_static_64.pdb
Binary file not shown.
Binary file not shown.
Binary file removed resources/bin/Release/apphost.exe
Binary file not shown.
Binary file removed resources/bin/Release/capnp.exe
Binary file not shown.
Binary file removed resources/bin/Release/capnpc-c++.exe
Binary file not shown.
Binary file removed resources/bin/Release/capnpc-capnp.exe
Binary file not shown.
Binary file removed resources/bin/Release/libhostfxr.pdb
Binary file not shown.
Binary file removed resources/bin/Release/libnethost.pdb
Binary file not shown.
Binary file removed resources/bin/Release/singlefilehost.exe
Binary file not shown.
Binary file removed resources/lib/Debug/EraEngineDomain.lib
Binary file not shown.
Binary file removed resources/lib/Debug/EraScriptingCPPDecls.lib
Binary file not shown.
Binary file removed resources/lib/Debug/EraScriptingCore.lib
Binary file not shown.
Binary file removed resources/lib/Debug/EraScriptingProjectTemplate.lib
Binary file not shown.
Binary file removed resources/lib/Release/DirectXTex.pdb
Binary file not shown.
Binary file removed resources/lib/Release/EraEngineDomain.lib
Binary file not shown.
Binary file removed resources/lib/Release/EraScriptingCPPDecls.lib
Binary file not shown.
Binary file removed resources/lib/Release/EraScriptingCore.lib
Binary file not shown.
Binary file not shown.
Binary file removed resources/lib/Release/PVDRuntime_64.exp
Binary file not shown.
Binary file removed resources/lib/Release/PhysXCommon_64.exp
Binary file not shown.
Loading

0 comments on commit 31d6ace

Please sign in to comment.