• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetCenter函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetCenter函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCenter函数的具体用法?C++ GetCenter怎么用?C++ GetCenter使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了GetCenter函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: mapToScene

/**
*Handles the mouse move event
*/
void MyGraphicsView::mouseMoveEvent(QMouseEvent* event) {
    if(!LastPanPoint.isNull()) {
        //Get how much we panned
        QPointF delta = mapToScene(LastPanPoint) - mapToScene(event->pos());
        LastPanPoint = event->pos();

        //Update the center ie. do the pan
        SetCenter(GetCenter() + delta);
    }
}
开发者ID:quimnuss,项目名称:superannotator,代码行数:13,代码来源:mygraphicsview.cpp


示例17: GetCenter

void TMesh::ScaleToNewDiagonal(float newDiagonal) {

    float oldDiagonal = (aabb->corners[1] - aabb->corners[0]).length();
    float sf = newDiagonal / oldDiagonal;
    V3 oldCenter = GetCenter();
    Position(V3(0.0f, 0.0f, 0.0f));
    Scale(sf);
    Position(oldCenter);
    SetAABB();
}
开发者ID:lazopard,项目名称:The-Engine,代码行数:10,代码来源:tmesh.cpp


示例18: AlignedB

bool OrientedBoxShape::Contains(const sf::Vector2f& Point)const
{
	AlignedBoxShape AlignedB(sf::Vector2f(0.0f, 0.0f), sf::Vector2f(GetHalfExtents().x * 2.0f, GetHalfExtents().y * 2.0f));

	sf::Vector2f RotatedPoint = Point - GetCenter();
	RotatedPoint = MathUtils::RotateVector(RotatedPoint, - GetRotation());
	RotatedPoint = RotatedPoint + GetHalfExtents();

	return AlignedB.Contains(RotatedPoint);
}
开发者ID:Soth1985,项目名称:Survive,代码行数:10,代码来源:oriented_box_shape.cpp


示例19: GetCenter

void AABB::GetVertices(FloatDataAccessor & accessor) const
{
	Eigen::Vector3f vertices[8];
	vertices[0] = GetCenter();
	vertices[0][0] += GetExtent(0);
	vertices[0][1] += GetExtent(1);
	vertices[0][2] += GetExtent(2);

	vertices[1] = GetCenter();
	vertices[1][0] -= GetExtent(0);
	vertices[1][1] += GetExtent(1);
	vertices[1][2] += GetExtent(2);

	vertices[2] = GetCenter();
	vertices[2][0] -= GetExtent(0);
	vertices[2][1] -= GetExtent(1);
	vertices[2][2] += GetExtent(2);

	vertices[3] = GetCenter();
	vertices[3][0] += GetExtent(0);
	vertices[3][1] -= GetExtent(1);
	vertices[3][2] += GetExtent(2);

	vertices[4] = GetCenter();
	vertices[4][0] += GetExtent(0);
	vertices[4][1] += GetExtent(1);
	vertices[4][2] -= GetExtent(2);

	vertices[5] = GetCenter();
	vertices[5][0] += GetExtent(0);
	vertices[5][1] -= GetExtent(1);
	vertices[5][2] -= GetExtent(2);

	vertices[6] = GetCenter();
	vertices[6][0] -= GetExtent(0);
	vertices[6][1] -= GetExtent(1);
	vertices[6][2] -= GetExtent(2);

	vertices[7] = GetCenter();
	vertices[7][0] -= GetExtent(0);
	vertices[7][1] += GetExtent(1);
	vertices[7][2] -= GetExtent(2);

	VEC3(accessor[0]) = vertices[0];
	VEC3(accessor[1]) = vertices[1];
	VEC3(accessor[2]) = vertices[2];
	VEC3(accessor[3]) = vertices[3];
	VEC3(accessor[4]) = vertices[4];
	VEC3(accessor[5]) = vertices[5];
	VEC3(accessor[6]) = vertices[6];
	VEC3(accessor[7]) = vertices[7];
}
开发者ID:Akranar,项目名称:daguerreo,代码行数:52,代码来源:AABB.cpp


示例20: GetGameClass

CPlanet::CPlanet()
{
	spriteType_ = PLANET;
	
	/* Imageresourcen manager */
	CImageResource* imageResource = GetGameClass()->GetImgResource();
	
	/* load pictures */
	backgroundStatic_ = new sf::Sprite ( *imageResource->Get ( "images/planet/002.png" ) );

	this->SetCenter ( backgroundStatic_->GetSize().x * 0.5, backgroundStatic_->GetSize().y * 0.5 );
	backgroundStatic_->SetCenter ( GetCenter() );
	
	shadow_ = new sf::Sprite ( *imageResource->Get ( "images/planet/shadow.png" ) );
	shadow_->SetCenter ( GetCenter() );
	
	cloud1_ = new sf::Sprite ( *imageResource->Get ( "images/planet/clouds_001.png" ) );
	cloud1_->SetCenter ( GetCenter() );
	
	cloud2_ = new sf::Sprite ( *imageResource->Get ( "images/planet/clouds_002.png" ) );
	cloud2_->SetCenter ( GetCenter() );
	
	atmosphere_ = new sf::Sprite ( *imageResource->Get ( "images/planet/atmosphere_001.png" ) );
	atmosphere_->SetCenter ( GetCenter() );
	
	/* Set color of planet TODO EXAMPLE DATA! */
	planetColor_ = sf::Color ( 160, 220, 255, 255 );
	
	backgroundStatic_->SetColor ( planetColor_ );
	atmosphere_->SetColor ( planetColor_ );
	
	/* Add to graphic list */
	graphics_.Add ( backgroundStatic_ );
	graphics_.Add ( atmosphere_ );
	graphics_.Add ( cloud1_ );
	graphics_.Add ( cloud2_ );
	graphics_.Add ( shadow_ );
	
	/* Set properties */
	this->SetZoomFactor( 0.1 );
	this->SetZoomLevel ( 0.2 );
}
开发者ID:jfreax,项目名称:Ufs,代码行数:42,代码来源:planet.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetChanceAgainst函数代码示例发布时间:2022-05-30
下一篇:
C++ GetCell函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap