Olympe Engine 2.0
2D Game Engine with ECS Architecture
Loading...
Searching...
No Matches
IsometricRenderer.h
Go to the documentation of this file.
1/*
2 * Olympe Engine V2 - 2025
3 * Isometric Renderer
4 *
5 * -> REFACTORED: Now provides utility functions only
6 * Batching and sorting moved to unified rendering pipeline in ECS_Systems.cpp
7 */
8
9#pragma once
10
11#include <SDL3/SDL.h>
12#include <vector>
13#include <memory>
14#include "../vector.h"
15
16namespace Olympe {
17namespace Rendering {
18
19 // Tile flip flags (from Tiled format)
20 constexpr uint32_t FLIPPED_HORIZONTALLY_FLAG = 0x80000000;
21 constexpr uint32_t FLIPPED_VERTICALLY_FLAG = 0x40000000;
22 constexpr uint32_t FLIPPED_DIAGONALLY_FLAG = 0x20000000;
23 constexpr uint32_t TILE_ID_MASK = 0x1FFFFFFF;
24
25 // -> Isometric utility functions (coordinate conversion, culling)
26 // Note: Tile batching and sorting moved to unified pipeline in ECS_Systems.cpp
28 {
29 public:
32
33 // Setup
34 void Initialize(SDL_Renderer* renderer, int tileWidth, int tileHeight);
35
36 // Camera control
37 void SetCamera(float camX, float camY, float zoom);
38 void SetViewport(int screenWidth, int screenHeight);
39
40 // -> Utility functions (coordinate conversion)
41 Vector WorldToScreen(float worldX, float worldY) const;
42 Vector ScreenToWorld(float screenX, float screenY) const;
43
44 // Culling utilities
45 bool IsTileVisible(int worldX, int worldY) const;
46 void GetVisibleTileRange(int& minX, int& minY, int& maxX, int& maxY) const;
47
48 private:
50
51 // Tile dimensions
54
55 // Camera state
56 float m_cameraX;
57 float m_cameraY;
58 float m_zoom;
59
60 // Viewport
63
64 // Rendering constants
65 static constexpr float ISOMETRIC_OFFSET_Y = 200.0f;
66 static constexpr float CULL_MARGIN = 100.0f;
67 static constexpr float TALL_TILE_MULTIPLIER = 5.0f;
68 static constexpr int VISIBLE_TILE_PADDING = 5;
69
70 // Helper functions
71 float CalculateCullingMargin() const;
72 };
73
74} // namespace Rendering
75} // namespace Olympe
ComponentTypeID GetComponentTypeID_Static()
Definition ECS_Entity.h:56
static SDL_Renderer * renderer
Vector WorldToScreen(float worldX, float worldY) const
void SetViewport(int screenWidth, int screenHeight)
Vector ScreenToWorld(float screenX, float screenY) const
static constexpr float TALL_TILE_MULTIPLIER
void Initialize(SDL_Renderer *renderer, int tileWidth, int tileHeight)
void GetVisibleTileRange(int &minX, int &minY, int &maxX, int &maxY) const
bool IsTileVisible(int worldX, int worldY) const
static constexpr float ISOMETRIC_OFFSET_Y
void SetCamera(float camX, float camY, float zoom)
constexpr uint32_t TILE_ID_MASK
constexpr uint32_t FLIPPED_VERTICALLY_FLAG
constexpr uint32_t FLIPPED_DIAGONALLY_FLAG
constexpr uint32_t FLIPPED_HORIZONTALLY_FLAG