LibCarna Version 3.4.0
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
LibCarna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType > Class Template Reference

Implements NormalMap3D generically for a particular VoxelType. More...

#include <BufferedNormalMap3D.hpp>

+ Inheritance diagram for LibCarna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >:
+ Collaboration diagram for LibCarna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >:

Public Types

typedef BufferType Buffer
 Holds the used buffer type.
 
typedef BufferedVectorComponentType BufferedVectorComponent
 Holds the type used to store the components of the normal vectors.
 
- Public Types inherited from LibCarna::base::math::VectorField< math::Vector3f >
typedef math::Vector3f Value
 Holds the co-domain type of the vector field.
 

Public Member Functions

 BufferedNormalMap3D (const math::Vector3ui &size, Association< BufferType > *buffer)
 Instantiates.
 
 BufferedNormalMap3D (const math::Vector3ui &size)
 
math::Vector3f operator() (const math::Vector3ui &location) const
 Decodes and tells the vector stored at location.
 
math::Vector3f operator() (unsigned int x, unsigned int y, unsigned int z) const
 
void setVoxel (const math::Vector3ui &location, const math::Vector3f &normal)
 Encodes normal and stores it at location.
 
void setVoxel (unsigned int x, unsigned int y, unsigned int z, const math::Vector3f &normal)
 
BufferTypebuffer ()
 References the underlying buffer.
 
const BufferTypebuffer () const
 References the underlying buffer.
 
- Public Member Functions inherited from LibCarna::base::NormalMap3D
 NormalMap3D ()
 Instantiates.
 
 NormalMap3D (const math::Vector3ui &size)
 Instantiates.
 
- Public Member Functions inherited from LibCarna::base::math::VectorField< math::Vector3f >
virtual ~VectorField ()
 Does nothing.
 

Static Public Member Functions

static float decodeComponent (BufferedVectorComponentType encodedVectorComponent)
 Returns the actual normal vector component corresponding to encodedVectorComponent.
 
static BufferedVectorComponentType encodeComponent (float actualVectorComponent)
 Returns the buffered vector component corresponding to actualVectorComponent.
 

Protected Attributes

const std::unique_ptr< Association< BufferType > > myBuffer
 Holds the buffer.
 

Additional Inherited Members

- Public Attributes inherited from LibCarna::base::NormalMap3D
math::Vector3ui size
 Holds the resolution.
 

Detailed Description

template<typename BufferedVectorComponentType, typename BufferType>
class LibCarna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >

Implements NormalMap3D generically for a particular VoxelType.

Parameters
BufferedVectorComponentTypeis the data type used to store the components of a single normal. Only integral data types are allowed.
BufferTypeis the data type used as container for the normal vectors.
Note
Although three channels would be sufficient to store the three components of a normal vector, we use four channels here. The reasons for this is that glTexImage3d caused read access errors on Windows when used with three channel textures, whereas it worked nicely on Linux. This class ignores the values stored within the fourth channel.
Author
Leonid Kostrykin

Definition at line 62 of file BufferedNormalMap3D.hpp.

Member Typedef Documentation

◆ Buffer

Holds the used buffer type.

Definition at line 74 of file BufferedNormalMap3D.hpp.

◆ BufferedVectorComponent

Holds the type used to store the components of the normal vectors.

Definition at line 79 of file BufferedNormalMap3D.hpp.

Constructor & Destructor Documentation

◆ BufferedNormalMap3D() [1/2]

Instantiates.

Precondition
buffer != nullptr && buffer->get() != nullptr
(**buffer).size() >= 4 * sizeof(BufferedVectorComponentType) * size.x * size.y * size.z

Definition at line 87 of file BufferedNormalMap3D.hpp.

◆ BufferedNormalMap3D() [2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 96 of file BufferedNormalMap3D.hpp.

Member Function Documentation

◆ buffer() [1/2]

References the underlying buffer.

Definition at line 188 of file BufferedNormalMap3D.hpp.

◆ buffer() [2/2]

References the underlying buffer.

Definition at line 196 of file BufferedNormalMap3D.hpp.

◆ decodeComponent()

Returns the actual normal vector component corresponding to encodedVectorComponent.

This function maps encodedVectorComponent to \(\left[-1, 1\right]\), whereby the minimum of BufferedVectorComponentType is mapped to \(-1\) and its maximum to \(+1\).

Definition at line 112 of file BufferedNormalMap3D.hpp.

◆ encodeComponent()

Returns the buffered vector component corresponding to actualVectorComponent.

This function maps actualVectorComponent to values from the minimum of BufferedVectorComponentType to its maximum linearly.

Precondition
std::abs(actualVectorComponent) <= 1

Definition at line 130 of file BufferedNormalMap3D.hpp.

◆ operator()() [1/2]

Decodes and tells the vector stored at location.

Reimplemented from LibCarna::base::math::VectorField< math::Vector3f >.

Definition at line 146 of file BufferedNormalMap3D.hpp.

◆ operator()() [2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Implements LibCarna::base::math::VectorField< math::Vector3f >.

Definition at line 153 of file BufferedNormalMap3D.hpp.

◆ setVoxel() [1/2]

Encodes normal and stores it at location.

Definition at line 169 of file BufferedNormalMap3D.hpp.

◆ setVoxel() [2/2]

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Definition at line 176 of file BufferedNormalMap3D.hpp.

Member Data Documentation

◆ myBuffer

Holds the buffer.

Definition at line 206 of file BufferedNormalMap3D.hpp.


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