Tesseract 0.28.4
Loading...
Searching...
No Matches
tesseract::geometry::MeshTexture Class Reference

Represents a texture and UV coordinates extracted from a mesh file. More...

#include <mesh_material.h>

Public Types

using Ptr = std::shared_ptr<MeshTexture>
using ConstPtr = std::shared_ptr<const MeshTexture>

Public Member Functions

 MeshTexture (std::shared_ptr< tesseract::common::Resource > texture_image, std::shared_ptr< const tesseract::common::VectorVector2d > uvs, MeshTextureType type=MeshTextureType::BASE_COLOR, unsigned uv_channel=0)
 Construct a new MeshTexture.
std::shared_ptr< tesseract::common::Resource > getTextureImage () const
 Get the texture image.
const std::shared_ptr< const tesseract::common::VectorVector2d > & getUVs () const
 Get the texture UV coordinates.
MeshTextureType getType () const
 Get the material slot the texture is applied to.
unsigned getUVChannel () const
 Get the index of the UV channel the UV coordinates were read from.
MeshTextureWrapMode getWrapU () const
 Get the wrap mode along U (S).
MeshTextureWrapMode getWrapV () const
 Get the wrap mode along V (T).
MeshTextureFilter getMagFilter () const
 Get the magnification filter.
MeshTextureFilter getMinFilter () const
 Get the minification filter.
void setWrap (MeshTextureWrapMode wrap_u, MeshTextureWrapMode wrap_v)
 Set the wrap modes along U (S) and V (T).
void setFilters (MeshTextureFilter mag_filter, MeshTextureFilter min_filter)
 Set the magnification and minification filters.
bool operator== (const MeshTexture &rhs) const
 Equality compares the texture settings, the UV values and the image resource contents.
bool operator!= (const MeshTexture &rhs) const

Friends

template<class Archive>
friend void::tesseract::geometry::serialize (Archive &ar, MeshTexture &obj)

Detailed Description

Represents a texture and UV coordinates extracted from a mesh file.

Mesh files contain (or reference) image files that form textures on the surface of the mesh. UV coordinates specify how the image is applied to the mesh. The MeshTexture structure contains a resource to the image, the UV coordinates, the material slot the texture is applied to, and the sampler settings. Currently only jpg and png image formats are supported.

UV coordinates specify the location of each vertex in the mesh on the texture. Each (u,v) coordinate is normalized to be between 0 and 1. Textures that use the same UV channel share the same UV vector.

Constructor & Destructor Documentation

◆ MeshTexture()

tesseract::geometry::MeshTexture::MeshTexture ( std::shared_ptr< tesseract::common::Resource > texture_image,
std::shared_ptr< const tesseract::common::VectorVector2d > uvs,
MeshTextureType type = MeshTextureType::BASE_COLOR,
unsigned uv_channel = 0 )

Construct a new MeshTexture.

Parameters
texture_imageResource representing the texture image (jpg or png)
uvsUV coordinates for texture on mesh
typeThe material slot the texture is applied to
uv_channelThe index of the UV channel in the source mesh that uvs were read from

Member Function Documentation

◆ getTextureImage()

std::shared_ptr< tesseract::common::Resource > tesseract::geometry::MeshTexture::getTextureImage ( ) const

Get the texture image.

Must be jpg or png

Returns
Resource to the texture image

◆ getUVs()

const std::shared_ptr< const tesseract::common::VectorVector2d > & tesseract::geometry::MeshTexture::getUVs ( ) const

Get the texture UV coordinates.

Returns
UV coordinate vector