Пример #1
0
        void SetupShaderLightConstants(CommandBuffer cmd, ref LightsData lightData, ref CameraData cameraData)
        {
            if (lightData.lightLoop.spritesAtlas != null)
            {
                cmd.SetGlobalTexture(LightConstantBuffer._lightsatlasmap, lightData.lightLoop.spritesAtlas.texture);
            }
            cmd.SetGlobalVector(LightConstantBuffer._ClusterInfo,
                                new Vector4(settings.NumClusterX,
                                            settings.NumClusterY,
                                            settings.NumClusterZ,
                                            settings.MaxItemsPerCluster));

            cmd.SetGlobalVector(LightConstantBuffer._IFScreenSize, cameraData.screenSize);
            cmd.SetGlobalVector(LightConstantBuffer._ClusterLighting, cameraData.ClusterdLighting);
            cmd.SetGlobalVector(LightConstantBuffer._ClusterCB_Size, cameraData._ClusterCB_Size);
            cmd.SetGlobalVector(LightConstantBuffer._IFScreenSize, cameraData.screenSize);
            cmd.SetGlobalBuffer(LightConstantBuffer.LightsDataList, lightData.lightLoop.lightLoopLightsData.LightsDatasBuf);
            cmd.SetGlobalBuffer(LightConstantBuffer._ItemsIDList, lightData.lightLoop.tileAndClusterData.itemsIDListBuf);
            cmd.SetGlobalBuffer(LightConstantBuffer.ClusterNumItems, lightData.lightLoop.tileAndClusterData.clusterNumItemsBuf);
            cmd.SetGlobalVector("_CameraClipDistance", new Vector4(
                                    cameraData.camera.nearClipPlane,
                                    cameraData.camera.farClipPlane - cameraData.camera.nearClipPlane, 0, 0));
        }
Пример #2
0
        static void InitializeLightData(PipelineSettings settings, List <VisibleLight> visibleLights, LightLoop lightloop, out LightsData lightData)
        {
            //        public int mainLightIndex;
            //public int additionalLightsCount;
            //public int maxPerObjectAdditionalLightsCount;
            //public List<VisibleLight> visibleLights;
            //public bool shadeAdditionalLightsPerVertex;
            //public bool supportsMixedLighting;


            lightData.visibleLights = visibleLights;
            lightData.lightLoop     = lightloop;
            //lightData.mainLightIndex = 0;
        }