| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "BsRenderBeastPrerequisites.h"
- #include "BsRendererMaterial.h"
- #include "BsParamBlocks.h"
- namespace bs { namespace ct
- {
- /** @addtogroup RenderBeast
- * @{
- */
- /** Information about a single light, as seen by the lighting shader. */
- struct LightData
- {
- Vector3 position;
- float radius;
- Vector3 direction;
- float intensity;
- Vector3 spotAngles;
- float radiusSqrdInv;
- Vector3 color;
- };
- /** Renderer information specific to a single light. */
- class RendererLight
- {
- public:
- RendererLight(Light* light);
- /** Populates the structure with light parameters. */
- void getParameters(LightData& output) const;
- /** Gets the internal light representation. */
- Light* getInternal() const { return mInternal; }
- private:
- Light* mInternal;
- };
- BS_PARAM_BLOCK_BEGIN(TiledLightingParamDef)
- BS_PARAM_BLOCK_ENTRY(Vector3I, gLightOffsets)
- BS_PARAM_BLOCK_END
- extern TiledLightingParamDef gTiledLightingParamDef;
- /** Shader that performs a lighting pass over data stored in the Gbuffer. */
- class TiledDeferredLightingMat : public RendererMaterial<TiledDeferredLightingMat>
- {
- RMAT_DEF("TiledDeferredLighting.bsl");
- public:
- TiledDeferredLightingMat();
- /** Binds the material for rendering, sets up parameters and executes it. */
- void execute(const SPtr<RenderTargets>& gbuffer, const SPtr<GpuParamBlockBuffer>& perCamera);
- /** Binds all the active lights. */
- void setLights(const Vector<LightData>& lightData, UINT32 numDirLights, UINT32 numRadialLights,
- UINT32 numSpotLights);
- private:
- GpuParamTexture mGBufferA;
- GpuParamTexture mGBufferB;
- GpuParamTexture mGBufferDepth;
- GpuParamBuffer mLightBufferParam;
- GpuParamLoadStoreTexture mOutputParam;
- SPtr<GpuParamBlockBuffer> mParamBuffer;
- SPtr<GpuBuffer> mLightBuffer;
- static const UINT32 TILE_SIZE;
- };
- /** @} */
- }}
|