persona-3-dual
A DS demake of Persona 3
Loading...
Searching...
No Matches
ModelComponent.hpp
Go to the documentation of this file.
1
7
8#pragma once
10#include "types/aeTypes.hpp"
11
12#include <aegis/component.hpp>
13#include <memory>
14#include <string>
15
16class ModelComponent : public ae::Component
17{
18 public:
19 static constexpr ae::ComponentTypeID TYPE_ID = static_cast<ae::ComponentTypeID>(ComponentType::Model);
20
21 void init() override
22 {
23 }
24
28 void destroy() override;
29
33 void update(ae::q20_12_t /*dt*/) override;
34
35 ae::ComponentTypeID getType() const override
36 {
37 return TYPE_ID;
38 }
39
45 bool loadMesh(std::string* meshFilePath);
46
50 void drawMesh();
51
52 protected:
53 void submitToManager() override
54 {
55 }
56
57 private:
58 std::unique_ptr<MDL3Model> model;
59
60 RenderManager& render = RenderManager::getInstance();
61
68 bool loadTextureHeader(FILE* f, MDL3Texture& tex);
77 bool loadTexture(FILE* f, MDL3Texture& tex);
78};
Manager for hardware specific rendering functionse.
void drawMesh()
Draws the loaded mesh to the screen.
std::unique_ptr< MDL3Model > model
void submitToManager() override
static constexpr ae::ComponentTypeID TYPE_ID
void update(ae::q20_12_t) override
Draws the mesh to the screen every frame.
void destroy() override
Sets active to false on component destruction.
bool loadMesh(std::string *meshFilePath)
Loads a mesh from a file into memory.
ae::ComponentTypeID getType() const override
RenderManager & render
bool loadTextureHeader(FILE *f, MDL3Texture &tex)
Loads a texture header from the file buffer into memory.
void init() override
bool loadTexture(FILE *f, MDL3Texture &tex)
Loads an embedded texture from the file buffer and uploads it to the GPU.
Represents a texture used in a 3D model.