本文整理汇总了C++中CBaseEntity::GetModelIndex方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseEntity::GetModelIndex方法的具体用法?C++ CBaseEntity::GetModelIndex怎么用?C++ CBaseEntity::GetModelIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseEntity
的用法示例。
在下文中一共展示了CBaseEntity::GetModelIndex方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: StaticDecal
void CDecal :: StaticDecal( void )
{
trace_t trace;
int entityIndex, modelIndex = 0;
Vector position = GetAbsOrigin();
UTIL_TraceLine( position - Vector(5,5,5), position + Vector(5,5,5), MASK_SOLID_BRUSHONLY, this, COLLISION_GROUP_NONE, &trace );
entityIndex = (short)trace.m_pEnt ? trace.m_pEnt->entindex() : 0;
if ( entityIndex )
{
CBaseEntity *ent = trace.m_pEnt;
if ( ent )
{
modelIndex = ent->GetModelIndex();
VectorITransform( GetAbsOrigin(), ent->EntityToWorldTransform(), position );
}
}
engine->StaticDecal( position, m_nTexture, entityIndex, modelIndex );
// CRecipientFilter initFilter;
// initFilter.MakeInitMessage();
// TE_BSPDecal( initFilter, GetAbsOrigin(), entityIndex, (int)pev->skin );
SUB_Remove();
}
示例2: StaticDecal
void CDecal::StaticDecal( void )
{
Vector position;
CBaseEntity *pEntity = GetDecalEntityAndPosition(&position, true);
int entityIndex = 0;
int modelIndex = 0;
if ( pEntity )
{
entityIndex = pEntity->entindex();
modelIndex = pEntity->GetModelIndex();
Vector worldspace = position;
VectorITransform( worldspace, pEntity->EntityToWorldTransform(), position );
}
else
{
position = GetAbsOrigin();
}
engine->StaticDecal( position, m_nTexture, entityIndex, modelIndex, m_bLowPriority );
SUB_Remove();
}
示例3: RestorePhysicsObjectAndModel
void RestorePhysicsObjectAndModel( IRestore *pRestore, const PhysObjectHeader_t &header, CPhysSaveRestoreBlockHandler::QueuedItem_t *pItem, int nObjects )
{
if ( nObjects == 1 )
{
pRestore->StartBlock();
CPhysCollide *pPhysCollide = NULL;
int modelIndex = -1;
bool fCustomCollide = false;
if ( header.modelName != NULL_STRING )
{
CBaseEntity *pGlobalEntity = header.hEntity;
#if !defined( CLIENT_DLL )
if ( NULL_STRING != pGlobalEntity->m_iGlobalname )
{
modelIndex = pGlobalEntity->GetModelIndex();
}
else
#endif
{
modelIndex = modelinfo->GetModelIndex( STRING( header.modelName ) );
pGlobalEntity = NULL;
}
if ( modelIndex != -1 )
{
vcollide_t *pCollide = modelinfo->GetVCollide( modelIndex );
if ( pCollide )
{
if ( pCollide->solidCount > 0 && pCollide->solids && header.iCollide < pCollide->solidCount )
pPhysCollide = pCollide->solids[header.iCollide];
}
}
}
else if ( header.bbox.mins != vec3_origin || header.bbox.maxs != vec3_origin )
{
pPhysCollide = PhysCreateBbox( header.bbox.mins, header.bbox.maxs );
fCustomCollide = true;
}
else if ( header.sphere.radius != 0 )
{
// HACKHACK: Handle spheres here!!!
if ( !(*pItem->ppPhysObj) )
{
RestorePhysicsObject( pRestore, header, pItem->ppPhysObj, NULL );
}
return;
}
if ( pPhysCollide )
{
if ( !(*pItem->ppPhysObj) )
{
RestorePhysicsObject( pRestore, header, pItem->ppPhysObj, pPhysCollide );
if ( (*pItem->ppPhysObj) )
{
IPhysicsObject *pObject = (IPhysicsObject *)(*pItem->ppPhysObj);
if ( !fCustomCollide )
{
AssociateModel( pObject, modelIndex );
}
else
{
AssociateModel( pObject, pPhysCollide );
}
}
else
DevMsg( "Failed to restore physics object\n" );
}
else
DevMsg( "Physics object pointer unexpectedly non-null before restore. Should be creating physics object in CreatePhysics()?\n" );
}
else
DevMsg( "Failed to reestablish collision model for object\n" );
pRestore->EndBlock();
}
else
DevMsg( "Don't know how to reconsitite models for physobj array \n" );
}
示例4: traceFilter
trace_t trace;
CTraceFilterValidForDecal traceFilter( this, COLLISION_GROUP_NONE );
int entityIndex, modelIndex = 0;
Vector position = GetAbsOrigin();
UTIL_TraceLine( position - Vector(5,5,5), position + Vector(5,5,5), MASK_SOLID, &traceFilter, &trace );
bool canDraw = true;
entityIndex = trace.m_pEnt ? (short)trace.m_pEnt->entindex() : 0;
if ( entityIndex )
{
CBaseEntity *ent = trace.m_pEnt;
if ( ent )
{
modelIndex = ent->GetModelIndex();
VectorITransform( GetAbsOrigin(), ent->EntityToWorldTransform(), position );
canDraw = ( modelIndex != 0 );
if ( !canDraw )
{
Warning( "Suppressed StaticDecal which would have hit entity %i (class:%s, name:%s) with modelindex = 0\n",
ent->entindex(),
ent->GetClassname(),
STRING( ent->GetEntityName() ) );
}
}
}
if ( canDraw )
{
示例5: FindPhysicsObject
bool CNPC_Dog::FindPhysicsObject( const char *pPickupName, CBaseEntity *pIgnore )
{
CBaseEntity *pEnt = NULL;
CBaseEntity *pNearest = NULL;
float flDist;
IPhysicsObject *pPhysObj = NULL;
float flNearestDist = 99999;
if ( pPickupName != NULL && strlen( pPickupName ) > 0 )
{
pEnt = gEntList.FindEntityByName( NULL, pPickupName );
if ( m_hUnreachableObjects.Find( pEnt ) == -1 )
{
m_bHasObject = false;
m_hPhysicsEnt = pEnt;
return true;
}
}
while ( ( pEnt = gEntList.FindEntityByClassname( pEnt, "prop_physics" ) ) != NULL )
{
//We don't want this one.
if ( pEnt == pIgnore )
continue;
if ( m_hUnreachableObjects.Find( pEnt ) != -1 )
continue;
pPhysObj = pEnt->VPhysicsGetObject();
if( pPhysObj == NULL )
continue;
if ( pPhysObj->GetMass() > DOG_MAX_THROW_MASS )
continue;
Vector center = pEnt->WorldSpaceCenter();
flDist = UTIL_DistApprox2D( GetAbsOrigin(), center );
vcollide_t *pCollide = modelinfo->GetVCollide( pEnt->GetModelIndex() );
if ( pCollide == NULL )
continue;
if ( pPhysObj->GetGameFlags() & FVPHYSICS_PLAYER_HELD )
continue;
if ( pPhysObj->IsMoveable() == false )
continue;
if ( pEnt->GetCollisionGroup() == COLLISION_GROUP_DEBRIS ||
pEnt->GetCollisionGroup() == COLLISION_GROUP_INTERACTIVE_DEBRIS )
continue;
if ( center.z > EyePosition().z )
continue;
if ( flDist >= flNearestDist )
continue;
if ( FVisible( pEnt ) == false )
continue;
pNearest = pEnt;
flNearestDist = flDist;
}
m_bHasObject = false;
m_hPhysicsEnt = pNearest;
if ( dog_debug.GetBool() == true )
{
if ( pNearest )
NDebugOverlay::Box( pNearest->WorldSpaceCenter(), pNearest->CollisionProp()->OBBMins(), pNearest->CollisionProp()->OBBMaxs(), 255, 0, 255, true, 3 );
}
if( m_hPhysicsEnt == NULL )
{
return false;
}
else
{
return true;
}
}