|
| 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 | set_transform (size_t index, const Mat4 &transform) |
| | Set the placement transform of the mesh at index.
|
| |
| void | set_name (size_t index, const std::string &name) |
| | Set the name of the mesh at index.
|
| |
| const Mat4 & | transform (size_t index) const |
| | The placement transform of the mesh at index (identity when unset).
|
| |
| const std::string & | name (size_t index) const |
| | The name of the mesh at index (empty when unset).
|
| |
| size_t | size () const |
| | Number of meshes in the scene.
|
| |
| bool | empty () const |
| | Whether the scene holds no meshes.
|
| |
| SceneNodeRef | node (size_t index) const |
| | A non-owning reference to the mesh at index (mesh + transform + name).
|
| |
| std::vector< SceneNodeRef > | nodes () const |
| | Non-owning references to all meshes, in draw order.
|
| |
| 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.
|
| |
| void | set_line_transform (size_t index, const Mat4 &transform) |
| | Set the placement transform of the line layer at index.
|
| |
| const Mat4 & | line_transform (size_t index) const |
| | The placement transform of the line layer at index (identity when unset).
|
| |
| const std::string & | line_name (size_t index) const |
| | The name of the line layer at index (empty when unset).
|
| |
| size_t | line_count () const |
| | Number of line layers in the scene.
|
| |
| 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.
|
| |
| 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.
|
| |
| 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< LineNodeRef > | line_nodes () const |
| | Non-owning references to all line layers, in draw order.
|
| |
| 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.
|
| |
| void | set_text_transform (size_t index, const Mat4 &transform) |
| | Set the placement transform of the text layer at index.
|
| |
| const Mat4 & | text_transform (size_t index) const |
| | The placement transform of the text layer at index (identity when unset).
|
| |
| const std::string & | text_name (size_t index) const |
| | The name of the text layer at index (empty when unset).
|
| |
| size_t | text_count () const |
| | Number of text layers in the scene.
|
| |
| TextNodeRef | text_node (size_t index) const |
| | A non-owning reference to the text layer at index.
|
| |
| std::vector< TextNodeRef > | text_nodes () const |
| | Non-owning references to all text layers, in draw order.
|
| |
| 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 transform.
|
| |
|
| std::vector< Mesh > | meshes |
| | The meshes in this scene, drawn in order.
|
| |
| std::vector< Mat4 > | transforms |
| | Per-mesh placement transforms, parallel to meshes.
|
| |
| std::vector< std::string > | names |
| | Optional per-mesh node names, parallel to meshes.
|
| |
| std::vector< LineLayer > | lines |
| | Line layers drawn together with the meshes, after them.
|
| |
| std::vector< Mat4 > | line_transforms |
| | Per-layer placement transforms, parallel to lines.
|
| |
| std::vector< std::string > | line_names |
| | Optional per-layer names, parallel to lines.
|
| |
| std::vector< TextLayer > | texts |
| | Text layers drawn together with the meshes, after them.
|
| |
| std::vector< Mat4 > | text_transforms |
| | Per-layer placement transforms, parallel to texts.
|
| |
| std::vector< std::string > | text_names |
| | Optional per-layer names, parallel to texts.
|
| |
A collection of Mesh objects to be rendered together.
A Scene is a list of meshes with optional per-mesh placement transforms and names. When rendered, meshes are drawn in order — later meshes appear on top of earlier ones. Each mesh's placement transform is applied as a model matrix at render time (meshes themselves are never modified).
Next to meshes a scene can hold two kinds of screen-oriented decorations, which create no geometry and are drawn after the meshes: LineLayer objects (see lines / add_lines()) and text labels (see texts / add_texts()). Line layers contribute to the bounding box of the scene (and thus to the camera fitted to it) unless their affects_bounds flag is set to false, because lines usually are the content of a figure; text labels are ignored by the bounding box, since their extent depends on the font and the output size. Both kinds are skipped by the mesh exporters.
Construction
glm::mat4 Mat4
4×4 floating-point matrix.
glm::vec3 Vec3
3-component floating-point vector (xyz).
A collection of Mesh objects to be rendered together.
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.
int x
Left edge of the bitmap, in image pixels.
For convenience the raw meshes vector is still public and can be modified directly (e.g. scene.meshes.push_back(m)); any mesh without a matching transform is treated as identity.
Bounding box
The combined bounding box of all meshes (after their transforms) can be computed for camera framing:
Camera camera_look_at(const Vec3 ¢er, float radius, const Vec3 &direction, const Vec3 &up, float fov_degrees, float margin, ProjectionType projection)
Create a camera that looks at a point from a given distance and direction.
A virtual camera that defines the viewpoint for rendering.
- See also
- Mesh, SceneNodeRef, Renderer::render_scene(), camera_fit_scene()
Definition at line 69 of file scene.h.