本文整理匯總了C++中GetCenter函數的典型用法代碼示例。如果您正苦於以下問題:C++ GetCenter函數的具體用法?C++ GetCenter怎麽用?C++ GetCenter使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了GetCenter函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。
示例1: GetCenter
//==== Scale Bounding Box ====//
void BndBox::Scale( const vec3d & scale_xyz )
{
vec3d center = GetCenter();
for ( int i = 0 ; i < 3 ; i++ )
{
m_Min[i] = center[i] + ( m_Min[i] - center[i] ) * scale_xyz[i];
m_Max[i] = center[i] + ( m_Max[i] - center[i] ) * scale_xyz[i];
}
}
示例2: GetCenter
SuperPill* GOFactory::CreateSuperPill(Tile* p_tile, GameStats* p_gameStats)
{
fVector3 pos = GetCenter(p_tile, 0.19f);
fVector2 size = GetScaledSize(p_tile, 1.5f);
SpriteInfo* spriteInfo = CreateSpriteInfo("../Textures/Item_SuperCheesy.png",
pos, size, NULL);
return new SuperPill(spriteInfo, p_tile, p_gameStats, CreateSoundInfo("../Sounds/use_power-up.wav",100));
}
示例3: GetCenter
void EBox::MoveRel(float x, float y) {
_x += x;
_y += y;
_center = GetCenter();
for (int i=0; i<_vChilds.size(); i++) {
_vChilds[i]->MoveRel(x,y);
}
}
示例4: GetCenter
void Item::RenderCollisionRegions()
{
for(unsigned int i = 0; i < m_vpBoundingRegionList.size(); i++)
{
BoundingRegion* pRegion = m_vpBoundingRegionList[i];
m_pRenderer->PushMatrix();
m_pRenderer->TranslateWorldMatrix(GetCenter().x, GetCenter().y, GetCenter().z);
Matrix4x4 justParentRotation;
justParentRotation.SetRotation(DegToRad(m_rotation.x), DegToRad(m_rotation.y), DegToRad(m_rotation.z));
m_pRenderer->MultiplyWorldMatrix(justParentRotation);
m_pRenderer->ScaleWorldMatrix(m_renderScale, m_renderScale, m_renderScale);
pRegion->Render(m_pRenderer);
m_pRenderer->PopMatrix();
}
}
示例5: EffectEnemyDead
void Enemy_01_01::OnWipped()
{
Enemy::OnWipped();
if (IsInScreen())
{
gm.AddObject(new EffectEnemyDead(GetCenter()));
dsMgr.playSound(rm.GetSoundBuffer(SOUND_ENEP));
}
}
示例6: GetCenter
void Heroes::Redraw(Surface & dst, bool with_shadow) const
{
const Point & mp = GetCenter();
const Interface::GameArea & gamearea = Interface::Basic::Get().GetGameArea();
s16 dx = gamearea.GetMapsPos().x + TILEWIDTH * (mp.x - gamearea.GetRectMaps().x);
s16 dy = gamearea.GetMapsPos().y + TILEWIDTH * (mp.y - gamearea.GetRectMaps().y);
Redraw(dst, dx, dy, with_shadow);
}
示例7: GetCenter
void TMesh::Rotate(vector axis, float theta) {
vector center = GetCenter();
for (int vi = 0; vi < vertsN; vi++){
//vector d = center - axis;
verts[vi].rotatePoint(center, axis, theta);
normals[vi].rotateVector(axis, theta);
}
SetAABB();
}
示例8: pn
bool AABB::InsideOf(const Plane& n) const{
vec3 h = (Max - Min)*.5f;
vec3 pn(fabs(n.a), fabs(n.b), fabs(n.c));
float e = Dot(h, pn);
float s = Dot(GetCenter(), n) + n.d;
if(s-e > 0) return true;
if(s+e < 0) return false;
return true;
}
示例9: GetCenter
BOOL Bounds::LineIntersection(const Vect &v1, const Vect &v2, float &fT) const
{
float tMax = M_INFINITE;
float tMin = -M_INFINITE;
Vect rayVect = (v2-v1);
float rayLength = rayVect.Len();
Vect rayDir = rayVect*(1.0f/rayLength);
Vect center = GetCenter();
Vect E = Max-center;
Vect T = center-v1;
for(int i=0; i<3; i++)
{
float e = T.ptr[i];
float f = rayDir.ptr[i];
float fI = 1.0f/f;
if(fabs(f) > 0.0f)
{
float t1 = (e+E.ptr[i])*fI;
float t2 = (e-E.ptr[i])*fI;
if(t1 > t2)
{
if(t2 > tMin) tMin = t2;
if(t1 < tMax) tMax = t1;
}
else
{
if(t1 > tMin) tMin = t1;
if(t2 < tMax) tMax = t2;
}
if(tMin > tMax) return FALSE;
if(tMax < 0.0f) return FALSE;
}
else if( ((-e - E.ptr[i]) > 0.0f) ||
((-e + E.ptr[i]) < 0.0f) )
{
return FALSE;
}
if(tMin > rayLength) return FALSE;
}
if(tMin > 0.0f)
{
fT = (tMin/rayLength);
return TRUE;
}
else
{
fT = (tMax/rayLength);
return TRUE;
}
}
示例10: GetCenter
void Heroes::FadeIn(void) const
{
const Point & mp = GetCenter();
const Interface::GameArea & gamearea = Interface::Basic::Get().GetGameArea();
if(!(gamearea.GetRectMaps() & mp)) return;
Display & display = Display::Get();
bool reflect = ReflectSprite(direction);
s32 dx = gamearea.GetMapsPos().x + TILEWIDTH * (mp.x - gamearea.GetRectMaps().x);
s32 dy = gamearea.GetMapsPos().y + TILEWIDTH * (mp.y - gamearea.GetRectMaps().y);
const Sprite & sprite1 = SpriteHero(*this, sprite_index, reflect, false);
Point dst_pt1(dx + (reflect ? TILEWIDTH - sprite1.x() - sprite1.w() : sprite1.x()), dy + sprite1.y() + TILEWIDTH);
const Rect src_rt = gamearea.RectFixed(dst_pt1, sprite1.w(), sprite1.h());
LocalEvent & le = LocalEvent::Get();
int alpha = 0;
while(le.HandleEvents() && alpha < 250)
{
if(Game::AnimateInfrequentDelay(Game::HEROES_FADE_DELAY))
{
Cursor::Get().Hide();
for(s32 y = mp.y - 1; y <= mp.y + 1; ++y)
for(s32 x = mp.x - 1; x <= mp.x + 1; ++x)
if(Maps::isValidAbsPoint(x, y))
{
const Maps::Tiles & tile = world.GetTiles(Maps::GetIndexFromAbsPoint(x, y));
tile.RedrawTile(display);
tile.RedrawBottom(display);
tile.RedrawObjects(display);
}
sprite1.Blit(alpha, src_rt, dst_pt1, display);
for(s32 y = mp.y - 1; y <= mp.y + 1; ++y)
for(s32 x = mp.x - 1; x <= mp.x + 1; ++x)
if(Maps::isValidAbsPoint(x, y))
{
const Maps::Tiles & tile = world.GetTiles(Maps::GetIndexFromAbsPoint(x, y));
tile.RedrawTop(display);
}
Cursor::Get().Show();
display.Flip();
alpha += 10;
}
}
}
示例11: SetSphere
VOID Bound::Merge( const Bound& Other )
{
Sphere OtherSphere;
OtherSphere.Center = Other.GetCenter();
OtherSphere.Radius = Other.GetMaxRadius();
if( m_Type == Bound::No_Bound )
{
SetSphere( OtherSphere );
return;
}
Sphere ThisSphere;
if( m_Type != Bound::Sphere_Bound )
{
// convert this bound into a sphere
ThisSphere.Center = GetCenter();
ThisSphere.Radius = GetMaxRadius();
}
else
{
ThisSphere = GetSphere();
}
XMVECTOR vThisCenter = XMLoadFloat3( &ThisSphere.Center );
XMVECTOR vOtherCenter = XMLoadFloat3( &OtherSphere.Center );
XMVECTOR vThisToOther = XMVectorSubtract( vOtherCenter, vThisCenter );
XMVECTOR vDistance = XMVector3LengthEst( vThisToOther );
FLOAT fCombinedDiameter = XMVectorGetX( vDistance ) + ThisSphere.Radius + OtherSphere.Radius;
if( fCombinedDiameter <= ( ThisSphere.Radius * 2 ) )
{
SetSphere( ThisSphere );
return;
}
if( fCombinedDiameter <= ( OtherSphere.Radius * 2 ) )
{
SetSphere( OtherSphere );
return;
}
XMVECTOR vDirectionNorm = XMVector3Normalize( vThisToOther );
XMVECTOR vRadius = XMVectorSet( ThisSphere.Radius, OtherSphere.Radius, 0, 0 );
XMVECTOR vThisRadius = XMVectorSplatX( vRadius );
XMVECTOR vOtherRadius = XMVectorSplatY( vRadius );
XMVECTOR vCombinedDiameter = vThisRadius + vDistance + vOtherRadius;
XMVECTOR vMaxDiameter = XMVectorMax( vCombinedDiameter, vThisRadius * 2 );
vMaxDiameter = XMVectorMax( vMaxDiameter, vOtherRadius * 2 );
XMVECTOR vMaxRadius = vMaxDiameter * 0.5f;
ThisSphere.Radius = XMVectorGetX( vMaxRadius );
vMaxRadius -= vThisRadius;
XMVECTOR vCombinedCenter = vThisCenter + vMaxRadius * vDirectionNorm;
XMStoreFloat3( &ThisSphere.Center, vCombinedCenter );
SetSphere( ThisSphere );
}
示例12: MSG_DEBUG
void ObjMine::Detection()
{
uint current_time = GameTime::GetInstance()->ReadSec();
if (escape_time == 0) {
escape_time = current_time + static_cast<MineConfig&>(cfg).escape_time;
MSG_DEBUG("mine", "Initialize escape_time : %d", current_time);
return;
}
if (current_time < escape_time || animation)
return;
//MSG_DEBUG("mine", "Escape_time is finished : %d", current_time);
Double tmp = PIXEL_PER_METER*static_cast<MineConfig&>(cfg).detection_range;
int detection_range = tmp*tmp;
FOR_ALL_LIVING_CHARACTERS(team, character) {
if (GetCenter().SquareDistance(character->GetCenter()) < detection_range) {
Weapon::Message(Format(_("%s is next to a mine!"), character->GetName().c_str()));
StartTimeout();
return;
}
}
Double speed_detection = static_cast<MineConfig&>(cfg).speed_detection;
Double norm, angle;
FOR_EACH_OBJECT(it) {
PhysicalObj *obj = *it;
if (obj != this && GetName() != obj->GetName() &&
GetCenter().SquareDistance(obj->GetCenter()) < detection_range) {
obj->GetSpeed(norm, angle);
if (norm < speed_detection && norm > ZERO) {
MSG_DEBUG("mine", "norm: %s, speed_detection: %s",
Double2str(norm).c_str(), Double2str(speed_detection).c_str());
StartTimeout();
return;
}
}
}
}
示例13: GetCenter
bool Ellipsoid::InEllipsoid(const NX::vector<float, 3> &point) const{
const NX::vector<float, 3> v = point - GetCenter();
const float lx = NX::Dot(v, GetAxisX());
const float ly = NX::Dot(v, GetAxisY());
const float lz = NX::Dot(v, GetAxisZ());
const float dx = lx / m_fSemiAxisX;
const float dy = ly / m_fSemiAxisY;
const float dz = lz / m_fSemiAxisZ;
return dx * dx + dy * dy + dz * dz <= kf1;
}
示例14: CEffect
int CPlayer::Damage()
{
g_pResource->sndDamage.Play(0);
if(g_pConfig->effect)
{
g_effect.Add(new CEffect(&g_pResource->imgExplode1,GetCenter(),1,150));
g_effect.Add(new CEffect(&g_pResource->imgSmoke1,GetCenter(),2,140));
}
else
{
g_effect.Add(new CEffect(&g_pResource->imgExplode1,GetCenter(),0,150));
}
m_zanki--;
m_anmtime = 0;
m_state = 2;
if(m_zanki<0)
return 0;
return 1;
}
示例15: GetCenter
//@cmember Set control window to foreground
HRESULT tomEdit::TxSetForegroundWindow()
{
HWND host = GetCenter()->GetHost() ;
if (!SetForegroundWindow(host))
{
::SetFocus(host);
}
return S_OK ;
}