本文整理汇总了C++中CBaseObject::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ CBaseObject::Draw方法的具体用法?C++ CBaseObject::Draw怎么用?C++ CBaseObject::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBaseObject
的用法示例。
在下文中一共展示了CBaseObject::Draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetActor
void C3DCanvas::Draw(float fDeltaTime)
{
CBaseObject* pActor = GetActor();
if(!IsEnabled() || pActor==0)
return;
if(m_bNeedUpdate == false)
return;
if(!m_bInitialized)
{
InitDeviceObjects();
RestoreDeviceObjects();
}
if(m_pCanvasSurface == 0 || m_pDepthStencilSurface==0)
return;
if(m_bAutoRotate)
{
m_camera.Rotate(0,0.3f*fDeltaTime, 0);
}
m_bNeedUpdate = false;
EffectManager* pEffectManager = CGlobals::GetEffectManager();
LPDIRECT3DDEVICE9 pd3dDevice = CGlobals::GetRenderDevice();
LPDIRECT3DSURFACE9 pOldRenderTarget = CGlobals::GetDirectXEngine().GetRenderTarget();
CGlobals::GetDirectXEngine().SetRenderTarget(0, m_pCanvasSurface);
// save old render origin
Vector3 vOldRenderOrigin = CGlobals::GetScene()->GetRenderOrigin();
// set depth surface
LPDIRECT3DSURFACE9 pOldZBuffer = NULL;
if(FAILED(pd3dDevice->GetDepthStencilSurface(&pOldZBuffer)))
return;
pd3dDevice->SetDepthStencilSurface( m_pDepthStencilSurface );
// save old actor position
pActor->PushParam();
pActor->SetPosition(m_vActorPosition);
pActor->SetFacing(m_fActorFacing);
// animate the camera and push result to transformation stack
m_camera.FrameMove(fDeltaTime);
CGlobals::GetProjectionMatrixStack().push(*m_camera.GetProjMatrix());
CGlobals::GetViewMatrixStack().push(*m_camera.GetViewMatrix());
CGlobals::GetEffectManager()->UpdateD3DPipelineTransform(true,true, true);
// clear
pd3dDevice->Clear(0L, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, COLOR_RGBA(0, 0, 0, 0), 1.0f, 0L);
// disable fog
pEffectManager->EnableFog(false);
if(pEffectManager->BeginEffect(pActor->GetPrimaryTechniqueHandle(), &(CGlobals::GetSceneState()->m_pCurrentEffect)))
{
/** draw the main stage object */
pActor->Draw(CGlobals::GetSceneState());
CGlobals::GetSceneState()->GetFaceGroups()->Clear();
}
if(m_pMask!=0 && pEffectManager->BeginEffect(TECH_GUI, &(CGlobals::GetSceneState()->m_pCurrentEffect)))
{
/** draw the mask square in front of the screen. */
CEffectFile* pEffectFile = CGlobals::GetEffectManager()->GetCurrentEffectFile();
if(pEffectFile == 0)
{
//////////////////////////////////////////////////////////////////////////
// fixed programming pipeline
float sx = (float)m_nTextureWidth,sy = (float)m_nTextureHeight;
DXUT_SCREEN_VERTEX v[10];
v[0].x = 0; v[0].y = sy; v[0].tu = 0; v[0].tv = 1.0f;
v[1].x = 0; v[1].y = 0; v[1].tu = 0; v[1].tv = 0;
v[2].x = sx; v[2].y = sy; v[2].tu = 1.f; v[2].tv = 1.f;
v[3].x = sx; v[3].y = 0; v[3].tu = 1.f; v[3].tv = 0;
DWORD dwColor = LinearColor(1.f,1.f,1.f,1.f);
int i;
for(i=0;i<4;i++)
{
v[i].color = dwColor;
v[i].z = 0;
v[i].h = 1.0f;
}
CGlobals::GetRenderDevice()->SetTexture(0, m_pMask->GetTexture());
RenderDevice::DrawPrimitiveUP( CGlobals::GetRenderDevice(), RenderDevice::DRAW_PERF_TRIANGLES_UI, D3DPT_TRIANGLESTRIP, 2, v, sizeof(DXUT_SCREEN_VERTEX) );
}
}
//////////////////////////////////////////////////////////////////////////
// Restore state for the normal pipeline
// enable fog
//.........这里部分代码省略.........