Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
Public Member Functions | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
Olympe::Rendering::IsometricRenderer Class Reference

#include <IsometricRenderer.h>

Public Member Functions

 IsometricRenderer ()
 
 ~IsometricRenderer ()
 
void Initialize (SDL_Renderer *renderer, int tileWidth, int tileHeight)
 
void SetCamera (float camX, float camY, float zoom)
 
void SetViewport (int screenWidth, int screenHeight)
 
Vector WorldToScreen (float worldX, float worldY) const
 
Vector ScreenToWorld (float screenX, float screenY) const
 
bool IsTileVisible (int worldX, int worldY) const
 
void GetVisibleTileRange (int &minX, int &minY, int &maxX, int &maxY) const
 

Private Member Functions

float CalculateCullingMargin () const
 

Private Attributes

SDL_Rendererm_renderer
 
int m_tileWidth
 
int m_tileHeight
 
float m_cameraX
 
float m_cameraY
 
float m_zoom
 
int m_screenWidth
 
int m_screenHeight
 

Static Private Attributes

static constexpr float ISOMETRIC_OFFSET_Y = 200.0f
 
static constexpr float CULL_MARGIN = 100.0f
 
static constexpr float TALL_TILE_MULTIPLIER = 5.0f
 
static constexpr int VISIBLE_TILE_PADDING = 5
 

Detailed Description

Definition at line 27 of file IsometricRenderer.h.

Constructor & Destructor Documentation

◆ IsometricRenderer()

Olympe::Rendering::IsometricRenderer::IsometricRenderer ( )

Definition at line 18 of file IsometricRenderer.cpp.

◆ ~IsometricRenderer()

Olympe::Rendering::IsometricRenderer::~IsometricRenderer ( )

Definition at line 30 of file IsometricRenderer.cpp.

Member Function Documentation

◆ CalculateCullingMargin()

float Olympe::Rendering::IsometricRenderer::CalculateCullingMargin ( ) const
private

Definition at line 131 of file IsometricRenderer.cpp.

References CULL_MARGIN, GetComponentTypeID_Static(), m_tileHeight, m_tileWidth, m_zoom, and TALL_TILE_MULTIPLIER.

Referenced by IsTileVisible().

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

◆ GetVisibleTileRange()

void Olympe::Rendering::IsometricRenderer::GetVisibleTileRange ( int minX,
int minY,
int maxX,
int maxY 
) const

Definition at line 110 of file IsometricRenderer.cpp.

References GetComponentTypeID_Static(), m_screenHeight, m_screenWidth, ScreenToWorld(), and VISIBLE_TILE_PADDING.

+ Here is the call graph for this function:

◆ Initialize()

void Olympe::Rendering::IsometricRenderer::Initialize ( SDL_Renderer renderer,
int  tileWidth,
int  tileHeight 
)

Definition at line 34 of file IsometricRenderer.cpp.

References m_renderer, m_tileHeight, m_tileWidth, renderer, and SYSTEM_LOG.

◆ IsTileVisible()

bool Olympe::Rendering::IsometricRenderer::IsTileVisible ( int  worldX,
int  worldY 
) const

Definition at line 95 of file IsometricRenderer.cpp.

References CalculateCullingMargin(), GetComponentTypeID_Static(), m_screenHeight, m_screenWidth, and WorldToScreen().

+ Here is the call graph for this function:

◆ ScreenToWorld()

Vector Olympe::Rendering::IsometricRenderer::ScreenToWorld ( float  screenX,
float  screenY 
) const

Definition at line 77 of file IsometricRenderer.cpp.

References GetComponentTypeID_Static(), ISOMETRIC_OFFSET_Y, m_cameraX, m_cameraY, m_screenHeight, m_screenWidth, m_tileHeight, m_tileWidth, m_zoom, Vector::x, Vector::y, and Vector::z.

Referenced by GetVisibleTileRange().

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

◆ SetCamera()

void Olympe::Rendering::IsometricRenderer::SetCamera ( float  camX,
float  camY,
float  zoom 
)

Definition at line 44 of file IsometricRenderer.cpp.

References GetComponentTypeID_Static(), m_cameraX, m_cameraY, and m_zoom.

+ Here is the call graph for this function:

◆ SetViewport()

void Olympe::Rendering::IsometricRenderer::SetViewport ( int  screenWidth,
int  screenHeight 
)

Definition at line 51 of file IsometricRenderer.cpp.

References m_screenHeight, and m_screenWidth.

◆ WorldToScreen()

Vector Olympe::Rendering::IsometricRenderer::WorldToScreen ( float  worldX,
float  worldY 
) const

Definition at line 57 of file IsometricRenderer.cpp.

References GetComponentTypeID_Static(), ISOMETRIC_OFFSET_Y, m_cameraX, m_cameraY, m_screenHeight, m_screenWidth, m_tileHeight, m_tileWidth, m_zoom, and Vector::x.

Referenced by IsTileVisible().

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

Member Data Documentation

◆ CULL_MARGIN

constexpr float Olympe::Rendering::IsometricRenderer::CULL_MARGIN = 100.0f
staticconstexprprivate

Definition at line 66 of file IsometricRenderer.h.

Referenced by CalculateCullingMargin().

◆ ISOMETRIC_OFFSET_Y

constexpr float Olympe::Rendering::IsometricRenderer::ISOMETRIC_OFFSET_Y = 200.0f
staticconstexprprivate

Definition at line 65 of file IsometricRenderer.h.

Referenced by ScreenToWorld(), and WorldToScreen().

◆ m_cameraX

float Olympe::Rendering::IsometricRenderer::m_cameraX
private

Definition at line 56 of file IsometricRenderer.h.

Referenced by ScreenToWorld(), SetCamera(), and WorldToScreen().

◆ m_cameraY

float Olympe::Rendering::IsometricRenderer::m_cameraY
private

Definition at line 57 of file IsometricRenderer.h.

Referenced by ScreenToWorld(), SetCamera(), and WorldToScreen().

◆ m_renderer

SDL_Renderer* Olympe::Rendering::IsometricRenderer::m_renderer
private

Definition at line 49 of file IsometricRenderer.h.

Referenced by Initialize().

◆ m_screenHeight

int Olympe::Rendering::IsometricRenderer::m_screenHeight
private

◆ m_screenWidth

int Olympe::Rendering::IsometricRenderer::m_screenWidth
private

◆ m_tileHeight

int Olympe::Rendering::IsometricRenderer::m_tileHeight
private

◆ m_tileWidth

int Olympe::Rendering::IsometricRenderer::m_tileWidth
private

◆ m_zoom

float Olympe::Rendering::IsometricRenderer::m_zoom
private

◆ TALL_TILE_MULTIPLIER

constexpr float Olympe::Rendering::IsometricRenderer::TALL_TILE_MULTIPLIER = 5.0f
staticconstexprprivate

Definition at line 67 of file IsometricRenderer.h.

Referenced by CalculateCullingMargin().

◆ VISIBLE_TILE_PADDING

constexpr int Olympe::Rendering::IsometricRenderer::VISIBLE_TILE_PADDING = 5
staticconstexprprivate

Definition at line 68 of file IsometricRenderer.h.

Referenced by GetVisibleTileRange().


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