Blowbox 2017
A 3D Game Engine by Riko Ophorst using DirectX 12
|
#include <entity.h>
Public Member Functions | |
Entity (const String &name) | |
~Entity () | |
void | SetName (const String &name) |
const String & | GetName () const |
void | SetLocalPosition (const DirectX::XMFLOAT3 &position) |
void | SetLocalRotation (const DirectX::XMFLOAT3 &rotation) |
void | SetLocalScaling (const DirectX::XMFLOAT3 &scaling) |
void | SetMesh (SharedPtr< Mesh > mesh) |
const DirectX::XMFLOAT3 & | GetLocalPosition () const |
const DirectX::XMFLOAT3 & | GetLocalRotation () const |
const DirectX::XMFLOAT3 & | GetLocalScaling () const |
SharedPtr< Mesh > | GetMesh () const |
const DirectX::XMMATRIX & | GetWorldTransform () |
const Vector< SharedPtr< Entity > > & | GetChildren () const |
UploadBuffer & | GetConstantBuffer () |
Protected Member Functions | |
void | Init () |
void | Update () |
void | Shutdown () |
bool | AddChild (SharedPtr< Entity > entity) |
bool | RemoveChild (SharedPtr< Entity > entity) |
void | SetInScene (bool in_scene) |
bool | GetInScene () const |
bool | IsTransformDirty () |
void | UpdateWorldTransform () |
Private Attributes | |
String | name_ |
WeakPtr< Entity > | parent_ |
Vector< SharedPtr< Entity > > | children_ |
DirectX::XMFLOAT3 | position_ |
DirectX::XMFLOAT3 | rotation_ |
DirectX::XMFLOAT3 | scaling_ |
DirectX::XMMATRIX | world_transform_ |
bool | transform_dirty_ |
bool | in_scene_ |
SharedPtr< Mesh > | mesh_ |
UploadBuffer | constant_buffer_ |
Friends | |
class | SceneManager |
class | EntityFactory |
The Blowbox equivalent of a game object.
An Entity is the Blowbox equivalent of a game object. It has everything in it that you need. There are no components. Every Entity has the same layout and same functionality: it allows you to render something into the scene. It contains a transform, and it is part of a scene graph. It is recommended that you construct an Entity through the EntityFactory instead of doing it through the Entity::Entity() constructor. However, it is very much possible to create an Entity through its constructor.
blowbox::Entity::Entity | ( | const String & | name | ) |
blowbox::Entity::~Entity | ( | ) |
Destructs the Entity.
|
inline |
|
protected |
Returns whether the Entity is present in the SceneManager.
const DirectX::XMFLOAT3 & blowbox::Entity::GetLocalPosition | ( | ) | const |
const DirectX::XMFLOAT3 & blowbox::Entity::GetLocalRotation | ( | ) | const |
const DirectX::XMFLOAT3 & blowbox::Entity::GetLocalScaling | ( | ) | const |
const String & blowbox::Entity::GetName | ( | ) | const |
const DirectX::XMMATRIX & blowbox::Entity::GetWorldTransform | ( | ) |
|
protected |
Initialises the Entity.
|
protected |
Returns whether the transform is dirty.
|
protected |
Sets whether the Entity is present in the SceneManager.
[in] | in_scene | Whether the Entity exists in the SceneManager. |
void blowbox::Entity::SetLocalPosition | ( | const DirectX::XMFLOAT3 & | position | ) |
void blowbox::Entity::SetLocalRotation | ( | const DirectX::XMFLOAT3 & | rotation | ) |
void blowbox::Entity::SetLocalScaling | ( | const DirectX::XMFLOAT3 & | scaling | ) |
void blowbox::Entity::SetName | ( | const String & | name | ) |
|
protected |
Shuts down the Entity.
|
protected |
Updates the Entity.
|
protected |
Updates the world transform based on current position, rotation and scaling.
|
private |
This Entity's constant buffer.
|
private |
Flag that determines whether this Entity exists in the SceneManager.
|
private |
The local position of this Entity.
|
private |
The local rotation of this Entity.
|
private |
The local scaling of this Entity.
|
private |
Whether the current world_transform_ is dirty (i.e. position/rotation/scaling changed).
|
private |
The world transform of this Entity.