本文整理汇总了C++中CServerDE::GetObjectDims方法的典型用法代码示例。如果您正苦于以下问题:C++ CServerDE::GetObjectDims方法的具体用法?C++ CServerDE::GetObjectDims怎么用?C++ CServerDE::GetObjectDims使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CServerDE
的用法示例。
在下文中一共展示了CServerDE::GetObjectDims方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateBoundingBox
void Trigger::CreateBoundingBox()
{
CServerDE* pServerDE = GetServerDE();
if (!pServerDE) return;
ObjectCreateStruct theStruct;
INIT_OBJECTCREATESTRUCT(theStruct);
DVector vPos;
pServerDE->GetObjectPos(m_hObject, &vPos);
VEC_COPY(theStruct.m_Pos, vPos);
SAFE_STRCPY(theStruct.m_Filename, "Models\\Props\\1x1_square.abc");
// strcpy(theStruct.m_SkinName, "SpecialFX\\smoke.dtx");
theStruct.m_Flags = FLAG_VISIBLE;
HCLASS hClass = pServerDE->GetClass("Model");
LPBASECLASS pModel = pServerDE->CreateObject(hClass, &theStruct);
if (pModel)
{
m_hBoundingBox = pModel->m_hObject;
DVector vDims;
pServerDE->GetObjectDims(m_hObject, &vDims);
DVector vScale;
VEC_DIVSCALAR(vScale, vDims, 0.5f);
pServerDE->ScaleObject(m_hBoundingBox, &vScale);
}
pServerDE->SetObjectColor(m_hBoundingBox, GetRandom(0.5f, 1.0f),
GetRandom(0.5f, 1.0f), GetRandom(0.5f, 1.0f), 1.0f);
}
示例2: FindPosAroundObj
DVector CMovement::FindPosAroundObj(DVector vStart, DVector vDir)
{
CServerDE* pServerDE = BaseClass::GetServerDE();
if (!pServerDE) return vStart;
DVector vDims, vPoint, vColor;
m_nWidthPoints = 10;
//get the parent's dims
pServerDE->GetObjectDims(m_hObject,&vDims);
DFLOAT fDim = (DFLOAT)sqrt((vDims.x * vDims.x) + (vDims.z * vDims.z)) + 0.1f;
VEC_ADDSCALED(vPoint, vStart, vDir, fDim);
while(m_nWidthPoints)
{
if(pServerDE->GetPointShade(&vPoint,&vColor))
{
return vPoint;
}
else
{
VEC_ADDSCALED(vPoint, vPoint, vDir, fDim);
}
m_nWidthPoints--;
}
return vStart;
}
示例3: CreateSurface
void VolumeBrush::CreateSurface()
{
CServerDE* pServerDE = GetServerDE();
if (!pServerDE) return;
ObjectCreateStruct theStruct;
INIT_OBJECTCREATESTRUCT(theStruct);
DVector vPos, vDims, vScale;
VEC_INIT(vScale);
pServerDE->GetObjectDims(m_hObject, &vDims);
pServerDE->GetObjectPos(m_hObject, &vPos);
DRotation rRot;
pServerDE->GetObjectRotation(m_hObject, &rRot);
VEC_COPY(m_vLastPos, vPos);
vPos.y += vDims.y - (m_fSurfaceHeight/2.0f);
VEC_COPY(theStruct.m_Pos, vPos);
ROT_COPY(theStruct.m_Rotation, rRot);
HCLASS hClass = pServerDE->GetClass("PolyGrid");
PolyGrid* pSurface = DNULL;
if (hClass)
{
pSurface = (PolyGrid *)pServerDE->CreateObject(hClass, &theStruct);
}
if (pSurface)
{
m_hSurfaceObj = pSurface->m_hObject;
vDims.y = m_fSurfaceHeight;
DFLOAT fXPan = 1.0f + (m_vCurrent.x * 0.01f);
DFLOAT fYPan = 1.0f + (m_vCurrent.y * 0.01f);
pSurface->Setup(&vDims, &m_vSurfaceColor1, &m_vSurfaceColor2,
m_hstrSurfaceSprite, m_fXScaleMin, m_fXScaleMax,
m_fYScaleMin, m_fYScaleMax, m_fXScaleDuration,
m_fYScaleDuration, fXPan, fYPan, m_fSurfaceAlpha,
m_dwNumSurfacePolies);
// pServerDE->SetObjectColor(m_hSurfaceObj,1.0f,0,0,0.1f);
}
}
示例4: Update
void VolumeBrush::Update()
{
CServerDE* pServerDE = GetServerDE();
if (!pServerDE || m_bHidden) return;
// Only do updates if we have a surface...
if (m_hSurfaceObj)
{
pServerDE->SetNextUpdate(m_hObject, UPDATE_DELTA);
}
else
{
pServerDE->SetNextUpdate(m_hObject, 0.0f);
}
// See if we have moved...
DVector vPos;
pServerDE->GetObjectPos(m_hObject, &vPos);
if (m_hSurfaceObj && !(m_vLastPos.x == vPos.x &&m_vLastPos.y == vPos.y && m_vLastPos.z == vPos.z))
{
VEC_COPY(m_vLastPos, vPos);
// Set the surface to its new position...
DVector vDims;
pServerDE->GetObjectDims(m_hObject, &vDims);
vPos.y += vDims.y - (m_fSurfaceHeight/2.0f);
pServerDE->SetObjectPos(m_hSurfaceObj, &vPos);
}
}
示例5: Update
//.........这里部分代码省略.........
// Need to build a table of Sprites and There Positions...
// Then Update Each position???
//
int x = m_nFireIndex;
{
// Remove everything if we're done.
if (fTime > m_fStartTime[x] + m_fDuration[x])
{
m_fStartTime[x] = pServerDE->GetTime();
if (m_hSprite[x])
{
g_pServerDE->RemoveObject(m_hSprite[x]);
m_hSprite[x] = DNULL;
}
if (m_hSmokeTrail[x])
{
g_pServerDE->RemoveObject(m_hSmokeTrail[x]);
m_hSmokeTrail[x] = DNULL;
}
// Add Flame
VEC_INIT(m_vUp);
VEC_INIT(m_vRight);
VEC_INIT(m_vForward);
if (!m_hLinkObject) return DFALSE;
pServerDE->GetObjectRotation(m_hLinkObject, &rRot);
pServerDE->GetRotationVectors(&rRot, &m_vUp, &m_vRight, &m_vForward);
if (!m_hLinkObject) return DFALSE;
pServerDE->GetObjectDims(m_hLinkObject, &vDims);
pServerDE->GetObjectPos(m_hLinkObject, &vPos);
// Need to use the Dims of the Object to set these!!!
VEC_MULSCALAR(vDims, vDims, 0.8f);
DFLOAT m_fForwardOffset = pServerDE->Random(-vDims.x, vDims.x);
DFLOAT m_fUpOffset = pServerDE->Random(-vDims.y, vDims.y/2.0f);
DFLOAT m_fRightOffset = pServerDE->Random(-vDims.z, vDims.z);
VEC_MULSCALAR(vTemp, m_vForward, m_fForwardOffset);
VEC_ADD(vPos, vPos, vTemp);
// vPos is a point in front of you.
// vDir is a point in front of you, but down
VEC_COPY(vDir, vPos);
vDir.y = vDir.y - m_fUpOffset;
vDir.x = vDir.x - m_fRightOffset;
vDir.z = vDir.z - m_fForwardOffset;
VEC_COPY(vPos, vDir);
ObjectCreateStruct theStruct;
INIT_OBJECTCREATESTRUCT(theStruct);
theStruct.m_Flags = FLAG_VISIBLE;
theStruct.m_ObjectType = OT_SPRITE;
VEC_COPY(theStruct.m_Pos, vPos);
theStruct.m_SkinName[0] = '\0';
theStruct.m_NextUpdate = 0.0f;
_mbscpy((unsigned char*)theStruct.m_Filename, (const unsigned char*)"Sprites\\gibflame.spr");
VEC_COPY(theStruct.m_Scale, m_vScale)
示例6: CalculatePath
DBOOL CMovement::CalculatePath(DVector vDestPos)
{
CServerDE* pServerDE = BaseClass::GetServerDE();
if (!pServerDE) return DFALSE;
DVector vDims, vTest;
DRotation rRot;
//sanity check to make sure vDestPos is valid
VEC_INIT(vTest);
if(VEC_DIST(vTest, vDestPos) <= 0)
return DFALSE;
IntersectQuery IQuery;
IntersectInfo IInfo;
IQuery.m_Flags = INTERSECT_OBJECTS;
IQuery.m_FilterFn = DNULL;
// LARGE_INTEGER start;
// QueryPerformanceCounter(&start);
//clear the path list out
Term();
//get the parent's dims
pServerDE->GetObjectDims(m_hObject,&vDims);
DFLOAT fDim = (DFLOAT)sqrt((vDims.x * vDims.x) + (vDims.z * vDims.z)) + 0.1f;
if(!ClearToPoint(m_vPos, vDestPos,vDims, &IInfo))
{
VEC_ADDSCALED(IInfo.m_Point,IInfo.m_Point, IInfo.m_Plane.m_Normal, fDim - 0.1f)
AddPosToPathList(IInfo.m_Point);
//align a test rotation to the obstacles normal and retrieve the rotation vectors
VEC_MULSCALAR(IInfo.m_Plane.m_Normal, IInfo.m_Plane.m_Normal, -1.0f);
pServerDE->AlignRotation(&rRot, &(IInfo.m_Plane.m_Normal), &m_vUp);
DVector vTurnPoint = FindShortestTurn(IInfo.m_Point, &rRot, fDim);
if(VEC_DIST(vTurnPoint, IInfo.m_Point) <= 0.0f)
return DFALSE;
AddPosToPathList(vTurnPoint);
DVector vU,vR,vF;
pServerDE->GetRotationVectors(&rRot,&vU,&vR,&vF);
vTurnPoint = FindTurn(vTurnPoint, vF, IInfo.m_Plane.m_Normal, fDim, fDim);
if(VEC_DIST(vTurnPoint, vDestPos) <= 0.0f)
return DFALSE;
if(ClearToPoint(vTurnPoint, vDestPos, vDims, &IInfo))
{
AddPosToPathList(vTurnPoint);
AddPosToPathList(vDestPos);
// ConsolidatePath();
}
else
return DFALSE;
}
else
AddPosToPathList(vDestPos);
/* LARGE_INTEGER end;
QueryPerformanceCounter(&end);
pServerDE->DebugOut("Shortest Path Computed: %u ticks\r\n", (unsigned long)(end.QuadPart - start.QuadPart));
*/
return DTRUE;
}