本文整理汇总了C++中GfxStats::update方法的典型用法代码示例。如果您正苦于以下问题:C++ GfxStats::update方法的具体用法?C++ GfxStats::update怎么用?C++ GfxStats::update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GfxStats
的用法示例。
在下文中一共展示了GfxStats::update方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateScene
void AmbientDiffuseDemo::updateScene(float dt)
{
mGfxStats->setVertexCount(mTeapot->GetNumVertices());
mGfxStats->setTriCount(mTeapot->GetNumFaces());
mGfxStats->update(dt);
// Get snapshot of input devices.
gDInput->poll();
// Check input.
if( gDInput->keyDown(DIK_W) )
mCameraHeight += 25.0f * dt;
if( gDInput->keyDown(DIK_S) )
mCameraHeight -= 25.0f * dt;
// Divide by 50 to make mouse less sensitive.
//mCameraRotationY += gDInput->mouseDX() / 100.0f;
//mCameraRadius += gDInput->mouseDY() / 25.0f;
if( gDInput->keyDown(DIK_LEFT) )
mCameraRotationY += 1.0f * dt;
if( gDInput->keyDown(DIK_RIGHT) )
mCameraRotationY -= 1.0f * dt;
if( gDInput->keyDown(DIK_UP) )
mCameraRadius -= 3.0f * dt;
if( gDInput->keyDown(DIK_DOWN) )
mCameraRadius += 3.0f * dt;
// If we rotate over 360 degrees, just roll back to 0
if( fabsf(mCameraRotationY) >= 2.0f * D3DX_PI )
mCameraRotationY = 0.0f;
// Don't let radius get too small.
if( mCameraRadius < 5.0f )
mCameraRadius = 5.0f;
// The camera position/orientation relative to world space can
// change every frame based on input, so we need to rebuild the
// view matrix every frame with the latest changes.
buildViewMtx();
}
示例2: updateScene
void StencilMirrorDemo::updateScene(float dt)
{
mGfxStats->update(dt);
gDInput->poll();
if (gDInput->keyDown(DIK_W))
mCameraHeight += 25.0f * dt;
if (gDInput->keyDown(DIK_S))
mCameraHeight -= 25.0f * dt;
// divide by 50 to make mouse less sensitive
mCameraRotationY += gDInput->mouseDX() / 100.0f;
mCameraRadius += gDInput->mouseDY() / 25.0f;
if (fabsf(mCameraRotationY) >= 2.0f * D3DX_PI)
mCameraRotationY = 0.0f;
if (mCameraRadius < 3.0f)
mCameraRadius = 3.0f;
buildViewMtx();
}
示例3: updateScene
void Evolution::updateScene(float dt)
{
gDInput->poll();
mTrueTime = dt;
mCoolTime += mTrueTime;
//mBellyFoods = 0;
mGfxStats->setTriCount((lifeformList.size()+foodList.size()+eggList.size())*2);
mGfxStats->setVertexCount((lifeformList.size()+foodList.size()+eggList.size())*4);
mGfxStats->update(mTrueTime);
dt *= mTimeSpeed;
if (gDInput->keyDown(DIK_LEFT) && mCoolTime > 0.1f)
{
--mTimeSpeed;
if (mTimeSpeed < 1.0f)
mTimeSpeed = 1.0f;
mCoolTime = 0.0f;
}
if (gDInput->keyDown(DIK_RIGHT) && mCoolTime > 0.1f)
{
++mTimeSpeed;
if (mTimeSpeed > 30.0f)
mTimeSpeed = 30.0f;
mCoolTime = 0.0f;
}
POINT mpos;
GetCursorPos(&mpos);
ScreenToClient(mhMainWnd, &mpos);
//mpos.x -= 400;
////mpos.y = -mpos.y + 300;
//D3DXVECTOR4 mousePos;
//D3DXVec3Transform(&mousePos, &(D3DXVECTOR3(mpos.x, mpos.y, 0.0f)), &(mView*mProj));
//Mouse position and clicking stuff
D3DXVECTOR3 mousePos(0.0f, 0.0f, 0.0f);
static float w = (float)md3dPP.BackBufferWidth;
static float h = (float)md3dPP.BackBufferHeight;
float x = (2.0f*mpos.x/w - 1.0f) / mProj(0,0);
float y = (-2.0f*mpos.y/h + 1.0f) / mProj(1,1);
D3DXVECTOR3 dir(x, y, 1.0f);
D3DXMATRIX invView;
D3DXMatrixInverse(&invView, 0, &mView);
D3DXVec3TransformNormal(&mousePos, &dir, &invView);
D3DXVec3Normalize(&mousePos, &mousePos);
float ratio = -mCameraPos.z/mousePos.z;
mousePos.x = mousePos.x*ratio + mCameraPos.x;
mousePos.y = mousePos.y*ratio + mCameraPos.y;
//Zooming in/out
// Try making a ray to each of the four corners and go from there
if (gDInput->mouseDZ() != 0.0f)
{
mCameraPos.z += gDInput->mouseDZ()*mTrueTime*400.000f;
mCameraPos.x += (gDInput->mouseDZ()*0.5000f*(mousePos.x-mCameraPos.x))*mTrueTime;
mCameraPos.y += (gDInput->mouseDZ()*0.5000f*(mousePos.y-mCameraPos.y))*mTrueTime;
}
if (mbFollow)
{
mCameraPos.x = mFollowPos.x;
mCameraPos.y = mFollowPos.y;
}
if (mCameraPos.z > -300.0f)
mCameraPos.z = -300.0f;
if (mCameraPos.z < -MapX)
mCameraPos.z = -MapX;
if (mCameraPos.x < -HalfMapX-mCameraPos.z/2.0f)
mCameraPos.x = -HalfMapX-mCameraPos.z/2.0f;
if (mCameraPos.x > HalfMapX+mCameraPos.z/2.0f)
mCameraPos.x = HalfMapX+mCameraPos.z/2.0f;
if (mCameraPos.y < -HalfMapY-mCameraPos.z*3.0f/8.0f)
mCameraPos.y = -HalfMapY-mCameraPos.z*3.0f/8.0f;
if (mCameraPos.y > HalfMapY+mCameraPos.z*3.0f/8.0f)
mCameraPos.y = HalfMapY+mCameraPos.z*3.0f/8.0f;
if (gDInput->mouseButtonDown(0) && mCoolTime > 1.0f)
{
mbDrawInfo = false;
}
if (gDInput->mouseButtonDown(1) && mCoolTime > 1.0f)
{
mbFollow = false;
}
//.........这里部分代码省略.........
示例4: updateScene
void GfxStatsDemo::updateScene(float dt)
{
mGfxStats->update(dt);
}