Fling Engine  0.00.1
Fling Engine is a game engine written in Vulkan
Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
Fling::Model Class Reference

A model represents a 3D model (.obj files for now) with vertices and indecies. More...

#include <Model.h>

Inherits Fling::Resource.

Public Member Functions

 Model (Guid t_ID)
 Construct a new model object. More...
 
 Model (Guid t_ID, std::vector< Vertex > &t_Verts, std::vector< UINT32 > t_Indecies)
 
 ~Model ()
 
FORCEINLINE BufferGetVertexBuffer () const
 
FORCEINLINE BufferGetIndexBuffer () const
 
FORCEINLINE const std::vector< Vertex > & GetVerts () const
 
FORCEINLINE const std::vector< UINT32 > & GetIndices () const
 
FORCEINLINE UINT32 GetIndexCount () const
 
FORCEINLINE UINT32 GetVertexCount () const
 
- Public Member Functions inherited from Fling::Resource
 Resource (Fling::Guid t_ID)
 
virtual ~Resource ()=default
 
Fling::Guid_Handle GetGuidHandle () const
 Get GUID handle (just an int) for this resources guid. More...
 
const std::string & GetGuidString () const
 Get the human-readable string representation of this GUID. More...
 
std::string GetFilepathReleativeToAssets () const
 Returns the full file path that is relative to the assets path based on the GUID of this resource. More...
 

Static Public Member Functions

static std::shared_ptr< Fling::ModelCreate (Guid t_ID)
 
static std::shared_ptr< Fling::ModelQuad ()
 Creates a quad primitive model. More...
 
static constexpr VkIndexType GetIndexType ()
 

Private Member Functions

void CreateBuffers ()
 
void LoadModel ()
 Load this model from Tiny Obj loader. More...
 

Static Private Member Functions

static void CalculateVertexTangents (Vertex *verts, UINT32 numVerts, UINT32 *indices, UINT32 numIndices)
 

Private Attributes

std::vector< Vertexm_Verts
 
std::vector< UINT32m_Indices
 
Bufferm_VertexBuffer = nullptr
 
Bufferm_IndexBuffer = nullptr
 

Additional Inherited Members

- Protected Attributes inherited from Fling::Resource
Fling::Guid m_Guid
 
std::string m_HumanReadableName
 

Detailed Description

A model represents a 3D model (.obj files for now) with vertices and indecies.

A model has a vertex and index buffer and can be bound to a command buffer.

Constructor & Destructor Documentation

◆ Model() [1/2]

Fling::Model::Model ( Guid  t_ID)

Construct a new model object.

Parameters
t_IDThe GUID that represents the file path to this model

◆ Model() [2/2]

Fling::Model::Model ( Guid  t_ID,
std::vector< Vertex > &  t_Verts,
std::vector< UINT32 t_Indecies 
)
Parameters
t_IDThe GUID that represents a unique name for this model. It's up to the user to ensure uniqueness

◆ ~Model()

Fling::Model::~Model ( )

Member Function Documentation

◆ CalculateVertexTangents()

void Fling::Model::CalculateVertexTangents ( Vertex verts,
UINT32  numVerts,
UINT32 indices,
UINT32  numIndices 
)
staticprivate

◆ Create()

std::shared_ptr< Fling::Model > Fling::Model::Create ( Guid  t_ID)
static

◆ CreateBuffers()

void Fling::Model::CreateBuffers ( )
private

◆ GetIndexBuffer()

FORCEINLINE Buffer* Fling::Model::GetIndexBuffer ( ) const
inline

◆ GetIndexCount()

FORCEINLINE UINT32 Fling::Model::GetIndexCount ( ) const
inline

◆ GetIndexType()

static constexpr VkIndexType Fling::Model::GetIndexType ( )
inlinestatic

◆ GetIndices()

FORCEINLINE const std::vector<UINT32>& Fling::Model::GetIndices ( ) const
inline

◆ GetVertexBuffer()

FORCEINLINE Buffer* Fling::Model::GetVertexBuffer ( ) const
inline

◆ GetVertexCount()

FORCEINLINE UINT32 Fling::Model::GetVertexCount ( ) const
inline

◆ GetVerts()

FORCEINLINE const std::vector<Vertex>& Fling::Model::GetVerts ( ) const
inline

◆ LoadModel()

void Fling::Model::LoadModel ( )
private

Load this model from Tiny Obj loader.

◆ Quad()

std::shared_ptr< Fling::Model > Fling::Model::Quad ( )
static

Creates a quad primitive model.

Field Documentation

◆ m_IndexBuffer

Buffer* Fling::Model::m_IndexBuffer = nullptr
private

◆ m_Indices

std::vector<UINT32> Fling::Model::m_Indices
private

◆ m_VertexBuffer

Buffer* Fling::Model::m_VertexBuffer = nullptr
private

◆ m_Verts

std::vector<Vertex> Fling::Model::m_Verts
private

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