-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDrawable.h
More file actions
44 lines (40 loc) · 1.5 KB
/
Drawable.h
File metadata and controls
44 lines (40 loc) · 1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#pragma once
#include "Graphics.h"
#include <DirectXMath.h>
class Bindable;
class IndexBuffer;
class Drawable {
template<class T>
friend class DrawableBase;
public:
Drawable() = default;
Drawable(const Drawable&) = delete;
// Returns the matrix that represents the transform of this current model
virtual DirectX::XMMATRIX GetTransformXM() const noexcept = 0;
// Binds all parts pipeline parts related to this model and draws the object
//
// gfx: A reference to a Graphics instance
void Draw(Graphics& gfx) const noexcept(!IS_DEBUG);
// Updates the information of the model in a form of time
//
// dt: The change of time since the last call
virtual void Update(float dt) noexcept = 0;
virtual ~Drawable() = default;
protected:
// Adds a bindable to this object's collection (I.E. attaching it to this object)
//
// bind: The bindable to be added to this object's collection
// WARNING: Use AddIndexBuffer() to add an IndexBuffer
// AddIndexBuffer() handles extra operations needed for using the idex buffer
void AddBind(std::unique_ptr<Bindable> bind) noexcept(!IS_DEBUG);
// Attachs an indexbuffer to this object
//
// ibuf: The index buffer for this object
// WARNING: ONLY 1 call of AddIndexBuffer() is allowed
void AddIndexBuffer(std::unique_ptr<class IndexBuffer> ibuf) noexcept(!IS_DEBUG);
private:
virtual const std::vector<std::unique_ptr<Bindable>>& GetStaticBinds() const noexcept = 0;
private:
const class IndexBuffer* pIndexBuffer = nullptr;
std::vector<std::unique_ptr<Bindable>> binds;
};