Architecture
Base Class Hierarchy
EntityRenderer Base Class
EntityRenderer.h:20
Core Methods
Render Method
entity- The entity to renderx, y, z- Interpolated positionrot- Body rotationa- Frame interpolation alpha (0.0 to 1.0)
EntityRenderer.h:39
Texture Binding
EntityRenderer.h:41-45
Shadow Rendering
EntityRenderer.h:48
Post-Render
EntityRenderer.h:57
MobRenderer
MobRenderer.h:11
Render Pipeline
TheMobRenderer::render method follows this sequence:
- Setup Position -
setupPosition() - Setup Rotations -
setupRotations() - Render Model -
renderModel() - Render Armor - Multiple passes for armor layers
- Additional Rendering -
additionalRendering() - Name Tag -
renderName()
MobRenderer.h:26
Model Rendering
wp- Walk positionws- Walk speedbob- Bobbing amountheadRotMinusBodyRot- Head rotation relative to bodyheadRotx- Head pitch rotationscale- Model scale
MobRenderer.h:28
Rotation Setup
- Death animation rotation
- Body rotation
- Bobbing animation
- Flip degrees when dying
MobRenderer.h:30
Armor Rendering
Armor is rendered in multiple layers:MobRenderer.h:14 and MobRenderer.h:34-36
Name Tag Rendering
MobRenderer.h:41
Name tags are visible within specific distances:
MobRenderer.h:6-8
Model System
Base Model Class
Model.h:10
Model Parts
Models are composed ofModelPart objects representing body parts:
- Position and rotation
- Child parts
- Texture coordinates
- Compiled display lists
Texture Mapping
Model.h:17-29
HumanoidModel
HumanoidModel.h:4
Animation System
HumanoidModel supports various animation overrides:HumanoidModel.h:20-40
Setup Animation
- Walking animation
- Idle animation
- Sneaking pose
- Bow drawing
- Eating
- Riding
- Swimming
- Custom skin animations
HumanoidModel.h:58
Rendering Components
HumanoidModel.h:59-61
Specialized Models
BookModel
BookModel.h:5
Used for enchantment tables and books.
QuadrupedModel
For animals with four legs:- PigModel
- CowModel
- SheepModel
- WolfModel
- OzelotModel
Specialized Mob Models
- SpiderModel - 8 legs with articulation
- GhastModel - Floating body with tentacles
- SlimeModel - Scalable cube
- EnderDragonModel - Complex multi-part dragon
- SquidModel - Body with 8 tentacles
Example Renderers
BlazeRenderer
BlazeRenderer.h:5
BoatRenderer
BoatRenderer.h:4
Renders boats with:
- Water bobbing animation
- Paddle animation
- Damage texture overlay
EntityRenderDispatcher
Central registry for all entity renderers:TileEntityRenderDispatcher
Similar system for tile entities:Custom Skin Support
The system supports custom player skins:- 64×64 texture support (via
_reinit) - HD skin textures
- Animated skin features
- Custom model parts
HumanoidModel.h:53
Performance Considerations
Compiled Models
Models can use OpenGL display lists:Shadow Rendering
Shadows are rendered as:- Projected texture on ground
- Strength fades with height
- Radius based on entity size
- Optional tile-based shadow occlusion
Flame Rendering
Entities on fire have flames rendered:EntityRenderer.h:47
Integration with Rendering Pipeline
Entity rendering is called fromLevelRenderer::renderEntities:
- Prepare dispatchers with camera offset
- Enable lighting layer
- Render global entities (no culling)
- Render regular entities (with frustum culling)
- Render tile entities
- Disable lighting layer
LevelRenderer.cpp:494-604
Related Systems
- Level Renderer - World rendering
- Particle Engine - Particle effects
- Animation System - Entity animations