void Render(const RenderParam& param, RenderParamOut* paramOut){ if (mSelf->HasObjFlag(SceneObjectFlag::Hide)) return; if (mBlendingSkySphere && mBlendingSkySphere->GetAlpha() == 1.0f){ mBlendingSkySphere->Render(param, paramOut); return; } if (!mMaterial) { assert(0); return; } auto& renderer = Renderer::GetInstance(); renderer.SetPrimitiveTopology(PRIMITIVE_TOPOLOGY_TRIANGLELIST); renderer.UnbindInputLayout(); renderer.UnbindVertexBuffers(); if (mMaterialOCC && param.mRenderPass == RENDER_PASS::PASS_GODRAY_OCC_PRE) { RenderEventMarker mark("SkySphere_OCC"); mMaterialOCC->Bind(false); renderer.Draw(3, 0); } else if (param.mRenderPass == RENDER_PASS::PASS_NORMAL) { RenderEventMarker mark("SkySphere"); mMaterial->Bind(false); if (mUseAlphaBlend) { renderer.GetResourceProvider()->BindBlendState(ResourceTypes::BlendStates::AlphaBlend); } renderer.Draw(3, 0); } if (mBlendingSkySphere && mBlendingSkySphere->GetAlpha() != 0.f){ mBlendingSkySphere->Render(param, paramOut); } }
void Render(const RenderParam& param, RenderParamOut* paramOut){ mRenderPass = (RENDER_PASS)param.mRenderPass; auto lightCamera = param.mLightCamera; auto cam = param.mCamera; if (!mSkipSpatialObjects) { if (param.mRenderPass == PASS_SHADOW) { for (auto& obj : mVisibleObjectsLight[lightCamera]) { obj->Render(param, paramOut); } } else { auto& observers = mSelf->mObservers_[ISceneObserver::Timing]; for (auto it = observers.begin(); it != observers.end(); /**/){ auto observer = it->lock(); if (!observer){ it = observers.erase(it); continue; } ++it; observer->OnBeforeRenderingOpaques(mSelf, param, paramOut); } for (auto& obj : mVisibleObjectsMain[cam]) { obj->Render(param, paramOut); } } } if (!(param.mRenderPass == RENDER_PASS::PASS_SHADOW || param.mRenderPass == RENDER_PASS::PASS_DEPTH)) { if (mSkyRendering) { if (mSkySphere) { mSkySphere->Render(param, paramOut); } } for (auto it : mSelf->mObservers_[ISceneObserver::Timing]){ auto observer = it.lock(); if (observer){ observer->OnBeforeRenderingTransparents(mSelf, param, paramOut); } } if (!mSkipSpatialObjects) { auto it = mVisibleTransparentObjects[cam].begin(), itEnd = mVisibleTransparentObjects[cam].end(); for (; it != itEnd; it++) { (*it)->Render(param, paramOut); } } { for (auto it : mObjects){ auto obj = it.lock(); if (obj){ obj->Render(param, paramOut); } } } } }