Beispiel #1
0
ViewportRegion ViewportInfo::get_viewport_for(const Pos &pos) const {
  // This simulates the code in Ui::viewport_to_loc on UNIX and
  // Ui::viewport_to_pos on Windows.

  // Windows
  if (smoothScroll) {
    Pos vPos = pos - 0.5f * logicalSize;
    Area visible(AR_RECT,vPos,logicalSize);    
    ViewportRegion ret(pos,radius,visible);
    return ret;
  }
  // UNIX
  else {
    Pos vPos((pos.x / logicalSize.width) * logicalSize.width 
             - extraSize.width,
             (pos.y / logicalSize.height) * logicalSize.height 
             - extraSize.height);
    Size vSize;
    vSize.set(logicalSize.width + 2 * extraSize.width,
              logicalSize.height + 2 * extraSize.height);
    
    Area visible(AR_RECT,vPos,vSize);
    ViewportRegion ret(pos,radius,visible);
    return ret;
  }
}
HRESULT KG3DAnimationTagContainer::FrameMove(IKG3DAnimationController* pController)
{
    HRESULT hr = E_FAIL;
    KG_PROCESS_ERROR(pController);

	if (g_bClient)
	{
		KG_PROCESS_ERROR(m_pClip && m_pClip->IsLoad());
	}

    KG3DAnimationController* p3dController = static_cast<KG3DAnimationController*>(pController);
    for (size_t i = 0; i < m_vecTags.size(); i++)
    {
        assert(m_vecTags[i].pTag);
		D3DXVECTOR3 vPos(.0f, 0.f, 0.f);
		D3DXVECTOR3 *pvPos = &vPos;
		KG3DModel *pModel = static_cast<KG3DModel*>(pController->GetModel());
		if (pModel)
		{
			vPos.x = pModel->m_matWorld._41;
			vPos.y = pModel->m_matWorld._42;
			vPos.z = pModel->m_matWorld._43;
			vPos /= 100.0f;
			pvPos = &vPos;
		}
        m_vecTags[i].pTag->Apply(p3dController, pvPos);
    }
    hr = S_OK;
Exit0:
    return hr;
}
cNumericalPanel::cNumericalPanel(cInit *apInit)  : iUpdateable("NumericalPanel")
{
	mpInit = apInit;
	mpDrawer = mpInit->mpGame->GetGraphics()->GetDrawer();

	//Load graphics (use notebook background for now).
	mpGfxBackground = mpDrawer->CreateGfxObject("notebook_background.bmp","diffalpha2d");

	mpGfxPanel = mpDrawer->CreateGfxObject("numpanel_panel.bmp","diffalpha2d");
	
	cVector2f vPos(307, 205);

	for(int i=1; i<=12; ++i)
	{
		int lNum = i;
		if(i==10) lNum=-1;
		else if(i==11)lNum=0;
		else if(i==12) lNum=-2;

		mlstButtons.push_back(hplNew( cNumericalButton, (mpInit,this,vPos,cVector2f(62,30),lNum)) );
        
		if(i%3 ==0)
		{
			vPos.y += (30 + 16);
			vPos.x = 307;
		}
		else
		{
			vPos.x += 62 + 16;
		}
	}

	Reset();
}
Beispiel #4
0
void MAP::LoadObjectEvent(HANDLE hFile)
{
	int 	iEventObjectCount = 0, zonenum = 0;
	__Vector3 vPos(0,0,0);
	DWORD	dwNum;
	_OBJECT_EVENT* pEvent = NULL;

	ReadFile(hFile, &iEventObjectCount, 4, &dwNum, NULL);
	for( int i=0; i<iEventObjectCount; i++)
	{
		pEvent = new _OBJECT_EVENT;
		ReadFile(hFile, &(pEvent->sBelong), 4, &dwNum, NULL);					// 소속 
		ReadFile(hFile, &(pEvent->sIndex), 2, &dwNum, NULL);				// Event Index
		ReadFile(hFile, &(pEvent->sType), 2, &dwNum, NULL);
		ReadFile(hFile, &(pEvent->sControlNpcID), 2, &dwNum, NULL);
		ReadFile(hFile, &(pEvent->sStatus), 2, &dwNum, NULL);
		ReadFile(hFile, &(pEvent->fPosX), 4, &dwNum, NULL);
		ReadFile(hFile, &(pEvent->fPosY), 4, &dwNum, NULL);
		ReadFile(hFile, &(pEvent->fPosZ), 4, &dwNum, NULL);

		// 작업할것 : 맵데이터가 바뀌면 Param1이 2이면 성문인것을 판단..  3이면 레버..
		if( pEvent->sType == 1 || pEvent->sType == 2 || pEvent->sType == 3) {
			// sungyong test
			m_pMain->AddObjectEventNpc(pEvent, m_nZoneNumber);
		}	

		if( pEvent->sIndex <= 0 ) continue;
		if( !m_ObjectEventArray.PutData(pEvent->sIndex, pEvent) ) {
			TRACE("Object Event PutData Fail - %d\n", pEvent->sIndex );
			delete pEvent;
			pEvent = NULL;
		}
	}
}
//---------------------------------------------------------------------------
void TBuilder_Model_Ogre::SetLocation_Shape(TShapeNode_Model* pNode)
{
  TNodeLocation_Model* pNodeLocation = mPatternModel->mMngNodeLocation.Get(pNode->namePart);

  // позиционирование
  // каждый вариант части будет виден в PostBuild
  pNode->mPtrEntity->setVisible(true);

  Ogre::Vector3 vPos(pNodeLocation->mGlobal.mPos.x,
    pNodeLocation->mGlobal.mPos.y, pNodeLocation->mGlobal.mPos.z);
  pNode->mPtrEntity->getParentSceneNode()->setPosition(vPos);
  pNode->mPtrEntity->setCastShadows(true);

  nsMathTools::TQuaternion q;
  SetMatrixToQuaternion(&(pNodeLocation->mGlobal.mOrient), &q);
  pNode->mPtrEntity->getParentSceneNode()->setOrientation(q.w, q.x, q.y, q.z);

  // соединить части через крючки через constraint
  int cntPart = mPatternModel->mHierarchy.GetCountChild(pNode->namePart);
  for( int iPart = 0 ; iPart < cntPart ; iPart++ )
  {
    TShapeNode_Model* pNodeChild = 
      (TShapeNode_Model*)mPatternModel->mHierarchy.GetChild(pNode->namePart,iPart);
    if( pNodeChild==NULL )
      continue;
    SetLocation_Shape(pNodeChild);
  }
}
Beispiel #6
0
int CScriptBind_Action::SetViewCamera(IFunctionHandler *pH)
{

	// save previous valid view
	IView *pView=m_pCryAction->GetIViewSystem()->GetActiveView();
	if (pView)
		m_pPreviousView=pView;

	// override view with our camera settings.
	pView=NULL;
	m_pCryAction->GetIViewSystem()->SetActiveView(pView);

	Vec3 vPos(0,0,0);
	Vec3 vDir(0,0,0);

	pH->GetParam(1, vPos);
	pH->GetParam(2, vDir);

	CCamera camera(GetISystem()->GetViewCamera());
	float	fRoll(camera.GetAngles().y);

	camera.SetMatrix(CCamera::CreateOrientationYPR(CCamera::CreateAnglesYPR(vDir, fRoll)));
	camera.SetPosition(vPos);
	GetISystem()->SetViewCamera(camera);

	return pH->EndFunction();
}
void VerletStick::constrainLen() {
    for (int i=0; i<constrainLoopCount; i++) {
        Vector3df delta = Vector3df(b2->getPos().x-b1->getPos().x, 
                                    b2->getPos().y-b1->getPos().y, 
                                    b2->getPos().z-b1->getPos().z);
        
        float deltaLength = delta.mag();
        float difference = ((deltaLength - len) / deltaLength);
        
        // nudge positiviely
        Vector3df vPos(delta.x * (constrainVal.elem0 * tension * difference),
                       delta.y * (constrainVal.elem0 * tension * difference),
                       delta.z * (constrainVal.elem0 * tension * difference) );
        b1->addPos(vPos);
        
        // nudge negatively
        Vector3df vNeg(delta.x * (constrainVal.elem1 * tension * difference),
                       delta.y * (constrainVal.elem1 * tension * difference),
                       delta.z * (constrainVal.elem1 * tension * difference) );
        b2->subPos(vNeg);
        
        
        /*std::cout << "b1.getPos() = " << b1.getPos() << std::endl;
         std::cout << "vNeg = " << vNeg << std::endl;
         std::cout << "deltaLength = " << deltaLength << std::endl;
         std::cout << "difference = " << difference << std::endl;*/
        
    }
}
//===================================================================================================>
//
bool TiledBackground::draw ( IDXSPRITE spriteobj, const RECT* dstRect )
{

   //todo sas - not quite right, just yet.  This should NOT stretch to the dstSurface's full size
   //           so... if dstRect isn't given... fool it into drawing in same aspect as srcSurface
   
   Rect srcRect( 0, 0, myTiledBgTexture.width(), myTiledBgTexture.height() );

   if (dstRect == NULL) 
      dstRect = &srcRect;

   Rect dRect = *dstRect;

   //todo: this isn't right.  limit to min's.
   dRect.bottom = min( dRect.bottom, srcRect.bottom );
   dRect.right  = min( dRect.right, srcRect.right);


   //HRESULT hr = myDevice->StretchRect( myTiledBgSurface, NULL, dstSurface, &dRect, D3DTEXF_NONE );
   //HRESULT hr = spriteobj->Draw( myTiledBgTexture, NULL, NULL );
   
   
   
   //TODO: Need to change locations
   D3DXVECTOR3 vPos( 0, 0, 0 );
   HRESULT hr = myTiledBgTexture.drawStretch( spriteobj, &srcRect, &dRect );
   
   //drawMySpriteMap( spriteobj );

   return SUCCEEDED( hr );  //TODO
}
bool VsJoint::Physics_CalculateLocalPosForWorldPos(float fltWorldX, float fltWorldY, float fltWorldZ, CStdFPoint &vLocalPos)
{
	VsMovableItem *lpParent = m_lpThisVsMI->VsParent();

	if(lpParent && m_lpVsChild)
	{
		fltWorldX *= m_lpThisAB->GetSimulator()->InverseDistanceUnits();
		fltWorldY *= m_lpThisAB->GetSimulator()->InverseDistanceUnits();
		fltWorldZ *= m_lpThisAB->GetSimulator()->InverseDistanceUnits();

		CStdFPoint vPos(fltWorldX, fltWorldY, fltWorldZ), vRot(0, 0, 0);
		osg::Matrix osgWorldPos = SetupMatrix(vPos, vRot);

		//Get the parent object.
		osg::Matrix osgInverse = osg::Matrix::inverse(m_lpVsChild->GetWorldMatrix());

		osg::Matrix osgCalc = osgWorldPos * osgInverse;

		osg::Vec3 vCoord = osgCalc.getTrans();
		vLocalPos.Set(vCoord[0] * m_lpThisAB->GetSimulator()->DistanceUnits(), 
				      vCoord[1] * m_lpThisAB->GetSimulator()->DistanceUnits(), 
				      vCoord[2] * m_lpThisAB->GetSimulator()->DistanceUnits());
		
		return true;
	}

	return false;
}
/**
\brief	Creates the default ball graphics.

\author	dcofer
\date	4/15/2011
**/
void VsJoint::CreateJointGraphics()
{
	//Create the cylinder for the hinge
	m_osgDefaultBall = CreateSphereGeometry(15, 15, m_lpThisJoint->Size());
	osg::ref_ptr<osg::Geode> osgBall = new osg::Geode;
	osgBall->addDrawable(m_osgDefaultBall.get());

	CStdFPoint vPos(0, 0, 0), vRot(VX_PI/2, 0, 0); 
	m_osgDefaultBallMT = new osg::MatrixTransform();
	m_osgDefaultBallMT->setMatrix(SetupMatrix(vPos, vRot));
	m_osgDefaultBallMT->addChild(osgBall.get());

	//create a material to use with the pos flap
	if(!m_osgDefaultBallMat.valid())
		m_osgDefaultBallMat = new osg::Material();		

	//create a stateset for this node
	m_osgDefaultBallSS = m_osgDefaultBallMT->getOrCreateStateSet();

	//set the diffuse property of this node to the color of this body	
	m_osgDefaultBallMat->setAmbient(osg::Material::FRONT_AND_BACK, osg::Vec4(0.1, 0.1, 0.1, 1));
	m_osgDefaultBallMat->setDiffuse(osg::Material::FRONT_AND_BACK, osg::Vec4(1, 0.25, 1, 1));
	m_osgDefaultBallMat->setSpecular(osg::Material::FRONT_AND_BACK, osg::Vec4(0.25, 0.25, 0.25, 1));
	m_osgDefaultBallMat->setShininess(osg::Material::FRONT_AND_BACK, 64);
	m_osgDefaultBallSS->setMode(GL_BLEND, osg::StateAttribute::OVERRIDE | osg::StateAttribute::ON); 

	//apply the material
	m_osgDefaultBallSS->setAttribute(m_osgDefaultBallMat.get(), osg::StateAttribute::ON);

	m_osgJointMT->addChild(m_osgDefaultBallMT.get());
}
Beispiel #11
0
bool wxStaticBox::Create( wxWindow*       pParent,
                          wxWindowID      vId,
                          const wxString& rsLabel,
                          const wxPoint&  rPos,
                          const wxSize&   rSize,
                          long            lStyle,
                          const wxString& rsName )
{
    if(!CreateControl( pParent
                      ,vId
                      ,rPos
                      ,rSize
                      ,lStyle
                      ,wxDefaultValidator
                      ,rsName
                     ))
    {
        return false;
    }

    wxPoint  vPos(0,0);
    wxSize   vSize(0,0);

    if (!OS2CreateControl( wxT("STATIC")
                          ,SS_GROUPBOX
                          ,vPos
                          ,vSize
                          ,rsLabel
                         ))
    {
        return false;
    }

    //
    // To be transparent we should have the same colour as the parent as well
    //
    SetBackgroundColour(GetParent()->GetBackgroundColour());

    LONG lColor = (LONG)wxBLACK->GetPixel();
    ::WinSetPresParam( m_hWnd
                      ,PP_FOREGROUNDCOLOR
                      ,sizeof(LONG)
                      ,(PVOID)&lColor
                     );

    lColor = (LONG)m_backgroundColour.GetPixel();
    ::WinSetPresParam( m_hWnd
                      ,PP_BACKGROUNDCOLOR
                      ,sizeof(LONG)
                      ,(PVOID)&lColor
                     );
    SetSize( rPos.x
            ,rPos.y
            ,rSize.x
            ,rSize.y
           );
    return true;
} // end of wxStaticBox::Create
Beispiel #12
0
//============================================================================
//処理
//============================================================================
void CEffectSword::Exec()
{
	sp<CGameObject> spObj = CCommonObject::GetResMgr()->FindObject( "Player" );
	
	Math::Vector2D vPos( 0, 0 );
	
	const int SLASH_NUM = 2;
	
	Math::Vector2D vAddPos[SLASH_NUM] =
	{
		Math::Vector2D( -5, -32 ),
		Math::Vector2D( 0, -28 ),
		//Math::Vector2D( -4, -32 ),
	};
	
	
	if( spObj != NULL )
	{
		vPos = spObj->GetPos() + vAddPos[ ( m_HitCount + 1 ) %SLASH_NUM];
	}
	
	else
	{
		vPos = Math::Vector2D( 0, 0 );	
	}
	
	m_vPos = vPos;
	
	if( ++m_ExistCount > 2 )
	{	
		m_AnimCount++;	
		m_ExistCount = 0;
	}
		
	m_Anim.x = m_AnimCount % m_DivNum.x;
	
	m_Anim.y = ( m_HitCount + 1 ) % (m_DivNum.y - 1);
	
	if( m_Anim.x == m_DivNum.x - 1 )
	{
		m_eState = STATE_DIED;	
	}
	
	m_DstRect.Set( m_vPos.x, m_vPos.y, m_fSize.x, m_fSize.y );
	
	m_SrcRect.Set( m_Anim.x * m_fSize.x, m_Anim.y * m_fSize.y, m_fSize.x, m_fSize.y );
	
	m_Color.r = 255;
	m_Color.g = 0;

	//描画
	CSprite::DrawRequest();
	
	//状態毎の処理
	StateExec();
	
}
Beispiel #13
0
void XOrderDialog::OnCreate()
{
	// 대화창 UI를 생성한다.
	// 좌표보존 옵션이면 이 좌표를 백업받는다.
	XE::VEC2 vPos( 0, 43 );
		vPos.x = m_spProp->m_vPos.x;
		vPos.y = m_spProp->m_vPos.y;
	if( m_spProp->m_bSavePos ) {
		// 좌표보존옵션일때 좌표를 백업받는다.
		s_vSavePos = vPos;
	} else {
		// 보존된 좌표가 있으면 그것을 쓴다.
		if( !s_vSavePos.IsMinus() )
			vPos = s_vSavePos;
	}
	// 대화창 생성
	{
		if( vPos.y == -1.f )
			vPos.y = 43;
		auto pPropHero = PROP_HERO->GetpProp( m_spProp->m_strTalker );
		XSPHero pHero = nullptr;
		if( XASSERT( pPropHero ) ) {
			// 영웅얼굴을 그리기위해 현재씬에 영웅객체를 요구한다.
			pHero = GAME->GetpScene()->GetpHero( pPropHero->idProp );
// 			_tstring szRes = XE::MakePath( DIR_IMG, pPropHero->strFace );
// 			pWnd->SetstrFaceRes( szRes );
			// 대화창이 시작될때 씬에 이벤트 날림.
		}
		// dialog.으로 시작하는 윈도우 모두 삭제,.
		for( int i = 0; i < 10; ++i ) {
			auto pWndPrev = GAME->FindWithPrefix( "__dialog." );		// 이 접두사로 시작하는 윈도우를 찾음.
			if( pWndPrev ) {
				pWndPrev->SetbDestroy( true );
				// 더이상 안나올때까지 반복.
			} else {
				break;
			}
		}
		auto pWnd = new XWndOrderDialog( GetThis(), vPos, pPropHero->idProp, pHero );
		pWnd->SetstrIdentifierf( "__dialog.%s.%d", GetpSeq()->GetspProp()->m_strIdentifier.c_str(), GetidxOrder() );
		m_idsWnd = pWnd->GetstrIdentifier();
		auto strText = m_spProp->GetstrText();
		XGAME::sReplaceToken( strText, _T( "#nick#" ), ACCOUNT->GetstrName() );
		TCHAR szBuff[ 1024 ];
		XE::ConvertJosaStr( szBuff, strText );
		pWnd->SetstrText( szBuff );
		if( m_spProp->m_typeEnd == xFIN_TOUCH ) {
			pWnd->SetbTouch( true );
		}
		GAME->GetpRootSeq()->Add( pWnd );
		// x좌표가 지정되지 않았을때 자동정렬한다.
		if( vPos.x == -1.f )
			pWnd->AutoLayoutHCenter();
		GAME->GetpScene()->OnCreateOrderDialog( pPropHero->idProp );
	}
}
Beispiel #14
0
Vec3D CFocusNode::getCenterPos()
{
	Vec3D vPos(0.0f,0.0f,0.0f);
	FOR_IN(LIST_RENDER_NODE,it,m_mapChildObj)
	{
		vPos+=(*it)->getPos();
	}
	vPos/=(float)m_mapChildObj.size();
	return vPos;
}
Beispiel #15
0
/**
* CAIGroup::calculateAvgPos
* @date Modified May 11, 2006
*/
void CAIGroup::calculateAvgPos(void)
{
	std::list<CEnemy*>::iterator oEnemyIter = m_loEnemies.begin();
	D3DXVECTOR3 vPos(0.0f, 0.0f, 0.0f);
	while (oEnemyIter != m_loEnemies.end())
	{
		vPos += ((CEnemy*)(*oEnemyIter))->getBV().centerPt;
		oEnemyIter++;
	}

	D3DXVec3Scale(&m_vAvgPos, &vPos, (1.0f / (float)m_loEnemies.size()));
}
Beispiel #16
0
void Mesh::InitMesh(unsigned int Index, const aiMesh* paiMesh)
{
    m_Entries[Index].MaterialIndex = paiMesh->mMaterialIndex;

    std::vector<Vertex> Vertices;
    std::vector<unsigned int> Indices;

    Vector bbox_min(0, 0, 0), bbox_max(0, 0, 0);

    const aiVector3D Zero3D(0.0f, 0.0f, 0.0f);

    for (unsigned int i = 0 ; i < paiMesh->mNumVertices ; i++) {
        const aiVector3D* pPos      = &(paiMesh->mVertices[i]);
        const aiVector3D* pNormal   = &(paiMesh->mNormals[i]);
        Vector vPos(pPos->x, pPos->y, pPos->z);

        if (vPos.x < bbox_min.x)
            bbox_min.x = vPos.x;

        if (vPos.y < bbox_min.y)
            bbox_min.y = vPos.y;

        if (vPos.z < bbox_min.z)
            bbox_min.z = vPos.z;

        if (vPos.x > bbox_max.x)
            bbox_max.x = vPos.x;

        if (vPos.y > bbox_max.y)
            bbox_max.y = vPos.y;

        if (vPos.z > bbox_max.z)
            bbox_max.z = vPos.z;

        Vertex v(vPos,
                 Vector(pNormal->x, pNormal->y, pNormal->z));

        Vertices.push_back(v);
    }

    m_BBox = bbox_max - bbox_min;

    for (unsigned int i = 0 ; i < paiMesh->mNumFaces ; i++) {
        const aiFace& Face = paiMesh->mFaces[i];
        assert(Face.mNumIndices == 3);
        Indices.push_back(Face.mIndices[0]);
        Indices.push_back(Face.mIndices[1]);
        Indices.push_back(Face.mIndices[2]);
    }

    m_Entries[Index].Init(Vertices, Indices);
}
Beispiel #17
0
LTVector AI_Helicopter::GetAttachmentPosition(HOBJECT hObject)
{
    LTVector vPos(0,0,0);

	HATTACHMENT hAttachment;
    if ( LT_OK == g_pLTServer->FindAttachment(m_hObject, hObject, &hAttachment) )
	{
		LTransform transform;
        g_pLTServer->Common()->GetAttachmentTransform(hAttachment, transform, LTTRUE);
		g_pTransLT->GetPos(transform, vPos);
	}
	return vPos;
}
// -----------------------------------------------------------------------------
// CTestPlatAlfVisual::TestAlfLayoutSetAndGetL
// -----------------------------------------------------------------------------
//
TInt CTestPlatAlfVisual::TestAlfLayoutSetAndGetL( CStifItemParser& /*aItem*/ )
    {
    _LIT( KTestPlatAlfVisual, "TestPlatAlfVisual" );
    _LIT( KTestAlfLayoutSetAndGetL, "TestAlfLayoutSetAndGetL" );
    TestModuleIf().Printf( 0, KTestPlatAlfVisual, KTestAlfLayoutSetAndGetL );
    // Print to log file
    iLog->Log( KTestAlfLayoutSetAndGetL );
    
    CAlfLayout* vLayout = CAlfLayout::AddNewL( *iAlfCtl );
    CAlfImageVisual* vVisualOne = CAlfImageVisual::AddNewL( *iAlfCtl );
    TUid vUid = { 0x00000000 };
    TAlfImage vFirstImage( vUid, EAknsAppIconTypeList, 
            TSize( 1, 1), EAspectRatioPreserved, 0, 0, 0, 0 );
    vVisualOne->SetImage( vFirstImage );
    
    CAlfImageVisual* vVisualTwo = CAlfImageVisual::AddNewL( *iAlfCtl );
    TUid vSecUid = { 0x00000001 };
    TAlfImage vSecImage( vSecUid, EAknsAppIconTypeList, 
            TSize( 1, 1), EAspectRatioPreserved, 0, 0, 0, 0 );
    vVisualTwo->SetImage( vSecImage );
    
    vLayout->Append( vVisualOne );
    vLayout->Append( vVisualTwo );
    
    vLayout->EnableScrollingL();
    vLayout->Scrolling();
    TAlfTimedPoint vPoint( 0, 0 );
    vLayout->SetScrollOffset( vPoint );
    vLayout->ScrollOffset();
    TPoint vPos( 0, 1);
    TSize vSize( 1, 1 );
    vLayout->ChildOrdinal( 1 );
    vLayout->ChildPos( 0, vPos );
    vLayout->ChildSize( 0, vSize );
    
    TAlfXYMetric vXYMetric;
    vLayout->SetInnerPadding( vXYMetric );
    vLayout->InnerPaddingAsMetric();
    const TPoint vConstPos( 1, 1);
    vLayout->SetInnerPadding( vConstPos );
    vLayout->InnerPadding();
    vLayout->SetTransitionTime( 1 );
    
    vLayout->TransitionTime();
    vLayout->HorizontalInnerPadding();
    vLayout->VerticalInnerPadding();
    vLayout->InnerPaddingInBaseUnits();
    vLayout->EffectiveLayoutOrdinal( *vVisualTwo );
    
    return KErrNone;
    }
Beispiel #19
0
void frame_move(void)
{
    Vector4 vPos(0.0f, 0.0f, 1.05f, 1.0f);

    float speedA = 0.1f;
    float speedB = 0.2f;
    float speed = speedB * g_fTimeElapsed * MATH_PI;

    // 重設 seed
    srand(1234);

    // stateless particle
    // 從 random number 數列來重建出每個光源的位置跟顏色資料

    for ( int i=1; i<NUM_LIGHTS; i++ )
    {
        sGutLight *pLight = &g_Lights[i];

        float rx = rnd() * MATH_PI;
        float ry = rnd() * MATH_PI * 2;
        float rz = rnd() * MATH_PI;
        float spin = (rnd()+speedA) * speed;

        Matrix4x4 local_mat;

        local_mat.RotateX_Replace(rx);
        local_mat.RotateY(ry);
        local_mat.RotateZ(rz);

        Matrix4x4 rot_mat;
        rot_mat.RotateY_Replace(spin);

        pLight->m_vPosition = vPos * rot_mat * local_mat * g_Control.GetObjectMatrix();

        pLight->m_vAmbient.Set(0.0f);

        pLight->m_vDiffuse[0] = rnd()*3.0f + 0.5f;
        pLight->m_vDiffuse[1] = rnd()*3.0f + 0.5f;
        pLight->m_vDiffuse[2] = rnd()*3.0f + 0.5f;
        pLight->m_vDiffuse[3] = rnd()*3.0f + 0.5f;

        // 把位置跟顏色放在放在另一個陣列中, 方便繪圖.
        g_LightsVC[i].m_Position = pLight->m_vPosition;
        g_LightsVC[i].m_Color = pLight->m_vDiffuse;

        // 光源范圍放在W
        pLight->m_vPosition[3] = rnd()*0.2f + 0.1f;
    }

    g_fTimeElapsed += g_fFrame_Time * g_fAnimation;
}
Beispiel #20
0
//============================================================================
//処理
//============================================================================
void CEffectShot::Exec()
{
	sp<CGameObject> spObj = CCommonObject::GetResMgr()->FindObject("Player");

	Math::Vector2D vPos( 67, 0 );

	if( spObj != NULL )
	{	
		m_vPos = spObj->GetPos() + vPos;
	}

	CEffect::Exec();

}
CStdFPoint VsSimulationWindow::GetCameraPosition()
{
	osg::Vec3d vEye, vCenter, vUp;
	float fltlookat=0;
	m_osgViewer->getCamera()->getViewMatrixAsLookAt(vEye, vCenter, vUp, fltlookat);

	CStdFPoint vPos(vEye.x(), vEye.y(), vEye.z());

	m_fltCameraPosX = vEye.x()*m_lpSim->DistanceUnits();
	m_fltCameraPosY = vEye.y()*m_lpSim->DistanceUnits();
	m_fltCameraPosZ = vEye.z()*m_lpSim->DistanceUnits();

	return vPos;
}
Beispiel #22
0
int addInvisibleBlockade(lua_State *l) {
    Ogre::Vector3 vPos(Ogre::StringConverter::parseVector3(lua_tostring(l, 1)));
    Ogre::Vector3 vSize(Ogre::StringConverter::parseVector3(lua_tostring(l, 2)));

    btRigidBody::btRigidBodyConstructionInfo rbConstruction(0, new btDefaultMotionState(), new btBoxShape(BtOgre::Convert::toBullet(vSize)));
    btRigidBody *pRB = new btRigidBody(rbConstruction);
    pRB->setWorldTransform(btTransform(btQuaternion::getIdentity(), BtOgre::Convert::toBullet(vPos)));

    GameScriptParser::getSingleton().getMap()->getPhysicsManager()->getWorld()->addRigidBody(pRB, COL_WALL, MASK_BLOCKADE_COLLIDES_WITH);


    lua_pushinteger(l, GameScriptParser::getSingleton().addPointerToMap(pRB, GameScriptParser::UserPointerData::RIGID_BODY));
    return 1;
}
Beispiel #23
0
void CMenu::update()
{
	sf::Vector2i vPos(pWindow->getPosition());
	vPos.x += INTERFACE_FONT_LINEHEIGHT;
	for(int i = iStartItem;i < (iStartItem + iQtyItemsWindow);i++)
	{
		if(i < vMenuItems.size())
		{
			vPos.y += INTERFACE_FONT_LINEHEIGHT;
			vMenuItems[i]->setPosition(vPos);
		}
		else
			break;
	}
}
Beispiel #24
0
void CRouter::MoveCurvely(D3DXVECTOR3 *vCurPos, D3DXMATRIX *mat, const float fSpeed, float fTime)
{
	//计算当前位置
	D3DXVECTOR3 vPos(m_fRadius*(1-cosf(m_fPerAgl)), 0, m_fRadius*sinf(m_fPerAgl));
	D3DXVec3TransformCoord(vCurPos, &vPos, mat);
	//绕Y轴调整物体的世界矩阵
	mat->_41 = vCurPos->x;
	mat->_42 = vCurPos->y;
	mat->_43 = vCurPos->z;
	if(fabs(m_fAgl2Ajust) > 1e-6)
	{
		AdjustYaw(m_fPerAgl, mat);
	}

}
Beispiel #25
0
//-----------------------------------------------------------------------
// Purpose:
//-----------------------------------------------------------------------
void CPlayerCar::Reset( void )
{
	Vector3f vPos(vec3_null);
	Angle3d aRot(vec3_null);
	if(m_vLastCheckpointPos == vec3_null)
	{
		vPos = m_vResetPosition;
		aRot = m_aResetAngles;
	}
	else
		GetNearestSpawnPosition( m_vLastCheckpointPos, vPos, aRot );
	SetAnglesAndOriginAndUpdatePhysics( vPos, aRot );
	g_pPhysics->VSetActorProperties( GetIndex(), vPos, aRot, vec3_null, vec3_null );
	m_bJustResetted = true;
}
void OsgHingeLimit::SetLimitPos(float fltHeight)
{
    float fltLimitPos = m_lpThisLimit->LimitPos();
	CStdFPoint vPos(0, 0, 0), vRot(0, 0, 0); 

	//Reset the position and rotation of the flap.
	if(m_osgFlapRotateMT.valid() && m_osgFlapTranslateMT.valid())
	{

		vPos.Set(0, 0, 0); vRot.Set(0, 0, -fltLimitPos); 
		m_osgFlapRotateMT->setMatrix(SetupMatrix(vPos, vRot));

		vPos.Set((fltHeight/2)*sin(-fltLimitPos), -(fltHeight/2)*cos(-fltLimitPos), 0); vRot.Set(0, 0, 0); 
		m_osgFlapTranslateMT->setMatrix(SetupMatrix(vPos, vRot));
	}
}
/**
\brief	Sets up the graphics for the joint.

\detail This base joint class sets up a default ball graphics object. A few of the joint
classes do not have any special graphics associated with them, so simply knowing where the joint
is located is enough, and a ball to define that position is sufficient. This base code creates
that graphics so that each derived class does not have to. If a joint does need special 
graphics then just override this function and define it yourself, but do not call this base method.

\author	dcofer
\date	4/15/2011
**/
void VsJoint::SetupGraphics()
{
	//Setup Vs pointers to child and parent.
	m_lpVsParent = dynamic_cast<VsRigidBody *>(m_lpThisJoint->Parent());
	if(!m_lpVsParent)
		THROW_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody);

	m_lpVsChild = dynamic_cast<VsRigidBody *>(m_lpThisJoint->Child());
	if(!m_lpVsChild)
		THROW_ERROR(Vs_Err_lUnableToConvertToVsRigidBody, Vs_Err_strUnableToConvertToVsRigidBody);

	//The parent osg object for the joint is actually the child rigid body object.
	m_osgParent = ParentOSG();
	osg::ref_ptr<osg::Group> osgChild = ChildOSG();

	if(m_osgParent.valid())
	{
		//Add the parts to the group node.
		CStdFPoint vPos(0, 0, 0), vRot(VX_PI/2, 0, 0); 
		vPos.Set(0, 0, 0); vRot.Set(0, VX_PI/2, 0); 
		
		m_osgJointMT = new osg::MatrixTransform();
		m_osgJointMT->setMatrix(SetupMatrix(vPos, vRot));

		m_osgNode = m_osgJointMT.get();

		//Create the sphere.
		CreateJointGraphics();

		BuildLocalMatrix();

		SetAlpha();
		SetCulling();
		SetVisible(m_lpThisMI->IsVisible());

		//Add it to the scene graph.
		m_osgParent->addChild(m_osgRoot.get());

		//Set the position with the world coordinates.
		Physics_UpdateAbsolutePosition();

		//We need to set the UserData on the OSG side so we can do picking.
		//We need to use a node visitor to set the user data for all drawable nodes in all geodes for the group.
		osg::ref_ptr<VsOsgUserDataVisitor> osgVisitor = new VsOsgUserDataVisitor(this);
		osgVisitor->traverse(*m_osgMT);
	}
}
Beispiel #28
0
	void ConvexHull::RenderHull(float depth)
	{
		if(m_renderLightOverHull)
			return;

		glBegin(GL_TRIANGLE_FAN);

		const unsigned int numVertices = m_vertices.size();
	
		for(unsigned int i = 0; i < numVertices; i++)
		{
			Vec2f vPos(GetWorldVertex(i));
			glVertex3f(vPos.x, vPos.y, depth);
		}

		glEnd();
	}
Beispiel #29
0
void wxToolBar::OnTimer ( wxTimerEvent& rEvent )
{
    if (rEvent.GetId() == m_vToolTimer.GetId())
    {
        wxPoint vPos( m_vXMouse, m_vYMouse );

        m_pToolTip->DisplayToolTipWindow(vPos);
        m_vToolTimer.Stop();
        m_vToolExpTimer.Start(4000L, TRUE);
    }
    else if (rEvent.GetId() == m_vToolExpTimer.GetId())
    {
        m_pToolTip->HideToolTipWindow();
        GetParent()->Refresh();
        m_vToolExpTimer.Stop();
    }
} // end of wxToolBar::OnTimer
Beispiel #30
0
//============================================================================
//ショット処理
//============================================================================
void CEnemyCurve::Shoot()
{
	static int count = 0;
	
	string str("");
	
	if( !m_IsShoot && ++m_ShootCount > 30 )
	{
		m_ShootCount = 0;
	}
	
	//弾を撃ち出す
	if( m_ShootCount == 0 )
	{
		m_IsShoot = true;
	}	
	
	if( m_IsShoot )
	{
		if( ++m_StreamCount % 30 == 0 )
		{
			stringstream ss(" ");
			
			ss << "Enemy_Bullet" << count;
			
			str = ss.str();
			
			Math::Vector2D vPos( m_vPos.x + Math::Cos( m_Angle ) * 2,
								 m_vPos.y - Math::Sin( m_Angle ) * 2 );
			
			CCommonObject::GetResMgr()->Push( new CFileData("enemy_bullet_red.png", str.c_str(), 
															"AIMSHOOT", "enemybullet.csv", m_vPos ) );
			count++;
			
			m_ShotNum++;
		}
		
		if( m_ShotNum > SHOT_MAX )
		{
			m_ShotNum = 0;
			m_IsShoot = false;
		}
	
	}
}