Skip to content

Commit

Permalink
Checkpoint.
Browse files Browse the repository at this point in the history
  • Loading branch information
edisonlee0212 committed Sep 4, 2024
1 parent bd8461b commit 7689713
Show file tree
Hide file tree
Showing 136 changed files with 301 additions and 92,422 deletions.
65 changes: 0 additions & 65 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,71 +38,6 @@ set(3RDPARTY_INCLUDES "")
set(3RDPARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/Extern/3rdParty)
add_subdirectory(${3RDPARTY_DIR})

function(CompileShader shader_path shader_type)
get_filename_component(dir ${shader_path} DIRECTORY)
get_filename_component(file_name ${shader_path} NAME)
get_filename_component(shader_name ${shader_path} NAME_WLE)

set(depends_option "")

if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(platform_options --platform windows)
set(target_types spirv)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
set(platform_options --platform linux)
set(target_types spirv)
endif()

set(compile_options ${depends_option} ${platform_options})
if (NOT (${shader_type} MATCHES "compute"))
set(compile_options ${compile_options} --varyingdef varying.def.sc)
endif()

set(target_headers "")
foreach(target_type ${target_types})
list(APPEND target_headers
${CMAKE_CURRENT_BINARY_DIR}/Shader/${target_type}/${shader_name}.h
)
endforeach()

list(LENGTH target_types num_target_types)
math(EXPR max_index_target_types "${num_target_types} - 1")
foreach(i RANGE ${max_index_target_types})
list(GET target_types ${i} target_type)
list(GET target_headers ${i} target_name)
set(append_tag "")
if(NOT (i EQUAL 0))
set(append_tag APPEND)
endif()

if(${target_type} MATCHES "glsl")
set(profile_options -p 430)
elseif(${target_type} MATCHES "spirv")
set(profile_options -p spirv)
endif()

add_custom_command(OUTPUT ${target_headers}
COMMAND $<TARGET_FILE:shaderc> -f ${file_name} -o ${target_name} --bin2c ${target_type}_${shader_name} ${compile_options} ${profile_options} --type ${shader_type}
MAIN_DEPENDENCY ${shader_path}
DEPENDS ${speedcg_render_shader_header}
WORKING_DIRECTORY ${dir}
COMMENT "Compiling ${file_name} to ${target_types} ..."
${append_tag}
VERBATIM
)
endforeach()
endfunction()

function(CompileVertexShader shader_path)
CompileShader(${shader_path} "vertex")
endfunction()
function(CompileFragmentShader shader_path)
CompileShader(${shader_path} "fragment")
endfunction()
function(CompileComputeShader shader_path)
CompileShader(${shader_path} "compute")
endfunction()

# ------------------------------------------------------------------
# EvoEngine - SDK
# ------------------------------------------------------------------
Expand Down
28 changes: 13 additions & 15 deletions EvoEngine_App/Demo/Demo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@

#include "EditorLayer.hpp"
#include "MeshRenderer.hpp"
#include "PlanetTerrainSystem.hpp"
#include "StarClusterSystem.hpp"
#include "PerlinNoiseStage.hpp"
#include "PlanetTerrainSystem.hpp"
#include "PlayerController.hpp"
#include "Prefab.hpp"
#include "RenderLayer.hpp"
#include "StarClusterSystem.hpp"
#include "Times.hpp"
#include "WindowLayer.hpp"

#include "PostProcessingStack.hpp"
#include "Resources.hpp"
#ifdef OPTIX_RAY_TRACER_PLUGIN
#include <CUDAModule.hpp>
#include <RayTracerLayer.hpp>
# include <CUDAModule.hpp>
# include <RayTracerLayer.hpp>
#endif
#ifdef PHYSICS_PLUGIN
#include "PhysicsLayer.hpp"
#include "RigidBody.hpp"
#ifdef RAY_TRACER_PLUGIN
#include "CpuRayTracerCamera.hpp"
# include "PhysicsLayer.hpp"
# include "RigidBody.hpp"
#endif

#ifdef RAY_TRACER_PLUGIN
# include "CpuRayTracerCamera.hpp"
#endif
using namespace evo_engine;
using namespace planet;
Expand Down Expand Up @@ -69,7 +68,7 @@ int main() {
#ifdef PHYSICS_PLUGIN
Application::PushLayer<PhysicsLayer>();
#endif

#ifdef RAY_TRACER_PLUGIN
PrivateComponentRegistration<CpuRayTracerCamera>("CpuRayTracerCamera");
#endif
Expand Down Expand Up @@ -467,7 +466,7 @@ void SetupDemoScene(DemoSetup demo_setup, ApplicationInfo& application_info) {
#ifdef PHYSICS_PLUGIN
Entity LoadPhysicsScene(const std::shared_ptr<Scene>& scene, const std::string& base_entity_name) {
const auto base_entity = scene->CreateEntity(base_entity_name);
#pragma region Create 9 spheres in different PBR properties
# pragma region Create 9 spheres in different PBR properties
const int amount = 5;
constexpr float scale_factor = 0.03f;
const auto collection = scene->CreateEntity("Spheres");
Expand Down Expand Up @@ -502,8 +501,8 @@ Entity LoadPhysicsScene(const std::shared_ptr<Scene>& scene, const std::string&
}
}
scene->SetParent(collection, base_entity);
#pragma endregion
#pragma region Create Boundaries
# pragma endregion
# pragma region Create Boundaries
{
const auto ground = CreateSolidCube(1.0, glm::vec3(1.0f), glm::vec3(0, -35, 0) * scale_factor, glm::vec3(0),
glm::vec3(30, 1, 60) * scale_factor, "Ground");
Expand Down Expand Up @@ -565,11 +564,10 @@ Entity LoadPhysicsScene(const std::shared_ptr<Scene>& scene, const std::string&
joint->SetMotion(MotionAxis::SwingZ, MotionType::Free);
*/
}
#pragma endregion
# pragma endregion
return base_entity;
}


Entity CreateSolidCube(const float& mass, const glm::vec3& color, const glm::vec3& position, const glm::vec3& rotation,
const glm::vec3& scale, const std::string& name) {
auto scene = Application::GetActiveScene();
Expand Down
6 changes: 3 additions & 3 deletions EvoEngine_Plugins/EcoSysLab/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
set(ECOSYSLAB_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
set(ECOSYSLAB_INCLUDES
${3RD_PARTY_DIR}/pinchot/include
${3RDPARTY_DIR}/pinchot/pinchot/include
${ECOSYSLAB_DIRECTORY}
${ECOSYSLAB_DIRECTORY}/include
${ECOSYSLAB_DIRECTORY}/include
Expand Down Expand Up @@ -56,7 +56,7 @@ target_precompile_headers(EcoSysLabPlugin
)

if (WIN32)
set(PINCHOT_LIB ${3RD_PARTY_DIR}/pinchot/lib/windows/x64/pinchot.lib)
set(PINCHOT_LIB ${3RDPARTY_DIR}/pinchot/pinchot/lib/windows/x64/pinchot.lib)
# Compiler settings for Windows platform
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
endif ()
Expand All @@ -71,7 +71,7 @@ set(EVOENGINE_PLUGINS_PCHS ${EVOENGINE_PLUGINS_PCHS} ${ECOSYSLAB_PCH} PARENT_SCO
set(EVOENGINE_PLUGINS_DEFS ${EVOENGINE_PLUGINS_DEFS} ECOSYSLAB_PLUGIN PARENT_SCOPE)

if (WIN32)
set(PINCHOT_DLL ${3RD_PARTY_DIR}/pinchot/lib/windows/x64/pinchot.dll)
set(PINCHOT_DLL ${3RDPARTY_DIR}/pinchot/pinchot/lib/windows/x64/pinchot.dll)
endif ()
set(EVOENGINE_PLUGINS_DLLS ${EVOENGINE_PLUGINS_DLLS} ${PINCHOT_DLL} PARENT_SCOPE)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
#include <fstream>
#include <string>
#include "joescan_pinchot.h"
#include "json.h"
using namespace treeio;
#include "nlohmann/json.hpp"
using namespace nlohmann;

namespace joescan {

/// Internal function
Expand Down
4 changes: 2 additions & 2 deletions EvoEngine_Plugins/EcoSysLab/include/Json.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#pragma once
#include "json.h"
#include "nlohmann/json.hpp"
using namespace evo_engine;
namespace eco_sys_lab {
class Json : public IAsset {
Expand All @@ -8,7 +8,7 @@ class Json : public IAsset {
bool LoadInternal(const std::filesystem::path& path) override;

public:
treeio::json m_json;
nlohmann::json m_json;
bool OnInspect(const std::shared_ptr<EditorLayer>& editorLayer) override;
};
} // namespace eco_sys_lab
12 changes: 7 additions & 5 deletions EvoEngine_Plugins/EcoSysLab/include/Tree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ class Tree : public IPrivateComponent {
const std::shared_ptr<Climate>& climate);
ShootGrowthController shoot_growth_controller_{};

void GenerateTreeParts(const TreeMeshGeneratorSettings& mesh_generator_settings, std::vector<TreePartData>& tree_parts);
void GenerateTreeParts(const TreeMeshGeneratorSettings& mesh_generator_settings,
std::vector<TreePartData>& tree_parts);

public:
StrandModelParameters strand_model_parameters{};
Expand Down Expand Up @@ -183,7 +184,7 @@ class Tree : public IPrivateComponent {
void FromTreeGraph(const std::shared_ptr<TreeGraph>& tree_graph);
void FromTreeGraphV2(const std::shared_ptr<TreeGraphV2>& tree_graph_v2);
void ExportTreeParts(const TreeMeshGeneratorSettings& mesh_generator_settings, YAML::Emitter& out);
void ExportTreeParts(const TreeMeshGeneratorSettings& mesh_generator_settings, treeio::json& out);
void ExportTreeParts(const TreeMeshGeneratorSettings& mesh_generator_settings, nlohmann::json& out);

void ExportTreeParts(const TreeMeshGeneratorSettings& mesh_generator_settings, const std::filesystem::path& path);
[[maybe_unused]] bool ExportIoTree(const std::filesystem::path& path) const;
Expand Down Expand Up @@ -231,9 +232,10 @@ void BranchPhysicsParameters::Link(const std::shared_ptr<Scene>& scene,
joint->SetType(JointType::D6);
joint->SetMotion(MotionAxis::SwingY, MotionType::Free);
joint->SetMotion(MotionAxis::SwingZ, MotionType::Free);
joint->SetDrive(
DriveType::Swing, glm::pow(child_thickness, joint_drive_stiffness_thickness_factor) * joint_drive_stiffness,
glm::pow(child_thickness, joint_drive_damping_thickness_factor) * joint_drive_damping, enable_acceleration_for_drive);
joint->SetDrive(DriveType::Swing,
glm::pow(child_thickness, joint_drive_stiffness_thickness_factor) * joint_drive_stiffness,
glm::pow(child_thickness, joint_drive_damping_thickness_factor) * joint_drive_damping,
enable_acceleration_for_drive);
#endif
}

Expand Down
10 changes: 5 additions & 5 deletions EvoEngine_Plugins/EcoSysLab/include/TreeIO/TreeIOTree.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ struct TreeDynamicMetaData {
void deserialize(const std::string &serialized);

/// Internal data holder.
json data{};
nlohmann::json data{};
}; // struct TreeDynamicMetaData

/// @brief Holds meta data containing information regarding the tree
Expand Down Expand Up @@ -200,12 +200,12 @@ struct TreeMetaData {
}

/// @brief Access the dynamic meta-data.
const json &dynamicData() const {
const nlohmann::json &dynamicData() const {
return mDynamicMetaData->data;
}

/// @brief Access the dynamic meta-data.
json &dynamicData() {
nlohmann::json &dynamicData() {
return mDynamicMetaData->data;
}

Expand Down Expand Up @@ -1571,8 +1571,8 @@ ArrayTreeT<DataT, MetaDataT> ArrayTreeT<DataT, MetaDataT>::parseTreeFromTreeStri
namespace impl {

inline auto getRootJSONObject(const std::string &serialized) {
const auto data{treeutil::containsOnlyWhiteSpaces(serialized) ? treeio::json{} : json::parse(serialized)};
const auto isArray{data.type() == json::value_t::array};
const auto data{treeutil::containsOnlyWhiteSpaces(serialized) ? nlohmann::json{} : nlohmann::json::parse(serialized)};
const auto isArray{data.type() == nlohmann::json::value_t::array};
return isArray ? *data.begin() : data;
}

Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/EcoSysLab/include/TreeIO/TreeIOUtils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include <utility>
#include <vector>

#include <json.h>
#include <nlohmann/json.hpp>

#include <glm/glm.hpp>
#define HAS_GLM
Expand Down
2 changes: 1 addition & 1 deletion EvoEngine_Plugins/EcoSysLab/src/Json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bool Json::SaveInternal(const std::filesystem::path& path) const {

bool Json::LoadInternal(const std::filesystem::path& path) {
std::ifstream ifs(path);
m_json = treeio::json::parse(ifs);
m_json = nlohmann::json::parse(ifs);
return true;
}

Expand Down
Loading

0 comments on commit 7689713

Please sign in to comment.