Elevate Engine 1
Loading...
Searching...
No Matches
Elevate::Model Class Reference

#include <Model.h>

Inheritance diagram for Elevate::Model:
Elevate::Component EEObject

Public Member Functions

 Model ()=default
 
 Model (PrimitiveType type)
 
 Model (std::string path, MaterialPtr material=nullptr)
 
void SetMaterial (MaterialPtr material)
 
void Render () override
 
RenderStateGetRenderState ()
 
- Public Member Functions inherited from Elevate::Component
 Component ()=default
 
virtual ~Component ()=default
 
virtual ComponentClone ()=0
 
virtual void CopyFrom (Component *other)=0
 
virtual GameObjectComponentFactory GetFactory () const =0
 
virtual GameObjectComponentDestructor GetDestructor () const =0
 
virtual const void * GetEditorIconHandle () const
 
virtual std::type_index GetTypeIndex () const =0
 
void SetActive (bool newState)
 
bool IsActive ()
 
virtual ComponentLayout GetLayout () const
 
virtual bool RemoveFromGameObject ()
 
virtual std::string GetName () const
 
- Public Member Functions inherited from EEObject
virtual EECategory GetCategory () const
 

Additional Inherited Members

- Public Attributes inherited from Elevate::Component
std::function< bool()> RemoveFromGOFunc
 
GameObjectgameObject = nullptr
 
- Protected Member Functions inherited from Elevate::Component
virtual void Init ()
 
virtual void Destroy ()
 
virtual void Update ()
 
virtual void RenderInEditor ()
 
virtual void RenderWhenSelected ()
 
virtual void OnSetPosition ()
 
virtual void OnSetRotation ()
 
virtual void OnSetScale ()
 
virtual void OnNotify (Event &event)
 
- Protected Attributes inherited from Elevate::Component
bool m_IsActive = true
 
- Protected Attributes inherited from EEObject
EECategory m_category
 

Detailed Description

Definition at line 18 of file Model.h.

Constructor & Destructor Documentation

◆ Model() [1/3]

Elevate::Model::Model ( )
default

◆ Model() [2/3]

Elevate::Model::Model ( PrimitiveType  type)

Definition at line 26 of file Model.cpp.

26 : Model("", nullptr)
27{
28 switch (type)
29 {
31 m_batchedMesh = Mesh::GenerateCube(1.0f);
32 break;
34 m_batchedMesh = Mesh::GenerateUVSphere(1.0f, 36, 18);
35 break;
41 m_batchedMesh = Mesh::GeneratePlane(1.0f, 1);
42 break;
44 m_batchedMesh = Mesh::GenerateQuad(1.0f);
45 break;
47 default:
48 EE_CORE_ASSERT(false, "Unsupported primitive shape given for mesh creation.");
49 break;
50 }
51}
static Mesh GeneratePlane(float size, int resolution)
Definition Mesh.cpp:191
static Mesh GenerateUVSphere(float radius, int latitudes, int longitudes)
Definition Mesh.cpp:127
static Mesh GenerateQuad(float size=1.0f)
Definition Mesh.cpp:186
static Mesh GenerateCube(float size=1.0f)
Definition Mesh.cpp:54
Model()=default

◆ Model() [3/3]

Elevate::Model::Model ( std::string  path,
MaterialPtr  material = nullptr 
)

Definition at line 53 of file Model.cpp.

54{
55 // todo : add a macro or const expression for the default value in asset maangers
56 SetMaterial(material ? material : MaterialRegistry::GetMaterial(EE_DEFAULT_MATERIAL));
57
58 if (!path.empty())
59 {
60 LoadModel(path);
61 }
62}
#define EE_DEFAULT_MATERIAL
Definition Material.h:17
void SetMaterial(MaterialPtr material)
Definition Model.h:28

Member Function Documentation

◆ GetRenderState()

RenderState & Elevate::Model::GetRenderState ( )
inline

Definition at line 35 of file Model.h.

35{ return m_attributes; }

◆ Render()

void Elevate::Model::Render ( )
overridevirtual

Reimplemented from Elevate::Component.

Definition at line 211 of file Model.cpp.

212{
214}
GameObject * gameObject
Definition Component.h:73
const glm::mat4 & GetModelMatrix() const
std::shared_ptr< VertexArray > GetVertexArray() const
Definition Mesh.h:51
static void SubmitMesh(const std::shared_ptr< VertexArray > &vao, const std::shared_ptr< Material > &material, const glm::mat4 &transform, RenderBucket::Type bucketType=RenderBucket::Opaque)
Definition Renderer.cpp:139

◆ SetMaterial()

void Elevate::Model::SetMaterial ( MaterialPtr  material)
inline

Definition at line 28 of file Model.h.

28{ m_material = material; }

The documentation for this class was generated from the following files: