CnaEngine::Graphics::GpuMesh
Uploads a built mesh to CNA vertex/index buffers and draws it with the caller's effect — replaced Easy3D::CubeMeshRenderer.
Easy3D::CubeMeshRenderer on 2026-10-20
This page used to document easy-3d's CubeMeshRenderer (and its billboard counterpart
BillboardMeshRenderer), which uploaded vertex + index buffers and drew them with a
BasicEffect. easy-3d was removed on 2026-10-20 and replaced by the strict modules of
cna-engine; that job is now done by GpuMesh. The page keeps its old file name so
existing links keep working.
Overview
Lives in the sibling ../cna-engine repository (CMake target
CnaEngine::Graphics, namespace CnaEngine::Graphics; XNA 4.0 types only).
GpuMesh::Upload(device, mesh, VertexLayout::PositionTexture()) uploads a mesh built
with MeshBuilder to CNA buffers once;
GpuMesh::Draw(device, effect) applies each pass of the effect's current technique and
draws the mesh. The effect — a BasicEffect in Galaxy Eggbert — is created and
configured by the game itself through CNA.
Header: include/CnaEngine/Graphics/GpuMesh.hpp (in ../cna-engine).
API (as used by GalaxyEggbertCNA)
namespace CnaEngine::Graphics {
class GpuMesh {
public:
// Uploads once; Galaxy Eggbert passes VertexLayout::PositionTexture().
static GpuMesh Upload(Microsoft::Xna::Framework::Graphics::GraphicsDevice& device,
const MeshData& mesh, const VertexLayout& layout);
// Applies each pass of effect's current technique and draws the mesh.
bool Draw(Microsoft::Xna::Framework::Graphics::GraphicsDevice& device,
Microsoft::Xna::Framework::Graphics::Effect& effect) const;
};
}
// Galaxy Eggbert: src/GalaxyEggbert/Game/TexturedMesh.hpp
std::unique_ptr<CnaEngine::Graphics::GpuMesh> UploadTexturedMesh(
Microsoft::Xna::Framework::Graphics::GraphicsDevice& device,
const CnaEngine::Graphics::MeshData& mesh);
The game keeps its meshes as std::unique_ptr<CnaEngine::Graphics::GpuMesh>
members, created with UploadTexturedMesh(device, meshData). Upload
rejects an empty mesh, so callers check for one first and leave the pointer empty instead.
Used By
GETerrainRenderer owns its terrain meshes this way: a static
mesh built once, and animated-tile meshes rebuilt only when the animation phase changes. Objects,
billboards, the HUD and the editor draw their meshes through GpuMesh the same way.
Billboards
The old roadmap note on this page — easy-3d's BillboardBatch had no vertex builder or
CNA renderer adapter yet (E3D-MIG-061/062) — is history. Billboards are
built with MeshBuilder::AddBillboard and drawn through a GpuMesh like
every other mesh.