56 lines
1.1 KiB
C++

//
// Created by Epagris on 2020. 03. 19..
//
#include "Entity.h"
eg3d::Entity::Entity(const ComPtr<ID3D12Device> &device) : Geometry(device) {
loadDefaults();
}
eg3d::Entity::Entity(const Entity& other): Geometry(other.device)
{
setEntitySRT(other.getEntitySRT());
}
void eg3d::Entity::loadDefaults() {
XMStoreFloat4x4(&mWorldMatrix, XMMatrixIdentity()); // egységmátrix betöltése a világ-mátrixba
mSRTProps.loadDefaults();
}
void eg3d::Entity::setEntitySRT(const eg3d::SRTProps &srtProps) {
mSRTProps = srtProps;
constructWorldMatrix();
}
eg3d::SRTProps eg3d::Entity::getEntitySRT() const {
return mSRTProps;
}
void eg3d::Entity::draw(ComPtr<ID3D12GraphicsCommandList> commandList) const
{
// TODO konstansbuffer becsatolása
}
void eg3d::Entity::constructWorldMatrix() {
// TODO (Cam alapján)
// XMMATRIX w = s * r * t
// XMStoreFloat4x4(...)
}
// ----------------------
eg3d::SRTProps::SRTProps() {
loadDefaults();
}
void eg3d::SRTProps::loadDefaults() {
scaling = { 1.0f, 1.0f, 1.0f };
rotation = { 0.0f, 0.0f, 0.0f };
translation = {0.0f, 0.0f, 0.0f };
}