本文整理汇总了C++中idWinding::GetNumPoints方法的典型用法代码示例。如果您正苦于以下问题:C++ idWinding::GetNumPoints方法的具体用法?C++ idWinding::GetNumPoints怎么用?C++ idWinding::GetNumPoints使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idWinding
的用法示例。
在下文中一共展示了idWinding::GetNumPoints方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteWinding
/*
================
idSaveGame::WriteBounds
================
*/
void idSaveGame::WriteWinding(const idWinding &w)
{
int i, num;
num = w.GetNumPoints();
file->WriteInt(num);
for (i = 0; i < num; i++) {
idVec5 v = w[i];
LittleRevBytes(&v, sizeof(float), sizeof(v)/sizeof(float));
file->Write(&v, sizeof(v));
}
}
示例2: CreateDecalFromWinding
/*
=================
idRenderModelDecal::CreateDecalFromWinding
=================
*/
void idRenderModelDecal::CreateDecalFromWinding( const idWinding &w, const idMaterial *decalMaterial, const idPlane fadePlanes[2], float fadeDepth, int startTime ) {
// Often we are appending a new triangle to an existing decal, so merge with the previous decal if possible
int decalIndex = ( nextDecal - 1 ) & ( MAX_DECALS - 1 );
if ( decalIndex >= 0
&& decals[decalIndex].material == decalMaterial
&& decals[decalIndex].startTime == startTime
&& decals[decalIndex].numVerts + w.GetNumPoints() <= MAX_DECAL_VERTS
&& decals[decalIndex].numIndexes + 3 * ( w.GetNumPoints() - 2 ) <= MAX_DECAL_INDEXES ) {
} else {
decalIndex = nextDecal++ & ( MAX_DECALS - 1 );
decals[decalIndex].material = decalMaterial;
decals[decalIndex].startTime = startTime;
decals[decalIndex].numVerts = 0;
decals[decalIndex].numIndexes = 0;
assert( w.GetNumPoints() <= MAX_DECAL_VERTS );
if ( nextDecal - firstDecal > MAX_DECALS ) {
firstDecal = nextDecal - MAX_DECALS;
}
}
decal_t & decal = decals[decalIndex];
const float invFadeDepth = -1.0f / fadeDepth;
int firstVert = decal.numVerts;
// create the vertices
for ( int i = 0; i < w.GetNumPoints(); i++ ) {
float depthFade = fadePlanes[0].Distance( w[i].ToVec3() ) * invFadeDepth;
if ( depthFade < 0.0f ) {
depthFade = fadePlanes[1].Distance( w[i].ToVec3() ) * invFadeDepth;
}
if ( depthFade < 0.0f ) {
depthFade = 0.0f;
} else if ( depthFade > 0.99f ) {
depthFade = 1.0f;
}
decal.vertDepthFade[decal.numVerts] = 1.0f - depthFade;
decal.verts[decal.numVerts].Clear();
decal.verts[decal.numVerts].xyz = w[i].ToVec3();
decal.verts[decal.numVerts].SetTexCoord( w[i].s, w[i].t );
decal.numVerts++;
}
// create the indexes
for ( int i = 2; i < w.GetNumPoints(); i++ ) {
assert( decal.numIndexes + 3 <= MAX_DECAL_INDEXES );
decal.indexes[decal.numIndexes + 0] = firstVert;
decal.indexes[decal.numIndexes + 1] = firstVert + i - 1;
decal.indexes[decal.numIndexes + 2] = firstVert + i;
decal.numIndexes += 3;
}
// add degenerate triangles until the index size is a multiple of 16 bytes
for ( ; ( ( ( decal.numIndexes * sizeof( triIndex_t ) ) & 15 ) != 0 ); decal.numIndexes += 3 ) {
assert( decal.numIndexes + 3 <= MAX_DECAL_INDEXES );
decal.indexes[decal.numIndexes + 0] = 0;
decal.indexes[decal.numIndexes + 1] = 0;
decal.indexes[decal.numIndexes + 2] = 0;
}
}