Visual Computing Library
Loading...
Searching...
No Matches
vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT > Class Template Reference

The WedgeTexCoords class is a container of texture coordinates associated to the wedges of a Face element. More...

#include <vclib/mesh/components/wedge_tex_coords.h>

Inheritance diagram for vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >:

Public Types

using WedgeTexCoordType = vcl::TexCoord< Scalar >
 Expose the type of the Texture Coordinate.
 
using WedgeTexCoordsIterator = Vector< vcl::TexCoord< Scalar >, N >::Iterator
 
using ConstWedgeTexCoordsIterator = Vector< vcl::TexCoord< Scalar >, N >::ConstIterator
 

Public Member Functions

 WedgeTexCoords ()=default
 Empty constructor.
 
vcl::TexCoord< Scalar > & wedgeTexCoord (uint i)
 Returns a reference to the i-th wedge texcoord of the element.
 
const vcl::TexCoord< Scalar > & wedgeTexCoord (uint i) const
 Returns a const reference to the i-th wedge texcoord of the element.
 
vcl::TexCoord< Scalar > & wedgeTexCoordMod (int i)
 Returns a reference to the i-th wedge texcoord of the element but using as index the module between i and the number of vertices of the element. You can use this function if you need to get the "next wedge texcoord after position k", without check if it is less than the number of vertices. Works also for negative numbers:
 
const vcl::TexCoord< Scalar > & wedgeTexCoordMod (int i) const
 Same of wedgeTexCoordMod(int) but returns a const reference.
 
void setWedgeTexCoord (uint i, const vcl::TexCoord< Scalar > &t)
 Sets the i-th wedge texcoord of the element.
 
template<Range Rng>
requires InputRange<Rng, vcl::TexCoord<Scalar>>
void setWedgeTexCoords (Rng &&r)
 Sets all the wedge texcoords of the element.
 
ushorttextureIndex ()
 Returns a reference to the texture index used to identify the texture on which the wedge texture coordinates are mapped.
 
ushort textureIndex () const
 Returns the texture index used to identify the texture on which the wedge texture coordinates are mapped.
 
WedgeTexCoordsIterator wedgeTexCoordBegin ()
 Returns an iterator to the first wedge texcoord in the container of this component.
 
WedgeTexCoordsIterator wedgeTexCoordEnd ()
 Returns an iterator to the end of the container of this component.
 
ConstWedgeTexCoordsIterator wedgeTexCoordBegin () const
 Returns a const iterator to the first wedge texcoord in the container of this component.
 
ConstWedgeTexCoordsIterator wedgeTexCoordEnd () const
 Returns a const iterator to the end of the container of this component.
 
View< WedgeTexCoordsIterator > wedgeTexCoords ()
 Returns a lightweight view object that stores the begin and end iterators of the container of wedge texcoords of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:
 
View< ConstWedgeTexCoordsIterator > wedgeTexCoords () const
 Returns a lightweight const view object that stores the begin and end iterators of the container of wedge texcoords of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:
 
void __wedgeTexCoords () const
 

Static Public Attributes

static const int WEDGE_TEX_COORD_NUMBER = N
 
- Static Public Attributes inherited from vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >
static const bool TIED_TO_VERTEX_NUMBER = TTVN
 Boolean that tells if this component stores a container having its size tied to the number of the vertices of the Element.
 
static const int SIZE = N
 

Protected Types

using WedgeTexCoordScalarType = Scalar
 
- Protected Types inherited from vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >
using Iterator = Vector< T, N >::Iterator
 
using ConstIterator = Vector< T, N >::ConstIterator
 

Protected Member Functions

template<typename Element >
void importFrom (const Element &e, bool=true)
 
void serialize (std::ostream &os) const
 
void deserialize (std::istream &is)
 
void resize (uint n)
 
void pushBack (const vcl::TexCoord< Scalar > &t=vcl::TexCoord< Scalar >())
 
void insert (uint i, const vcl::TexCoord< Scalar > &t=vcl::TexCoord< Scalar >())
 
void erase (uint i)
 
void clear ()
 
- Protected Member Functions inherited from vcl::comp::ContainerComponent< DerivedComponent, COMP_ID, T, N, AdditionalData, ParentElemType, VERT, OPT, TTVN, PointedTypes >
void init ()
 
Vector< T, N > & container ()
 
const Vector< T, N > & container () const
 
template<typename AdDt = AdditionalData>
requires (HAS_ADDITIONAL_DATA)
AdDtadditionalData ()
 
template<typename AdDt = AdditionalData>
requires (HAS_ADDITIONAL_DATA)
const AdDtadditionalData () const
 

Private Types

using Base = ContainerComponent< WedgeTexCoords< Scalar, N, ParentElemType, OPT >, CompId::WEDGE_TEX_COORDS, vcl::TexCoord< Scalar >, N, ushort, ParentElemType, !std::is_same_v< ParentElemType, void >, OPT, true >
 

Private Member Functions

template<typename Element >
void importWedgeTexCoordsFrom (const Element &e)
 
Vector< vcl::TexCoord< Scalar >, N > & texCoords ()
 
const Vector< vcl::TexCoord< Scalar >, N > & texCoords () const
 

Detailed Description

template<typename Scalar, int N, typename ParentElemType = void, bool OPT = false>
class vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >

The WedgeTexCoords class is a container of texture coordinates associated to the wedges of a Face element.

The component is composed of a static or dynamic size container, depending on the value of the template argument N (a negative value indicates a dynamic size), plus a texture index that represents the index of the texture used by all the texture coordinates stored in the container.

The member functions of this class will be available in the instance of any Element that will contain this component, altough it is usually used (and it makes sense only) on the Face element.

For example, if you have a Face Element f that has the WedgeTexCoords component, you'll be able to access to this component member functions from f:

auto t = f.wedgeTexCoord(0);
ushort tid = f.textureIndex();
A class representing a line segment in n-dimensional space. The class is parameterized by a PointConc...
Definition segment.h:43
Note
This component is Tied To Vertex Number: it means that the size of the container, if dynamic, will change automatically along the Vertex Number of the Component. For further details check the documentation of the ContainerComponent class.
Template Parameters
ScalarThe Scalar type used for the texture coordinates.
NThe size of the container, that will represent the number of storable wedge texcoords. If N is negative, the container will be dynamic. In any case, N must be the same of the Vertex Number of the Element that will contain this component.
ParentElemTypeThis template argument must be void if the component needs to be stored horizontally, or the type of the parent element that will contain this component if the component needs to be stored vertically.
OPTIf true, the component will be optional. This argument is considered only if the component is stored vertically.

Constructor & Destructor Documentation

◆ WedgeTexCoords()

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::WedgeTexCoords ( )
default

Empty constructor.

If the Wedge TexCoords container size is static, initializes all the Wedge TexCoords to with the vcl::TexCoord empty constructor, otherwise the container will be empty.

Member Function Documentation

◆ setWedgeTexCoord()

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
void vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::setWedgeTexCoord ( uint  i,
const vcl::TexCoord< Scalar > &  t 
)
inline

Sets the i-th wedge texcoord of the element.

Parameters
[in]ithe position in the container on which set the wedge texcoord; the value must be between 0 and the number of vertices of the element.
[in]tthe new wedge texcoord.

◆ setWedgeTexCoords()

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
template<Range Rng>
requires InputRange<Rng, vcl::TexCoord<Scalar>>
void vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::setWedgeTexCoords ( Rng &&  r)
inline

Sets all the wedge texcoords of the element.

If the size of the container is static, the size of the input range must be the same one of the container.

Template Parameters
RngThe type of the range of wedge texcoords to set. The value type of the range must be convertible to a vcl::TexCoord<Scalar>.
Parameters
[in]rrange of texcoords to set.

◆ textureIndex() [1/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
ushort & vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::textureIndex ( )
inline

Returns a reference to the texture index used to identify the texture on which the wedge texture coordinates are mapped.

Returns
A reference to the texture index.

◆ textureIndex() [2/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
ushort vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::textureIndex ( ) const
inline

Returns the texture index used to identify the texture on which the wedge texture coordinates are mapped.

Returns
The texture index.

◆ wedgeTexCoord() [1/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
vcl::TexCoord< Scalar > & vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoord ( uint  i)
inline

Returns a reference to the i-th wedge texcoord of the element.

You can use this function to set the i-th texcoord of the element:

f.wedgeTexCoord(0) = {0.5, 0.5};
Parameters
[in]ithe index of the wedge texcoord to return. The value must be between 0 and the number of vertices of the element.
Returns
A reference to the i-th wedge texcoord of the element.

◆ wedgeTexCoord() [2/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
const vcl::TexCoord< Scalar > & vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoord ( uint  i) const
inline

Returns a const reference to the i-th wedge texcoord of the element.

Parameters
[in]ithe index of the wedge texcoord to return. The value must be between 0 and the number of vertices of the element.
Returns
A const reference to the i-th wedge texcoord of the element.

◆ wedgeTexCoordBegin() [1/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
WedgeTexCoordsIterator vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoordBegin ( )
inline

Returns an iterator to the first wedge texcoord in the container of this component.

Returns
an iterator pointing to the begin of this container.

◆ wedgeTexCoordBegin() [2/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
ConstWedgeTexCoordsIterator vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoordBegin ( ) const
inline

Returns a const iterator to the first wedge texcoord in the container of this component.

Returns
a const iterator pointing to the begin of this container.

◆ wedgeTexCoordEnd() [1/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
WedgeTexCoordsIterator vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoordEnd ( )
inline

Returns an iterator to the end of the container of this component.

Returns
an iterator pointing to the end of this container.

◆ wedgeTexCoordEnd() [2/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
ConstWedgeTexCoordsIterator vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoordEnd ( ) const
inline

Returns a const iterator to the end of the container of this component.

Returns
a const iterator pointing to the end of this container.

◆ wedgeTexCoordMod() [1/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
vcl::TexCoord< Scalar > & vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoordMod ( int  i)
inline

Returns a reference to the i-th wedge texcoord of the element but using as index the module between i and the number of vertices of the element. You can use this function if you need to get the "next wedge texcoord after position k", without check if it is less than the number of vertices. Works also for negative numbers:

f.wedgeTexCoordMod(-1) = {0.1, 0.2}; // the wedge texcoord in position
// vertexNumber() - 1
Parameters
[in]ithe position of the required wedge texcoord in the container, w.r.t. the position 0; value is modularized on vertexNumber().
Returns
A reference to the required wedge texcoord of the element.

◆ wedgeTexCoordMod() [2/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
const vcl::TexCoord< Scalar > & vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoordMod ( int  i) const
inline

Same of wedgeTexCoordMod(int) but returns a const reference.

Parameters
[in]ithe position of the required wedge texcoord in the container, w.r.t. the position 0; value is modularized on vertexNumber().
Returns
A const reference to the required wedge texcoord of the element.

◆ wedgeTexCoords() [1/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
View< WedgeTexCoordsIterator > vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoords ( )
inline

Returns a lightweight view object that stores the begin and end iterators of the container of wedge texcoords of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:

for (auto& tc : el.wedgeTexCoords()) {
// Do something with tc
}
View< WedgeTexCoordsIterator > wedgeTexCoords()
Returns a lightweight view object that stores the begin and end iterators of the container of wedge t...
Definition wedge_tex_coords.h:293
Returns
a lightweight view object that can be used in range-based for loops to iterate over wedge texcoords.

◆ wedgeTexCoords() [2/2]

template<typename Scalar , int N, typename ParentElemType = void, bool OPT = false>
View< ConstWedgeTexCoordsIterator > vcl::comp::WedgeTexCoords< Scalar, N, ParentElemType, OPT >::wedgeTexCoords ( ) const
inline

Returns a lightweight const view object that stores the begin and end iterators of the container of wedge texcoords of the element. The view object exposes the iterators trough the begin() and end() member functions, and therefore the returned object can be used in range-based for loops:

for (const auto& tc : el.wedgeTexCoords()) {
// Do something read-only with tc
}
Returns
a lightweight const view object that can be used in range-based for loops to iterate over wedge texcoords.

The documentation for this class was generated from the following file: