Exemple #1
0
        protected virtual void LateUpdate()
        {
            // Write lights and shadows
            SgtHelper.SetTempMaterial(material);

            var mask   = 1 << gameObject.layer;
            var lights = SgtLight.Find(lit, mask, transform.position);

            SgtShadow.Find(lit, mask, lights);
            SgtShadow.FilterOutRing(transform.position);
            SgtShadow.Write(lit, 2);

            SgtLight.FilterOut(transform.position);
            SgtLight.Write(lit, transform.position, null, null, scatteringStrength, 2);

            // Update scrolling?
            if (detail == true)
            {
                if (Application.isPlaying == true)
                {
                    detailOffset += detailSpeed * Time.deltaTime;
                }

                if (material != null)
                {
                    material.SetVector(SgtShader._DetailOffset, detailOffset);
                }
            }
        }
        protected void CameraPreRender(Camera camera)
        {
            if (material != null)
            {
                var observer = default(SgtCamera);

                if (SgtCamera.TryFind(camera, ref observer) == true)
                {
                    material.SetFloat(SgtShader._CameraRollAngle, observer.RollAngle * Mathf.Deg2Rad);
                }
                else
                {
                    material.SetFloat(SgtShader._CameraRollAngle, 0.0f);
                }

                // Write these once to save CPU
                if (renderedThisFrame == false)
                {
                    renderedThisFrame = true;

                    // Write lights and shadows
                    SgtHelper.SetTempMaterial(material);

                    var mask   = 1 << gameObject.layer;
                    var lights = SgtLight.Find(Lit, mask);

                    SgtShadow.Find(Lit, mask, lights);
                    SgtShadow.FilterOutRing(transform.position);
                    SgtShadow.Write(Lit, 2);

                    SgtLight.Write(Lit, transform.position, transform, null, 1.0f, 2);
                }
            }
        }
        private void CameraPreRender(Camera camera)
        {
            // Write these once to save CPU
            if (renderedThisFrame == false && material != null)
            {
                renderedThisFrame = true;

                // Write lights and shadows
                SgtHelper.SetTempMaterial(material);

                var mask   = 1 << gameObject.layer;
                var lights = SgtLight.Find(Lit, mask);

                SgtShadow.Find(Lit, mask, lights);
                SgtShadow.FilterOutRing(transform.position);
                SgtShadow.Write(Lit, mask, 2);

                SgtLight.FilterOut(transform.position);
                SgtLight.Write(Lit, transform.position, null, null, ScatteringStrength, 2);
            }
        }
Exemple #4
0
        protected override void LateUpdate()
        {
            base.LateUpdate();

            if (Application.isPlaying == true)
            {
                orbitOffset += Time.deltaTime * orbitSpeed;
            }

            material.SetFloat(SgtShader._Age, orbitOffset);

            // Write lights and shadows
            SgtHelper.SetTempMaterial(material);

            var mask   = 1 << gameObject.layer;
            var lights = SgtLight.Find(lit, mask, transform.position);

            SgtShadow.Find(lit, mask, lights);
            SgtShadow.FilterOutRing(transform.position);
            SgtShadow.Write(lit, 2);

            SgtLight.Write(lit, transform.position, transform, null, 1.0f, 2);
        }