-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Connected the physics to the renderer. (#71)
Co-authored-by: ZacharyH777 <[email protected]>
- Loading branch information
1 parent
403996f
commit 524e8a2
Showing
22 changed files
with
622 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 8 additions & 7 deletions
15
TestApp/Scenes/Assets/Components/Graphics/SpriteRender3D.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,23 @@ | ||
|
||
#include <engine3d/Core/SceneManagment/Components/GameComponent.hpp> | ||
#include <Scenes/Assets/Components/Physics/PhysicsBody3D.hpp> | ||
#include <Core/SceneManagment/SceneObjects/SceneObject.hpp> | ||
#include <Scenes/Assets/Components/Graphics/Meshes/MeshContainer.hpp> | ||
|
||
#include <Core/GraphicDrivers/Mesh.hpp> | ||
class SpriteRender3D : public engine3d::GameComponent | ||
{ | ||
public: | ||
SpriteRender3D(MeshContainer* meshBody); | ||
void OnIntegrate(); | ||
void Update(); | ||
void LateUpdate(); | ||
void PhysicsUpdate(); | ||
SpriteRender3D() = default; | ||
SpriteRender3D(const engine3d::Mesh& p_MeshBody, engine3d::SceneObject* p_sceneObj); | ||
SpriteRender3D(const std::string& p_model, engine3d::SceneObject* p_sceneObj); | ||
void OnIntegrate(); | ||
void RenderObject(); | ||
std::vector<glm::vec3> vertices; | ||
std::vector<glm::vec3> normals; | ||
std::vector<glm::vec2> texCoords; | ||
|
||
private: | ||
MeshContainer* m_MeshContainer; | ||
engine3d::Mesh m_Mesh; | ||
engine3d::Transform m_Transform; | ||
glm::vec3* m_TransformPosition; | ||
}; |
30 changes: 30 additions & 0 deletions
30
TestApp/Scenes/Assets/WorldInstances/ShowCaseWorldInstance.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#include <Core/SceneManagment/SceneObjects/SceneObject.hpp> | ||
#include <Core/ApplicationManager/Scene.hpp> | ||
|
||
|
||
#include <vector> | ||
|
||
// #include "Core/SceneManagment/SceneObjects/SceneObject.hpp" | ||
class ShowCaseWorldInstance | ||
{ | ||
public: | ||
ShowCaseWorldInstance(); | ||
~ShowCaseWorldInstance(); | ||
std::vector<engine3d::Scene*> m_Scenes; | ||
engine3d::Scene* GetScene(); | ||
void RenderScenes(); | ||
|
||
|
||
private: | ||
void CreateObjects(); | ||
std::unordered_map<std::string, std::vector<engine3d::SceneObject *>> m_AllSceneObjecs; | ||
std::vector<engine3d::SceneObject*> m_SceneObjectList; | ||
std::vector<engine3d::SceneObject*> m_RenderedObjectList; | ||
std::vector<engine3d::SceneObject*> m_PointLightObjectList; | ||
std::vector<engine3d::SceneObject*> m_CameraObjectList; | ||
std::vector<engine3d::SceneObject*> m_PointRadiusLightList; | ||
|
||
glm::vec2 m_MousePosition; | ||
float m_MoveSpeed = {5.f}; | ||
float m_LookSpeed = {1.5f}; | ||
}; |
39 changes: 19 additions & 20 deletions
39
TestApp/src/Scenes/Assets/Components/Graphics/SpriteRender3D.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,33 @@ | ||
#include "Core/EngineLogger.hpp" | ||
#include "Core/GraphicDrivers/Mesh.hpp" | ||
#include <Scenes/Assets/Components/Graphics/SpriteRender3D.hpp> | ||
#include <Core/SceneManagment/SceneObjects/SceneObject.hpp> | ||
using namespace engine3d; | ||
|
||
const int Radius = 1; | ||
const int SectorCount = 10; | ||
const int StackCount = 10; | ||
|
||
SpriteRender3D::SpriteRender3D(MeshContainer* meshBody) : m_MeshContainer(meshBody){} | ||
SpriteRender3D::SpriteRender3D(const engine3d::Mesh& p_MeshBody, SceneObject* p_sceneObj) | ||
{ | ||
m_Mesh = p_MeshBody; | ||
p_sceneObj->SetMesh(m_Mesh); | ||
} | ||
|
||
void SpriteRender3D::OnIntegrate() | ||
SpriteRender3D::SpriteRender3D(const std::string& p_model, SceneObject* p_sceneObj) | ||
{ | ||
|
||
SyncUpdateManager::GetInstance()->Subscribe( | ||
this, &SpriteRender3D::Update); | ||
SyncUpdateManager::GetInstance()->Subscribe | ||
(this, &SpriteRender3D::LateUpdate); | ||
SyncUpdateManager::GetInstance()->Subscribe( | ||
this, &SpriteRender3D::PhysicsUpdate); | ||
m_Mesh = Mesh::LoadModel(p_model); | ||
p_sceneObj->SetMesh(m_Mesh); | ||
} | ||
|
||
|
||
void SpriteRender3D::OnIntegrate() | ||
{ | ||
// Need an activation and start fuction | ||
m_Transform = m_GameObjectRef->SceneGetComponent<Transform>(); | ||
m_Transform = m_GameObjectRef->GetComponent<Transform>(); | ||
m_TransformPosition = &m_Transform.m_Position; | ||
}; | ||
} | ||
|
||
void SpriteRender3D::Update() | ||
void SpriteRender3D::RenderObject() | ||
{ | ||
//! @note needs to be sent to the vulkanmodal | ||
m_MeshContainer->GetVertices(); | ||
}; | ||
|
||
void SpriteRender3D::LateUpdate() {}; | ||
|
||
void SpriteRender3D::PhysicsUpdate() {}; | ||
//! @note for special renderer/task based rendering | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.