3#include <glm/gtc/matrix_transform.hpp>
21 if (!mesh.has_normals()) {
38 for (
auto &
n : mesh.normals) {
85 const std::vector<uint32_t> &
fs_faces,
96 for (
size_t i = 0;
i <
nv;
i++) {
107 out.colors.push_back(
Color(1.0f, 1.0f, 1.0f,
119 out.triangles.reserve(
nf);
120 for (
size_t i = 0;
i <
nf;
i++) {
129 out.update_transparency();
Low-level math utilities for the rendering pipeline.
glm::vec2 Vec2
2-component floating-point vector (xy).
glm::mat4 Mat4
4×4 floating-point matrix.
void flip_uvs(Mesh &mesh)
Flip the texture coordinates of a mesh vertically (v → 1 − v).
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).
void scale_mesh(Mesh &mesh, const Vec3 &scale)
Scale a mesh non-uniformly along each axis.
void rotate_mesh(Mesh &mesh, float angle_radians, const Vec3 &axis)
Rotate a mesh around an arbitrary axis.
Mesh mesh_from_fs(const std::vector< float > &fs_vertices, const std::vector< uint32_t > &fs_faces, const std::vector< float > &per_vertex_values, const std::vector< uint8_t > &rgb_bytes, bool detect_transparency)
Convert a FreeSurfer-format mesh (flat vertex/face arrays) to a scimesh Mesh.
void transform_mesh(Mesh &mesh, const Mat4 &matrix)
Apply an arbitrary 4×4 transformation matrix to a mesh.
void translate_mesh(Mesh &mesh, const Vec3 &translation)
Translate (move) a mesh by a displacement vector.
An RGBA color with floating-point components.
A 3D triangle mesh using an indexed face set representation.
std::vector< Vec3 > vertices
3D vertex positions.
std::vector< Vec2 > uvs
Per-vertex texture coordinates (UVs).
A triangle defined by three vertex indices.
int x
Left edge of the bitmap, in image pixels.