Пример #1
0
        public void SkyManagerUpdate()
        {
            SkyTarget curSky = CurrentSkyTarget();

            curSkyGlowInt = curSky.glow;
            if (map == Find.CurrentMap)
            {
                MatBases.LightOverlay.color = curSky.colors.sky;
                //Find.CameraColor.saturation = curSky.colors.saturation;
                Color sky = curSky.colors.sky;
                sky.a = 1f;
                sky  *= FogOfWarBaseColor;
                MatBases.FogOfWar.color = sky;
                Color   color = curSky.colors.shadow;
                Vector3?overridenShadowVector = GetOverridenShadowVector();
                if (overridenShadowVector.HasValue)
                {
                    SetSunShadowVector(overridenShadowVector.Value);
                }
                else
                {
                    SetSunShadowVector(GenCelestial.GetLightSourceInfo(map, GenCelestial.LightType.Shadow).vector);
                    color = Color.Lerp(Color.white, color, GenCelestial.CurShadowStrength(map));
                }
                GenCelestial.LightInfo lightSourceInfo  = GenCelestial.GetLightSourceInfo(map, GenCelestial.LightType.LightingSun);
                GenCelestial.LightInfo lightSourceInfo2 = GenCelestial.GetLightSourceInfo(map, GenCelestial.LightType.LightingMoon);
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectSun, new Vector4(lightSourceInfo.vector.x, 0f, lightSourceInfo.vector.y, lightSourceInfo.intensity));
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectMoon, new Vector4(lightSourceInfo2.vector.x, 0f, lightSourceInfo2.vector.y, lightSourceInfo2.intensity));
                Shader.SetGlobalFloat("_LightsourceShineSizeReduction", 20f * (1f / curSky.lightsourceShineSize));
                Shader.SetGlobalFloat("_LightsourceShineIntensity", curSky.lightsourceShineIntensity);
                MatBases.SunShadow.color = color;
                UpdateOverlays(curSky);
            }
        }
Пример #2
0
        public void SkyManagerUpdate()
        {
            SkyTarget curSky = this.CurrentSkyTarget();

            this.curSkyGlowInt = curSky.glow;
            if (this.map == Find.VisibleMap)
            {
                MatBases.LightOverlay.color = curSky.colors.sky;
                Find.CameraColor.saturation = curSky.colors.saturation;
                Color color = curSky.colors.sky;
                color.a = 1f;
                color  *= SkyManager.FogOfWarBaseColor;
                MatBases.FogOfWar.color = color;
                Color   color2 = curSky.colors.shadow;
                Vector3?overridenShadowVector = this.GetOverridenShadowVector();
                if (overridenShadowVector.HasValue)
                {
                    this.SetSunShadowVector(overridenShadowVector.Value);
                }
                else
                {
                    GenCelestial.LightInfo lightSourceInfo = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.Shadow);
                    this.SetSunShadowVector(lightSourceInfo.vector);
                    color2 = Color.Lerp(Color.white, color2, GenCelestial.CurShadowStrength(this.map));
                }
                GenCelestial.LightInfo lightSourceInfo2 = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.LightingSun);
                GenCelestial.LightInfo lightSourceInfo3 = GenCelestial.GetLightSourceInfo(this.map, GenCelestial.LightType.LightingMoon);
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectSun, new Vector4(lightSourceInfo2.vector.x, 0f, lightSourceInfo2.vector.y, lightSourceInfo2.intensity));
                Shader.SetGlobalVector(ShaderPropertyIDs.WaterCastVectMoon, new Vector4(lightSourceInfo3.vector.x, 0f, lightSourceInfo3.vector.y, lightSourceInfo3.intensity));
                Shader.SetGlobalFloat("_LightsourceShineSizeReduction", (float)(20.0 * (1.0 / curSky.lightsourceShineSize)));
                Shader.SetGlobalFloat("_LightsourceShineIntensity", curSky.lightsourceShineIntensity);
                MatBases.SunShadow.color = color2;
                this.UpdateOverlays(curSky);
            }
        }
Пример #3
0
 private void SetSunShadowVector(Vector2 vec)
 {
     Shader.SetGlobalVector(ShaderPropertyIDs.MapSunLightDirection, new Vector4(vec.x, 0f, vec.y, GenCelestial.CurShadowStrength(map)));
 }
Пример #4
0
 // Token: 0x0600012B RID: 299 RVA: 0x0000AA80 File Offset: 0x00008C80
 public override void Draw()
 {
     this.spaceshipMatrix.SetTRS(this.DrawPos + Altitudes.AltIncVect, this.spaceshipExactRotation.ToQuat(), this.spaceshipScale);
     Graphics.DrawMesh(MeshPool.plane10, this.spaceshipMatrix, this.spaceshipTexture, 0);
     this.spaceshipShadowMatrix.SetTRS(this.ShadowDrawPos + Altitudes.AltIncVect, this.spaceshipExactRotation.ToQuat(), this.spaceshipShadowScale);
     Graphics.DrawMesh(MeshPool.plane10, this.spaceshipShadowMatrix, FadedMaterialPool.FadedVersionOf(this.spaceshipShadowTexture, 0.75f * GenCelestial.CurShadowStrength(base.Map)), 0);
 }
Пример #5
0
        public void DrawDropSpotShadow(Vector3 center, float rot, Material material, Vector2 shadowSize, int ticksToImpact, bool flip)
        {
            if (base.Rotation.IsHorizontal)
            {
                Gen.Swap <float>(ref shadowSize.x, ref shadowSize.y);
            }
            ticksToImpact = Mathf.Max(ticksToImpact, 0);
            Vector3 pos = center;

            pos.y = AltitudeLayer.Shadows.AltitudeFor();
            //    float num = 1f + (float)ticksToImpact / 100f;
            float f   = !this.def.skyfaller.zPositionCurve.EnumerableNullOrEmpty() ? this.def.skyfaller.zPositionCurve.Evaluate(this.TimeInAnimation) : this.TimeInAnimation;
            float num = 1f + Mathf.Max(0.25f, f) / 100f;
            //    shadow = 1f * (float)ticksToImpact / 100f;
            Vector3 s     = new Vector3(num * shadowSize.x, 1f, num * shadowSize.y);
            Color   white = Color.white;

            if (ticksToImpact > 150)
            {
                white.a = Mathf.InverseLerp(200f, 150f, (float)ticksToImpact);
            }
            DropShipIncoming.shadowPropertyBlock.SetColor(ShaderPropertyIDs.Color, white);
            this.shadowMatrix.SetTRS(this.ShadowDrawPos + Altitudes.AltIncVect, (-rot).ToQuat(), s);
            Graphics.DrawMesh(MeshPool.plane10, this.shadowMatrix, FadedMaterialPool.FadedVersionOf(material, 0.4f * GenCelestial.CurShadowStrength(base.Map)), 0, null, 0);

            /*
             * matrix.SetTRS(pos, rot.AsQuat, s);
             * Graphics.DrawMesh(MeshPool.plane10Back, matrix, material, 0, null, 0, DropShipLeaving.shadowPropertyBlock);
             */
        }
Пример #6
0
        public new void DrawDropSpotShadow(Vector3 center, Rot4 rot, Material material, Vector2 shadowSize, int ticksToImpact)
        {
            if (rot.IsHorizontal)
            {
                Gen.Swap <float>(ref shadowSize.x, ref shadowSize.y);
            }
            ticksToImpact = Mathf.Max(ticksToImpact, 0);
            Vector3 pos = center;

            pos.y = AltitudeLayer.Shadows.AltitudeFor();
            float   num   = 1f + (float)ticksToImpact / 100f;
            Vector3 s     = new Vector3(num * shadowSize.x, 1f, num * shadowSize.y);
            Color   white = Color.white;

            if (ticksToImpact > 150)
            {
                white.a = Mathf.InverseLerp(200f, 150f, (float)ticksToImpact);
            }
            DropShipLeaving.shadowPropertyBlock.SetColor(ShaderPropertyIDs.Color, white);
            this.shadowMatrix.SetTRS(this.ShadowDrawPos + Altitudes.AltIncVect, this.angle.ToQuat(), this.shadowScale);
            Graphics.DrawMesh(MeshPool.plane10, this.shadowMatrix, FadedMaterialPool.FadedVersionOf(this.ShadowMaterial, 0.4f * GenCelestial.CurShadowStrength(base.Map)), 0);
            Matrix4x4 matrix = default(Matrix4x4);

            /*
             * matrix.SetTRS(pos, rot.AsQuat, s);
             * Graphics.DrawMesh(MeshPool.plane10Back, matrix, material, 0, null, 0, DropShipLeaving.shadowPropertyBlock);
             */
        }