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

#include <RenderManager.hpp>

Inheritance diagram for RenderManager:
Collaboration diagram for RenderManager:

Public Member Functions

void init () override
void process () override
void shutdown () override
void initialize3DView (View3DConfig config)
 Initialize a new 3D view.
void cleanup3DView ()
 Cleans up the 3D view, resetting the state.
bool uploadTexture (int &textureID, const GL_TEXTURE_TYPE_ENUM texType, const int sizeX, const int sizeY, int param, const void *bitmap)
 Uploads a texture to the GPU.
void renderModelComponent (MDL3Model &model)
 Renders a MDL3 model.
void renderModelComponent (MDL3Model &model, ae::q20_12_t posX, ae::q20_12_t posY, ae::q20_12_t posZ, uint32_t rotX, uint32_t rotY, uint32_t rotZ, ae::q20_12_t scale=ae::q20_12_t{1})
 Renders a MDL3 model.
void renderTexturedBillboard (BillboardData bb, const int texture, bool faceCamera, ae::q20_12_t camX, ae::q20_12_t camY, ae::q20_12_t camZ)
 Renders a textured billboard.
void renderDisplayList (const void *displayList, const int texture)
 Renders a textured model.
void deleteTexture (int &texture)
 Deletes a texture from the GPU and resets its ID.

Private Member Functions

 RenderManager ()=default

Private Attributes

int activeTexture = -1
MathManager & math = MathManager::getInstance()

Static Private Attributes

static const ae::q20_12_t DEGREE_MODIFIER = ae::q20_12_t{1 << 15} / ae::q20_12_t{360}

Friends

class Singleton< RenderManager >

Detailed Description

Definition at line 14 of file RenderManager.hpp.

Constructor & Destructor Documentation

◆ RenderManager()

RenderManager::RenderManager ( )
privatedefault
Here is the caller graph for this function:

Member Function Documentation

◆ cleanup3DView()

void RenderManager::cleanup3DView ( )

Cleans up the 3D view, resetting the state.

Definition at line 94 of file RenderManager.cpp.

◆ deleteTexture()

void RenderManager::deleteTexture ( int & texture)

Deletes a texture from the GPU and resets its ID.

Parameters
textureThe ID of the texture to delete. This will be set to -1 after deletion.

Definition at line 271 of file RenderManager.cpp.

◆ init()

void RenderManager::init ( )
inlineoverride

Definition at line 17 of file RenderManager.hpp.

◆ initialize3DView()

void RenderManager::initialize3DView ( View3DConfig config)

Initialize a new 3D view.

Parameters
configThe configuration for the 3D view.

This function initializes the 3D view with the specified configuration. It does all of the general configuration, and also activates Fog and Outlines if they are present in the configuration.

Note
This function will check config.outlineColor and config.fogRed respectively to determine if outlins or fog need to be enabled. If these values are -1, then that feature will not be enabled. The general setting for these features is not affected. This means if these values are -1, GL_FOG or GL_OUTLINE should not be activated in config.settings, else they will work of default data. In turn GL_FOG or GL_OUTLINE will need to be activated in config.settings if they are desired, as this is not handled automatically.

Definition at line 44 of file RenderManager.cpp.

◆ process()

void RenderManager::process ( )
inlineoverride

Definition at line 21 of file RenderManager.hpp.

◆ renderDisplayList()

void RenderManager::renderDisplayList ( const void * displayList,
const int texture )

Renders a textured model.

Parameters
displayListPointer to the display list of the model to render.
textureThe ID of the texture to use for rendering.
Warning
This function should not be used outside of RenderManager as it will soon be inlined & private. Calls from outside of RenderManager should start using renderMeshComponent() instead.

Definition at line 255 of file RenderManager.cpp.

Here is the caller graph for this function:

◆ renderModelComponent() [1/2]

void RenderManager::renderModelComponent ( MDL3Model & model)

Renders a MDL3 model.

Parameters
modelThe 3D model to render.
Note
This function will render the model at the origin (0, 0, 0) with no rotation or scaling applied. It is intended for environment models. There is a separate function for rendering with transformations.

Definition at line 135 of file RenderManager.cpp.

Here is the call graph for this function:

◆ renderModelComponent() [2/2]

void RenderManager::renderModelComponent ( MDL3Model & model,
ae::q20_12_t posX,
ae::q20_12_t posY,
ae::q20_12_t posZ,
uint32_t rotX,
uint32_t rotY,
uint32_t rotZ,
ae::q20_12_t scale = ae::q20_12_t{1} )

Renders a MDL3 model.

Parameters
modelThe 3D model to render.
posXThe X position of the model.
posYThe Y position of the model.
posZThe Z position of the model.
rotXThe X rotation of the model.
rotYThe Y rotation of the model.
rotZThe Z rotation of the model.
scaleThe scale of the model (default 1).

Definition at line 150 of file RenderManager.cpp.

Here is the call graph for this function:

◆ renderTexturedBillboard()

void RenderManager::renderTexturedBillboard ( BillboardData bb,
const int texture,
bool faceCamera,
ae::q20_12_t camX,
ae::q20_12_t camY,
ae::q20_12_t camZ )

Renders a textured billboard.

Parameters
bbThe billboard data to render.
textureThe ID of the texture to use for rendering.
faceCameraWhether the billboard should face the camera.
camXThe X position of the camera.
camYThe Y position of the camera.
camZThe Z position of the camera.

Definition at line 196 of file RenderManager.cpp.

◆ shutdown()

void RenderManager::shutdown ( )
inlineoverride

Definition at line 25 of file RenderManager.hpp.

◆ uploadTexture()

bool RenderManager::uploadTexture ( int & textureID,
const GL_TEXTURE_TYPE_ENUM texType,
const int sizeX,
const int sizeY,
int param,
const void * bitmap )

Uploads a texture to the GPU.

Parameters
textureIDThe ID of the texture to upload.
texTypeThe type of the texture to upload (i.e. RGB16, RGBA, ...).
sizeXThe width of the texture in pixels.
sizeYThe height of the texture in pixels.
paramThe parameters of the texture.
bitmapPointer to the texture data to load.
Returns
True if the texture was successfully uploaded, false otherwise.
Note
Will delete old texture if textureID is not -1, and will set textureID to the new texture ID.

glTexImage2D can return 0 on failure, we can use this to catch out of VRAM errors, etc.

Definition at line 102 of file RenderManager.cpp.

Here is the call graph for this function:

◆ Singleton< RenderManager >

friend class Singleton< RenderManager >
friend

Definition at line 128 of file RenderManager.hpp.

Member Data Documentation

◆ activeTexture

int RenderManager::activeTexture = -1
private

Definition at line 135 of file RenderManager.hpp.

◆ DEGREE_MODIFIER

const ae::q20_12_t RenderManager::DEGREE_MODIFIER = ae::q20_12_t{1 << 15} / ae::q20_12_t{360}
inlinestaticprivate

Definition at line 134 of file RenderManager.hpp.

◆ math

MathManager& RenderManager::math = MathManager::getInstance()
private

Definition at line 137 of file RenderManager.hpp.


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