当前位置: 首页>>代码示例>>C++>>正文


C++ GetCenter函数代码示例

本文整理汇总了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];
    }
}
开发者ID:sanbales,项目名称:OpenVSP,代码行数:10,代码来源:BndBox.cpp

示例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));
}
开发者ID:MattiasLiljeson,项目名称:denLilleOstPojken,代码行数:9,代码来源:GOFactory.cpp

示例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);
	}
}
开发者ID:CortlandNation9,项目名称:Gamecodeur,代码行数:9,代码来源:EBox.cpp

示例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();
	}
}
开发者ID:AlwaysGeeky,项目名称:Vox,代码行数:18,代码来源:Item.cpp

示例5: EffectEnemyDead

void	Enemy_01_01::OnWipped()
{
	Enemy::OnWipped();
	if (IsInScreen())
	{
		gm.AddObject(new EffectEnemyDead(GetCenter()));
		dsMgr.playSound(rm.GetSoundBuffer(SOUND_ENEP));
	}
}
开发者ID:frosttear,项目名称:Th06Imitation,代码行数:9,代码来源:Stage1Enemy.cpp

示例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);
}
开发者ID:mastermind-,项目名称:free-heroes,代码行数:9,代码来源:heroes_move.cpp

示例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();
}
开发者ID:Sylast,项目名称:Graphics,代码行数:9,代码来源:tmesh.cpp

示例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;
}
开发者ID:LazyNarwhal,项目名称:Destination_Toolkit,代码行数:9,代码来源:AABB.cpp

示例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; 
    }
}
开发者ID:373137461,项目名称:OBS,代码行数:56,代码来源:XMath.cpp

示例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;
        }
    }
}
开发者ID:mastermind-,项目名称:free-heroes,代码行数:56,代码来源:heroes_move.cpp

示例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 );
}
开发者ID:CodeAsm,项目名称:ffplay360,代码行数:56,代码来源:AtgBound.cpp

示例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;
      }
    }
  }
}
开发者ID:Arnaud474,项目名称:Warmux,代码行数:43,代码来源:mine.cpp

示例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;
 }
开发者ID:MandyMo,项目名称:NXEngine,代码行数:10,代码来源:NXEllipsoid.cpp

示例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;
}
开发者ID:yohokuno,项目名称:suzuri,代码行数:19,代码来源:Player.cpp

示例15: GetCenter

//@cmember Set control window to foreground
HRESULT tomEdit::TxSetForegroundWindow() 
{
    HWND host = GetCenter()->GetHost() ;
    if (!SetForegroundWindow(host))
    {
        ::SetFocus(host);
    }

    return S_OK ;
}
开发者ID:baogechen,项目名称:foundit,代码行数:11,代码来源:tomEdit.cpp


注:本文中的GetCenter函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。