Skip to main content

Overview

The GameRenderer class is the main rendering coordinator for Minecraft, handling camera positioning, viewport setup, FOV calculations, rendering effects, lighting, weather, and the main render loop. It orchestrates the rendering of the entire game view. Header: Minecraft.Client/GameRenderer.h

Class Definition

Constants

Light Textures

Number of light texture maps (one per split-screen player).

Static Members

Constructor

Creates a new GameRenderer instance. Parameters:
  • mc - Pointer to the main Minecraft instance

Core Rendering Methods

render

Main render method called each frame. Parameters:
  • a - Interpolation alpha for smooth rendering (0.0-1.0)
  • bFirst - Whether this is the first player in split-screen
Example Usage:

renderLevel

Renders the level/world from the current camera perspective. Parameters:
  • a - Interpolation alpha
  • until - (Optional) Timestamp to stop rendering (for performance budgeting)

Camera Methods

setupCamera

Sets up the camera position, orientation, and projection matrix. Parameters:
  • a - Interpolation alpha
  • eye - Eye index for stereoscopic rendering (0 = left, 1 = right)
Example:

pick

Performs ray-casting to determine what the player is looking at (block/entity selection). Parameters:
  • a - Interpolation alpha

zoomRegion / unZoomRegion

Zoom in on a specific region of the screen (used for spyglass, etc.). Parameters:
  • zoom - Zoom factor
  • xa - X offset (normalized -1 to 1)
  • ya - Y offset (normalized -1 to 1)

Field of View (FOV)

SetFovVal / GetFovVal

Set or get the base field of view value. Example:

GUI and Screen Setup

setupGuiScreen

Sets up orthographic projection for rendering GUI/HUD elements. Parameters:
  • forceScale - Force a specific GUI scale (default -1 = use settings)
Example:

Lighting

Light Texture Management

Gets the light texture ID for a specific player and level. Parameters:
  • iPad - Player index (0-3 for split-screen)
  • level - The level/dimension
Returns: OpenGL texture ID for the light map

turnOnLightLayer / turnOffLightLayer

Enable or disable the lighting layer blend (for fullbright effects). Parameters:
  • alpha - Transition alpha

updateLightTexture

Updates the dynamic light texture based on time of day, dimension, and effects.

Weather Effects

renderSnowAndRain

Renders precipitation effects (rain in overworld, snow in cold biomes). Parameters:
  • a - Interpolation alpha

Item in Hand

ItemInHandRenderer

Public member for rendering held items and tools. Example:

Chunk Updates

updateAllChunks

Forces update of all dirty chunks in the render distance.
Performance Impact: Calling this method can cause frame hitches as it rebuilds multiple chunks. Use sparingly.

Update Thread Management

Enable or disable multithreaded chunk updating. Example:

Tick Methods

tick

Called once per game tick (20 times per second) to update camera state. Parameters:
  • bFirst - Whether this is the first player
Example:

Memory Management

Delete Stack Methods

Thread-safe deferred deletion for chunk data structures. Example:

Rendering Pipeline Example

Advanced Camera Control

These smooth interpolation members handle camera smoothing for third-person view and camera effects.

FOV Effects

The FOV system supports dynamic field of view changes:

Lighting System

The lighting system uses dynamic texture mapping:

Usage with Level Renderer

Performance Monitoring

These members track frame timing for performance monitoring and tick synchronization.