Skip to content

Commit

Permalink
Get our D3D12 device and command list on our mesh component
Browse files Browse the repository at this point in the history
  • Loading branch information
PR3C14D0 committed Aug 14, 2024
1 parent ec6744c commit b9f9daf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/private/Core/GameObject/Component/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
Mesh::Mesh(std::string name) : Component::Component(name) {
this->m_core = Core::GetInstance();

this->m_dev = nullptr;
this->m_list = nullptr;

this->m_renderer = nullptr;
}

Expand All @@ -18,5 +21,8 @@ void Mesh::Init() {
}

void Mesh::D3D12Init(D3D12* renderer) {

renderer->GetDevice(this->m_dev);
renderer->GetCommandList(this->m_list);


}
8 changes: 6 additions & 2 deletions src/private/Core/GameObject/GameObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,13 @@ GameObject::GameObject(std::string name) {
}

void GameObject::Init() {

for (Component* component : this->m_components) {
component->Init();
}
}

void GameObject::Update() {

for (Component* component : this->m_components) {
component->Update();
}
}
6 changes: 6 additions & 0 deletions src/public/Core/GameObject/Component/Mesh.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
#include <Windows.h>
#include <d3d12.h>
#include <wrl.h>
#include <vector>

#include "Core/GameObject/Component/Component.h"

Expand All @@ -20,6 +21,11 @@ class Mesh : public Component {
Renderer* m_renderer;

void D3D12Init(D3D12* renderer);

ComPtr<ID3D12Device1> m_dev;
ComPtr<ID3D12GraphicsCommandList> m_list;

std::vector<ComPtr<ID3D12Resource>> m_buffers;
public:
Mesh(std::string name);

Expand Down

0 comments on commit b9f9daf

Please sign in to comment.