/** *\~english *\brief Renders the given depth cube texture to the currently draw-bound frame buffer. *\param[in] size The render viewport size. *\param[in] texture The texture. *\~french *\brief Rend la texture cube de profondeur donnée dans le tampon d'image actuellement activé en dessin. *\param[in] size La taille du viewport de rendu. *\param[in] texture La texture. */ inline void renderDepthCube( castor::Size const & size , TextureLayout const & texture ) { static castor::Position const position; renderDepth( position , size , texture ); }
/** *\~english *\brief Renders the wanted layer of given depth 2D texture array to the currently draw-bound frame buffer. *\param[in] size The render viewport size. *\param[in] texture The texture. *\param[in] index The layer index. *\~french *\brief Rend la couche voulue du tableau de textures 2D de profondeur donné dans le tampon d'image actuellement activé en dessin. *\param[in] size La taille du viewport de rendu. *\param[in] texture La texture. *\param[in] index L'index de la couche. */ inline void renderDepth( castor::Size const & size , TextureLayout const & texture , uint32_t index ) { static castor::Position const position; renderDepth( position , size , texture , index ); }
// renderStage1 - Render grass and shadows over near features, and write depth texture for scene 0 void DistantLand::renderStage1() { DECLARE_MWBRIDGE IDirect3DStateBlock9 *stateSaved; UINT passes; ///LOG::logline("Stage 1 prims: %d", recordMW.size()); if(!isRenderCached) { // Save state block manually since we can change FVF/decl device->CreateStateBlock(D3DSBT_ALL, &stateSaved); // TODO: Locate this properly if(isDistantCell()) cullGrass(&mwView, &mwProj); if(isDistantCell()) { // Render over Morrowind domain effect->Begin(&passes, D3DXFX_DONOTSAVESTATE); // Draw grass with shadows if(Configuration.MGEFlags & USE_GRASS) { effect->BeginPass(PASS_RENDERGRASSINST); renderGrassInst(); effect->EndPass(); } // Overlay shadow onto Morrowind objects if((Configuration.MGEFlags & USE_SHADOWS) && mwBridge->CellHasWeather()) { effect->BeginPass(PASS_RENDERSHADOW); renderShadow(); effect->EndPass(); } effect->End(); } // Depth texture from recorded renders and distant land effectDepth->Begin(&passes, D3DXFX_DONOTSAVESTATE); renderDepth(); effectDepth->End(); // Restore render state stateSaved->Apply(); stateSaved->Release(); } recordMW.clear(); }
void render() { switch(renderMode){ case 0: renderText(); break; case 1: renderASCII(); break; case 2: renderFlat(); break; case 3: renderDepth(); break; default: renderWrong(); break; } }
bool Render::ResizeRenderTargets(int width, int height) { if(m_overdrawColor) { if(m_overdrawColor->m_width == width && m_overdrawColor->m_height == height) { return true; // success but nothing is true I guess } } m_bufferWidth = width; m_bufferHeight = height; UpdateViewHeightFromBuffer(); DEL_NULL(m_overdrawColor); //DEL_NULL(m_overdrawDepth); DEL_NULL(m_renderColor); DEL_NULL(m_renderDepth); if(!m_multiPass || width == 0 || height == 0) return true; // don't need any of these unless it's multipass std::unique_ptr<Texture> colorOverdraw(new Texture()); if(!colorOverdraw->CreateColorTarget(width, height)) return false; //std::unique_ptr<Texture> depthOverdraw(new Texture()); //if(!depthOverdraw->CreateDepthTarget(width, height)) // return false; std::unique_ptr<Texture> renderColor(new Texture()); if(!renderColor->CreateColorTarget(width, height)) return false; std::unique_ptr<Texture> renderDepth(new Texture()); if(!renderDepth->CreateDepthTarget(width, height)) return false; m_overdrawColor = colorOverdraw.release(); //m_overdrawDepth = depthOverdraw.release(); m_renderColor = renderColor.release(); m_renderDepth = renderDepth.release(); return true; }
void Stage::forwardRender(void) { initForwardRendering(); renderDepth(); //in forward rendering the scene is rendered for each light and blended together for (unsigned int i = 0; i < m_lights.size(); ++i) { initLightRendering(); Camera shadowMapCamera; BaseShadowMap* baseShadowMap = 0; ShaderProgram* finalShader = 0; if (m_lights[i]->getType() == LightTypes::PointLight) { if (m_lights[i]->shadow != Shadows::None) baseShadowMap = &m_shadowCubeMap; renderPointLightShadowMap(m_lights[i], &shadowMapCamera); finalShader = getCorrectPointLightShadowShader(m_lights[i]); } else if (m_lights[i]->getType() == LightTypes::DirectionalLight) { if (m_lights[i]->shadow != Shadows::None) baseShadowMap = &m_shadowMap; renderDirectionalLightShadowMap(m_lights[i], &shadowMapCamera); finalShader = getCorrectDirectionalLightShadowShader(m_lights[i]); } renderColor(m_lights[i], i, finalShader, &shadowMapCamera, baseShadowMap); } }