persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
ModelComponent Class Reference

#include <ModelComponent.hpp>

Inheritance diagram for ModelComponent:
Collaboration diagram for ModelComponent:

Public Member Functions

void init () override
void destroy () override
 Sets active to false on component destruction.
void update (ae::q20_12_t) override
 Draws the mesh to the screen every frame.
ae::ComponentTypeID getType () const override
bool loadMesh (std::string *meshFilePath)
 Loads a mesh from a file into memory.
void drawMesh ()
 Draws the loaded mesh to the screen.

Static Public Attributes

static constexpr ae::ComponentTypeID TYPE_ID = static_cast<ae::ComponentTypeID>(ComponentType::Model)

Protected Member Functions

void submitToManager () override

Private Member Functions

bool loadTextureHeader (FILE *f, MDL3Texture &tex)
 Loads a texture header from the file buffer into memory.
bool loadTexture (FILE *f, MDL3Texture &tex)
 Loads an embedded texture from the file buffer and uploads it to the GPU.

Private Attributes

std::unique_ptr< MDL3Model > model
RenderManager & render = RenderManager::getInstance()

Detailed Description

Definition at line 16 of file ModelComponent.hpp.

Member Function Documentation

◆ destroy()

void ModelComponent::destroy ( )
override

Sets active to false on component destruction.

Definition at line 9 of file ModelComponent.cpp.

◆ drawMesh()

void ModelComponent::drawMesh ( )

Draws the loaded mesh to the screen.

Definition at line 237 of file ModelComponent.cpp.

Here is the caller graph for this function:

◆ getType()

ae::ComponentTypeID ModelComponent::getType ( ) const
inlineoverride

Definition at line 35 of file ModelComponent.hpp.

◆ init()

void ModelComponent::init ( )
inlineoverride

Definition at line 21 of file ModelComponent.hpp.

◆ loadMesh()

bool ModelComponent::loadMesh ( std::string * meshFilePath)

Loads a mesh from a file into memory.

Parameters
meshFilePathThe path to the mesh file to load.
Returns
true if the mesh was successfully loaded, false otherwise.

Definition at line 115 of file ModelComponent.cpp.

Here is the call graph for this function:

◆ loadTexture()

bool ModelComponent::loadTexture ( FILE * f,
MDL3Texture & tex )
private

Loads an embedded texture from the file buffer and uploads it to the GPU.

Parameters
bufferThe file buffer to read from.
texThe texture object to populate with the texture data.
Returns
true if the texture was successfully loaded and uploaded, false otherwise.
Note
The function allocates a 32-bit aligned buffer for the GPU upload and frees it after use.

Definition at line 65 of file ModelComponent.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ loadTextureHeader()

bool ModelComponent::loadTextureHeader ( FILE * f,
MDL3Texture & tex )
private

Loads a texture header from the file buffer into memory.

Parameters
bufferThe file buffer to read from.
texThe texture object to populate with the header data.
Returns
true if the header was successfully loaded, false otherwise.

Definition at line 39 of file ModelComponent.cpp.

Here is the caller graph for this function:

◆ submitToManager()

void ModelComponent::submitToManager ( )
inlineoverrideprotected

Definition at line 53 of file ModelComponent.hpp.

◆ update()

void ModelComponent::update ( ae::q20_12_t )
override

Draws the mesh to the screen every frame.

Definition at line 4 of file ModelComponent.cpp.

Here is the call graph for this function:

Member Data Documentation

◆ model

std::unique_ptr<MDL3Model> ModelComponent::model
private

Definition at line 58 of file ModelComponent.hpp.

◆ render

RenderManager& ModelComponent::render = RenderManager::getInstance()
private

Definition at line 60 of file ModelComponent.hpp.

◆ TYPE_ID

ae::ComponentTypeID ModelComponent::TYPE_ID = static_cast<ae::ComponentTypeID>(ComponentType::Model)
staticconstexpr

Definition at line 19 of file ModelComponent.hpp.


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