126 const std::string &
name =
"") {
128 meshes.back().update_transparency();
135 if (index >=
meshes.size())
144 if (index >=
meshes.size())
146 while (
names.size() <= index)
160 const std::string &
name(
size_t index)
const {
161 static const std::string
kEmpty;
162 if (index >=
names.size())
185 std::vector<SceneNodeRef>
nodes()
const {
186 std::vector<SceneNodeRef>
out;
188 for (
size_t i = 0;
i <
meshes.size(); ++
i)
205 const std::string &
name =
"") {
206 lines.push_back(layer);
213 if (index >=
lines.size())
231 static const std::string
kEmpty;
245 if (index >=
lines.size())
247 lines[index].affects_bounds = affects_bounds;
257 for (
size_t i = 0;
i <
lines.size(); ++
i) {
259 lines[
i].affects_bounds = affects_bounds;
270 if (index >=
lines.size())
272 return lines[index].affects_bounds;
288 std::vector<LineNodeRef>
out;
290 for (
size_t i = 0;
i <
lines.size(); ++
i)
307 const std::string &
name =
"") {
308 texts.push_back(layer);
315 if (index >=
texts.size())
333 static const std::string
kEmpty;
355 std::vector<TextNodeRef>
out;
357 for (
size_t i = 0;
i <
texts.size(); ++
i)
376 for (
int c = 0;
c < 8; ++
c) {
393 for (
size_t i = 0;
i <
meshes.size(); ++
i) {
405 for (
size_t i = 0;
i <
lines.size(); ++
i) {
406 if (!
lines[
i].affects_bounds)
418 for (
size_t i = 0;
i <
lines.size(); ++
i) {
Screen-space line primitives — the LineLayer.
Low-level math utilities for the rendering pipeline.
The Mesh — the central data structure for 3D geometry in scimesh.
glm::mat4 Mat4
4×4 floating-point matrix.
glm::vec3 Vec3
3-component floating-point vector (xyz).
Vec3 transform_point(const Mat4 &m, const Vec3 &p)
Transform a point by a 4×4 matrix (with implicit w=1).
A batch of independent line segments drawn with a fixed screen-space width.
A non-owning reference to one line layer in a scene, together with its placement transform (and optio...
const LineLayer * layer
Pointer to the owned layer (never null for a valid node).
std::string name
Optional node name (used by exporters / debugging).
Mat4 transform
Model matrix placing the lines in world space.
A 3D triangle mesh using an indexed face set representation.
void compute_bounding_box(Vec3 &min_bound, Vec3 &max_bound) const
Compute the axis-aligned bounding box (AABB) of the mesh.
std::vector< Vec3 > vertices
3D vertex positions.
A lightweight, non-owning reference to one mesh in a scene, together with its placement transform (an...
std::string name
Optional node name (used by exporters / debugging).
Mat4 transform
Model matrix placing the mesh in world space (identity = as-is).
const Mesh * mesh
Pointer to the owned mesh (never null for a valid node).
A collection of Mesh objects to be rendered together.
bool set_line_affects_bounds(const std::string &name, bool affects_bounds)
Set whether the line layer called name contributes to the scene bounds, see LineLayer::affects_bounds...
std::vector< std::string > text_names
Optional per-layer names, parallel to texts.
void set_transform(size_t index, const Mat4 &transform)
Set the placement transform of the mesh at index.
std::vector< Mesh > meshes
The meshes in this scene, drawn in order.
void set_line_affects_bounds(size_t index, bool affects_bounds)
Set whether the line layer at index contributes to the scene bounds, see LineLayer::affects_bounds.
std::vector< TextLayer > texts
Text layers drawn together with the meshes, after them.
void add_texts(const TextLayer &layer, const Mat4 &transform=Mat4(1.0f), const std::string &name="")
Add a text layer to the scene with an optional placement transform and name.
std::vector< LineNodeRef > line_nodes() const
Non-owning references to all line layers, in draw order.
void set_text_transform(size_t index, const Mat4 &transform)
Set the placement transform of the text layer at index.
const std::string & text_name(size_t index) const
The name of the text layer at index (empty when unset).
const std::string & line_name(size_t index) const
The name of the line layer at index (empty when unset).
bool empty() const
Whether the scene holds no meshes.
std::vector< std::string > line_names
Optional per-layer names, parallel to lines.
size_t text_count() const
Number of text layers in the scene.
void compute_bounding_box(Vec3 &min_bound, Vec3 &max_bound) const
Compute the combined axis-aligned bounding box of all meshes, after applying each mesh's placement tr...
std::vector< Mat4 > transforms
Per-mesh placement transforms, parallel to meshes.
void set_line_transform(size_t index, const Mat4 &transform)
Set the placement transform of the line layer at index.
std::vector< Mat4 > line_transforms
Per-layer placement transforms, parallel to lines.
const Mat4 & text_transform(size_t index) const
The placement transform of the text layer at index (identity when unset).
size_t line_count() const
Number of line layers in the scene.
bool line_affects_bounds(size_t index) const
Whether the line layer at index contributes to the scene bounds.
LineNodeRef line_node(size_t index) const
A non-owning reference to the line layer at index.
std::vector< Mat4 > text_transforms
Per-layer placement transforms, parallel to texts.
const Mat4 & transform(size_t index) const
The placement transform of the mesh at index (identity when unset).
const Mat4 & line_transform(size_t index) const
The placement transform of the line layer at index (identity when unset).
size_t size() const
Number of meshes in the scene.
std::vector< LineLayer > lines
Line layers drawn together with the meshes, after them.
void set_name(size_t index, const std::string &name)
Set the name of the mesh at index.
std::vector< SceneNodeRef > nodes() const
Non-owning references to all meshes, in draw order.
std::vector< TextNodeRef > text_nodes() const
Non-owning references to all text layers, in draw order.
std::vector< std::string > names
Optional per-mesh node names, parallel to meshes.
TextNodeRef text_node(size_t index) const
A non-owning reference to the text layer at index.
void add(const Mesh &mesh, const Mat4 &transform=Mat4(1.0f), const std::string &name="")
Add a mesh to the scene with an optional placement transform and name.
void add_lines(const LineLayer &layer, const Mat4 &transform=Mat4(1.0f), const std::string &name="")
Add a line layer to the scene with an optional placement transform and name.
const std::string & name(size_t index) const
The name of the mesh at index (empty when unset).
SceneNodeRef node(size_t index) const
A non-owning reference to the mesh at index (mesh + transform + name).
A batch of text labels drawn together, in one coordinate space.
A non-owning reference to one text layer in a scene, together with its placement transform (and optio...
const TextLayer * layer
Pointer to the owned layer (never null for a valid node).
Mat4 transform
Model matrix applied to the anchor positions.
std::string name
Optional node name (used by exporters / debugging).
int x
Left edge of the bitmap, in image pixels.
Text labels — the TextLayer.