Carna  Version 3.0.1
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. More...
 
 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)
 
BufferType & buffer ()
 References the underlying buffer.
 
const BufferType & buffer () 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. More...
 
static BufferedVectorComponentType encodeComponent (float actualVectorComponent)
 Returns the buffered vector component corresponding to actualVectorComponent. More...
 

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.

Constructor & Destructor Documentation

template<typename BufferedVectorComponentType , typename BufferType >
Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >::BufferedNormalMap3D ( const math::Vector3ui size,
Association< BufferType > *  buffer 
)
inline

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.

template<typename BufferedVectorComponentType , typename BufferType >
Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >::BufferedNormalMap3D ( const math::Vector3ui size)
inlineexplicit

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

template<typename BufferedVectorComponentType , typename BufferType >
static float Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >::decodeComponent ( BufferedVectorComponentType  encodedVectorComponent)
inlinestatic

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.

template<typename BufferedVectorComponentType , typename BufferType >
static BufferedVectorComponentType Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >::encodeComponent ( float  actualVectorComponent)
inlinestatic

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.

template<typename BufferedVectorComponentType , typename BufferType >
math::Vector3f Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >::operator() ( unsigned int  x,
unsigned int  y,
unsigned int  z 
) const
inlinevirtual

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

template<typename BufferedVectorComponentType , typename BufferType >
void Carna::base::BufferedNormalMap3D< BufferedVectorComponentType, BufferType >::setVoxel ( unsigned int  x,
unsigned int  y,
unsigned int  z,
const math::Vector3f normal 
)
inline

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.


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