Minor - Smart pointer and switch from composition to aggregation for object relation with modelclass - V11.3.0
This commit is contained in:
@@ -42,6 +42,7 @@
|
||||
#include <algorithm>
|
||||
#include <DirectXMath.h>
|
||||
#include <mutex>
|
||||
#include <memory>
|
||||
|
||||
#include "shadow_map.h"
|
||||
#include "stats.h"
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
ImVec2 GetWindowSize() const { return windowSize; }
|
||||
|
||||
// Getters
|
||||
void SetApp(application_class* app) { app_ = app; }
|
||||
void SetApp(std::shared_ptr<application_class> app) { app_ = app; }
|
||||
|
||||
// Shader toggles
|
||||
|
||||
@@ -75,7 +75,7 @@ private:
|
||||
|
||||
std::vector<widget_entry> widgets_;
|
||||
|
||||
application_class* app_;
|
||||
std::shared_ptr<application_class> app_;
|
||||
scene_manager* scene_manager_;
|
||||
stats* stats_;
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ enum class ShaderType
|
||||
ALPHA_MAPPING
|
||||
};
|
||||
|
||||
class object : public model_class
|
||||
class object
|
||||
{
|
||||
public:
|
||||
object();
|
||||
@@ -35,6 +35,13 @@ public:
|
||||
object(const object&) = delete;
|
||||
object& operator=(const object&) = delete;
|
||||
|
||||
bool Initialize(
|
||||
ID3D11Device* device,
|
||||
ID3D11DeviceContext* deviceContext,
|
||||
char* modelFilename,
|
||||
TextureContainer& texturesContainer
|
||||
);
|
||||
|
||||
void SetScaleMatrix(XMMATRIX scaleMatrix);
|
||||
void SetRotateMatrix(XMMATRIX rotateMatrix);
|
||||
void SetTranslateMatrix(XMMATRIX translateMatrix);
|
||||
@@ -119,6 +126,9 @@ public:
|
||||
bool IsGravityEnabled() const { return m_gravityEnabled; }
|
||||
void SetGravityEnabled(bool state) { m_gravityEnabled = state; }
|
||||
|
||||
std::shared_ptr<model_class> get_model() const { return m_model_; }
|
||||
void SetModel(std::shared_ptr<model_class> model) { m_model_ = model; }
|
||||
|
||||
public :
|
||||
bool m_demoSpinning = false;
|
||||
XMVECTOR m_previousPosition;
|
||||
@@ -149,5 +159,7 @@ private:
|
||||
float m_alpha = 0.0f;
|
||||
float m_initialStretch = 0.0f;
|
||||
float m_springConstant = 10.0f;
|
||||
|
||||
std::shared_ptr<model_class> m_model_;
|
||||
|
||||
};
|
||||
|
||||
@@ -32,20 +32,12 @@ public:
|
||||
|
||||
void send_path(wchar_t* path, std::filesystem::path w_folder);
|
||||
|
||||
application_class* get_application_class() const { return application_; }
|
||||
void set_application_class(application_class* application) {
|
||||
if (application_) {
|
||||
delete application_;
|
||||
}
|
||||
application_ = application;
|
||||
}
|
||||
input_class* get_input_class() const { return input_; }
|
||||
void set_input(input_class* input) {
|
||||
if (input_) {
|
||||
delete input_;
|
||||
}
|
||||
input_ = input;
|
||||
}
|
||||
std::shared_ptr<application_class> get_application_class() const { return application_; }
|
||||
void set_application_class(std::shared_ptr<application_class> application) { application_ = std::move(application); }
|
||||
|
||||
std::shared_ptr<input_class> get_input_class() const { return input_; }
|
||||
void set_input(std::shared_ptr<input_class> input) { input_ = std::move(input); }
|
||||
|
||||
HWND get_hwnd() const { return hwnd_; }
|
||||
|
||||
void set_d_3D_mock(d_3d_class* mock) {application_->set_direct_3d(mock);}
|
||||
@@ -61,9 +53,9 @@ private:
|
||||
HINSTANCE hinstance_;
|
||||
HWND hwnd_;
|
||||
|
||||
input_class* input_;
|
||||
application_class* application_;
|
||||
imguiManager* imgui_manager_;
|
||||
std::shared_ptr<input_class> input_;
|
||||
std::shared_ptr<application_class> application_;
|
||||
std::shared_ptr<imguiManager> imgui_manager_;
|
||||
|
||||
int initial_window_width_;
|
||||
int initial_window_height_;
|
||||
|
||||
Reference in New Issue
Block a user