Zappy GUI
C++ graphic client: renderer, camera, network
Loading...
Searching...
No Matches
EntityRenderer Class Reference

Helper class for rendering game entities (players, eggs, resources). More...

#include <EntityRenderer.hpp>

+ Collaboration diagram for EntityRenderer:

Static Public Member Functions

static void drawPlayer (Vector3 &worldPos, Color teamColor, float rotation, Model &model, const Color *baseMats, float modelSize=0.4f)
 Draws a player at the given world position.
 
static void drawEgg (Vector3 &worldPos, Color teamColor, Model &model, float rotation=0.0f, const Color *baseMats=nullptr, float modelSize=0.3f)
 Draws an egg at the given world position.
 
static void drawResources (const Resources &resources, const std::array< int, 7 > &slotIndices, const std::array< float, 7 > &rotations, const Vector3 &tileCenter, float tileSize, Model &foodModel, float foodModelSize, Model &crystalModel, float crystalModelSize, float baseSize=0.15f)
 Draws all resources for a tile using precomputed slot indices.
 

Static Private Member Functions

static void _restoreModelBaseColors (Model &model, const Color *baseMats, int count=6)
 

Detailed Description

Helper class for rendering game entities (players, eggs, resources).

Definition at line 11 of file EntityRenderer.hpp.

Member Function Documentation

◆ _restoreModelBaseColors()

void EntityRenderer::_restoreModelBaseColors ( Model &  model,
const Color *  baseMats,
int  count = 6 
)
staticprivate

Definition at line 76 of file EntityRenderer.cpp.

Referenced by drawEgg(), and drawPlayer().

+ Here is the caller graph for this function:

◆ drawEgg()

void EntityRenderer::drawEgg ( Vector3 &  worldPos,
Color  teamColor,
Model &  model,
float  rotation = 0.0f,
const Color *  baseMats = nullptr,
float  modelSize = 0.3f 
)
static

Draws an egg at the given world position.

Parameters
worldPosWorld position to draw at.
teamColorColor for the egg's team.
modelSizeSize scalar for the model.

Definition at line 32 of file EntityRenderer.cpp.

References _restoreModelBaseColors().

Referenced by RaylibRenderer::_render3D().

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

◆ drawPlayer()

void EntityRenderer::drawPlayer ( Vector3 &  worldPos,
Color  teamColor,
float  rotation,
Model &  model,
const Color *  baseMats,
float  modelSize = 0.4f 
)
static

Draws a player at the given world position.

Parameters
worldPosWorld position to draw at.
teamColorColor for the player's team.
modelSizeSize scalar for the model.

Definition at line 8 of file EntityRenderer.cpp.

References _restoreModelBaseColors(), ColorPalette::SlimePalette::blush, ColorPalette::colorEquals(), ColorPalette::getSlimePalette(), ColorPalette::SlimePalette::inner, ColorPalette::KEEP, and ColorPalette::SlimePalette::outer.

Referenced by RaylibRenderer::_render3D().

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

◆ drawResources()

void EntityRenderer::drawResources ( const Resources resources,
const std::array< int, 7 > &  slotIndices,
const std::array< float, 7 > &  rotations,
const Vector3 &  tileCenter,
float  tileSize,
Model &  foodModel,
float  foodModelSize,
Model &  crystalModel,
float  crystalModelSize,
float  baseSize = 0.15f 
)
static

Draws all resources for a tile using precomputed slot indices.

Parameters
resourcesThe resources to draw.
slotIndicesSlot index per resource type (0-7), or -1 if absent.
tileCenterWorld position of tile center.
tileSizeSize of a tile in world units.
baseSizeBase size of resource models.

Definition at line 45 of file EntityRenderer.cpp.

References ColorPalette::getResourceColor(), and TileSlotMap::slotOffset().

Referenced by RaylibRenderer::_render3D().

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

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