本文整理汇总了C++中FindFloatPlane函数的典型用法代码示例。如果您正苦于以下问题:C++ FindFloatPlane函数的具体用法?C++ FindFloatPlane怎么用?C++ FindFloatPlane使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了FindFloatPlane函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AllocBrush
/*
==================
BrushFromBounds
Creates a new axial brush
==================
*/
bspbrush_t *BrushFromBounds (vec3_t mins, vec3_t maxs)
{
bspbrush_t *b;
int i;
vec3_t normal;
vec_t dist;
b = AllocBrush (6);
b->numsides = 6;
for (i=0 ; i<3 ; i++)
{
VectorClear (normal);
normal[i] = 1;
dist = maxs[i];
b->sides[i].planenum = FindFloatPlane (normal, dist);
normal[i] = -1;
dist = -mins[i];
b->sides[3+i].planenum = FindFloatPlane (normal, dist);
}
CreateBrushWindings (b);
return b;
}
示例2: qprintf
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
tmp_node_t *AAS_SubdivideArea_r( tmp_node_t *tmpnode ) {
int planenum;
tmp_area_t *frontarea, *backarea;
tmp_node_t *tmpnode1, *tmpnode2;
vec3_t normal;
float dist;
if ( AAS_FindBestAreaSplitPlane( tmpnode->tmparea, normal, &dist ) ) {
qprintf( "\r%6d", ++numgravitationalsubdivisions );
//
planenum = FindFloatPlane( normal, dist, 0, NULL );
//split the area
AAS_SplitArea( tmpnode->tmparea, planenum, &frontarea, &backarea );
//
tmpnode->tmparea = NULL;
tmpnode->planenum = FindFloatPlane( normal, dist, 0, NULL );
//
tmpnode1 = AAS_AllocTmpNode();
tmpnode1->planenum = 0;
tmpnode1->tmparea = frontarea;
//
tmpnode2 = AAS_AllocTmpNode();
tmpnode2->planenum = 0;
tmpnode2->tmparea = backarea;
//subdivide the areas created by splitting recursively
tmpnode->children[0] = AAS_SubdivideArea_r( tmpnode1 );
tmpnode->children[1] = AAS_SubdivideArea_r( tmpnode2 );
} //end if
return tmpnode;
} //end of the function AAS_SubdivideArea_r
示例3: AllocNode
/*
============
BlockTree
============
*/
node_t *BlockTree (int xl, int yl, int xh, int yh)
{
node_t *node;
vec3_t normal;
float dist;
int mid;
if (xl == xh && yl == yh)
{
node = block_nodes[xl+5][yl+5];
if (!node)
{ // return an empty leaf
node = AllocNode ();
node->planenum = PLANENUM_LEAF;
node->contents = 0; //CONTENTS_SOLID;
return node;
}
return node;
}
// create a seperator along the largest axis
node = AllocNode ();
if (xh - xl > yh - yl)
{ // split x axis
mid = xl + (xh-xl)/2 + 1;
normal[0] = 1;
normal[1] = 0;
normal[2] = 0;
dist = mid*1024;
node->planenum = FindFloatPlane (normal, dist);
node->children[0] = BlockTree ( mid, yl, xh, yh);
node->children[1] = BlockTree ( xl, yl, mid-1, yh);
}
else
{
mid = yl + (yh-yl)/2 + 1;
normal[0] = 0;
normal[1] = 1;
normal[2] = 0;
dist = mid*1024;
node->planenum = FindFloatPlane (normal, dist);
node->children[0] = BlockTree ( xl, mid, xh, yh);
node->children[1] = BlockTree ( xl, yl, xh, mid-1);
}
return node;
}
示例4: AdjustBrushesForOrigin
/*
=================
AdjustBrushesForOrigin
=================
*/
void AdjustBrushesForOrigin( entity_t *ent )
{
int i;
side_t *s;
vec_t newdist;
brush_t *b;
parseMesh_t *p;
for( b = ent->brushes; b != NULL; b = b->next )
{
for( i = 0; i < b->numsides; i++)
{
s = &b->sides[i];
newdist = mapplanes[ s->planenum ].dist - DotProduct( mapplanes[ s->planenum ].normal, ent->origin );
s->planenum = FindFloatPlane( mapplanes[ s->planenum ].normal, newdist, 0, NULL );
}
// rebuild brush windings (just offsetting the winding above should be fine)
CreateBrushWindings( b );
}
for( p = ent->patches; p != NULL; p = p->next )
{
for( i = 0; i < (p->mesh.width * p->mesh.height); i++ )
VectorSubtract( p->mesh.verts[i].xyz, ent->origin, p->mesh.verts[i].xyz );
}
}
示例5: AdjustEntityForOrigin
static void AdjustEntityForOrigin( uEntity_t *ent ) {
primitive_t *prim;
uBrush_t *b;
int i;
side_t *s;
for ( prim = ent->primitives ; prim ; prim = prim->next ) {
b = prim->brush;
if ( !b ) {
continue;
}
for ( i = 0; i < b->numsides; i++ ) {
idPlane plane;
s = &b->sides[i];
plane = dmapGlobals.mapPlanes[s->planenum];
plane[3] += plane.Normal() * ent->origin;
s->planenum = FindFloatPlane( plane );
s->texVec.v[0][3] += DotProduct( ent->origin, s->texVec.v[0] );
s->texVec.v[1][3] += DotProduct( ent->origin, s->texVec.v[1] );
// remove any integral shift
s->texVec.v[0][3] -= floor( s->texVec.v[0][3] );
s->texVec.v[1][3] -= floor( s->texVec.v[1][3] );
}
CreateBrushWindings(b);
}
}
示例6: ParseBrush
/*
=================
ParseBrush
=================
*/
static void ParseBrush( const idMapBrush *mapBrush, int primitiveNum ) {
uBrush_t *b;
side_t *s;
const idMapBrushSide *ms;
int i;
bool fixedDegeneracies = false;
buildBrush->entitynum = dmapGlobals.num_entities - 1;
buildBrush->brushnum = entityPrimitive;
buildBrush->numsides = mapBrush->GetNumSides();
for( i = 0 ; i < mapBrush->GetNumSides() ; i++ ) {
s = &buildBrush->sides[i];
ms = mapBrush->GetSide( i );
memset( s, 0, sizeof( *s ) );
s->planenum = FindFloatPlane( ms->GetPlane(), &fixedDegeneracies );
s->material = declManager->FindMaterial( ms->GetMaterial() );
ms->GetTextureVectors( s->texVec.v );
// remove any integral shift, which will help with grouping
s->texVec.v[0][3] -= floor( s->texVec.v[0][3] );
s->texVec.v[1][3] -= floor( s->texVec.v[1][3] );
}
// if there are mirrored planes, the entire brush is invalid
if( !RemoveDuplicateBrushPlanes( buildBrush ) ) {
return;
}
// get the content for the entire brush
SetBrushContents( buildBrush );
b = FinishBrush();
if( !b ) {
return;
}
if( fixedDegeneracies && dmapGlobals.verboseentities ) {
common->Warning( "brush %d has degenerate plane equations", primitiveNum );
}
}
示例7: AAS_ExpandMapBrush
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void AAS_ExpandMapBrush(mapbrush_t *brush, vec3_t mins, vec3_t maxs)
{
int sn;
float dist;
side_t *s;
plane_t *plane;
for (sn = 0; sn < brush->numsides; sn++)
{
s = brush->original_sides + sn;
plane = &mapplanes[s->planenum];
dist = plane->dist;
if (capsule_collision) {
dist += CapsuleOriginDistanceFromPlane(plane->normal, mins, maxs);
}
else {
dist += BoxOriginDistanceFromPlane(plane->normal, mins, maxs, 0);
}
s->planenum = FindFloatPlane(plane->normal, dist);
//the side isn't a bevel after expanding
s->flags &= ~SFL_BEVEL;
//don't skip the surface
s->surf &= ~SURF_SKIP;
//make sure the texinfo is not TEXINFO_NODE
//when player clip contents brushes are read from the bsp tree
//they have the texinfo field set to TEXINFO_NODE
//s->texinfo = 0;
} //end for
} //end of the function AAS_ExpandMapBrush
示例8: AAS_TestSplitPlane
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int AAS_TestSplitPlane(tmp_area_t *tmparea, vec3_t normal, float dist,
int *facesplits, int *groundsplits, int *epsilonfaces)
{
int j, side, front, back, planenum;
float d, d_front, d_back;
tmp_face_t *face;
winding_t *w;
*facesplits = *groundsplits = *epsilonfaces = 0;
planenum = FindFloatPlane(normal, dist);
w = AAS_SplitWinding(tmparea, planenum);
if (!w) return false;
FreeWinding(w);
//
for (face = tmparea->tmpfaces; face; face = face->next[side])
{
//side of the face the area is on
side = face->frontarea != tmparea;
if ((face->planenum & ~1) == (planenum & ~1))
{
Log_Print("AAS_TestSplitPlane: tried face plane as splitter\n");
return false;
} //end if
w = face->winding;
//reset distance at front and back side of plane
d_front = d_back = 0;
//reset front and back flags
front = back = 0;
for (j = 0; j < w->numpoints; j++)
{
d = DotProduct(w->p[j], normal) - dist;
if (d > d_front) d_front = d;
if (d < d_back) d_back = d;
if (d > 0.4) // PLANESIDE_EPSILON)
front = 1;
if (d < -0.4) // PLANESIDE_EPSILON)
back = 1;
} //end for
//check for an epsilon face
if ( (d_front > FACECLIP_EPSILON && d_front < FACE_EPSILON)
|| (d_back < -FACECLIP_EPSILON && d_back > -FACE_EPSILON) )
{
(*epsilonfaces)++;
} //end if
//if the face has points at both sides of the plane
if (front && back)
{
(*facesplits)++;
if (face->faceflags & FACE_GROUND)
{
(*groundsplits)++;
} //end if
} //end if
} //end for
return true;
} //end of the function AAS_TestSplitPlane
示例9: Q3_DPlanes2MapPlanes
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void Q3_DPlanes2MapPlanes( void ) {
int i;
for ( i = 0; i < q3_numplanes; i++ )
{
dplanes2mapplanes[i] = FindFloatPlane( q3_dplanes[i].normal, q3_dplanes[i].dist );
} //end for
} //end of the function Q3_DPlanes2MapPlanes
示例10: AllocBrush
/*
==================
BrushFromBounds
Creates a new axial brush
==================
*/
brush_t *BrushFromBounds (float minx, float miny, float minz, float maxx, float maxy, float maxz, shaderInfo_t *si)
{
brush_t *b;
vec3_t mins, maxs;
vec3_t normal;
vec_t dist;
int i;
b = AllocBrush (6);
b->entityNum = mapEntityNum;
b->original = b;
b->contentShader = si;
b->compileFlags = si->compileFlags;
b->contentFlags = si->contentFlags;
b->opaque = qtrue;
b->detail = qfalse;
b->numsides = 6;
VectorSet(mins, minx, miny, minz);
VectorSet(maxs, maxx, maxy, maxz);
for (i=0 ; i<3 ; i++)
{
VectorClear (normal);
normal[i] = 1;
dist = maxs[i];
b->sides[i].planenum = FindFloatPlane (normal, dist, 1, (vec3_t*) &maxs );
b->sides[i].shaderInfo = si;
b->sides[i].surfaceFlags = si->surfaceFlags;
b->sides[i].contentFlags = si->contentFlags;
b->sides[i].compileFlags = si->compileFlags;
b->sides[i].value = si->value;
normal[i] = -1;
dist = -mins[i];
b->sides[3+i].planenum = FindFloatPlane (normal, dist, 1, (vec3_t*) &mins );
b->sides[3+i].shaderInfo = si;
b->sides[3+i].surfaceFlags = si->surfaceFlags;
b->sides[3+i].contentFlags = si->contentFlags;
b->sides[3+i].compileFlags = si->compileFlags;
b->sides[3+i].value = si->value;
}
CreateBrushWindings (b);
return b;
}
示例11: DPlanes2MapPlanes
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
void DPlanes2MapPlanes(void)
{
int i;
for (i = 0; i < numplanes; i++)
{
dplanes2mapplanes[i] = FindFloatPlane(dplanes[i].normal, dplanes[i].dist, 0, NULL);
} //end for
} //end of the function DPlanes2MapPlanes
示例12: AAS_TransformPlane
//===========================================================================
//
// Parameter: -
// Returns: -
// Changes Globals: -
//===========================================================================
int AAS_TransformPlane(int planenum, vec3_t origin, vec3_t angles)
{
float newdist, matrix[3][3];
vec3_t normal;
//rotate the node plane
VectorCopy(mapplanes[planenum].normal, normal);
CreateRotationMatrix(angles, matrix);
RotatePoint(normal, matrix);
newdist = mapplanes[planenum].dist + DotProduct(normal, origin);
return FindFloatPlane(normal, newdist);
} //end of the function AAS_TransformPlane
示例13: MapPlaneFromPoints
/*
=================
MapPlaneFromPoints
takes 3 points and finds the plane they lie in
=================
*/
int MapPlaneFromPoints( vec3_t *p )
{
vec3_t t1, t2, normal;
vec_t dist;
VectorSubtract( p[0], p[1], t1 );
VectorSubtract( p[2], p[1], t2 );
CrossProduct( t1, t2, normal );
VectorNormalize( normal );
dist = DotProduct( p[0], normal );
return FindFloatPlane( normal, dist, 3, p );
}
示例14: PlaneFromPoints
/*
* PlaneFromPoints
*/
static int PlaneFromPoints(const vec3_t p0, const vec3_t p1, const vec3_t p2) {
vec3_t t1, t2, normal;
vec_t dist;
VectorSubtract(p0, p1, t1);
VectorSubtract(p2, p1, t2);
CrossProduct(t1, t2, normal);
VectorNormalize(normal);
dist = DotProduct(p0, normal);
return FindFloatPlane(normal, dist);
}
示例15: AllocBrush
/*
==================
BrushFromBounds
Creates a new axial brush
==================
*/
uBrush_t *BrushFromBounds( const idBounds &bounds ) {
uBrush_t *b;
int i;
idPlane plane;
b = AllocBrush (6);
b->numsides = 6;
for (i=0 ; i<3 ; i++) {
plane[0] = plane[1] = plane[2] = 0;
plane[i] = 1;
plane[3] = -bounds[1][i];
b->sides[i].planenum = FindFloatPlane( plane );
plane[i] = -1;
plane[3] = bounds[0][i];
b->sides[3+i].planenum = FindFloatPlane( plane );
}
CreateBrushWindings (b);
return b;
}