本文整理汇总了C++中idVec3::ToFloatPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ idVec3::ToFloatPtr方法的具体用法?C++ idVec3::ToFloatPtr怎么用?C++ idVec3::ToFloatPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idVec3
的用法示例。
在下文中一共展示了idVec3::ToFloatPtr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
===================
R_ClipLineToLight
If neither point is clearly behind the clipping
plane, the edge will be passed unmodified. A sil edge that
is on a border plane must be drawn.
If one point is clearly clipped by the plane and the
other point is on the plane, it will be completely removed.
===================
*/
ID_STATIC_TEMPLATE ID_INLINE bool R_ClipLineToLight( const idVec3 &a, const idVec3 &b, const idPlane frustum[6], idVec3 &p1, idVec3 &p2 ) {
float *clip;
int j;
float d1, d2;
float f;
p1 = a;
p2 = b;
// clip it
for( j = 0; j < 6; j++ ) {
d1 = frustum[j].Distance( p1 );
d2 = frustum[j].Distance( p2 );
// if both on or in front, not clipped to this plane
if( d1 > -LIGHT_CLIP_EPSILON && d2 > -LIGHT_CLIP_EPSILON ) {
continue;
}
// if one is behind and the other isn't clearly in front, the edge is clipped off
if( d1 <= -LIGHT_CLIP_EPSILON && d2 < LIGHT_CLIP_EPSILON ) {
return false;
}
if( d2 <= -LIGHT_CLIP_EPSILON && d1 < LIGHT_CLIP_EPSILON ) {
return false;
}
// clip it, keeping the negative side
if( d1 < 0 ) {
clip = p1.ToFloatPtr();
} else {
clip = p2.ToFloatPtr();
}
f = d1 / ( d1 - d2 );
clip[0] = p1[0] + f * ( p2[0] - p1[0] );
clip[1] = p1[1] + f * ( p2[1] - p1[1] );
clip[2] = p1[2] + f * ( p2[2] - p1[2] );
}
return true; // retain a fragment
}
示例2: ParseVector
/*
============
idAASSettings::ParseVector
============
*/
bool idAASSettings::ParseVector( idLexer &src, idVec3 &vec )
{
if ( !src.ExpectTokenString( "=" ) )
{
return false;
}
return ( src.Parse1DMatrix( 3, vec.ToFloatPtr() ) != 0 );
}
示例3: glLabeledPoint
/*
================
glLabeledPoint
================
*/
void glLabeledPoint(idVec4 &color, idVec3 &point, float size, const char *label) {
qglColor3fv( color.ToFloatPtr() );
qglPointSize( size );
qglBegin( GL_POINTS );
qglVertex3fv( point.ToFloatPtr() );
qglEnd();
idVec3 v = point;
v.x += 1;
v.y += 1;
v.z += 1;
qglRasterPos3fv( v.ToFloatPtr() );
qglCallLists( strlen(label), GL_UNSIGNED_BYTE, label );
}
示例4: DrawLine
void DrawLine( idVec3 v1, idVec3 v2, int color ) {
if( !dmapGlobals.drawflag ) {
return;
}
switch( color ) {
case 0:
GL_Color( 0.0f, 0.0f, 0.0f );
break;
case 1:
GL_Color( 0.0f, 0.0f, 1.0f );
break;
case 2:
GL_Color( 0.0f, 1.0f, 0.0f );
break;
case 3:
GL_Color( 0.0f, 1.0f, 1.0f );
break;
case 4:
GL_Color( 1.0f, 0.0f, 0.0f );
break;
case 5:
GL_Color( 1.0f, 0.0f, 1.0f );
break;
case 6:
GL_Color( 1.0f, 1.0f, 0.0f );
break;
case 7:
GL_Color( 1.0f, 1.0f, 1.0f );
break;
}
glBegin( GL_LINES );
glVertex3fv( v1.ToFloatPtr() );
glVertex3fv( v2.ToFloatPtr() );
glEnd();
glFlush();
}