/* * draws the Emitter * @author Rigardt de Vries * @return void */ void CPICParticleEmitter::Draw() { if (!m_pVertexBuffer) { return; } if (!IsEmpty() ) { TVertexParticleSize* pv; DWORD dwNumParticlesInBatch = 0; PreDraw(); CRenderer* pRenderer = CTotalCubeDomination::GetInstance().GetRenderer(); if (m_ePICType == PIC_BULLET_DAMAGE) { CTextureManager::GetInstance().SetTexture(0, s_uiBulletDamageID); } else if (m_ePICType == PIC_BULLET_SPEED) { CTextureManager::GetInstance().SetTexture(0, s_uiBulletMoveID); } else if (m_ePICType == PIC_MOVE_SPEED) { CTextureManager::GetInstance().SetTexture(0, s_uiMoveID); } else if (m_ePICType == PIC_EXPLODE_RADIUS) { CTextureManager::GetInstance().SetTexture(0, s_uiRadiusID); } else { CTextureManager::GetInstance().SetTexture(0, s_uiShieldID); } pRenderer->SetWorldMatrix(m_matWorld); pRenderer->GetDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_PSIZE); pRenderer->GetDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(TVertexParticleSize) ); SortParticles(); m_pVertexBuffer->Lock(NULL, 0, (void**)&pv, D3DLOCK_DISCARD); for (int32 i = 0; i < static_cast<int32>(m_vecParticles.size() ); ++i) { pv->vec3Position = m_vecParticles[i].vec3Position; const D3DXCOLOR& kr = m_vecParticles[i].colour; pv->colour = D3DCOLOR_COLORVALUE(kr.r, kr.g, kr.b, kr.a); pv->fsize = m_vecParticles[i].fSize; pv++; ++dwNumParticlesInBatch; } m_pVertexBuffer->Unlock(); //if (IsAlive() == true) //{ pRenderer->GetDevice()->DrawPrimitive(D3DPT_POINTLIST, 0, dwNumParticlesInBatch); //} PostDraw(); } }
void GraphView::EndViewExpose() { // call graph manager proc PostDraw(); Pop2dViewport(); }
int D3DApp::Run() { MSG msg; ZeroMemory(&msg, sizeof(MSG)); gTimer->Start(); while (msg.message != WM_QUIT) { gDInput->poll(); gTimer->Tick(); if (PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { TranslateMessage(&msg); DispatchMessage(&msg); } else { Update(); PreDraw(); Draw(); PostDraw(); } } gTimer->Stop(); return (int)msg.wParam; }
bool GObject::ObjectRender(ID3D11DeviceContext* pContext, bool bCommand) { for (int iModel = 0; iModel < m_pModelList.size(); iModel++) { TObjWM* pUnit = m_pModelList[iModel].get(); PreDraw(pContext, pUnit, bCommand); PostDraw(pContext, pUnit, bCommand); } return true; }
/* * Draws the particles * * @author Michael McQuarrie * * @return void */ void CFlagParticleEmitter::Draw() { if (!m_pVertexBuffer) { return; } if (!IsEmpty() ) { //First PreDraw it TVertexParticleSize* pv; DWORD dwNumParticlesInBatch = 0; PreDraw(); //Get the renderer CRenderer* pRenderer = CTotalCubeDomination::GetInstance().GetRenderer(); //Get the texture CTextureManager::GetInstance().SetTexture(0, s_uiTextureID); //Set Matrix pRenderer->SetWorldMatrix(m_matWorld); //Set FVF and source things pRenderer->GetDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_PSIZE); pRenderer->GetDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(TVertexParticleSize) ); SortParticles(); m_pVertexBuffer->Lock(NULL, 0, (void**)&pv, D3DLOCK_DISCARD); //Doing colour things for (int32 i = 0; i < static_cast<int32>(m_vecParticles.size() ); ++i) { if (m_vecParticles[i].bAlive) { pv->vec3Position = m_vecParticles[i].vec3Position; const D3DXCOLOR& kr = m_vecParticles[i].colour; pv->colour = D3DCOLOR_COLORVALUE(kr.r, kr.g, kr.b, 1.0f - kr.a); pv->fsize = m_vecParticles[i].fLifeTime + 0.5f; pv++; ++dwNumParticlesInBatch; } } m_pVertexBuffer->Unlock(); //Draw it if (IsAlive() == true) { pRenderer->GetDevice()->DrawPrimitive(D3DPT_POINTLIST, 0, dwNumParticlesInBatch); } //End the drawing PostDraw(); } }
/* * Draw the particles in this emitter * @author Rigardt de Vries * @return void */ void CSpiralParticleEmitter::Draw() { if (!m_pVertexBuffer) { return; } if (!IsEmpty() ) { TVertexParticle* pv; DWORD dwNumParticlesInBatch = 0; PreDraw(); CRenderer* pRenderer = CTotalCubeDomination::GetInstance().GetRenderer(); CTextureManager::GetInstance().SetTexture(0, s_uiTextureID); pRenderer->SetWorldMatrix(m_matWorld); pRenderer->GetDevice()->SetFVF(D3DFVF_XYZ | D3DFVF_DIFFUSE); pRenderer->GetDevice()->SetStreamSource(0, m_pVertexBuffer, 0, sizeof(TVertexParticle) ); SortParticles(); m_pVertexBuffer->Lock(NULL, 0, (void**)&pv, D3DLOCK_DISCARD); for (int32 i = 0; i < static_cast<int32>(m_vecParticles.size() ); ++i) { if (m_vecParticles[i].bAlive) { pv->vec3Position = m_vecParticles[i].vec3Position; const D3DXCOLOR& kr = m_vecParticles[i].colour; pv->colour = D3DCOLOR_COLORVALUE(kr.r, kr.g, kr.b, kr.a); pv++; ++dwNumParticlesInBatch; } } m_pVertexBuffer->Unlock(); if (dwNumParticlesInBatch) { pRenderer->GetDevice()->DrawPrimitive(D3DPT_POINTLIST, 0, dwNumParticlesInBatch); } PostDraw(); } }
bool PostMisc(uint32_t eid, DrawFlags flags, VkCommandBuffer cmd) { return PostDraw(eid, cmd); }
bool PostDispatch(uint32_t eid, VkCommandBuffer cmd) { return PostDraw(eid, cmd); }
void CzApp::Draw() { PLATFORM_RENDER->Begin(); #if defined(CZ_ENABLE_METRICS) CzMetrics::TotalSpritesProcessed = 0; CzMetrics::TotalActorsProcessed = 0; #endif // Calculate max layers, also draw any scenes that have negative layers int max_layers = 0; for (_Iterator it = Scenes.begin(); it != Scenes.end(); ++it) { CzScene* s = *it; if (!s->isDestroyed()) { int layer = s->getLayer(); if (layer < 0) s->Draw(); else if (layer < CZ_MAX_SCENE_LAYERS && layer > max_layers) max_layers = layer; } } // Draw all scenes in layer order int num_scenes = Scenes.size(); for (int t = 0; t <= max_layers; t++) { for (_Iterator it = Scenes.begin(); it != Scenes.end(); ++it) { CzScene* s = *it; if (!s->isDestroyed()) { if (s->getLayer() == t) s->Draw(); } } } // Draw any scenes that have layers that are out of range last for (_Iterator it = Scenes.begin(); it != Scenes.end(); ++it) { CzScene* s = *it; if (!s->isDestroyed()) { int layer = s->getLayer(); if (layer >= CZ_MAX_SCENE_LAYERS) s->Draw(); } } // Take care of any post draw rendering PostDraw(); #if defined(CZ_ENABLE_METRICS) CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "TotalSpritesProcessed - ", CzString(CzMetrics::TotalSpritesProcessed).c_str()); CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "TotalSpritesCreated - ", CzString(CzMetrics::TotalSpritesCreated).c_str()); CzDebug::Log(CZ_DEBUG_CHANNEL_INFO, "TotalSpritesDestroyed - ", CzString(CzMetrics::TotalSpritesDestroyed).c_str()); #endif PLATFORM_RENDER->End(); // Swap display buffers PLATFORM_DISPLAY->Swap(); // Clear the screen PLATFORM_DISPLAY->Clear(); // Yield to the operating system PLATFORM_SYS->YieldToOS(0); }
void THFrame::Draw() { PreDraw(); DrawObjects(); PostDraw(); }
bool PostDispatch(uint32_t eid, ID3D12GraphicsCommandList *cmd) { return PostDraw(eid, cmd); }
void Engine::Draw() { RenderManager::Get()->Render(); PostDraw(); GraphicsManager::Get()->Present(); }