53 lines
1.4 KiB
C++
53 lines
1.4 KiB
C++
//
|
|
// Created by Epagris on 2020. 03. 19..
|
|
//
|
|
|
|
#ifndef ENTITY
|
|
#define ENTITY
|
|
|
|
#include "Geometry.h"
|
|
#include "IHasDefault.h"
|
|
#include "const_bufs.h"
|
|
|
|
namespace eg3d {
|
|
|
|
// nagyítás, forgatás, eltolás
|
|
struct SRTProps : public IHasDefault {
|
|
XMFLOAT3 scaling; // nagyítás
|
|
XMFLOAT3 rotation; // forgatás
|
|
XMFLOAT3 translation; // pozíció
|
|
|
|
SRTProps(); // konstr.
|
|
void loadDefaults() override;
|
|
};
|
|
|
|
class Entity : public Geometry, public IHasDefault {
|
|
private:
|
|
ComPtr<ID3D12Resource> mConstBufRes; // konstansbuffer erõforrás a videokártyán
|
|
CB_Entity mConstBuf; // konstansbuffer
|
|
SRTProps mSRTProps; // STR-tulajdonságok
|
|
|
|
void constructWorldMatrix(); // világ-mátrix újragenerálása
|
|
|
|
// TODO konstansbuffer létrehozása, feltöltése
|
|
void createConstantBuffer(); // konstansbuffer létrehozása
|
|
void updateConstantBuffer(); // konstansbuffer frissítése
|
|
public:
|
|
Entity(const ComPtr<ID3D12Device> &device);
|
|
explicit Entity(const Entity& other); // másolókonstruktor
|
|
|
|
void loadDefaults() override;
|
|
|
|
void setEntitySRT(const SRTProps& srtProps); // SRT-tulajdonságok beállítása
|
|
SRTProps getEntitySRT() const; // SRT-tualjdonságok elkérése
|
|
|
|
void draw(ComPtr<ID3D12GraphicsCommandList> commandList) const override;
|
|
|
|
void setColor(float r, float g, float b); // szín beállítása
|
|
};
|
|
|
|
}
|
|
|
|
|
|
#endif //ENTITY
|