8#ifndef META_OCEAN_TRACKING_MAPTEXTURING_TEXTURE_ATLAS_H 
    9#define META_OCEAN_TRACKING_MAPTEXTURING_TEXTURE_ATLAS_H 
   56        template <
bool innerTriangleWithBorder>
 
   57        void triangleAtlasTextureCoordinates(
const Index32 meshTriangleId, 
Vector2* textureCoordinates) 
const;
 
   71        static constexpr unsigned int textureSizePixels();
 
   77        static constexpr unsigned int triangleSizePixels();
 
   83        static constexpr Scalar borderSizePixels();
 
   89        static constexpr unsigned int numberBins();
 
   95        static constexpr unsigned int numberTriangles();
 
 
  111    ocean_assert(index < 3u);
 
  113    if (triangleId % 2u == 0u)
 
 
  125#ifdef OCEAN_PLATFORM_BUILD_MOBILE 
 
  134#ifdef OCEAN_PLATFORM_BUILD_MOBILE 
 
  155    return bins * bins * 2u;
 
 
  158template <
bool tInnerTriangleWithBorder>
 
  164    ocean_assert(textureCoordinates != 
nullptr);
 
  166    const unsigned int binId = meshTriangleId / 2u;
 
  168    const unsigned int xBin = binId % bins;
 
  169    const unsigned int yBin = binId / bins;
 
  189    if constexpr (tInnerTriangleWithBorder)
 
  194        if (meshTriangleId % 2u == 0u)
 
  198            textureCoordinates[0] = 
Vector2(leftBinTexture + smallOffsetTexture, topBinTexture - bigOffsetTexture);
 
  199            textureCoordinates[1] = 
Vector2(leftBinTexture + smallOffsetTexture, bottomBinTexture + smallOffsetTexture);
 
  200            textureCoordinates[2] = 
Vector2(rightBinTexture - bigOffsetTexture, bottomBinTexture + smallOffsetTexture);
 
  206            textureCoordinates[0] = 
Vector2(leftBinTexture + bigOffsetTexture, topBinTexture - smallOffsetTexture);
 
  207            textureCoordinates[1] = 
Vector2(rightBinTexture - smallOffsetTexture, bottomBinTexture + bigOffsetTexture);
 
  208            textureCoordinates[2] = 
Vector2(rightBinTexture - smallOffsetTexture, topBinTexture - smallOffsetTexture);
 
  213        if (meshTriangleId % 2u == 0u)
 
  217            textureCoordinates[0] = 
Vector2(leftBinTexture, topBinTexture);
 
  218            textureCoordinates[1] = 
Vector2(leftBinTexture, bottomBinTexture);
 
  219            textureCoordinates[2] = 
Vector2(rightBinTexture, bottomBinTexture);
 
  225            textureCoordinates[0] = 
Vector2(leftBinTexture, topBinTexture);
 
  226            textureCoordinates[1] = 
Vector2(rightBinTexture, bottomBinTexture);
 
  227            textureCoordinates[2] = 
Vector2(rightBinTexture, topBinTexture);
 
 
This class implements the abstract base class for all AnyCamera objects.
Definition AnyCamera.h:130
This class implements a texture atlas for triangles with regular shape.
Definition TextureAtlas.h:31
TextureAtlas()
Default constructor.
Vector3 outerBorderBarycentricOdd_[3]
The barycentric triangle coordinates for the outer triangles with odd id.
Definition TextureAtlas.h:103
static constexpr unsigned int triangleSizePixels()
Returns the major edge size of all triangles of this atlas.
Definition TextureAtlas.h:132
static constexpr unsigned int textureSizePixels()
Returns the texture size of this atlas.
Definition TextureAtlas.h:123
static constexpr unsigned int numberTriangles()
Returns the number of triangles this atlas can hold.
Definition TextureAtlas.h:151
static constexpr unsigned int numberBins()
Returns the number of bins this atlas holds.
Definition TextureAtlas.h:146
static constexpr Scalar borderSizePixels()
The border size of the triangles.
Definition TextureAtlas.h:141
void triangleCameraTextureCoordiantes(const AnyCamera &anyCamera, const HomogenousMatrix4 &flippedCamera_T_world, const Index32 meshTriangleId, const Vector3 *vertices, Vector2 *textureCoordinates, const bool respectBorder) const
Returns the camera texture coordinates of a triangle within a camera frame.
void triangleAtlasTextureCoordinates(const Index32 meshTriangleId, Vector2 *textureCoordinates) const
Returns the atlas texture coordinates of a triangle within this atlas.
Definition TextureAtlas.h:159
Scalar diagonalSizePixels_
The diagonal border size of the triangles, in pixels.
Definition TextureAtlas.h:106
const Vector3 & outerBorderBarycentric(const Index32 triangleId, const Index32 index) const
Returns the barycentric triangle coordinates for the outer triangle.
Definition TextureAtlas.h:109
Vector3 outerBorderBarycentricEven_[3]
The barycentric triangle coordinates for the outer triangles with even id.
Definition TextureAtlas.h:100
uint32_t Index32
Definition of a 32 bit index value.
Definition Base.h:84
float Scalar
Definition of a scalar type.
Definition Math.h:129
VectorT2< Scalar > Vector2
Definition of a 2D vector.
Definition Vector2.h:28
The namespace covering the entire Ocean framework.
Definition Accessor.h:15