本文整理汇总了C++中VEC_COPY函数的典型用法代码示例。如果您正苦于以下问题:C++ VEC_COPY函数的具体用法?C++ VEC_COPY怎么用?C++ VEC_COPY使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了VEC_COPY函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: VEC_COPY
LTBOOL CParticleTrailSegmentFX::Init(SFXCREATESTRUCT* psfxCreateStruct)
{
if (!CBaseParticleSystemFX::Init(psfxCreateStruct)) return LTFALSE;
g_cvarSmokeTrailStartScale.Init(g_pLTClient, "SmokeTrailStartScale", LTNULL, 1.0f);
g_cvarSmokeTrailLWEndScale.Init(g_pLTClient, "SmokeTrailLWEndScale", LTNULL, 15.0f);
g_cvarSmokeTrailSWEndScale.Init(g_pLTClient, "SmokeTrailSWEndScale", LTNULL, 15.0f);
g_cvarSmokeTrailSBEndScale.Init(g_pLTClient, "SmokeTrailSBEndScale", LTNULL, 15.0f);
g_cvarSmokeTrailStartAlpha.Init(g_pLTClient, "SmokeTrailStartAlpha", LTNULL, 0.9f);
g_cvarSmokeTrailEndAlpha.Init(g_pLTClient, "SmokeTrailEndAlpha", LTNULL, 0.0f);
PTSCREATESTRUCT* pPTS = (PTSCREATESTRUCT*)psfxCreateStruct;
VEC_COPY(m_vColor1, pPTS->vColor1);
VEC_COPY(m_vColor2, pPTS->vColor2);
VEC_COPY(m_vDriftOffset, pPTS->vDriftOffset);
m_nType = pPTS->nType;
m_fLifeTime = pPTS->fLifeTime;
m_fFadeTime = pPTS->fFadeTime;
m_fOffsetTime = pPTS->fOffsetTime;
m_fRadius = pPTS->fRadius;
m_fGravity = pPTS->fGravity;
m_nNumPerPuff = pPTS->nNumPerPuff;
m_bIgnoreWind = LTFALSE;
// We'll control the particle system's position...
m_basecs.bClientControlsPos = LTTRUE;
return LTTRUE;
}
示例2: VEC_COPY
DBOOL CParticleStreamFX::Init(SFXCREATESTRUCT* psfxCreateStruct)
{
if (!CBaseParticleSystemFX::Init(psfxCreateStruct)) return DFALSE;
PSTREAMCREATESTRUCT* pSS = (PSTREAMCREATESTRUCT*)psfxCreateStruct;
m_fRadius = pSS->fRadius;
m_fPosRadius = pSS->fPosRadius;
m_fMinVel = pSS->fMinVel;
m_fMaxVel = pSS->fMaxVel;
m_nNumParticles = pSS->nNumParticles;
m_fSpread = pSS->fSpread;
VEC_COPY(m_vColor1, pSS->vColor1);
VEC_COPY(m_vColor2, pSS->vColor2);
m_fAlpha = pSS->fAlpha;
m_fMinLife = pSS->fMinLife;
m_fMaxLife = pSS->fMaxLife;
m_fRampTime = pSS->fRampTime;
m_fDelay = pSS->fDelay;
m_bState = pSS->bOn ? 2 : 0;
m_bRampFlags = pSS->bRampFlags;
m_fGravity = pSS->fGravity;
m_hstrSound1 = pSS->hstrSound1;
m_hstrSound2 = pSS->hstrSound2;
m_hstrSound3 = pSS->hstrSound3;
m_hstrTexture = pSS->hstrTexture;
m_pTextureName = "SpriteTextures\\drop32_1.dtx";
return DTRUE;
}
示例3: VEC_COPY
LTBOOL CSmokeFX::Init(SFXCREATESTRUCT* psfxCreateStruct)
{
if (!CBaseParticleSystemFX::Init(psfxCreateStruct)) return LTFALSE;
m_pTextureName = "SpecialFX\\ParticleTextures\\smoke.dtx";
SMCREATESTRUCT* pSM = (SMCREATESTRUCT*)psfxCreateStruct;
VEC_COPY(m_vPos, pSM->vPos);
VEC_COPY(m_vColor1, pSM->vColor1);
VEC_COPY(m_vColor2, pSM->vColor1);
VEC_COPY(m_vMinDriftVel, pSM->vMinDriftVel);
VEC_COPY(m_vMaxDriftVel, pSM->vMaxDriftVel);
m_fVolumeRadius = pSM->fVolumeRadius;
m_fLifeTime = pSM->fLifeTime;
m_fRadius = pSM->fRadius;
m_fParticleCreateDelta = pSM->fParticleCreateDelta;
m_fMinParticleLife = pSM->fMinParticleLife;
m_fMaxParticleLife = pSM->fMaxParticleLife;
m_nNumParticles = pSM->nNumParticles;
m_bIgnoreWind = pSM->bIgnoreWind;
m_hstrTexture = pSM->hstrTexture;
m_fGravity = 0.0f;
return LTTRUE;
}
示例4: VEC_COPY
DBOOL CSmokePuffFX::Init(SFXCREATESTRUCT* psfxCreateStruct)
{
if (!CBaseParticleSystemFX::Init(psfxCreateStruct)) return DFALSE;
m_pTextureName = "SpriteTextures\\Particles\\ParticleSmoke2.dtx";
SMPCREATESTRUCT* pSM = (SMPCREATESTRUCT*)psfxCreateStruct;
VEC_COPY(m_vColor1, pSM->vColor1);
VEC_COPY(m_vColor2, pSM->vColor2);
VEC_COPY(m_vMinDriftVel, pSM->vMinDriftVel);
VEC_COPY(m_vMaxDriftVel, pSM->vMaxDriftVel);
m_fDriftDeceleration = pSM->fDriftDeceleration;
VEC_COPY(m_vPos, pSM->vPos);
m_fVolumeRadius = pSM->fVolumeRadius;
m_fLifeTime = pSM->fLifeTime;
m_fRadius = pSM->fRadius;
m_fParticleCreateDelta = pSM->fParticleCreateDelta;
m_fMinParticleLife = pSM->fMinParticleLife;
m_fMaxParticleLife = pSM->fMaxParticleLife;
m_fMaxAlpha = pSM->fMaxAlpha;
m_fCreateLifetime = pSM->fCreateLifetime;
m_nNumParticles = pSM->nNumParticles;
m_bIgnoreWind = pSM->bIgnoreWind;
m_pTextureName = pSM->pTexture;
m_fFadeTime = m_fLifeTime*0.6f;
m_fCreateLifetime = m_fLifeTime * m_fCreateLifetime;
m_fGravity = 0.0f;
return DTRUE;
}
示例5: SetNextUpdate
LTBOOL ScaleSprite::Update()
{
if (m_bStartOn)
{
g_pCommonLT->SetObjectFlags(m_hObject, OFT_User, USRFLG_VISIBLE, USRFLG_VISIBLE);
g_pCommonLT->SetObjectFlags(m_hObject, OFT_Flags, FLAG_VISIBLE, FLAG_VISIBLE);
}
SetNextUpdate(UPDATE_NEVER);
// BUG - This isn't quite right. Sometimes this works (flipping the sprite)
// other times the sprite shouldn't be flipped...Not sure what the bug is.
// For some reason the sprites are sometimes backwards...Get the rotation
// so we can flip it...
LTRotation rRot;
LTVector vPos, vDir, vU, vR, vF;
g_pLTServer->GetObjectPos(m_hObject, &vPos);
g_pLTServer->GetObjectRotation(m_hObject, &rRot);
vU = rRot.Up();
vR = rRot.Right();
vF = rRot.Forward();
if (m_bFlushWithWorld)
{
// Align the sprite to the surface directly behind the sprite
// (i.e., opposite the forward vector)...
VEC_NORM(vF);
VEC_MULSCALAR(vDir, vF, -1.0f);
// Determine where on the surface to place the sprite...
IntersectInfo iInfo;
IntersectQuery qInfo;
VEC_COPY(qInfo.m_From, vPos);
VEC_COPY(qInfo.m_Direction, vDir);
qInfo.m_Flags = IGNORE_NONSOLID | INTERSECT_OBJECTS | INTERSECT_HPOLY;
qInfo.m_FilterFn = LTNULL;
if (g_pLTServer->CastRay(&qInfo, &iInfo))
{
LTVector vTemp;
VEC_COPY(vPos, iInfo.m_Point);
VEC_COPY(vDir, iInfo.m_Plane.m_Normal);
// Place the sprite just above the surface...
VEC_MULSCALAR(vTemp, vDir, 1.0f);
VEC_ADD(vPos, vPos, vTemp);
g_pLTServer->SetObjectPos(m_hObject, &vPos);
}
}
return LTTRUE;
}
示例6: VEC_COPY
void CMovement::ConsolidatePath()
{
CServerDE* pServerDE = BaseClass::GetServerDE();
if (!pServerDE) return;
IntersectQuery IQuery;
IntersectInfo IInfo;
IQuery.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID;
IQuery.m_FilterFn = DNULL;
//check first from our pos to second path point
DLink* pLink1 = m_PathList.m_Head.m_pNext;
// add a little sanity checking (gk 9/2)
if (pLink1->m_pData && pLink1->m_pNext->m_pData)
{
VEC_COPY(IQuery.m_From, m_vPos);
VEC_COPY(IQuery.m_To, *((DVector*)pLink1->m_pNext->m_pData));
if(!pServerDE->IntersectSegment(&IQuery, &IInfo))
{
dl_RemoveAt(&m_PathList,pLink1);
delete pLink1;
}
}
//loop through pathpoint and pathpoint + 2
pLink1 = m_PathList.m_Head.m_pNext;
if (pLink1->m_pData && pLink1->m_pNext->m_pData)
{
DLink* pLink2 = pLink1->m_pNext->m_pNext;
while(pLink1->m_pData && pLink2->m_pData)
{
VEC_COPY(IQuery.m_From, *((DVector*)pLink1->m_pData));
VEC_COPY(IQuery.m_To, *((DVector*)pLink2->m_pData));
if(!pServerDE->IntersectSegment(&IQuery, &IInfo))
{
DLink *pObLink = pLink1->m_pNext;
dl_RemoveAt(&m_PathList,pObLink);
delete pObLink;
pLink2 = pLink2->m_pNext;
}
else
{
pLink1 = pLink1->m_pNext;
pLink2 = pLink2->m_pNext;
}
}
}
return;
}
示例7: _ASSERT
LTBOOL CScanner::CanSeeObject(ObjectFilterFn ofn, HOBJECT hObject)
{
_ASSERT(hObject);
if (!hObject) return LTFALSE;
if (g_pGameServerShell->GetGameType() == COOPERATIVE_ASSAULT && m_nPlayerTeamFilter && IsPlayer(hObject))
{
CPlayerObj* pPlayer = (CPlayerObj*)g_pLTServer->HandleToObject(hObject);
if (pPlayer->GetTeamID() != m_nPlayerTeamFilter)
return LTFALSE;
}
LTVector vPos;
g_pLTServer->GetObjectPos(hObject, &vPos);
LTVector vDir;
vDir = vPos - GetScanPosition();
if (VEC_MAGSQR(vDir) >= m_fVisualRange)
{
return LTFALSE;
}
vDir.Norm();
LTRotation rRot = GetScanRotation();
LTVector vUp, vRight, vForward;
g_pLTServer->GetRotationVectors(&rRot, &vUp, &vRight, &vForward);
LTFLOAT fDp = vDir.Dot(vForward);
if (fDp < m_fFOV)
{
return LTFALSE;
}
// See if we can see the position in question
IntersectQuery IQuery;
IntersectInfo IInfo;
VEC_COPY(IQuery.m_From, GetScanPosition());
VEC_COPY(IQuery.m_To, vPos);
IQuery.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID;
IQuery.m_FilterFn = ofn;
if (g_pLTServer->IntersectSegment(&IQuery, &IInfo))
{
if (IInfo.m_hObject == hObject)
{
return LTTRUE;
}
}
return LTFALSE;
}
示例8: GetServerDE
DBOOL ParticleSystem::ReadProp(ObjectCreateStruct *)
{
CServerDE* pServerDE = GetServerDE();
if (!pServerDE) return DFALSE;
GenericProp genProp;
if (g_pServerDE->GetPropGeneric("Static", &genProp) == DE_OK)
m_bStatic = genProp.m_Bool;
if (g_pServerDE->GetPropGeneric("ParticleFlags", &genProp) == DE_OK)
m_dwFlags = genProp.m_Long;
if (g_pServerDE->GetPropGeneric("BurstWait", &genProp) == DE_OK)
m_fBurstWait = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("ParticlesPerSecond", &genProp) == DE_OK)
m_fParticlesPerSecond = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("EmissionRadius", &genProp) == DE_OK)
m_fEmissionRadius = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("MinimumVelocity", &genProp) == DE_OK)
m_fMinimumVelocity = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("MaximumVelocity", &genProp) == DE_OK)
m_fMaximumVelocity = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("VelocityOffset", &genProp) == DE_OK)
m_fVelocityOffset = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("ParticleLifetime", &genProp) == DE_OK)
m_fParticleLifetime = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("Color1", &genProp) == DE_OK)
VEC_COPY(m_vColor1, genProp.m_Color);
if (g_pServerDE->GetPropGeneric("Color2", &genProp) == DE_OK)
VEC_COPY(m_vColor2, genProp.m_Color);
if (g_pServerDE->GetPropGeneric("ParticleRadius", &genProp) == DE_OK)
m_fRadius = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("Gravity", &genProp) == DE_OK)
m_fGravity = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("RotationVelocity", &genProp) == DE_OK)
m_fRotationVelocity = genProp.m_Float;
if (g_pServerDE->GetPropGeneric("TextureName", &genProp) == DE_OK)
{
if (genProp.m_String[0]) m_hstrTextureName = pServerDE->CreateString(genProp.m_String);
}
return DTRUE;
}
示例9: dCollideRTL
int dCollideRTL(dxGeom* g1, dxGeom* RayGeom, int Flags, dContactGeom* Contacts, int Stride)
{
dxTriMesh* TriMesh = (dxTriMesh*)g1;
dReal Length = dGeomRayGetLength(RayGeom);
int FirstContact, BackfaceCull;
dGeomRayGetParams(RayGeom, &FirstContact, &BackfaceCull);
int ClosestHit = dGeomRayGetClosestHit(RayGeom);
dVector3 Origin, Direction;
dGeomRayGet(RayGeom, Origin, Direction);
char intersect=0;
GIM_TRIANGLE_RAY_CONTACT_DATA contact_data;
if(ClosestHit)
{
intersect = gim_trimesh_ray_closest_collision(&TriMesh->m_collision_trimesh,Origin,Direction,Length,&contact_data);
}
else
{
intersect = gim_trimesh_ray_collision(&TriMesh->m_collision_trimesh,Origin,Direction,Length,&contact_data);
}
if(intersect == 0)
{
return 0;
}
int OutTriCount = 0;
if(TriMesh->RayCallback)
{
if(TriMesh->RayCallback(TriMesh, RayGeom, contact_data.m_face_id,
contact_data.u , contact_data.v))
{
OutTriCount = 1;
}
}
else
{
OutTriCount = 1;
}
if(OutTriCount>0)
{
dContactGeom* Contact = SAFECONTACT(Flags, Contacts, (OutTriCount-1), Stride);
VEC_COPY(Contact->pos,contact_data.m_point);
VEC_COPY(Contact->normal,contact_data.m_normal);
Contact->depth = contact_data.tparam;
Contact->g1 = TriMesh;
Contact->g2 = RayGeom;
}
return OutTriCount;
}
示例10: ROT_INIT
DBOOL CBaseParticleSystemFX::CreateObject(CClientDE *pClientDE)
{
if (!CSpecialFX::CreateObject(pClientDE)) return DFALSE;
DVector vPos;
DRotation rRot;
ROT_INIT(rRot);
// Use server object position if a position wasn't specified...
if (m_vPos.x == 0.0f && m_vPos.y == 0.0f && m_vPos.z == 0.0f)
{
if (m_hServerObject)
{
pClientDE->GetObjectPos(m_hServerObject, &vPos);
}
}
else
{
VEC_COPY(vPos, m_vPos);
}
// Use the specified rotation if applicable
if (m_rRot.m_Vec.x != 0.0f || m_rRot.m_Vec.y != 0.0f ||
m_rRot.m_Vec.z != 0.0f || m_rRot.m_Spin != 1.0f)
{
ROT_COPY(rRot, m_rRot);
}
// Setup the ParticleSystem...
ObjectCreateStruct createStruct;
INIT_OBJECTCREATESTRUCT(createStruct);
createStruct.m_ObjectType = OT_PARTICLESYSTEM;
createStruct.m_Flags = FLAG_VISIBLE | FLAG_UPDATEUNSEEN;
VEC_COPY(createStruct.m_Pos, vPos);
ROT_COPY(createStruct.m_Rotation, rRot);
m_hObject = m_pClientDE->CreateObject(&createStruct);
m_pClientDE->SetupParticleSystem(m_hObject, m_pTextureName,
m_fGravity, m_dwFlags, m_fRadius / 640.0f);
VEC_SET(m_vColorRange, m_vColor2.x - m_vColor1.x,
m_vColor2.y - m_vColor1.y,
m_vColor2.z - m_vColor1.z);
if (m_vColorRange.x < 0.0f) m_vColorRange.x = 0.0f;
if (m_vColorRange.y < 0.0f) m_vColorRange.y = 0.0f;
if (m_vColorRange.z < 0.0f) m_vColorRange.z = 0.0f;
return DTRUE;
}
示例11: VEC_COPY
LTBOOL CParticleTrailFX::Update()
{
CSFXMgr* psfxMgr = g_pRiotClientShell->GetSFXMgr();
if (!psfxMgr || !m_pClientDE || !m_hServerObject) return LTFALSE;
LTFLOAT fTime = m_pClientDE->GetTime();
// Check to see if we should go away...
if (m_bWantRemove)
{
return LTFALSE;
}
// See if it is time to create a new trail segment...
if ((m_fStartTime < 0) || (fTime > m_fStartTime + m_fSegmentTime))
{
PTSCREATESTRUCT pts;
pts.hServerObj = m_hServerObject;
VEC_COPY(pts.vColor1, m_vColor1);
VEC_COPY(pts.vColor2, m_vColor2);
VEC_COPY(pts.vDriftOffset, m_vDriftOffset);
pts.nType = m_nType;
pts.bSmall = m_bSmall;
pts.fLifeTime = m_fLifeTime;
pts.fFadeTime = m_fFadeTime;
pts.fOffsetTime = m_fOffsetTime;
pts.fRadius = 2000.0f;
pts.fGravity = 0.0f;
pts.nNumPerPuff = m_nNumPerPuff;
if (m_nType & PT_BLOOD)
{
pts.fRadius = 600.0f;
}
else if (m_nType & PT_GIBSMOKE)
{
pts.fRadius = 1250.0f;
}
CSpecialFX* pFX = psfxMgr->CreateSFX(SFX_PARTICLETRAILSEG_ID, &pts);
// Let each Particle segment do its initial update...
if (pFX) pFX->Update();
m_fStartTime = fTime;
}
return LTTRUE;
}
示例12: VEC_INIT
DVector CMovement::FindTurn(DVector vStart, DVector vTestDir, DVector vMoveDir, DFLOAT fMoveLen,
DFLOAT fTestLen)
{
DVector vFinal,vCurPos;
DBOOL bStop = DTRUE;
DFLOAT fMaxDist = 0.0f;
VEC_INIT(vFinal);
VEC_COPY(vCurPos, vStart);
CServerDE* pServerDE = BaseClass::GetServerDE();
if (!pServerDE) return vFinal;
IntersectQuery IQuery;
IntersectInfo IInfo;
IQuery.m_Flags = INTERSECT_OBJECTS | IGNORE_NONSOLID;
IQuery.m_FilterFn = DNULL;
VEC_COPY(IQuery.m_From,vStart);
VEC_COPY(IQuery.m_Direction,vMoveDir);
//find maximum searchable distance in vMoveDir
if(pServerDE->CastRay(&IQuery,&IInfo))
{
fMaxDist = VEC_DIST(vStart,IInfo.m_Point);
}
//loop til we find a spot to turn
for(float fDist = 0.0f; !((fDist + fMoveLen) >= fMaxDist); fDist += fMoveLen)
{
VEC_ADDSCALED(vCurPos, vCurPos, vMoveDir, fMoveLen);
VEC_COPY(IQuery.m_From,vCurPos);
VEC_ADDSCALED(IQuery.m_To,vCurPos, vTestDir, fTestLen);
if(!pServerDE->IntersectSegment(&IQuery, &IInfo))
{
VEC_ADDSCALED(vFinal, vCurPos, vMoveDir, fMoveLen);
return vFinal;
}
}
if(m_nNumPoints >= 10 || (VEC_DIST(vCurPos,vStart) <= 0.0))
return vCurPos;
//we can't turn here so we add to list and keep searching in new direction
AddPosToPathList(vCurPos);
DVector vNewMoveDir;
VEC_MULSCALAR(vNewMoveDir, vTestDir, -1.0f);
return FindTurn(vCurPos, vMoveDir, vNewMoveDir, fMoveLen, (fMaxDist - fDist) + 1.0f);
}
示例13: Setup
void PolyGrid:: Setup(DVector* pvDims, DVector* pvColor1, DVector* pvColor2,
HSTRING hstrSurfaceSprite, DFLOAT fXScaleMin, DFLOAT fXScaleMax,
DFLOAT fYScaleMin, DFLOAT fYScaleMax, DFLOAT fXScaleDuration,
DFLOAT fYScaleDuration, DFLOAT fXPan, DFLOAT fYPan,
DFLOAT fAlpha, DDWORD dwNumPolies)
{
D_WORD wColor1, wColor2;
CServerDE* pServerDE = GetServerDE();
if (!pServerDE || !pvDims || !pvColor1 || !pvColor2 || dwNumPolies < 4) return;
VEC_COPY(m_vDims, *pvDims);
pServerDE->SetObjectDims(m_hObject, pvDims);
VEC_COPY(m_vColor1, *pvColor1);
VEC_COPY(m_vColor2, *pvColor2);
wColor1 = Color255VectorToWord( pvColor1 );
wColor2 = Color255VectorToWord( pvColor2 );
// Limit the number of polies to 32k...
if ( dwNumPolies > 0x7FFF )
dwNumPolies = 0x7FFF;
HSTRING hstrSprite = hstrSurfaceSprite ? hstrSurfaceSprite : pServerDE->CreateString("");
// Tell the clients about the polygrid...
HMESSAGEWRITE hMessage = pServerDE->StartSpecialEffectMessage(this);
pServerDE->WriteToMessageByte(hMessage, SFX_POLYGRID_ID);
pServerDE->WriteToMessageVector(hMessage, &m_vDims);
pServerDE->WriteToMessageWord(hMessage, wColor1);
pServerDE->WriteToMessageWord(hMessage, wColor2);
pServerDE->WriteToMessageFloat(hMessage, fXScaleMin);
pServerDE->WriteToMessageFloat(hMessage, fXScaleMax);
pServerDE->WriteToMessageFloat(hMessage, fYScaleMin);
pServerDE->WriteToMessageFloat(hMessage, fYScaleMax);
pServerDE->WriteToMessageFloat(hMessage, fXScaleDuration);
pServerDE->WriteToMessageFloat(hMessage, fYScaleDuration);
pServerDE->WriteToMessageFloat(hMessage, fXPan);
pServerDE->WriteToMessageFloat(hMessage, fYPan);
pServerDE->WriteToMessageFloat(hMessage, fAlpha);
pServerDE->WriteToMessageHString(hMessage, hstrSprite);
pServerDE->WriteToMessageWord(hMessage, (D_WORD)dwNumPolies);
pServerDE->WriteToMessageByte(hMessage, m_nPlasmaType);
pServerDE->WriteToMessageByte(hMessage, m_nRingRate[0]);
pServerDE->WriteToMessageByte(hMessage, m_nRingRate[1]);
pServerDE->WriteToMessageByte(hMessage, m_nRingRate[2]);
pServerDE->WriteToMessageByte(hMessage, m_nRingRate[3]);
pServerDE->EndMessage(hMessage);
if (!hstrSurfaceSprite)
{
pServerDE->FreeString(hstrSprite);
}
}
示例14: BounceMovingObject
DBOOL BounceMovingObject(PhysicsState *pUserState, MovingObject *pObject,
DVector *pNewPos, ClientIntersectInfo* pInfo, SurfaceType *eType)
{
if (!pObject || !pNewPos || !pInfo) return DFALSE;
PhysicsState* pState = pUserState ? pUserState : GetCurPhysicsState(pObject);
if (!pState) return DFALSE;
ClientIntersectQuery query;
float dot;
// Only do an intersection test if the line is long enough (sometimes the
// intersection test will fail on really short lines).
memset(&query, 0, sizeof(query));
VEC_COPY(query.m_From, pObject->m_Pos);
VEC_COPY(query.m_To, *pNewPos);
if (eType)
query.m_Flags = INTERSECT_HPOLY;
if (pState->m_pClientDE->IntersectSegment(&query, pInfo))
{
// get the surface type
if (eType)
*eType = GetSurfaceType(pInfo->m_hObject, pInfo->m_hPoly);
// Reflect the velocity.
dot = VEC_DOT(pObject->m_Velocity, pInfo->m_Plane.m_Normal);
dot *= -2.0f;
VEC_ADDSCALED(pObject->m_Velocity, pObject->m_Velocity, pInfo->m_Plane.m_Normal, dot);
// If the plane hit is in the opposite direction of travel, then move back a little...
if( dot > 0.0f )
{
// Move the dest point a little in front of the plane.
VEC_ADDSCALED(*pNewPos, pInfo->m_Point, pInfo->m_Plane.m_Normal, 0.3f);
}
// Dampen it.
VEC_MULSCALAR(pObject->m_Velocity, pObject->m_Velocity, pState->m_VelocityDampen);
// (250 is the max squared magnitude).
if(pInfo->m_Plane.m_Normal.y > 0.6f && (VEC_MAGSQR(pObject->m_Velocity) < (250.0f)))
{
pObject->m_PhysicsFlags |= MO_RESTING;
}
return DTRUE;
}
return DFALSE;
}
示例15: gim_trimesh_get_triangle_vertices
void gim_trimesh_get_triangle_vertices(GIM_TRIMESH * trimesh, GUINT32 triangle_index, vec3f v1,vec3f v2,vec3f v3)
{
vec3f * transformed_vertices = GIM_BUFFER_ARRAY_POINTER(vec3f,trimesh->m_transformed_vertex_buffer,0);
GUINT32 * triangle_indices = GIM_BUFFER_ARRAY_POINTER(GUINT32,trimesh->m_tri_index_buffer,triangle_index*3);
//Copy the vertices
VEC_COPY(v1,transformed_vertices[triangle_indices[0]]);
VEC_COPY(v2,transformed_vertices[triangle_indices[1]]);
VEC_COPY(v3,transformed_vertices[triangle_indices[2]]);
}