Architecture

Easy3D / Guide / Architecture

Easy3D is a companion library, not an engine. It sits beside CNA: a game still creates and drives its CNA Game, devices, graphics device, and input directly. Easy3D only removes repetitive glue — cameras, billboard/cube batching, a texture atlas, debug drawing.

The big picture

Galaxy Eggbert
  -> uses CNA directly
  -> uses Easy3D helpers
  -> may use Mobile Eggbert as existing reference/library/data source

Easy3D
  -> depends on CNA
  -> does not hide CNA
  -> contains helper classes only

CNA
  -> XNA 4.0-style runtime and future CNA/NOXNA extensions

Dependency direction

galaxy-eggbert ──depends on──> easy-3d ──depends on──> cna
        │                                               ▲
        └───────────────── also depends on ─────────────┘
                       (uses CNA directly too)

Easy3D depends on CNA. Nothing in CNA depends on Easy3D. A game depends on both, and is free to call CNA directly whenever Easy3D does not help.

Principles

Easy3D APIs may expose CNA types

It is normal and encouraged for Easy3D functions to take or return Microsoft::Xna::Framework::Vector3, Matrix, and friends. Easy3D must not invent parallel math types that hide CNA, and must not wrap CNA objects just to rename them. The one deliberate exception: TextureAtlas uses two small Easy3D-local PODs (AtlasRect, UvRect) because pixel/UV rectangles are not CNA concepts — this also keeps it CNA-free and unit-testable on its own.

The intended design — CNA stays in charge

// A bad design (Easy3D hiding everything):
Easy3D::Game game;
game.RunEverything();   // NO — this is not what Easy3D is for

// The intended design (CNA stays in charge, Easy3D just helps):
Easy3D::Camera3D     camera;
Easy3D::OrbitCamera  orbit;
Easy3D::TextureAtlas atlas;

Eggbert-specific rules stay out of Easy3D

Anything that only makes sense for Galaxy Eggbert / Mobile Eggbert — tile meanings, Blupi animation tables, level formats, gameplay rules — belongs in those projects, never in Easy3D. Likewise, Mobile Eggbert is an existing, working reference and is not refactored just because Galaxy Eggbert (or Easy3D) would find it convenient.

How Easy3D consumes CNA

Sibling repository layout

.../openeggbert/
  ├── cna/            <- required: the CNA runtime (headers under cna/include)
  ├── sharp-runtime/  <- optional: used by CNA; Easy3D does NOT depend on it (yet)
  └── easy-3d/        <- the Easy3D repository

Anatomy of the library

The public API is thirteen headers under include/Easy3D/. Eleven of them are pulled in by the umbrella header Easy3D.hpp; BillboardMesh.hpp and BillboardMeshRenderer.hpp are deliberately not — include those two directly.

HeaderProvidesCNA at runtime?In umbrella?
Easy3D/Version.hppVersion macros, constants, VersionString()NoYes
Easy3D/Camera3D.hppCamera3DYes (matrices)Yes
Easy3D/OrbitCamera.hppOrbitCameraYesYes
Easy3D/FollowCamera.hppFollowCameraYesYes
Easy3D/TextureAtlas.hppTextureAtlas, AtlasRect, UvRectNo (CNA-free)Yes
Easy3D/BillboardBatch.hppBillboardBatch, BillboardItemStores CNA typesYes
Easy3D/BillboardMesh.hppBillboardVertex, AppendBillboardMesh, BuildBillboardMeshYes (Vector3 math)No
Easy3D/BillboardMeshRenderer.hppBillboardMeshRendererYes (GPU draw)No
Easy3D/CubeBatch.hppCubeBatch, CubeItemStores CNA typesYes
Easy3D/CubeMesh.hppCubeVertex, AppendCubeMesh/BuildCubeMesh, DirectionalCubeItem, PlateItem, TripleCrossItem, PyramidTipItemYes (Vector3 math)Yes
Easy3D/CubeMeshRenderer.hppCubeMeshRendererYes (GPU draw)Yes
Easy3D/DebugDraw.hppDebugDraw, DebugLine, DebugBoxStores CNA typesYes

The data-first pipeline

Easy3D is being built in deliberate phases (see the Roadmap). The batching classes are data recorders, not renderers:

1. Queue data — BillboardBatch / CubeBatch / DebugDraw store plain items (done)
2. Build CPU-side geometry — BuildCubeMesh() / BuildBillboardMesh()std::vector of vertices/indices (done for cubes & billboards; debug lines/boxes remain)
3. CNA renderer adapters — CubeMeshRenderer / BillboardMeshRenderer upload buffers, issue real CNA draw calls (done for cubes & billboards; debug lines/boxes remain)

This kept every step testable without a GPU until it actually needed one, and deferred the concrete CNA draw-path decision to the phase that actually needed it. Debug line/box drawing is the one shape that hasn't made it through this pipeline yet.

What Easy3D is deliberately NOT

No ECS, no generic engine object hierarchy, no Lua, no physics, no navigation, no networking, no editor, no asset database, no resource cache, no model importer, no plugin system, no PBR renderer. If one of these starts to appear, it is a sign Easy3D is drifting toward being an engine — stop and reconsider. See Design Principles.