本文整理汇总了C++中KVS_ASSERT函数的典型用法代码示例。如果您正苦于以下问题:C++ KVS_ASSERT函数的具体用法?C++ KVS_ASSERT怎么用?C++ KVS_ASSERT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KVS_ASSERT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: KVS_ASSERT
void Texture::setSubImage1D( GLsizei width, const GLvoid* data, GLint xoffset )
{
KVS_ASSERT( m_target == GL_TEXTURE_1D );
KVS_ASSERT( this->isBound() );
const GLint level = 0; // level-of-detail number
KVS_GL_CALL( glTexSubImage1D( m_target, level, xoffset, width, m_external_format, m_external_type, data ) );
}
示例2: KVS_ASSERT
RGBColor& RGBColor::operator = ( const kvs::Vec3& rgb )
{
KVS_ASSERT( 0.0f <= rgb.x() && rgb.x() <= 1.0f );
KVS_ASSERT( 0.0f <= rgb.y() && rgb.y() <= 1.0f );
KVS_ASSERT( 0.0f <= rgb.z() && rgb.z() <= 1.0f );
m_red = kvs::Math::Round( rgb.x() * 255.0f );
m_green = kvs::Math::Round( rgb.y() * 255.0f );
m_blue = kvs::Math::Round( rgb.z() * 255.0f );
return *this;
}
示例3: KVS_ASSERT
const kvs::Vector<T>& LUSolver<T>::solve( const kvs::Matrix<T>& A, const kvs::Vector<T>& b )
{
KVS_ASSERT( A.rowSize() == A.columnSize() );
KVS_ASSERT( A.columnSize() == b.size() );
// LU decomposition.
m_decomposer.setMatrix( A );
m_decomposer.decompose();
return( this->solve( b ) );
}
示例4: KVS_ASSERT
RGBAColor& RGBAColor::operator = ( const kvs::Vec4& rgba )
{
KVS_ASSERT( 0.0f <= rgba.x() && rgba.x() <= 1.0f );
KVS_ASSERT( 0.0f <= rgba.y() && rgba.y() <= 1.0f );
KVS_ASSERT( 0.0f <= rgba.z() && rgba.z() <= 1.0f );
KVS_ASSERT( 0.0f <= rgba.w() && rgba.w() <= 1.0f );
m_red = kvs::Math::Round( rgba.x() * 255.0f );
m_green = kvs::Math::Round( rgba.y() * 255.0f );
m_blue = kvs::Math::Round( rgba.z() * 255.0f );
m_opacity = rgba.w();
return *this;
}
示例5: KVS_ASSERT
kvs::RGBAColor& RGBAColor::operator = ( const kvs::Vec4& rgba )
{
KVS_ASSERT( 0.0f <= rgba.x() && rgba.x() <= 1.0f );
KVS_ASSERT( 0.0f <= rgba.y() && rgba.y() <= 1.0f );
KVS_ASSERT( 0.0f <= rgba.z() && rgba.z() <= 1.0f );
KVS_ASSERT( 0.0f <= rgba.w() && rgba.w() <= 1.0f );
const kvs::UInt8 r = kvs::Math::Round( rgba.x() * 255.0f );
const kvs::UInt8 g = kvs::Math::Round( rgba.y() * 255.0f );
const kvs::UInt8 b = kvs::Math::Round( rgba.z() * 255.0f );
kvs::RGBColor::set( r, g, b );
m_a = rgba.w();
return *this;
}
示例6: KVS_ASSERT
kvs::Mat3 PrismCell::localGradient()
{
const kvs::Real32 p = m_local.x();
const kvs::Real32 q = m_local.y();
const kvs::Real32 r = m_local.z();
KVS_ASSERT( 0.0f <= p && p <= 1.0f );
KVS_ASSERT( 0.0f <= q && q <= 1.0f );
KVS_ASSERT( 0.0f <= r && r <= 1.0f );
KVS_ASSERT( p + q <= 1.0f );
const kvs::Vec3 v02 = ::Mix( this->value(0), this->value(2), q );
const kvs::Vec3 v35 = ::Mix( this->value(3), this->value(5), q );
const kvs::Vec3 v12 = ::Mix( this->value(1), this->value(2), q );
const kvs::Vec3 v45 = ::Mix( this->value(4), this->value(5), q );
const kvs::Vec3 x0 = ::Mix( v02, v35, r );
const kvs::Vec3 x1 = ::Mix( v12, v45, r );
const kvs::Vec3 v01 = ::Mix( this->value(0), this->value(1), p );
const kvs::Vec3 v34 = ::Mix( this->value(3), this->value(4), p );
const kvs::Vec3 v21 = ::Mix( this->value(2), this->value(1), p );
const kvs::Vec3 v54 = ::Mix( this->value(5), this->value(4), p );
const kvs::Vec3 y0 = ::Mix( v01, v34, r );
const kvs::Vec3 y1 = ::Mix( v21, v54, r );
const kvs::Real32 ratio = kvs::Math::IsZero( 1 - q ) ? 0.0f : p / ( 1 - q );
const kvs::Vec3 z0 = ::Mix( v02, v12, ratio );
const kvs::Vec3 z1 = ::Mix( v35, v45, ratio );
const kvs::Real32 dx = 1 - q;
const kvs::Real32 dy = 1 - p;
const kvs::Real32 dz = 1;
const kvs::Real32 dudx = ( x1.x() - x0.x() ) / dx;
const kvs::Real32 dudy = ( y1.x() - y0.x() ) / dy;
const kvs::Real32 dudz = ( z1.x() - z0.x() ) / dz;
const kvs::Real32 dvdx = ( x1.y() - x0.y() ) / dx;
const kvs::Real32 dvdy = ( y1.y() - y0.y() ) / dy;
const kvs::Real32 dvdz = ( z1.y() - z0.y() ) / dz;
const kvs::Real32 dwdx = ( x1.z() - x0.z() ) / dx;
const kvs::Real32 dwdy = ( y1.z() - y0.z() ) / dy;
const kvs::Real32 dwdz = ( z1.z() - z0.z() ) / dz;
return kvs::Mat3(
dudx, dvdx, dwdx,
dudy, dvdy, dwdy,
dudz, dvdz, dwdz );
}
示例7: KVS_ASSERT
/*===========================================================================*/
void ScreenBase::create()
{
KVS_ASSERT( m_id == -1 );
// Initialize display mode.
QGLFormat f = QGLFormat::defaultFormat();
f.setDoubleBuffer( displayFormat().doubleBuffer() );
f.setRgba( displayFormat().colorBuffer() );
f.setDepth( displayFormat().depthBuffer() );
f.setAccum( displayFormat().accumulationBuffer() );
f.setStencil( displayFormat().stencilBuffer() );
f.setStereo( displayFormat().stereoBuffer() );
f.setSampleBuffers( displayFormat().multisampleBuffer() );
f.setAlpha( displayFormat().alphaChannel() );
QGLFormat::setDefaultFormat( f );
// Set screen geometry.
QWidget::setGeometry( BaseClass::x(), BaseClass::y(), BaseClass::width(), BaseClass::height() );
QGLWidget::makeCurrent();
// Initialize GLEW.
GLenum result = glewInit();
if ( result != GLEW_OK )
{
const GLubyte* message = glewGetErrorString( result );
kvsMessageError( "GLEW initialization failed: %s.", message );
}
// Create window.
static int counter = 0;
m_id = counter++;
}
示例8: KVS_ASSERT
void GridBase::bind( const kvs::Vec3& global )
{
const int grid_index = this->findGrid( global );
KVS_ASSERT( grid_index >= 0 );
this->bind( grid_index );
this->setLocalPoint( this->globalToLocal( global ) );
}
示例9: KVS_ASSERT
/*==========================================================================*/
void TetrahedralCell::updateDifferentialFunctions( const kvs::Vec3& local ) const
{
KVS_ASSERT( this->containsLocalPoint( local ) );
kvs::IgnoreUnusedVariable( local );
const size_t nnodes = BaseClass::numberOfCellNodes();
kvs::Real32* dN = BaseClass::differentialFunctions();
kvs::Real32* dNdp = dN;
kvs::Real32* dNdq = dN + nnodes;
kvs::Real32* dNdr = dN + nnodes + nnodes;
dNdp[0] = 1.0f;
dNdp[1] = 0.0f;
dNdp[2] = 0.0f;
dNdp[3] = -1.0f;
dNdq[0] = 0.0f;
dNdq[1] = 1.0f;
dNdq[2] = 0.0f;
dNdq[3] = -1.0f;
dNdr[0] = 0.0f;
dNdr[1] = 0.0f;
dNdr[2] = 1.0f;
dNdr[3] = -1.0f;
}
示例10: KVS_ASSERT
void* BufferObject::mapBuffer( const GLenum access_type )
{
KVS_ASSERT( this->isBound() );
void* result = 0;
KVS_GL_CALL( result = glMapBuffer( m_target, access_type ) );
return result;
}
示例11: KVS_ASSERT
/*===========================================================================*/
const kvs::Mat3 CellBase::gradientTensor() const
{
KVS_ASSERT( m_veclen == 3 );
// Calculate a gradient tensor in the local coordinate.
const kvs::UInt32 nnodes = m_nnodes;
const float* dNdp = m_differential_functions;
const float* dNdq = m_differential_functions + nnodes;
const float* dNdr = m_differential_functions + nnodes + nnodes;
const kvs::Real32* Su = m_values;
const kvs::Real32* Sv = Su + nnodes;
const kvs::Real32* Sw = Sv + nnodes;
const float dudp = this->interpolateValue( Su, dNdp, nnodes );
const float dudq = this->interpolateValue( Su, dNdq, nnodes );
const float dudr = this->interpolateValue( Su, dNdr, nnodes );
const float dvdp = this->interpolateValue( Sv, dNdp, nnodes );
const float dvdq = this->interpolateValue( Sv, dNdq, nnodes );
const float dvdr = this->interpolateValue( Sv, dNdr, nnodes );
const float dwdp = this->interpolateValue( Sw, dNdp, nnodes );
const float dwdq = this->interpolateValue( Sw, dNdq, nnodes );
const float dwdr = this->interpolateValue( Sw, dNdr, nnodes );
const kvs::Mat3 t( dudp, dvdp, dwdp, dudq, dvdq, dwdq, dudr, dvdr, dwdr );
// Calculate a gradient tensor in the global coordinate.
const kvs::Mat3 J = this->JacobiMatrix();
float determinant = 0.0f;
const kvs::Mat3 T = 3.0f * J.inverted( &determinant ) * t;
return kvs::Math::IsZero( determinant ) ? kvs::Mat3::Zero() : T;
}
示例12: m_bo
BufferObject::GuardedBinder::GuardedBinder( const kvs::BufferObject& bo ):
m_bo( bo ),
m_id( 0 )
{
KVS_ASSERT( bo.isCreated() );
m_id = kvs::OpenGL::Integer( bo.targetBinding() );
if ( bo.id() != static_cast<GLuint>( m_id ) ) { bo.bind(); }
}
示例13: KVS_ASSERT
bool GRIBData::read( FILE* fp )
{
KVS_ASSERT( fp );
if ( !this->parse( fp ) ) { return false; }
if ( !this->load() ) { return false; }
return true;
}
示例14: m_texture
Texture::Binder::Binder( const Texture& texture, GLint unit ) :
m_texture( texture ),
m_unit( unit )
{
KVS_ASSERT( texture.isCreated() );
Texture::SelectActiveUnit( unit );
texture.bind();
}
示例15: m_texture
TextureBinder::TextureBinder( const Texture& texture, GLint unit ) :
m_texture( texture ),
m_unit( unit )
{
KVS_ASSERT( texture.isCreated() );
kvs::OpenGL::ActivateTextureUnit( unit );
texture.bind();
}