diff --git a/TestApp/Application.cpp b/TestApp/Application.cpp index d04d8eb..b1cf406 100644 --- a/TestApp/Application.cpp +++ b/TestApp/Application.cpp @@ -1,6 +1,6 @@ #include "Core/EngineLogger.hpp" #include -#include "SceneTest/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp" +#include "Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp" #include namespace engine3d{ diff --git a/TestApp/CMakeLists.txt b/TestApp/CMakeLists.txt index e923169..7887f01 100644 --- a/TestApp/CMakeLists.txt +++ b/TestApp/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.15) project(TestApp CXX) + # find_package(Vulkan REQUIRED) # find_package(engine3d CONFIG REQUIRED) @@ -8,72 +9,68 @@ add_executable(${PROJECT_NAME} Application.cpp #To Test - SceneTest/Scenes/Assets/Components/testComp.hpp - SceneTest/src/Scenes/Assets/Components/testComp.cpp + Scenes/Assets/Components/testComp.hpp + src/Scenes/Assets/Components/testComp.cpp #Physics - SceneTest/Scenes/Assets/Components/Physics/PhysicsBody3D.hpp - SceneTest/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp + Scenes/Assets/Components/Physics/PhysicsBody3D.hpp + src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp - SceneTest/Scenes/Assets/Components/Bodies/BodyContainer.hpp - SceneTest/src/Scenes/Assets/Components/Bodies/BodyContainer.cpp + Scenes/Assets/Components/Bodies/BodyContainer.hpp + src/Scenes/Assets/Components/Bodies/BodyContainer.cpp #Body Shapes - SceneTest/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.hpp - SceneTest/src/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.cpp + Scenes/Assets/Components/Bodies/Shapes/BoxShaper.hpp + src/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.cpp - SceneTest/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.hpp - SceneTest/src/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.cpp + Scenes/Assets/Components/Bodies/Shapes/SphereShaper.hpp + src/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.cpp #Scenes - SceneTest/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp - SceneTest/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp - + Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp + src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp + + #Graphics + Scenes/Assets/Components/Graphics/SpriteRender3D.hpp + src/Scenes/Assets/Components/Graphics/SpriteRender3D.cpp + + #Graphics Meshes ChildrenMeshes + Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.hpp + src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.cpp + Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.hpp + # src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.cpp + src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.cpp + Scenes/Assets/Components/Graphics/Meshes/MeshContainer.hpp + src/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.cpp -) + ) -target_include_directories(${PROJECT_NAME} PUBLIC SceneTest) +target_include_directories(${PROJECT_NAME} PUBLIC ./ SceneTest) target_include_directories(${PROJECT_NAME} PRIVATE ../) target_compile_definitions(${PROJECT_NAME} PRIVATE ${dev_definitions}) -find_package(OpenGL REQUIRED) -find_package(glfw3 REQUIRED) - -find_package(Vulkan REQUIRED) -find_package(VulkanHeaders REQUIRED) - -if(LINUX) -find_package(VulkanLoader REQUIRED) -endif(LINUX) - -# target_include_directories(${PROJECT_NAME} PUBLIC ${ENGINE_INCLUDE_DIR}) -target_include_directories(${PROJECT_NAME} PRIVATE ../) -find_package(glm REQUIRED) find_package(fmt REQUIRED) find_package(spdlog REQUIRED) +find_package(glm REQUIRED) find_package(yaml-cpp REQUIRED) -find_package(imguidocking REQUIRED) -find_package(box2d REQUIRED) +find_package(Vulkan REQUIRED) find_package(joltphysics REQUIRED) find_package(EnTT REQUIRED) +find_package(imguidocking REQUIRED) target_link_libraries( ${PROJECT_NAME} PRIVATE - glfw - ${OPENGL_LIBRARIES} - Vulkan::Vulkan - vulkan-headers::vulkan-headers - glm::glm fmt::fmt spdlog::spdlog + glm::glm yaml-cpp::yaml-cpp - imguidocking::imguidocking - box2d::box2d + Vulkan::Vulkan Jolt::Jolt EnTT::EnTT + imguidocking::imguidocking engine3d ) \ No newline at end of file diff --git a/TestApp/SceneTest/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp b/TestApp/SceneTest/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp deleted file mode 100644 index 3701bd8..0000000 --- a/TestApp/SceneTest/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp +++ /dev/null @@ -1,111 +0,0 @@ -#include - -#include -#include -#include -#include -#include -#include -using namespace engine3d; -PhysicsBody3D::PhysicsBody3D(BodyContainer * p_bodyCon) -{ - bodyType = p_bodyCon; -} - -void PhysicsBody3D::OnIntegrate() -{ - SyncUpdateManager::GetInstance()->Subscribe - (this, &PhysicsBody3D::Update); - SyncUpdateManager::GetInstance()->Subscribe - (this, &PhysicsBody3D::LateUpdate); - SyncUpdateManager::GetInstance()->Subscribe - (this, &PhysicsBody3D::PhysicsUpdate); - - // Probably should be an event or called when activated - //! @note For now just calling Begin on integrate - - Begin(); -} - -void PhysicsBody3D::Begin() -{ - m_interface = engine3d::JoltHandler::GetInstance()->getInterface(); - m_Transform = &m_GameObjectRef->SceneGetComponent(); -} - -void PhysicsBody3D::Update() -{ - - //Convert Posiitons - m_Transform->m_Position.x = m_interface-> - GetCenterOfMassPosition(bodyType->m_BodyID).GetX(); - m_Transform->m_Position.y = m_interface-> - GetCenterOfMassPosition(bodyType->m_BodyID).GetY(); - m_Transform->m_Position.z = m_interface-> - GetCenterOfMassPosition(bodyType->m_BodyID).GetZ(); - - //Convert Rotations - m_Transform->m_QuaterionRot.x = m_interface-> - GetRotation(bodyType->m_BodyID).GetX(); - m_Transform->m_QuaterionRot.y = m_interface-> - GetRotation(bodyType->m_BodyID).GetY(); - m_Transform->m_QuaterionRot.z = m_interface-> - GetRotation(bodyType->m_BodyID).GetZ(); - m_Transform->m_QuaterionRot.w = m_interface-> - GetRotation(bodyType->m_BodyID).GetW(); - - //Convert Rotations - m_Transform->m_AxisRotation.x = m_interface-> - GetRotation(bodyType->m_BodyID).GetEulerAngles().GetX(); - m_Transform->m_AxisRotation.y = m_interface-> - GetRotation(bodyType->m_BodyID).GetEulerAngles().GetY(); - m_Transform->m_AxisRotation.z = m_interface-> - GetRotation(bodyType->m_BodyID).GetEulerAngles().GetZ(); - - // std::print("Rotation: (X: {0}, Y: {1}, Z: {2})\n", - // m_Transform->m_AxisRotation.x, - // m_Transform->m_AxisRotation.y, - // m_Transform->m_AxisRotation.z); - -} - -void PhysicsBody3D::SetScale(float x, float y, float z) -{ - m_interface->GetShape(bodyType->m_BodyID)->ScaleShape(RVec3(x,y,z)); -} - -void PhysicsBody3D::SetPosition(float x, float y, float z) -{ - m_interface->SetPosition( - bodyType->m_BodyID, - RVec3(x,y,z), - JPH::EActivation::Activate); -} - -void PhysicsBody3D::SetRotation(Quat quaternion) -{ - m_interface->SetRotation( - bodyType->m_BodyID, - quaternion, - JPH::EActivation::Activate); -} - -void PhysicsBody3D::LateUpdate() -{ - -} - -void PhysicsBody3D::PhysicsUpdate() -{ - -} - -BodyContainer* PhysicsBody3D::GetBody() -{ - return bodyType; -} - -PhysicsBody3D::~PhysicsBody3D() -{ - delete bodyType; -} \ No newline at end of file diff --git a/TestApp/SceneTest/Scenes/Assets/Components/Bodies/BodyContainer.hpp b/TestApp/Scenes/Assets/Components/Bodies/BodyContainer.hpp similarity index 100% rename from TestApp/SceneTest/Scenes/Assets/Components/Bodies/BodyContainer.hpp rename to TestApp/Scenes/Assets/Components/Bodies/BodyContainer.hpp diff --git a/TestApp/SceneTest/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.hpp b/TestApp/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.hpp similarity index 100% rename from TestApp/SceneTest/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.hpp rename to TestApp/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.hpp diff --git a/TestApp/SceneTest/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.hpp b/TestApp/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.hpp similarity index 100% rename from TestApp/SceneTest/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.hpp rename to TestApp/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.hpp diff --git a/TestApp/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.hpp b/TestApp/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.hpp new file mode 100644 index 0000000..a1889c2 --- /dev/null +++ b/TestApp/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.hpp @@ -0,0 +1,8 @@ +#pragma once +class CubeMesh +{ + public: + CubeMesh(); + void Draw(); + +}; \ No newline at end of file diff --git a/TestApp/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.hpp b/TestApp/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.hpp new file mode 100644 index 0000000..43aafef --- /dev/null +++ b/TestApp/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.hpp @@ -0,0 +1,14 @@ +#pragma once +#include "Core/SceneManagment/Components/GameComponent.hpp" +#include "Scenes/Assets/Components/Physics/PhysicsBody3D.hpp" + +class SphereMesh : public engine3d::GameComponent +{ + public: + SphereMesh(int Radius, int SectorCount, int StackCount) + void CreateSphere(); + + private: + engine3d::Transform m_Transform; + glm::vec3* m_TransformPosition; +}; \ No newline at end of file diff --git a/TestApp/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.hpp b/TestApp/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.hpp new file mode 100644 index 0000000..7f7fd58 --- /dev/null +++ b/TestApp/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.hpp @@ -0,0 +1,17 @@ +#include +#include +#include + +//! @brief Factory +class MeshContainer +{ + public: + MeshContainer(); + + + private: + + std::vector vertices; + std::vector normals; + std::vector texCoords; +}; \ No newline at end of file diff --git a/TestApp/Scenes/Assets/Components/Graphics/SpriteRender3D.hpp b/TestApp/Scenes/Assets/Components/Graphics/SpriteRender3D.hpp new file mode 100644 index 0000000..861ad20 --- /dev/null +++ b/TestApp/Scenes/Assets/Components/Graphics/SpriteRender3D.hpp @@ -0,0 +1,22 @@ + +#include +#include +#include + +class SpriteRender3D : public engine3d::GameComponent +{ + public: + SpriteRender3D(MeshContainer* meshBody); + void OnIntegrate(); + void Update(); + void LateUpdate(); + void PhysicsUpdate(); + std::vector vertices; + std::vector normals; + std::vector texCoords; + + private: + MeshContainer m_MeshContainer; + engine3d::Transform m_Transform; + glm::vec3* m_TransformPosition; +}; \ No newline at end of file diff --git a/TestApp/SceneTest/Scenes/Assets/Components/Physics/PhysicsBody3D.hpp b/TestApp/Scenes/Assets/Components/Physics/PhysicsBody3D.hpp similarity index 100% rename from TestApp/SceneTest/Scenes/Assets/Components/Physics/PhysicsBody3D.hpp rename to TestApp/Scenes/Assets/Components/Physics/PhysicsBody3D.hpp diff --git a/TestApp/SceneTest/Scenes/Assets/Components/testComp.hpp b/TestApp/Scenes/Assets/Components/testComp.hpp similarity index 100% rename from TestApp/SceneTest/Scenes/Assets/Components/testComp.hpp rename to TestApp/Scenes/Assets/Components/testComp.hpp diff --git a/TestApp/SceneTest/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp b/TestApp/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp similarity index 100% rename from TestApp/SceneTest/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp rename to TestApp/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp diff --git a/TestApp/SceneTest/src/Scenes/Assets/Components/Bodies/BodyContainer.cpp b/TestApp/src/Scenes/Assets/Components/Bodies/BodyContainer.cpp similarity index 100% rename from TestApp/SceneTest/src/Scenes/Assets/Components/Bodies/BodyContainer.cpp rename to TestApp/src/Scenes/Assets/Components/Bodies/BodyContainer.cpp diff --git a/TestApp/SceneTest/src/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.cpp b/TestApp/src/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.cpp similarity index 100% rename from TestApp/SceneTest/src/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.cpp rename to TestApp/src/Scenes/Assets/Components/Bodies/Shapes/BoxShaper.cpp diff --git a/TestApp/SceneTest/src/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.cpp b/TestApp/src/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.cpp similarity index 100% rename from TestApp/SceneTest/src/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.cpp rename to TestApp/src/Scenes/Assets/Components/Bodies/Shapes/SphereShaper.cpp diff --git a/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.cpp b/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.cpp new file mode 100644 index 0000000..b5c1dec --- /dev/null +++ b/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.cpp @@ -0,0 +1,63 @@ +#include +#include +#include + +void CubeMesh::Draw() +{ + Ref CreateCubeMesh(glm::vec3 offset){ + std::vector vertices{ + // left face (white) + {{-.5f, -.5f, -.5f}, {.9f, .9f, .9f}}, + {{-.5f, .5f, .5f}, {.9f, .9f, .9f}}, + {{-.5f, -.5f, .5f}, {.9f, .9f, .9f}}, + {{-.5f, -.5f, -.5f}, {.9f, .9f, .9f}}, + {{-.5f, .5f, -.5f}, {.9f, .9f, .9f}}, + {{-.5f, .5f, .5f}, {.9f, .9f, .9f}}, + + // right face (yellow) + {{.5f, -.5f, -.5f}, {.8f, .8f, .1f}}, + {{.5f, .5f, .5f}, {.8f, .8f, .1f}}, + {{.5f, -.5f, .5f}, {.8f, .8f, .1f}}, + {{.5f, -.5f, -.5f}, {.8f, .8f, .1f}}, + {{.5f, .5f, -.5f}, {.8f, .8f, .1f}}, + {{.5f, .5f, .5f}, {.8f, .8f, .1f}}, + + // top face (orange, remember y axis points down) + {{-.5f, -.5f, -.5f}, {.9f, .6f, .1f}}, + {{.5f, -.5f, .5f}, {.9f, .6f, .1f}}, + {{-.5f, -.5f, .5f}, {.9f, .6f, .1f}}, + {{-.5f, -.5f, -.5f}, {.9f, .6f, .1f}}, + {{.5f, -.5f, -.5f}, {.9f, .6f, .1f}}, + {{.5f, -.5f, .5f}, {.9f, .6f, .1f}}, + + // bottom face (red) + {{-.5f, .5f, -.5f}, {.8f, .1f, .1f}}, + {{.5f, .5f, .5f}, {.8f, .1f, .1f}}, + {{-.5f, .5f, .5f}, {.8f, .1f, .1f}}, + {{-.5f, .5f, -.5f}, {.8f, .1f, .1f}}, + {{.5f, .5f, -.5f}, {.8f, .1f, .1f}}, + {{.5f, .5f, .5f}, {.8f, .1f, .1f}}, + + // nose face (blue) + {{-.5f, -.5f, 0.5f}, {.1f, .1f, .8f}}, + {{.5f, .5f, 0.5f}, {.1f, .1f, .8f}}, + {{-.5f, .5f, 0.5f}, {.1f, .1f, .8f}}, + {{-.5f, -.5f, 0.5f}, {.1f, .1f, .8f}}, + {{.5f, -.5f, 0.5f}, {.1f, .1f, .8f}}, + {{.5f, .5f, 0.5f}, {.1f, .1f, .8f}}, + + // tail face (green) + {{-.5f, -.5f, -0.5f}, {.1f, .8f, .1f}}, + {{.5f, .5f, -0.5f}, {.1f, .8f, .1f}}, + {{-.5f, .5f, -0.5f}, {.1f, .8f, .1f}}, + {{-.5f, -.5f, -0.5f}, {.1f, .8f, .1f}}, + {{.5f, -.5f, -0.5f}, {.1f, .8f, .1f}}, + {{.5f, .5f, -0.5f}, {.1f, .8f, .1f}}, + }; + + for (auto& v : vertices) { + v.Position += offset; + } + return CreateRef(vertices, VK_BUFFER_USAGE_VERTEX_BUFFER_BIT, VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT | VK_MEMORY_PROPERTY_HOST_COHERENT_BIT); + } +} \ No newline at end of file diff --git a/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.cpp b/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.cpp new file mode 100644 index 0000000..a9776db --- /dev/null +++ b/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.cpp @@ -0,0 +1,10 @@ +// #include "Core/EngineLogger.hpp" +// #include +// #include +#include +using namespace engine3d; + +void SphereMesh::CreateSphere(){ + m_Transform = m_GameObjectRef->SceneGetComponent(); + m_TransformPosition = &m_Transform.m_Position; +} \ No newline at end of file diff --git a/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.cpp b/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.cpp new file mode 100644 index 0000000..7bb919b --- /dev/null +++ b/TestApp/src/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.cpp @@ -0,0 +1,53 @@ +#include +#include +void MeshContainer::SphereBlueprint() +{ + std::vector().swap(normals); + std::vector().swap(vertices); + std::vector().swap(texCoords); + float nx, ny, nz, LengthInv = 1.0f / Radius; //vertex normal + float x, y, z, xy; //vertex position + float s, t; //vertex texCoord + float SectorStep = 2 * std::numbers::pi / SectorCount; + float StackStep = std::numbers::pi / StackCount; + float SectorAngle, StackAngle; + for(int i = 0; i <= StackCount; ++i) + { + // starting from pi/2 to -pi/2 + StackAngle = std::numbers::pi / 2 - i * StackStep; + xy = Radius * cosf(StackAngle); // r * cos(u) + z = Radius * sinf(StackAngle); // r * sin(u) + + // add (SectorCount+1) vertices per stack + // first and last vertices have same position + // and normal, but different tex coords + for(int j = 0; j <= SectorCount; ++j) + { + + SectorAngle = j * SectorStep; // starting from 0 to 2pi + + // vertex position (x, y, z) + x = xy * cosf(SectorAngle); // r * cos(u) * cos(v) + y = xy * sinf(SectorAngle); // r * cos(u) * sin(v) + vertices.push_back(glm::vec3(x,y,z)); + + // normalized vertex normal (nx, ny, nz) + nx = x * LengthInv; + ny = y * LengthInv; + nz = z * LengthInv; + normals.push_back(glm::vec3(nx,ny,nz)); + + // vertex tex coord (s, t) range between [0, 1] + s = (float)j / SectorCount; + t = (float)i / StackCount; + texCoords.push_back(glm::vec2(s,t)); + } + } + // For loop is used for printing out the position vectors + for (auto position : vertices) + { + ConsoleLogInfo("vector positions: ({0}, {1}, {2})", position.x, + position.y, position.z); + } +}; + diff --git a/TestApp/src/Scenes/Assets/Components/Graphics/SpriteRender3D.cpp b/TestApp/src/Scenes/Assets/Components/Graphics/SpriteRender3D.cpp new file mode 100644 index 0000000..5204b1f --- /dev/null +++ b/TestApp/src/Scenes/Assets/Components/Graphics/SpriteRender3D.cpp @@ -0,0 +1,52 @@ +#include +#include +#include +#include + +// #include "Scene" + +using namespace engine3d; + const int Radius = 1; + const int SectorCount = 10; + const int StackCount = 10; + +SpriteRender3D(MeshContainer* meshBody) : m_MeshContainter(meshBody){} +void SpriteRender3D::CreateMesh() +{ + // TODO: change from hardcoded values later + MeshContainer myMeshContainer(int 1, int 10, int 10); + myMeshContainer.SphereBlueprint(); +}; + +void SpriteRender3D::OnIntegrate() +{ + + SyncUpdateManager::GetInstance()->Subscribe( + this, &SpriteRender3D::Update); + SyncUpdateManager::GetInstance()->Subscribe + (this, &SpriteRender3D::LateUpdate); + SyncUpdateManager::GetInstance()->Subscribe( + this, &SpriteRender3D::PhysicsUpdate); + + // Need an activation and start fuction + m_Transform = m_GameObjectRef->SceneGetComponent(); + m_TransformPosition = &m_Transform.m_Position; +}; + +void SpriteRender3D::Update() +{ +// std::vector().swap(normals); +// std::vector().swap(vertices); +// std::vector().swap(texCoords); +// float x, y, z, xy; //vertex position +// float nx, ny, nz, LengthInv = 1.0f / Radius; //vertex normal +// float s, t; //vertex texCoord +// float SectorStep = 2 * std::numbers::pi / SectorCount; +// float StackStep = std::numbers::pi / StackCount; +// float SectorAngle, StackAngle; + +}; + +void SpriteRender3D::LateUpdate() {}; + +void SpriteRender3D::PhysicsUpdate() {}; \ No newline at end of file diff --git a/TestApp/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp b/TestApp/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp new file mode 100644 index 0000000..b4fdcd6 --- /dev/null +++ b/TestApp/src/Scenes/Assets/Components/Physics/PhysicsBody3D.cpp @@ -0,0 +1,68 @@ +#include +#include +#include +using namespace engine3d; +PhysicsBody3D::PhysicsBody3D(BodyContainer * p_bodyCon) +{ + bodyType = p_bodyCon; +} + +void PhysicsBody3D::OnIntegrate() +{ + SyncUpdateManager::GetInstance()->Subscribe + (this, &PhysicsBody3D::Update); + SyncUpdateManager::GetInstance()->Subscribe + (this, &PhysicsBody3D::LateUpdate); + SyncUpdateManager::GetInstance()->Subscribe + (this, &PhysicsBody3D::PhysicsUpdate); + + // Probably should be an event or called when activated + //! @note For now just calling Begin on integrate + + Begin(); +} + +void PhysicsBody3D::Begin() +{ + m_interface = engine3d::JoltHandler::GetInstance()->getInterface(); + m_Transform = &m_GameObjectRef->SceneGetComponent(); +} + +void PhysicsBody3D::Update() +{ + m_Transform->m_Position.x = m_interface->GetCenterOfMassPosition(bodyType->m_BodyID).GetX(); + m_Transform->m_Position.y = m_interface->GetCenterOfMassPosition(bodyType->m_BodyID).GetY(); + m_Transform->m_Position.z = m_interface->GetCenterOfMassPosition(bodyType->m_BodyID).GetZ(); + + //m_interface->ResetSleepTimer(bodyType->m_BodyID); + //! @note for testing purposes! + + // if(bodyType->m_BodyID.GetIndex()) + // { + // printf("BODY_ID %i:(X:%f, Y:%f, Z:%f)\n", + // bodyType->m_BodyID.GetIndex(), + // m_Transform->m_Position.x, + // m_Transform->m_Position.y, + // m_Transform->m_Position.z); + // } +} + +void PhysicsBody3D::LateUpdate() +{ + +} + +void PhysicsBody3D::PhysicsUpdate() +{ + +} + +BodyContainer* PhysicsBody3D::GetBody() +{ + return bodyType; +} + +PhysicsBody3D::~PhysicsBody3D() +{ + delete bodyType; +} \ No newline at end of file diff --git a/TestApp/SceneTest/src/Scenes/Assets/Components/testComp.cpp b/TestApp/src/Scenes/Assets/Components/testComp.cpp similarity index 100% rename from TestApp/SceneTest/src/Scenes/Assets/Components/testComp.cpp rename to TestApp/src/Scenes/Assets/Components/testComp.cpp diff --git a/TestApp/SceneTest/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp b/TestApp/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp similarity index 64% rename from TestApp/SceneTest/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp rename to TestApp/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp index 1e2706e..5ab78fe 100644 --- a/TestApp/SceneTest/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp +++ b/TestApp/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp @@ -4,12 +4,15 @@ #include "Scenes/Assets/Components/testComp.hpp" #include #include -#include +#include +#include +#include +#include ShowCaseSceneInstance::ShowCaseSceneInstance() { m_Scene = new engine3d::Scene(); - printf("getting here\n"); + printf("getting here/n"); CreateObjects(); } @@ -20,12 +23,18 @@ void ShowCaseSceneInstance::CreateObjects() m_SceneObjects.push_back(new engine3d::SceneObject(m_Scene)); BodyContainer * l_Body = new BoxShaper(); m_SceneObjects[0]->AddComponent(l_Body); + + MeshContainer * l_Mesh = new CubeMesh(); + m_SceneObjects[0]->AddComponent(l_Mesh); m_SceneObjects[0]->name = "Platform1"; //Sphere m_SceneObjects.push_back(new engine3d::SceneObject(m_Scene)); l_Body = new SphereShaper(); m_SceneObjects[1]->AddComponent(l_Body); + // why is l_Mesh assigned the address of SphereMesh() + // the first index of m_SceneObjects is assigned the value of + // SpriteRender3D instance?? But what does l_mesh do in this line? m_SceneObjects[1]->AddComponent(); m_SceneObjects[1]->name = "Ball"; diff --git a/engine3d/Core/API.hpp b/sim_shader_transforms/engine3d/Core/API.hpp similarity index 100% rename from engine3d/Core/API.hpp rename to sim_shader_transforms/engine3d/Core/API.hpp diff --git a/engine3d/Core/ApplicationInstance.hpp b/sim_shader_transforms/engine3d/Core/ApplicationInstance.hpp similarity index 100% rename from engine3d/Core/ApplicationInstance.hpp rename to sim_shader_transforms/engine3d/Core/ApplicationInstance.hpp diff --git a/engine3d/Core/ApplicationManager/GameObjManager/UUID.hpp b/sim_shader_transforms/engine3d/Core/ApplicationManager/GameObjManager/UUID.hpp similarity index 100% rename from engine3d/Core/ApplicationManager/GameObjManager/UUID.hpp rename to sim_shader_transforms/engine3d/Core/ApplicationManager/GameObjManager/UUID.hpp diff --git a/engine3d/Core/ApplicationManager/Scene.hpp b/sim_shader_transforms/engine3d/Core/ApplicationManager/Scene.hpp similarity index 100% rename from engine3d/Core/ApplicationManager/Scene.hpp rename to sim_shader_transforms/engine3d/Core/ApplicationManager/Scene.hpp diff --git a/engine3d/Core/ApplicationManager/ThreadMngr.hpp b/sim_shader_transforms/engine3d/Core/ApplicationManager/ThreadMngr.hpp similarity index 100% rename from engine3d/Core/ApplicationManager/ThreadMngr.hpp rename to sim_shader_transforms/engine3d/Core/ApplicationManager/ThreadMngr.hpp diff --git a/engine3d/Core/Core.hpp b/sim_shader_transforms/engine3d/Core/Core.hpp similarity index 100% rename from engine3d/Core/Core.hpp rename to sim_shader_transforms/engine3d/Core/Core.hpp diff --git a/engine3d/Core/EngineLogger.hpp b/sim_shader_transforms/engine3d/Core/EngineLogger.hpp similarity index 100% rename from engine3d/Core/EngineLogger.hpp rename to sim_shader_transforms/engine3d/Core/EngineLogger.hpp diff --git a/engine3d/Core/Event/Event.hpp b/sim_shader_transforms/engine3d/Core/Event/Event.hpp similarity index 100% rename from engine3d/Core/Event/Event.hpp rename to sim_shader_transforms/engine3d/Core/Event/Event.hpp diff --git a/engine3d/Core/Event/InputPoll.hpp b/sim_shader_transforms/engine3d/Core/Event/InputPoll.hpp similarity index 100% rename from engine3d/Core/Event/InputPoll.hpp rename to sim_shader_transforms/engine3d/Core/Event/InputPoll.hpp diff --git a/engine3d/Core/Event/KeyCodes.hpp b/sim_shader_transforms/engine3d/Core/Event/KeyCodes.hpp similarity index 100% rename from engine3d/Core/Event/KeyCodes.hpp rename to sim_shader_transforms/engine3d/Core/Event/KeyCodes.hpp diff --git a/engine3d/Core/Event/KeyEvent.hpp b/sim_shader_transforms/engine3d/Core/Event/KeyEvent.hpp similarity index 100% rename from engine3d/Core/Event/KeyEvent.hpp rename to sim_shader_transforms/engine3d/Core/Event/KeyEvent.hpp diff --git a/engine3d/Core/Event/MouseCodes.hpp b/sim_shader_transforms/engine3d/Core/Event/MouseCodes.hpp similarity index 100% rename from engine3d/Core/Event/MouseCodes.hpp rename to sim_shader_transforms/engine3d/Core/Event/MouseCodes.hpp diff --git a/engine3d/Core/Event/MouseEvent.hpp b/sim_shader_transforms/engine3d/Core/Event/MouseEvent.hpp similarity index 100% rename from engine3d/Core/Event/MouseEvent.hpp rename to sim_shader_transforms/engine3d/Core/Event/MouseEvent.hpp diff --git a/engine3d/Core/GraphicDrivers/GraphicContextDriver.hpp b/sim_shader_transforms/engine3d/Core/GraphicDrivers/GraphicContextDriver.hpp similarity index 100% rename from engine3d/Core/GraphicDrivers/GraphicContextDriver.hpp rename to sim_shader_transforms/engine3d/Core/GraphicDrivers/GraphicContextDriver.hpp diff --git a/engine3d/Core/GraphicDrivers/GraphicPhysicalDriver.hpp b/sim_shader_transforms/engine3d/Core/GraphicDrivers/GraphicPhysicalDriver.hpp similarity index 100% rename from engine3d/Core/GraphicDrivers/GraphicPhysicalDriver.hpp rename to sim_shader_transforms/engine3d/Core/GraphicDrivers/GraphicPhysicalDriver.hpp diff --git a/engine3d/Core/GraphicDrivers/GraphicSwapchain.hpp b/sim_shader_transforms/engine3d/Core/GraphicDrivers/GraphicSwapchain.hpp similarity index 100% rename from engine3d/Core/GraphicDrivers/GraphicSwapchain.hpp rename to sim_shader_transforms/engine3d/Core/GraphicDrivers/GraphicSwapchain.hpp diff --git a/engine3d/Core/GraphicDrivers/Shader.hpp b/sim_shader_transforms/engine3d/Core/GraphicDrivers/Shader.hpp similarity index 100% rename from engine3d/Core/GraphicDrivers/Shader.hpp rename to sim_shader_transforms/engine3d/Core/GraphicDrivers/Shader.hpp diff --git a/engine3d/Core/Renderer/Renderer.hpp b/sim_shader_transforms/engine3d/Core/Renderer/Renderer.hpp similarity index 100% rename from engine3d/Core/Renderer/Renderer.hpp rename to sim_shader_transforms/engine3d/Core/Renderer/Renderer.hpp diff --git a/engine3d/Core/Renderer/RendererSettings.hpp b/sim_shader_transforms/engine3d/Core/Renderer/RendererSettings.hpp similarity index 100% rename from engine3d/Core/Renderer/RendererSettings.hpp rename to sim_shader_transforms/engine3d/Core/Renderer/RendererSettings.hpp diff --git a/engine3d/Core/Scene/SceneObject.hpp b/sim_shader_transforms/engine3d/Core/Scene/SceneObject.hpp similarity index 100% rename from engine3d/Core/Scene/SceneObject.hpp rename to sim_shader_transforms/engine3d/Core/Scene/SceneObject.hpp diff --git a/engine3d/Core/SceneManagment/Components/GameComponent.hpp b/sim_shader_transforms/engine3d/Core/SceneManagment/Components/GameComponent.hpp similarity index 100% rename from engine3d/Core/SceneManagment/Components/GameComponent.hpp rename to sim_shader_transforms/engine3d/Core/SceneManagment/Components/GameComponent.hpp diff --git a/engine3d/Core/SceneManagment/Components/SPComps/Transform.hpp b/sim_shader_transforms/engine3d/Core/SceneManagment/Components/SPComps/Transform.hpp similarity index 100% rename from engine3d/Core/SceneManagment/Components/SPComps/Transform.hpp rename to sim_shader_transforms/engine3d/Core/SceneManagment/Components/SPComps/Transform.hpp diff --git a/engine3d/Core/SceneManagment/SceneObjects/SceneObject.hpp b/sim_shader_transforms/engine3d/Core/SceneManagment/SceneObjects/SceneObject.hpp similarity index 100% rename from engine3d/Core/SceneManagment/SceneObjects/SceneObject.hpp rename to sim_shader_transforms/engine3d/Core/SceneManagment/SceneObjects/SceneObject.hpp diff --git a/engine3d/Core/TimeManagement/GlobalUpdateManager.hpp b/sim_shader_transforms/engine3d/Core/TimeManagement/GlobalUpdateManager.hpp similarity index 100% rename from engine3d/Core/TimeManagement/GlobalUpdateManager.hpp rename to sim_shader_transforms/engine3d/Core/TimeManagement/GlobalUpdateManager.hpp diff --git a/engine3d/Core/TimeManagement/Timer.hpp b/sim_shader_transforms/engine3d/Core/TimeManagement/Timer.hpp similarity index 100% rename from engine3d/Core/TimeManagement/Timer.hpp rename to sim_shader_transforms/engine3d/Core/TimeManagement/Timer.hpp diff --git a/engine3d/Core/TimeManagement/UpdateManagers/ParallelFrameUpdateManager.hpp b/sim_shader_transforms/engine3d/Core/TimeManagement/UpdateManagers/ParallelFrameUpdateManager.hpp similarity index 100% rename from engine3d/Core/TimeManagement/UpdateManagers/ParallelFrameUpdateManager.hpp rename to sim_shader_transforms/engine3d/Core/TimeManagement/UpdateManagers/ParallelFrameUpdateManager.hpp diff --git a/engine3d/Core/TimeManagement/UpdateManagers/SyncUpdateManager.hpp b/sim_shader_transforms/engine3d/Core/TimeManagement/UpdateManagers/SyncUpdateManager.hpp similarity index 100% rename from engine3d/Core/TimeManagement/UpdateManagers/SyncUpdateManager.hpp rename to sim_shader_transforms/engine3d/Core/TimeManagement/UpdateManagers/SyncUpdateManager.hpp diff --git a/engine3d/Core/Timestep.hpp b/sim_shader_transforms/engine3d/Core/Timestep.hpp similarity index 100% rename from engine3d/Core/Timestep.hpp rename to sim_shader_transforms/engine3d/Core/Timestep.hpp diff --git a/engine3d/Core/Window.hpp b/sim_shader_transforms/engine3d/Core/Window.hpp similarity index 100% rename from engine3d/Core/Window.hpp rename to sim_shader_transforms/engine3d/Core/Window.hpp diff --git a/engine3d/Core/internal/CoreInternal.hpp b/sim_shader_transforms/engine3d/Core/internal/CoreInternal.hpp similarity index 100% rename from engine3d/Core/internal/CoreInternal.hpp rename to sim_shader_transforms/engine3d/Core/internal/CoreInternal.hpp diff --git a/engine3d/Core/internal/FrameTimer.hpp b/sim_shader_transforms/engine3d/Core/internal/FrameTimer.hpp similarity index 100% rename from engine3d/Core/internal/FrameTimer.hpp rename to sim_shader_transforms/engine3d/Core/internal/FrameTimer.hpp diff --git a/engine3d/Core/internal/Serializer.hpp b/sim_shader_transforms/engine3d/Core/internal/Serializer.hpp similarity index 100% rename from engine3d/Core/internal/Serializer.hpp rename to sim_shader_transforms/engine3d/Core/internal/Serializer.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderPipelineConfig.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderPipelineConfig.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderPipelineConfig.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderPipelineConfig.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderSpirvBins.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderSpirvBins.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderSpirvBins.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Shaders/ShaderSpirvBins.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/Shaders/VulkanShader.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Shaders/VulkanShader.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/Shaders/VulkanShader.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Shaders/VulkanShader.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/Vulkan.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Vulkan.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/Vulkan.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/Vulkan.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/VulkanContext.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanContext.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/VulkanContext.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanContext.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/VulkanDriver.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanDriver.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/VulkanDriver.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanDriver.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/VulkanModel.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanModel.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/VulkanModel.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanModel.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/VulkanPhysicalDriver.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanPhysicalDriver.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/VulkanPhysicalDriver.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanPhysicalDriver.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/VulkanSwapchain.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanSwapchain.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/VulkanSwapchain.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanSwapchain.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/VulkanWindow.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanWindow.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/VulkanWindow.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/VulkanWindow.hpp diff --git a/engine3d/Core/internal/Vulkan2Showcase/helper_functions.hpp b/sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/helper_functions.hpp similarity index 100% rename from engine3d/Core/internal/Vulkan2Showcase/helper_functions.hpp rename to sim_shader_transforms/engine3d/Core/internal/Vulkan2Showcase/helper_functions.hpp diff --git a/engine3d/Math/Interpolation.hpp b/sim_shader_transforms/engine3d/Math/Interpolation.hpp similarity index 100% rename from engine3d/Math/Interpolation.hpp rename to sim_shader_transforms/engine3d/Math/Interpolation.hpp diff --git a/engine3d/Physics/Interaction/Engine3DActivationListener.hpp b/sim_shader_transforms/engine3d/Physics/Interaction/Engine3DActivationListener.hpp similarity index 100% rename from engine3d/Physics/Interaction/Engine3DActivationListener.hpp rename to sim_shader_transforms/engine3d/Physics/Interaction/Engine3DActivationListener.hpp diff --git a/engine3d/Physics/Interaction/Engine3DContactListener.hpp b/sim_shader_transforms/engine3d/Physics/Interaction/Engine3DContactListener.hpp similarity index 100% rename from engine3d/Physics/Interaction/Engine3DContactListener.hpp rename to sim_shader_transforms/engine3d/Physics/Interaction/Engine3DContactListener.hpp diff --git a/engine3d/Physics/Interfaces/BPLayerInterfaceHandler.hpp b/sim_shader_transforms/engine3d/Physics/Interfaces/BPLayerInterfaceHandler.hpp similarity index 100% rename from engine3d/Physics/Interfaces/BPLayerInterfaceHandler.hpp rename to sim_shader_transforms/engine3d/Physics/Interfaces/BPLayerInterfaceHandler.hpp diff --git a/engine3d/Physics/Interfaces/ObjectLayerPairFilterInterface.hpp b/sim_shader_transforms/engine3d/Physics/Interfaces/ObjectLayerPairFilterInterface.hpp similarity index 100% rename from engine3d/Physics/Interfaces/ObjectLayerPairFilterInterface.hpp rename to sim_shader_transforms/engine3d/Physics/Interfaces/ObjectLayerPairFilterInterface.hpp diff --git a/engine3d/Physics/Interfaces/ObjectVsBPLayerFilterInterface.hpp b/sim_shader_transforms/engine3d/Physics/Interfaces/ObjectVsBPLayerFilterInterface.hpp similarity index 100% rename from engine3d/Physics/Interfaces/ObjectVsBPLayerFilterInterface.hpp rename to sim_shader_transforms/engine3d/Physics/Interfaces/ObjectVsBPLayerFilterInterface.hpp diff --git a/engine3d/Physics/JoltHandler.hpp b/sim_shader_transforms/engine3d/Physics/JoltHandler.hpp similarity index 100% rename from engine3d/Physics/JoltHandler.hpp rename to sim_shader_transforms/engine3d/Physics/JoltHandler.hpp diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 186270a..33489da 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,10 @@ build_library( ${ENGINE_INCLUDE_NAME}/Core/SceneManagment/SceneObjects/SceneObject.hpp ${ENGINE_INCLUDE_NAME}/Core/ApplicationManager/GameObjManager/UUID.hpp + # ${ENGINE_INCLUDE_NAME}/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes + # ${ENGINE_SRC_DIR}/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/SphereMesh.cpp + # ${ENGINE_INCLUDE_NAME}/src/Scenes/Assets/Components/Graphics/Meshes/ChildrenMeshes/CubeMesh.cpp + # Special Component Includes ${ENGINE_INCLUDE_NAME}/Core/SceneManagment/Components/SPComps/Transform.hpp