Commit 800d8220 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[ADD] - added long double to our traits

parent a81e30da
......@@ -79,6 +79,18 @@ namespace WTypeTraits
// Exclusion of this macro stuff from doxygen:
// \cond HIDDEN_SYMBOLS
// long double is the better choice for these
CREATEPROMOTION( long double, double, long double )
CREATEPROMOTION( long double, float, long double )
CREATEPROMOTION( long double, int64_t, long double )
CREATEPROMOTION( long double, int32_t, long double )
CREATEPROMOTION( long double, int16_t, long double )
CREATEPROMOTION( long double, int8_t, long double )
CREATEPROMOTION( long double, uint64_t, long double )
CREATEPROMOTION( long double, uint32_t, long double )
CREATEPROMOTION( long double, uint16_t, long double )
CREATEPROMOTION( long double, uint8_t, long double )
// double is the better choice for these
CREATEPROMOTION( double, float, double )
CREATEPROMOTION( double, int64_t, double )
......
......@@ -276,6 +276,26 @@ struct DataTypeRT< W_DT_DOUBLE >
typedef double type;
};
/**
* Specialization for a specific datatype.
*/
template<>
struct DataType< long double >
{
//! the dataType flag
static dataType const type = W_DT_FLOAT128;
};
/**
* Specialization for a specific type
*/
template<>
struct DataTypeRT< W_DT_FLOAT128 >
{
//! correct C++ type for this runtime type
typedef long double type;
};
enum qformOrientation
{
Left_to_Right,
......
......@@ -104,6 +104,27 @@ void WDataTexture3D::create()
uint16_t* source = const_cast< uint16_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_UINT32 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_UINT32";
boost::shared_ptr< WValueSet< uint32_t > > vs = boost::shared_dynamic_cast< WValueSet< uint32_t > >( m_valueSet );
uint32_t* source = const_cast< uint32_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_INT64 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_INT64";
boost::shared_ptr< WValueSet< int64_t > > vs = boost::shared_dynamic_cast< WValueSet< int64_t > >( m_valueSet );
int64_t* source = const_cast< int64_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_UINT64 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_UINT64";
boost::shared_ptr< WValueSet< uint64_t > > vs = boost::shared_dynamic_cast< WValueSet< uint64_t > >( m_valueSet );
uint64_t* source = const_cast< uint64_t* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_SIGNED_INT )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_SIGNED_INT";
......@@ -125,6 +146,13 @@ void WDataTexture3D::create()
double* source = const_cast< double* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else if( m_valueSet->getDataType() == W_DT_FLOAT128 )
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type W_DT_FLOAT128";
boost::shared_ptr< WValueSet< long double > > vs = boost::shared_dynamic_cast< WValueSet< long double > >( m_valueSet );
long double* source = const_cast< long double* > ( vs->rawData() );
ima = createTexture( source, m_valueSet->dimension() );
}
else
{
wlog::debug( "WDataTexture3D" ) << "Creating Texture of type" << m_valueSet->getDataType();
......
......@@ -76,6 +76,32 @@ namespace wge
static Type FullIntensity(){ return 1.0; } // NOLINT
};
/**
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
*/
template <>
class WGE_EXPORT GLType< long double >
{
public:
/**
* The best matching OpenGL type for the specified template parameter.
*/
typedef float Type;
/**
* The enum type of OpenGL
*/
static const GLenum TypeEnum = GL_FLOAT;
/**
* The value for full intensity.
*
* \return the full intensity value
*/
static Type FullIntensity(){ return 1.0; } // NOLINT
};
/**
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
*/
......@@ -258,6 +284,60 @@ namespace wge
*/
static Type FullIntensity(){ return 1.0; } // NOLINT
};
/**
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
*
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
*/
template <>
class WGE_EXPORT GLType< int64_t >
{
public:
/**
* The best matching OpenGL type for the specified template parameter.
*/
typedef float Type;
/**
* The enum type of OpenGL
*/
static const GLenum TypeEnum = GL_FLOAT;
/**
* The value for full intensity.
*
* \return the full intensity value
*/
static Type FullIntensity(){ return 1.0; } // NOLINT
};
/**
* Class helping to adapt types specified as template parameter into the best matching OpenGL type.
*
* \note integral types get downscaled to float. This is done for easiness but might be better if the real type is used instead.
*/
template <>
class WGE_EXPORT GLType< uint64_t >
{
public:
/**
* The best matching OpenGL type for the specified template parameter.
*/
typedef float Type;
/**
* The enum type of OpenGL
*/
static const GLenum TypeEnum = GL_FLOAT;
/**
* The value for full intensity.
*
* \return the full intensity value
*/
static Type FullIntensity(){ return 1.0; } // NOLINT
};
}
#endif // WGETYPETRAITS_H
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment