本文整理汇总了C++中GfxStats类的典型用法代码示例。如果您正苦于以下问题:C++ GfxStats类的具体用法?C++ GfxStats怎么用?C++ GfxStats使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了GfxStats类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HR
void DiffuseCubeDemo::drawScene()
{
// Clear the backbuffer and depth buffer.
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0));
HR(gd3dDevice->BeginScene());
// Let Direct3D know the vertex buffer, index buffer and vertex
// declaration we are using.
HR(gd3dDevice->SetStreamSource(0, mVB, 0, sizeof(VertexPN)));
HR(gd3dDevice->SetIndices(mIB));
HR(gd3dDevice->SetVertexDeclaration(VertexPN::Decl));
// Setup the rendering FX
HR(mFX->SetTechnique(mhTech));
HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj)));
D3DXMATRIX worldInverseTranspose;
D3DXMatrixInverse(&worldInverseTranspose, 0, &mWorld);
D3DXMatrixTranspose(&worldInverseTranspose, &worldInverseTranspose);
HR(mFX->SetMatrix(mhWorldInverseTranspose, &worldInverseTranspose));
HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3)));
HR(mFX->SetValue(mhDiffuseMtrl, &mDiffuseMtrl, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR)));
// Begin passes.
UINT numPasses = 0;
HR(mFX->Begin(&numPasses, 0));
for(UINT i = 0; i < numPasses; ++i)
{
HR(mFX->BeginPass(i));
HR(gd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12));
HR(mFX->EndPass());
}
HR(mFX->End());
mGfxStats->display();
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例2: updateScene
void GunDemo::updateScene(float dt)
{
mGfxStats->update(dt);
gDInput->poll();
gCamera->update(dt, 0, 0);
mPSys->update(dt);
// Can only fire once every tenth of a second.
static float delay = 0.0f;
if( gDInput->keyDown(DIK_SPACE) && delay <= 0.0f)
{
delay = 0.1f;
mPSys->addParticle();
}
delay -= dt;
}
示例3: HR
void XFileDemo::drawScene()
{
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0));
HR(gd3dDevice->BeginScene());
HR(mFX->SetValue(mhLight, &mLight, sizeof(DirLight)));
HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj)));
D3DXMATRIX worldInvTrans;
D3DXMatrixInverse(&worldInvTrans, 0, &mWorld);
D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans);
HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans));
HR(mFX->SetMatrix(mhWorld, &mWorld));
HR(mFX->SetTechnique(mhTech));
UINT numPasses = 0;
HR(mFX->Begin(&numPasses, 0));
HR(mFX->BeginPass(0));
for (int j = 0; j < mMtrl.size(); ++j)
{
HR(mFX->SetValue(mhMtrl, &mMtrl[j], sizeof(Material)));
if (mTex[j] != 0)
{
HR(mFX->SetTexture(mhTex, mTex[j]));
}
else
{
HR(mFX->SetTexture(mhTex, mWhiteTex));
}
HR(mFX->CommitChanges());
HR(mMesh->DrawSubset(j));
}
HR(mFX->EndPass());
HR(mFX->End());
mGfxStats->display(D3DCOLOR_XRGB(0,0,0));
HR(gd3dDevice->EndScene());
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例4: updateScene
void SpotlightDemo::updateScene(float dt)
{
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 to make mouse less sensitive.
mCameraRotationY += gDInput->mouseDX() / 100.0f;
mCameraRadius += gDInput->mouseDY() / 25.0f;
// 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;
// Control spotlight cone.
if( gDInput->keyDown(DIK_G) )
mSpotPower += 25.0f * dt;
if( gDInput->keyDown(DIK_H) )
mSpotPower -= 25.0f * dt;
// Clamp spot Power.
if( mSpotPower < 1.0f )
mSpotPower = 1.0f;
if( mSpotPower > 64.0f )
mSpotPower = 64.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();
}
示例5: HR
void CubeDemo::drawScene()
{
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(255,255,255), 1.0f, 0));
HR(gd3dDevice->BeginScene());
HR(gd3dDevice->SetStreamSource(0, mVB, 0, sizeof(VertexPos)));
HR(gd3dDevice->SetIndices(mIB));
HR(gd3dDevice->SetVertexDeclaration(VertexPos::Decl));
D3DXMATRIX W;
D3DXMatrixIdentity(&W);
HR(gd3dDevice->SetTransform(D3DTS_WORLD, &W));
HR(gd3dDevice->SetTransform(D3DTS_VIEW, &mView));
HR(gd3dDevice->SetTransform(D3DTS_PROJECTION, &mProj));
HR(gd3dDevice->SetRenderState(D3DRS_FILLMODE, D3DFILL_WIREFRAME));
HR(gd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, 8, 0, 12));
mGfxStats->display(D3DCOLOR_XRGB(0,0,0));
HR(gd3dDevice->EndScene());
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例6: HR
void AmbientDiffuseDemo::drawScene()
{
// Clear the backbuffer and depth buffer.
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0));
HR(gd3dDevice->BeginScene());
// Setup the rendering FX
HR(mFX->SetTechnique(mhTech));
HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj)));
D3DXMATRIX worldInverseTranspose;
D3DXMatrixInverse(&worldInverseTranspose, 0, &mWorld);
D3DXMatrixTranspose(&worldInverseTranspose, &worldInverseTranspose);
HR(mFX->SetMatrix(mhWorldInverseTranspose, &worldInverseTranspose));
HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3)));
HR(mFX->SetValue(mhDiffuseMtrl, &mDiffuseMtrl, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhAmbientMtrl, &mAmbientMtrl, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR)));
// Begin passes.
UINT numPasses = 0;
HR(mFX->Begin(&numPasses, 0));
for(UINT i = 0; i < numPasses; ++i)
{
HR(mFX->BeginPass(i));
HR(mTeapot->DrawSubset(0));
HR(mFX->EndPass());
}
HR(mFX->End());
mGfxStats->display();
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例7: HR
void ProjTexDemo::drawScene()
{
HR(gd3dDevice->BeginScene());
// Draw sky first--this also replaces our gd3dDevice->Clear call.
//mSky->draw();
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));
// Draw the scene mesh.
HR(mFX->SetTechnique(mhTech));
HR(mFX->SetMatrix(mhWorldInvTrans, &mSceneWorld));
HR(mFX->SetMatrix(mhWorld, &mSceneWorld));
HR(mFX->SetValue(mhLight, &mLight, sizeof(SpotLight)));
HR(mFX->SetMatrix(mhWVP, &(mSceneWorld*gCamera->viewProj())));
HR(mFX->SetValue(mhEyePosW, &gCamera->pos(), sizeof(D3DXVECTOR3)));
HR(mFX->SetTexture(mhTex, mSkullTex));
HR(mFX->SetMatrix(mhLightWVP, &mLightWVP));
UINT numPasses = 0;
HR(mFX->Begin(&numPasses, 0));
HR(mFX->BeginPass(0));
for(UINT j = 0; j < mSceneMtrls.size(); ++j)
{
HR(mFX->SetValue(mhMtrl, &mSceneMtrls[j], sizeof(Mtrl)));
HR(mFX->CommitChanges());
HR(mSceneMesh->DrawSubset(j));
}
HR(mFX->EndPass());
HR(mFX->End());
mGfxStats->display();
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例8: 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();
}
示例9: HR
void SpotlightDemo::drawScene()
{
// Clear the backbuffer and depth buffer.
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));
HR(gd3dDevice->BeginScene());
// Setup the rendering FX
HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhSpecLight, &mSpecLight, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhAttenuation012, &mAttenuation012, sizeof(D3DXVECTOR3)));
HR(mFX->SetFloat(mhSpotPower, mSpotPower));
// Begin passes.
UINT numPasses = 0;
HR(mFX->Begin(&numPasses, 0));
for(UINT i = 0; i < numPasses; ++i)
{
HR(mFX->BeginPass(i));
drawGrid();
drawCylinders();
drawSpheres();
HR(mFX->EndPass());
}
HR(mFX->End());
mGfxStats->display();
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例10: HR
void GateDemo::drawScene()
{
// Clear the backbuffer and depth buffer.
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffeeeeee, 1.0f, 0));
HR(gd3dDevice->BeginScene());
// Setup the rendering FX
HR(mFX->SetTechnique(mhTech));
HR(mFX->SetValue(mhLightVecW, &mLightVecW, sizeof(D3DXVECTOR3)));
HR(mFX->SetValue(mhDiffuseLight, &mDiffuseLight, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhAmbientLight, &mAmbientLight, sizeof(D3DXCOLOR)));
HR(mFX->SetValue(mhSpecularLight, &mSpecularLight, sizeof(D3DXCOLOR)));
drawGround();
drawGate();
mGfxStats->display();
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例11: onLostDevice
void GfxStatsDemo::onLostDevice()
{
mGfxStats->onLostDevice();
}
示例12: HR
void RobotArmDemo::drawScene()
{
// Clear the backbuffer and depth buffer.
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));
HR(gd3dDevice->BeginScene());
HR(mFX->SetValue(mhLight, &mLight, sizeof(DirLight)));
HR(mFX->SetTechnique(mhTech));
UINT numPasses = 0;
HR(mFX->Begin(&numPasses, 0));
HR(mFX->BeginPass(0));
// Build the world transforms for each bone, then render them.
buildBoneWorldTransforms();
D3DXMATRIX T;
D3DXMatrixTranslation(&T, -NUM_BONES, 0.0f, 0.0f);
for(int i = 0; i < NUM_BONES; ++i)
{
// Append the transformation with a slight translation to better
// center the skeleton at the center of the scene.
mWorld = mBones[i].toWorldXForm * T;
HR(mFX->SetMatrix(mhWVP, &(mWorld*mView*mProj)));
D3DXMATRIX worldInvTrans;
D3DXMatrixInverse(&worldInvTrans, 0, &mWorld);
D3DXMatrixTranspose(&worldInvTrans, &worldInvTrans);
HR(mFX->SetMatrix(mhWorldInvTrans, &worldInvTrans));
HR(mFX->SetMatrix(mhWorld, &mWorld));
for(int j = 0; j < mMtrl.size(); ++j)
{
HR(mFX->SetValue(mhMtrl, &mMtrl[j], sizeof(Mtrl)));
// If there is a texture, then use.
if(mTex[j] != 0)
{
HR(mFX->SetTexture(mhTex, mTex[j]));
}
// But if not, then set a pure white texture. When the texture color
// is multiplied by the color from lighting, it is like multiplying by
// 1 and won't change the color from lighting.
else
{
HR(mFX->SetTexture(mhTex, mWhiteTex));
}
HR(mFX->CommitChanges());
HR(mBoneMesh->DrawSubset(j));
}
}
HR(mFX->EndPass());
HR(mFX->End());
mGfxStats->display();
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}
示例13: onLostDevice
void RobotArmDemo::onLostDevice()
{
mGfxStats->onLostDevice();
HR(mFX->OnLostDevice());
}
示例14: onLostDevice
void MirrorDemo::onLostDevice()
{
mGfxStats->onLostDevice();
HR(mFX->OnLostDevice());
}
示例15: HR
void Evolution::drawScene()
{
// Clear the backbuffer and depth buffer.
HR(gd3dDevice->Clear(0, 0, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, 0xffffffff, 1.0f, 0));
HR(gd3dDevice->BeginScene());
static char buffer[255];
static RECT clientRect = {0, 0, 0, 0};
GetClientRect(mhMainWnd, &clientRect);
HR(gd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, true));
HR(gd3dDevice->SetRenderState(D3DRS_ALPHAREF, 25));
HR(gd3dDevice->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER));
if (foodList.size() != 0 || eggList.size() != 0)
drawEggsFood();
if (lifeformList.size() != 0)
drawLifeforms();
if (mbDrawInfo)
{
sprintf(buffer, "Carnivore: %d\n"
"Carnivore Parts: %d\n"
"Egg Cycle Length: %f\n"
"Egg Time Length: %f\n"
"Food Cycle Length: %f\n"
"Lifetime Length: %f\n"
"Sight Distance: %f\n"
"Fear Distance: %f\n"
"Pursuit Length: %f\n"
"Speed: %f",
mDrawInfo.carnivore,
mDrawInfo.carnivoreParts,
mDrawInfo.eggCycleLength,
mDrawInfo.eggTimeLength,
mDrawInfo.foodCycleLength,
mDrawInfo.lifeTimeLength,
mDrawInfo.sightDistance,
mDrawInfo.fearDistance,
mDrawInfo.pursuitLength,
mDrawInfo.speed);
RECT N = {clientRect.left, clientRect.top+(4*18), clientRect.left+300, clientRect.top+(14*18)};
HR(mFont->DrawText(0, buffer, -1, &N, DT_LEFT | DT_NOCLIP, D3DCOLOR_XRGB(0, 0, 0)));
}
/*if (foodList.size() + BellyFoods + eggList.size() != mMaxBio || BellyFoods < 0)
{
sprintf(buffer, "BIOMASS LOST/GAINED");
RECT N = {clientRect.left, clientRect.top+(4*18), clientRect.left+300, clientRect.top+(13*18)};
HR(mFont->DrawText(0, buffer, -1, &N, DT_LEFT | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0)));
}*/
mGfxStats->display();
HR(gd3dDevice->SetRenderState(D3DRS_ALPHATESTENABLE, false));
HR(gd3dDevice->EndScene());
// Present the backbuffer.
HR(gd3dDevice->Present(0, 0, 0, 0));
}