Skip to content

Enable orthographic camera 2d#313

Merged
waynemwashuma merged 2 commits into
wimaengine:devfrom
waynemwashuma:enable-orthographic-camera-2d
May 12, 2026
Merged

Enable orthographic camera 2d#313
waynemwashuma merged 2 commits into
wimaengine:devfrom
waynemwashuma:enable-orthographic-camera-2d

Conversation

@waynemwashuma
Copy link
Copy Markdown
Collaborator

@waynemwashuma waynemwashuma commented May 12, 2026

Objective

Introduce orthographic projection support for the Canvas2D renderer.

  • Added projection-aware camera rendering to canvas2d renderer
  • Updated the default 2D camera prefab to use OrthographicProjection

Solution

Previously, the Canvas2D renderer assumed a fixed normalized coordinate space based entirely on window dimensions and ignored the camera projection entirely;
This tightly coupled rendering behavior to the canvas size and prevented cameras from defining their own projection bounds.

Why this approach

Instead of baking projection assumptions into renderer logic, the camera now fully owns projection behavior.
Benefits:

  • Custom orthographic bounds now affect rendering correctly
  • World-space scaling behaves consistently
  • Camera projection is now explicit and extensible
  • Aligns the render's behavior with other renderers

Showcase

Before

const camera = new Camera()

// Projection settings had no effect
// Canvas coordinates were implicitly normalized to window size

After

const camera = new Camera(
  new OrthographicProjection(-10, 10, 10, -10)
)
// Projection settings now has an effect

Migration guide

2D cameras now require a supported projection, unsupported projection types now throw.

Checklist

  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@waynemwashuma waynemwashuma self-assigned this May 12, 2026
@waynemwashuma waynemwashuma added the type:enhancement New feature or request label May 12, 2026
@waynemwashuma waynemwashuma merged commit 4a7e97c into wimaengine:dev May 12, 2026
7 checks passed
@waynemwashuma waynemwashuma deleted the enable-orthographic-camera-2d branch May 12, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

mod:render type:enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant