Inviwo 0.9.12-pre
Inviwo documentation
|
Enumerations | |
enum class | IncludeNormals { Yes , No } |
enum class | CalculateMeshNormalsMode { PassThrough , NoWeighting , WeightArea , WeightAngle , WeightNMax , PassThrough , NoWeighting , WeightArea , WeightAngle , WeightNMax } |
The weighting modes for calculating normals. More... | |
enum class | CalculateMeshNormalsMode { PassThrough , NoWeighting , WeightArea , WeightAngle , WeightNMax , PassThrough , NoWeighting , WeightArea , WeightAngle , WeightNMax } |
The weighting modes for calculating normals. More... | |
Functions | |
IVW_CORE_API bool | hasPickIDBuffer (const Mesh *mesh) |
IVW_CORE_API bool | hasRadiiBuffer (const Mesh *mesh) |
IVW_MODULE_BASE_API std::pair< vec3, vec3 > | axisAlignedBoundingBox (const std::vector< std::shared_ptr< const Mesh > > &meshes) |
Compute bounding box of meshes aligned to principal axes of world space. | |
IVW_MODULE_BASE_API std::pair< vec3, vec3 > | axisAlignedBoundingBox (const Mesh &mesh) |
Compute bounding box of mesh aligned to principal axes of world space. Returns mesh offset in both min/max if the mesh does not have any vertices. | |
IVW_MODULE_BASE_API void | centerViewOnMeshes (const std::vector< std::shared_ptr< const Mesh > > &meshes, CameraProperty &camera, float minMaxRatio=10.f) |
Set lookAt position of camera to the center point of the meshes and adjust near/far plane distances. Adjusts min/max parameters of lookTo and near/far plane according to the supplied minMaxRatio. | |
IVW_MODULE_BASE_API std::pair< float, float > | computeNearFarPlanes (std::pair< vec3, vec3 > worldSpaceBoundingBox, const CameraProperty &camera, float nearFarRatio=1.f/10000.f) |
Compute near and far plane parameters covering the bounding box when maximally zoomed out. | |
IVW_MODULE_BASE_API std::shared_ptr< Mesh > | clipMeshAgainstPlane (const Mesh &mesh, const Plane &worldSpacePlane, bool capClippedHoles=true) |
std::unique_ptr< Mesh > | toPointMesh (const Mesh &mesh) |
std::unique_ptr< Mesh > | toLineMesh (const Mesh &mesh) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | ellipse (const vec3 ¢er, const vec3 &majorAxis, const vec3 &minorAxis, const vec4 &color=vec4(1.0f, 0.0f, 0.0f, 1.0f), const float &radius=0.001f, const size_t &segments=16) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | disk (const vec3 ¢er, const vec3 &normal, const vec4 &color=vec4(1.0f, 0.0f, 0.0f, 1.0f), const float &radius=1.0f, const size_t &segments=16) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | cone (const vec3 &start, const vec3 &stop, const vec4 &color=vec4(1.0f, 0.0f, 0.0f, 1.0f), const float &radius=1.0f, const size_t &segments=16) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | cylinder (const vec3 &start, const vec3 &stop, const vec4 &color=vec4(1.0f, 0.0f, 0.0f, 1.0f), const float &radius=1.0f, const size_t &segments=16, bool caps=true, std::shared_ptr< BasicMesh > mesh=nullptr) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | line (const vec3 &start, const vec3 &stop, const vec3 &normal, const vec4 &color=vec4(1.0f, 0.0f, 0.0f, 1.0f), const float &width=1.0f, const ivec2 &res=ivec2(1)) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | arrow (const vec3 &start, const vec3 &stop, const vec4 &color=vec4(1.0f, 0.0f, 0.0f, 1.0f), const float &radius=1.0f, const float &arrowfraction=0.15f, const float &arrowRadius=2.0f, const size_t &segments=16) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | colorsphere (const vec3 ¢er, const float &radius, std::shared_ptr< BasicMesh > mesh=nullptr) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | sphere (const vec3 ¢er, const float &radius, const vec4 &color, std::shared_ptr< BasicMesh > mesh=nullptr) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | square (const vec3 ¢er, const vec3 &normal, const vec2 &extent, const vec4 &color=vec4(1, 1, 1, 1), const ivec2 &segments=ivec2(1)) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | cube (const mat4 &orientation, const vec4 &color=vec4(1, 1, 1, 1)) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | coordindicator (const vec3 ¢er, const float &size) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | boundingbox (const mat4 &basisandoffset, const vec4 &color) |
IVW_MODULE_BASE_API std::shared_ptr< PosTexColorMesh > | boundingBoxAdjacency (const mat4 &basisandoffset, const vec4 &color) |
IVW_MODULE_BASE_API std::shared_ptr< BasicMesh > | torus (const vec3 ¢er, const vec3 &up=vec3(0, 1, 0), float r1=1.f, float r2=.3f, const ivec2 &subdivisions=ivec2(32, 8), vec4 color=vec4(1, 1, 1, 1)) |
IVW_MODULE_BASE_API std::shared_ptr< ColoredMesh > | cameraFrustum (const Camera &camera, vec4 color, std::shared_ptr< ColoredMesh > mesh=std::make_shared< ColoredMesh >()) |
IVW_MODULE_BASE_API std::shared_ptr< Mesh > | parallelepiped (glm::vec3 origin, glm::vec3 p1, glm::vec3 p2, glm::vec3 p3, glm::vec4 color, glm::vec4 c1, glm::vec4 c2, glm::vec4 c3, IncludeNormals includeNormals) |
Create parallelepiped mesh. | |
template<typename Callback > | |
void | forEachTriangle (const Mesh::MeshInfo &info, const IndexBuffer &ib, Callback callback) |
template<typename Callback > | |
void | forEachLineSegment (const Mesh::MeshInfo &info, const IndexBuffer &ib, Callback &&callback) |
template<typename LineStartCallback , typename LinePointCallback , typename LineEndCallback > | |
void | forEachLine (const Mesh::MeshInfo &info, const IndexBuffer &ib, LineStartCallback &&lineStartCallback, LinePointCallback &&linePointCallback, LineEndCallback &&lineEndCallback) |
IVW_MODULE_OIT_API void | calculateMeshNormals (Mesh &mesh, CalculateMeshNormalsMode mode=CalculateMeshNormalsMode::WeightNMax) |
std::unique_ptr< Mesh > | calculateMeshNormals (const Mesh &mesh, CalculateMeshNormalsMode mode=CalculateMeshNormalsMode::WeightNMax) |
meshutil
|
strong |
The weighting modes for calculating normals.
|
strong |
The weighting modes for calculating normals.
IVW_MODULE_BASE_API std::pair< vec3, vec3 > inviwo::meshutil::axisAlignedBoundingBox | ( | const Mesh & | mesh | ) |
Compute bounding box of mesh aligned to principal axes of world space. Returns mesh offset in both min/max if the mesh does not have any vertices.
mesh | Mesh to consider |
IVW_MODULE_BASE_API std::pair< vec3, vec3 > inviwo::meshutil::axisAlignedBoundingBox | ( | const std::vector< std::shared_ptr< const Mesh > > & | meshes | ) |
Compute bounding box of meshes aligned to principal axes of world space.
meshes | Meshes to consider |
IVW_MODULE_BASE_API void inviwo::meshutil::centerViewOnMeshes | ( | const std::vector< std::shared_ptr< const Mesh > > & | meshes, |
CameraProperty & | camera, | ||
float | minMaxRatio = 10.f ) |
Set lookAt position of camera to the center point of the meshes and adjust near/far plane distances. Adjusts min/max parameters of lookTo and near/far plane according to the supplied minMaxRatio.
meshes | Meshes to consider |
camera | Camera to adjust |
minMaxRatio | Adjust min/max values to (value - minMaxRatio*|value|, value + minMaxRatio*|value|) |
IVW_MODULE_BASE_API std::shared_ptr< Mesh > inviwo::meshutil::clipMeshAgainstPlane | ( | const Mesh & | mesh, |
const Plane & | worldSpacePlane, | ||
bool | capClippedHoles = true ) |
Clip mesh against plane using Sutherland-Hodgman. If holes should be closed, the input mesh must be manifold. Vertex attributes are interpolated. Floating types use linear interpolation, integer types use nearest. Connectivity types loop and fan are not handled.
mesh | to clip |
worldSpacePlane | in world space coordinate system |
capClippedHoles | replaces removed parts with triangles aligned with the plane |
Exception | if mesh is not supported. |
IVW_MODULE_BASE_API std::pair< float, float > inviwo::meshutil::computeNearFarPlanes | ( | std::pair< vec3, vec3 > | worldSpaceBoundingBox, |
const CameraProperty & | camera, | ||
float | nearFarRatio = 1.f/10000.f ) |
Compute near and far plane parameters covering the bounding box when maximally zoomed out.
Projects the bounding box onto the view direction and selects the distance furthest away as far plane (increased by 1% to make sure that mesh is not clipped). The view directions considered are lookFrom min/max -> lookTo. Near plane is computed as max(1e^-6, farPlaneDistance * farNearRatio)
worldSpaceBoundingBox | Min and max points of geometry |
camera | Camera used as basis for computation |
nearFarRatio | Ratio between near and far plane. 1:10000 is commonly used by game engines. |
IVW_MODULE_BASE_API std::shared_ptr< Mesh > inviwo::meshutil::parallelepiped | ( | glm::vec3 | origin, |
glm::vec3 | p1, | ||
glm::vec3 | p2, | ||
glm::vec3 | p3, | ||
glm::vec4 | color, | ||
glm::vec4 | c1, | ||
glm::vec4 | c2, | ||
glm::vec4 | c3, | ||
IncludeNormals | includeNormals ) |
Create parallelepiped mesh.
The parallelepiped is anchored at origin and spanned by p1, p2, and p2
* * 6───────────────────▶7 * ▲ ▲ ▲ ▲ * ╱ ╲ ╱ ╲ * ╱ ╲ ╱ ╲ * ╱ ╲ ╱ ╲ * ╱ ╲ ╱ ╲ * 4───────────────────▶5 ╲ * ▲ ╲ ▲ ╲ * ╲ ╲ ╲ ╲ * ╲ 2────────╲──────────▶3 * ╲ ▲ ╲ ▲ * p3 ╲ ╱ ╲ ╱ * ╲ ╱p2 ╲ ╱ * ╲ ╱ ╲ ╱ * ╲ ╱ ╲ ╱ * 0───────────────────▶1 * ▲ p1 * ╱ * ╱ * ╱ Origin * ╱ * ╱ * ╱ *
origin | position |
p1 | basis vector 1 |
p2 | basis vector 2 |
p3 | basis vector 3 |
color | at origin |
c1 | color at p1 |
c2 | color at p2 |
c3 | color at p3 |
includeNormals | Add face normals to the mesh |
Will construct a new mesh out of the given mesh with its position and color buffer, if existing. It will discard all IndexBuffes with DrawType equal to Points, copy all IndexBuffers with DrawType equal to Lines, and construct IndexBuffers with lines out of all IndexBuffers with DrawType equal to Triangles.