# juniojsv/juniojsv-engine architecture

> Architecture diagram of the GitHub repository juniojsv/juniojsv-engine, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/juniojsv/juniojsv-engine
- Repository: https://github.com/juniojsv/juniojsv-engine

## Overview

juniojsv-engine is a Kotlin Multiplatform 3D game and rendering engine for desktop JVM and Android. Its runtime starts in a platform window, initializes shared window contexts, and repeatedly updates and renders a scene; rendering uses multiple passes and platform-specific OpenGL bindings. The graph retains documented physics, instancing, bounds, shader, and resource capabilities. Some subsystem links rely on README documentation because their implementations were not sampled; those links are cited to the README rather than inferred from folder names.

Main entry points: [`engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt`](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt) (Render pipeline), [`engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt`](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt) (Window context), [`engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt`](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt) (Window lifecycle), [`engine/src/commonMain/kotlin/juniojsv/engine/features/scene/Scene.kt`](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/scene/Scene.kt) (Scene and entities)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime and Contexts"]
  node_window["Window lifecycle<br/>[PlatformWindow.kt]"]
  node_windowctx["Window context<br/>[WindowContext.kt]"]
  node_camera["Camera context<br/>[CameraContext.kt]"]
  node_gui["GUI context<br/>[GuiContext.kt]"]
end

subgraph group_world["World and Physics"]
  node_scene["Scene and entities<br/>[Scene.kt]"]
  node_player["Player controller<br/>[Player.kt]"]
  node_physics["Physics simulation<br/>[PhysicsContext.kt]"]
  node_physicscomponent["Physics component"]
  node_bounds["Bounds and culling<br/>[IBoundaryShape.kt]"]
end

subgraph group_graphics["Rendering and Assets"]
  node_pipeline["Render pipeline<br/>[RenderPipeline.kt]"]
  node_instancing["Instanced rendering"]
  node_mesh["Mesh handling<br/>[Mesh.kt]"]
  node_resources["Resource loading<br/>[Resources.kt]"]
  node_shader["Shader loading<br/>[Shader.kt]"]
  node_program["Shader programs<br/>[ShadersProgram.kt]"]
  node_textures["Textures<br/>[Texture.kt]"]
  node_debug["Debug rendering"]
end

subgraph group_platform["Platform Backends"]
  node_jvmwindow["JVM window<br/>[JvmWindow.kt]"]
  node_androidwindow["Android window<br/>[AndroidWindow.kt]"]
  node_gl["OpenGL interface<br/>[GL.kt]"]
  node_jvmgl["JVM GL binding<br/>[GL.jvm.kt]"]
  node_androidgl["Android GL binding<br/>[GL.android.kt]"]
  node_shaderconvert["Android shader conversion<br/>[ShaderConverter.kt]"]
end

node_app(("Engine host"))

node_app -->|"starts"| node_window
node_window -->|"creates context"| node_windowctx
node_windowctx -->|"owns"| node_camera
node_window -.->|"implemented by"| node_jvmwindow
node_window -.->|"implemented by"| node_androidwindow
node_jvmwindow -->|"uses"| node_gl
node_androidwindow -->|"uses"| node_gl
node_gl -.->|"JVM actual"| node_jvmgl
node_gl -.->|"Android actual"| node_androidgl
node_windowctx -->|"owns"| node_physics
node_windowctx -->|"owns"| node_gui
node_physics -->|"updates"| node_physicscomponent
node_player -->|"uses"| node_physicscomponent
node_scene -.->|"contains"| node_player
node_scene -.->|"renders through"| node_pipeline
node_pipeline -->|"invokes render callbacks"| node_scene
node_pipeline -.->|"supports"| node_instancing
node_pipeline -->|"runs overlay pass"| node_debug
node_windowctx -->|"updates"| node_camera
node_camera -->|"provides frustum"| node_bounds
node_bounds -.->|"supplies debug shapes"| node_debug
node_scene -.->|"uses meshes"| node_mesh
node_resources -.->|"loads mesh assets"| node_mesh
node_resources -->|"loads shader assets"| node_shader
node_shader -->|"provides compiled shaders"| node_program
node_program -->|"binds uniforms"| node_textures
node_pipeline -->|"creates pass programs"| node_program
node_pipeline -->|"composites frame textures"| node_textures
node_shaderconvert -->|"translates shaders for"| node_androidgl

click node_window "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt"
click node_windowctx "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt"
click node_camera "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/CameraContext.kt"
click node_jvmwindow "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/jvmMain/kotlin/juniojsv/engine/features/window/JvmWindow.kt"
click node_androidwindow "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/androidMain/kotlin/juniojsv/engine/features/window/AndroidWindow.kt"
click node_gl "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/platforms/GL.kt"
click node_jvmgl "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/jvmMain/kotlin/juniojsv/engine/platforms/GL.jvm.kt"
click node_androidgl "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/androidMain/kotlin/juniojsv/engine/platforms/GL.android.kt"
click node_scene "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/scene/Scene.kt"
click node_player "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/entities/Player.kt"
click node_physics "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/PhysicsContext.kt"
click node_physicscomponent "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/entities/PhysicsComponent.kt"
click node_bounds "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/utils/IBoundaryShape.kt"
click node_pipeline "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt"
click node_instancing "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/MultiEntityRender.kt"
click node_mesh "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/mesh/Mesh.kt"
click node_resources "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/utils/Resources.kt"
click node_shader "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/shader/Shader.kt"
click node_program "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/shader/ShadersProgram.kt"
click node_textures "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/textures/Texture.kt"
click node_debug "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/DebugShapeRender.kt"
click node_gui "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/GuiContext.kt"
click node_shaderconvert "https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/androidMain/kotlin/juniojsv/engine/features/utils/ShaderConverter.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_window,node_windowctx,node_camera,node_gui toneBlue
class node_scene,node_player,node_physics,node_physicscomponent,node_bounds toneAmber
class node_pipeline,node_instancing,node_mesh,node_resources,node_shader,node_program,node_textures,node_debug toneMint
class node_jvmwindow,node_androidwindow,node_gl,node_jvmgl,node_androidgl,node_shaderconvert toneRose
class node_app toneIndigo
```

## Components

### Runtime and Contexts

- [Window lifecycle](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt`
- [Window context](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt`
- [Camera context](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/CameraContext.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/context/CameraContext.kt`
- [GUI context](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/GuiContext.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/context/GuiContext.kt`

### World and Physics

- [Scene and entities](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/scene/Scene.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/scene/Scene.kt`
- [Player controller](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/entities/Player.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/entities/Player.kt`
- [Physics simulation](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/context/PhysicsContext.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/context/PhysicsContext.kt`
- [Physics component](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/entities/PhysicsComponent.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/entities/PhysicsComponent.kt`
- [Bounds and culling](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/utils/IBoundaryShape.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/utils/IBoundaryShape.kt`

### Rendering and Assets

- [Render pipeline](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt`
- [Instanced rendering](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/MultiEntityRender.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/render/MultiEntityRender.kt`
- [Mesh handling](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/mesh/Mesh.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/mesh/Mesh.kt`
- [Resource loading](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/utils/Resources.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/utils/Resources.kt`
- [Shader loading](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/shader/Shader.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/shader/Shader.kt`
- [Shader programs](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/shader/ShadersProgram.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/shader/ShadersProgram.kt`
- [Textures](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/textures/Texture.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/textures/Texture.kt`
- [Debug rendering](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/features/render/DebugShapeRender.kt): `engine/src/commonMain/kotlin/juniojsv/engine/features/render/DebugShapeRender.kt`

### Platform Backends

- [JVM window](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/jvmMain/kotlin/juniojsv/engine/features/window/JvmWindow.kt): `engine/src/jvmMain/kotlin/juniojsv/engine/features/window/JvmWindow.kt`
- [Android window](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/androidMain/kotlin/juniojsv/engine/features/window/AndroidWindow.kt): `engine/src/androidMain/kotlin/juniojsv/engine/features/window/AndroidWindow.kt`
- [OpenGL interface](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/commonMain/kotlin/juniojsv/engine/platforms/GL.kt): `engine/src/commonMain/kotlin/juniojsv/engine/platforms/GL.kt`
- [JVM GL binding](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/jvmMain/kotlin/juniojsv/engine/platforms/GL.jvm.kt): `engine/src/jvmMain/kotlin/juniojsv/engine/platforms/GL.jvm.kt`
- [Android GL binding](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/androidMain/kotlin/juniojsv/engine/platforms/GL.android.kt): `engine/src/androidMain/kotlin/juniojsv/engine/platforms/GL.android.kt`
- [Android shader conversion](https://github.com/juniojsv/juniojsv-engine/blob/master/engine/src/androidMain/kotlin/juniojsv/engine/features/utils/ShaderConverter.kt): `engine/src/androidMain/kotlin/juniojsv/engine/features/utils/ShaderConverter.kt`

### Other components

- **Engine host**

## Connections

- Engine host → Window lifecycle: starts (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt`)
- Window lifecycle → Window context: creates context (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/window/PlatformWindow.kt`)
- Window context → Camera context: owns (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt`)
- Window lifecycle → JVM window: implemented by (evidence: `README.md`)
- Window lifecycle → Android window: implemented by (evidence: `README.md`)
- JVM window → OpenGL interface: uses (evidence: `engine/src/jvmMain/kotlin/juniojsv/engine/features/window/JvmWindow.kt`)
- Android window → OpenGL interface: uses (evidence: `engine/src/androidMain/kotlin/juniojsv/engine/features/window/AndroidWindow.kt`)
- OpenGL interface → JVM GL binding: JVM actual (evidence: `README.md`)
- OpenGL interface → Android GL binding: Android actual (evidence: `README.md`)
- Window context → Physics simulation: owns (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt`)
- Window context → GUI context: owns (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt`)
- Physics simulation → Physics component: updates (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/context/PhysicsContext.kt`)
- Player controller → Physics component: uses (evidence: `README.md`)
- Scene and entities → Player controller: contains
- Scene and entities → Render pipeline: renders through (evidence: `README.md`)
- Render pipeline → Scene and entities: invokes render callbacks (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt`)
- Render pipeline → Instanced rendering: supports (evidence: `README.md`)
- Render pipeline → Debug rendering: runs overlay pass (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt`)
- Window context → Camera context: updates (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/context/WindowContext.kt`)
- Camera context → Bounds and culling: provides frustum (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/context/CameraContext.kt`)
- Bounds and culling → Debug rendering: supplies debug shapes (evidence: `README.md`)
- Scene and entities → Mesh handling: uses meshes (evidence: `README.md`)
- Resource loading → Mesh handling: loads mesh assets (evidence: `README.md`)
- Resource loading → Shader loading: loads shader assets (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/utils/Resources.kt`)
- Shader loading → Shader programs: provides compiled shaders (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/shader/ShadersProgram.kt`)
- Shader programs → Textures: binds uniforms (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/shader/ShadersProgram.kt`)
- Render pipeline → Shader programs: creates pass programs (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt`)
- Render pipeline → Textures: composites frame textures (evidence: `engine/src/commonMain/kotlin/juniojsv/engine/features/render/RenderPipeline.kt`)
- Android shader conversion → Android GL binding: translates shaders for (evidence: `engine/src/androidMain/kotlin/juniojsv/engine/platforms/GL.android.kt`)
