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

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

#include <BufferedNormalMap3D.h>

+ Inheritance diagram for Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >:
+ Collaboration diagram for Carna::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 Carna::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 Carna::base::NormalMap3D
 NormalMap3D ()
 Instantiates.
 
 NormalMap3D (const math::Vector3ui &size)
 Instantiates.
 
- Public Member Functions inherited from Carna::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 Carna::base::NormalMap3D
math::Vector3ui size
 Holds the resolution.
 

Detailed Description

template<typename BufferedVectorComponentType, typename BufferType>
class Carna::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
Date
26.3.15 - 29.3.15

Definition at line 59 of file BufferedNormalMap3D.h.

Member Typedef Documentation

◆ Buffer

Holds the used buffer type.

Definition at line 71 of file BufferedNormalMap3D.h.

◆ BufferedVectorComponent

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

Definition at line 76 of file BufferedNormalMap3D.h.

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 84 of file BufferedNormalMap3D.h.

◆ 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 93 of file BufferedNormalMap3D.h.

Member Function Documentation

◆ buffer() [1/2]

References the underlying buffer.

Definition at line 185 of file BufferedNormalMap3D.h.

◆ buffer() [2/2]

References the underlying buffer.

Definition at line 193 of file BufferedNormalMap3D.h.

◆ 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 109 of file BufferedNormalMap3D.h.

◆ 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 127 of file BufferedNormalMap3D.h.

◆ operator()() [1/2]

Decodes and tells the vector stored at location.

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

Definition at line 143 of file BufferedNormalMap3D.h.

◆ 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 Carna::base::math::VectorField< math::Vector3f >.

Definition at line 150 of file BufferedNormalMap3D.h.

◆ setVoxel() [1/2]

Encodes normal and stores it at location.

Definition at line 166 of file BufferedNormalMap3D.h.

◆ 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 173 of file BufferedNormalMap3D.h.

Member Data Documentation

◆ myBuffer

Holds the buffer.

Definition at line 203 of file BufferedNormalMap3D.h.


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