本文整理汇总了C++中idWinding类的典型用法代码示例。如果您正苦于以下问题:C++ idWinding类的具体用法?C++ idWinding怎么用?C++ idWinding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了idWinding类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: FromWinding
/*
============
idBrush::FromWinding
============
*/
bool idBrush::FromWinding( const idWinding& w, const idPlane& windingPlane )
{
int i, j, bestAxis;
idPlane plane;
idVec3 normal, axialNormal;
sides.Append( new idBrushSide( windingPlane, -1 ) );
sides.Append( new idBrushSide( -windingPlane, -1 ) );
bestAxis = 0;
for( i = 1; i < 3; i++ )
{
if( idMath::Fabs( windingPlane.Normal()[i] ) > idMath::Fabs( windingPlane.Normal()[bestAxis] ) )
{
bestAxis = i;
}
}
axialNormal = vec3_origin;
if( windingPlane.Normal()[bestAxis] > 0.0f )
{
axialNormal[bestAxis] = 1.0f;
}
else
{
axialNormal[bestAxis] = -1.0f;
}
for( i = 0; i < w.GetNumPoints(); i++ )
{
j = ( i + 1 ) % w.GetNumPoints();
normal = ( w[j].ToVec3() - w[i].ToVec3() ).Cross( axialNormal );
if( normal.Normalize() < 0.5f )
{
continue;
}
plane.SetNormal( normal );
plane.FitThroughPoint( w[j].ToVec3() );
sides.Append( new idBrushSide( plane, -1 ) );
}
if( sides.Num() < 4 )
{
for( i = 0; i < sides.Num(); i++ )
{
delete sides[i];
}
sides.Clear();
return false;
}
sides[0]->winding = w.Copy();
windingsValid = true;
BoundBrush();
return true;
}
开发者ID:Yetta1,项目名称:OpenTechBFG,代码行数:61,代码来源:Brush.cpp
示例2: SetupPolygon
/*
============
idTraceModel::SetupPolygon
============
*/
void idTraceModel::SetupPolygon( const idWinding &w ) {
int i;
idVec3 *verts;
verts = (idVec3 *) _alloca16( w.GetNumPoints() * sizeof( idVec3 ) );
for ( i = 0; i < w.GetNumPoints(); i++ ) {
verts[i] = w[i].ToVec3();
}
SetupPolygon( verts, w.GetNumPoints() );
}
开发者ID:pdoughty,项目名称:Q4--Hardqore,代码行数:15,代码来源:TraceModel.cpp
示例3: WriteWinding
void idSaveGame::WriteWinding( const idWinding &w ) {
int i, num;
num = w.GetNumPoints();
WriteInt( num );
for( i = 0; i < num; i++ ) {
WriteVec5( w[i] );
}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:8,代码来源:SaveGame.cpp
示例4: ReadWinding
/*
================
idRestoreGame::ReadWinding
================
*/
void idRestoreGame::ReadWinding( idWinding &w ) {
int i, num;
file->ReadInt( num );
w.SetNumPoints( num );
for( i = 0; i < num; i++ ) {
file->Read( &w[i], sizeof( idVec5 ) );
LittleRevBytes( &w[i], sizeof( float ), sizeof( idVec5 ) / sizeof( float ) );
}
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:14,代码来源:SaveGame.cpp
示例5: 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 ) );
}
}
开发者ID:revelator,项目名称:Revelation-Engine,代码行数:15,代码来源:SaveGame.cpp
示例6: WriteWinding
/*
================
idSaveGame::WriteBounds
================
*/
void idSaveGame::WriteWinding( const idWinding& w )
{
int i, num;
num = w.GetNumPoints();
file->WriteBig( num );
for( i = 0; i < num; i++ )
{
idVec5 v = w[i];
file->WriteBig( v );
}
}
开发者ID:Anthony-Gaudino,项目名称:OpenTechBFG,代码行数:16,代码来源:SaveGame.cpp
示例7: ReadWinding
/*
================
idRestoreGame::ReadWinding
================
*/
void idRestoreGame::ReadWinding( idWinding& w )
{
int i, num;
ReadInt( num );
w.SetNumPoints( num );
for( i = 0; i < num; i++ )
{
idVec5& v = w[i];
file->ReadBig( v );
}
}
开发者ID:Anthony-Gaudino,项目名称:OpenTechBFG,代码行数:16,代码来源:SaveGame.cpp
示例8: ReadWinding
void idRestoreGame::ReadWinding( idWinding &w ) {
int i, num;
ReadInt( num );
if( num < 0 ) {
Error( "idRestoreGame::ReadWinding: negative number of points (%d)", num );
}
w.SetNumPoints( num );
for( i = 0; i < num; i++ ) {
ReadVec5( w[i] );
}
}
开发者ID:SL987654,项目名称:The-Darkmod-Experimental,代码行数:11,代码来源:SaveGame.cpp
示例9: 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;
}
}
开发者ID:Deepfreeze32,项目名称:taken,代码行数:66,代码来源:ModelDecal.cpp
注:本文中的idWinding类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论