예제 #1
0
    void Start()
    {
        Cursor.visible   = false;
        Cursor.lockState = CursorLockMode.Locked;

        _textComponents = this.canvas.GetComponentsInChildren <Text>();

        //initialSkyColor = RenderSettings.fogColor;
        _initialFogSettings = new FogSettings();

        _speed = baseSpeed;

        if (characterController == null)
        {
            characterController = GetComponent <CharacterController>();
        }

        // Mouse Movement
        Vector3 rot = camera.localRotation.eulerAngles;

        rotY = rot.y;
        rotX = rot.x;

        // PlacePlayerOnSurface(false);
    }
예제 #2
0
    public static void SetFogSettings(FogSettings fogSettings)
    {
        VRC.Core.Logger.Log("Force-enabling Fog", VRC.Core.DebugLevel.All);

        const string     graphicsSettingsAssetPath = "ProjectSettings/GraphicsSettings.asset";
        SerializedObject graphicsManager           = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(graphicsSettingsAssetPath)[0]);

        SerializedProperty fogStripping = graphicsManager.FindProperty("m_FogStripping");

        fogStripping.enumValueIndex = (int)fogSettings.fogStrippingMode;

        SerializedProperty fogKeepLinear = graphicsManager.FindProperty("m_FogKeepLinear");

        fogKeepLinear.boolValue = fogSettings.keepLinear;

        SerializedProperty fogKeepExp = graphicsManager.FindProperty("m_FogKeepExp");

        fogKeepExp.boolValue = fogSettings.keepExp;

        SerializedProperty fogKeepExp2 = graphicsManager.FindProperty("m_FogKeepExp2");

        fogKeepExp2.boolValue = fogSettings.keepExp2;

        graphicsManager.ApplyModifiedProperties();
    }
예제 #3
0
 /// <summary>
 /// Load fog for this scene
 /// </summary>
 /// <param name="fogPath">Path to fog environmental settings</param>
 public void LoadFog(string fogPath)
 {
     if (fogPath.Length > 0)
     {
         fogSettings = this.game.Content.Load <FogSettings>(fogPath);
     }
 }
예제 #4
0
 public override void ApplyFogSettings(FogSettings fogSettings)
 {
     device.SetUniformValue(modelViewMatrixLocation, modelViewMatrix);
     SetUniformColorValue(fogColorUniformLocation, fogSettings.FogColor);
     device.SetUniformValue(fogStartUniformLocation, fogSettings.FogStart);
     device.SetUniformValue(fogEndUniformLocation, fogSettings.FogEnd);
 }
예제 #5
0
    public static FogSettings GetFogSettings()
    {
        VRC.Core.Logger.Log("Force-enabling Fog", VRC.Core.DebugLevel.All);

        const string     graphicsSettingsAssetPath = "ProjectSettings/GraphicsSettings.asset";
        SerializedObject graphicsManager           = new SerializedObject(AssetDatabase.LoadAllAssetsAtPath(graphicsSettingsAssetPath)[0]);


        SerializedProperty fogStrippingSerializedProperty = graphicsManager.FindProperty("m_FogStripping");

        FogSettings.FogStrippingMode fogStripping = (FogSettings.FogStrippingMode)fogStrippingSerializedProperty.enumValueIndex;

        SerializedProperty fogKeepLinearSerializedProperty = graphicsManager.FindProperty("m_FogKeepLinear");
        bool keepLinear = fogKeepLinearSerializedProperty.boolValue;

        SerializedProperty fogKeepExpSerializedProperty = graphicsManager.FindProperty("m_FogKeepExp");
        bool keepExp = fogKeepExpSerializedProperty.boolValue;

        SerializedProperty fogKeepExp2SerializedProperty = graphicsManager.FindProperty("m_FogKeepExp2");
        bool keepExp2 = fogKeepExp2SerializedProperty.boolValue;

        FogSettings fogSettings = new FogSettings(fogStripping, keepLinear, keepExp, keepExp2);

        return(fogSettings);
    }
예제 #6
0
 public override void ApplyFogSettings(FogSettings fogSettings)
 {
     device.ShaderEffect.FogEnabled = Flags.HasFlag(ShaderFlags.Fog);
     device.ShaderEffect.FogColor   = new Vector3(fogSettings.FogColor.RedValue,
                                                  fogSettings.FogColor.GreenValue, fogSettings.FogColor.BlueValue);
     device.ShaderEffect.FogStart = fogSettings.FogStart;
     device.ShaderEffect.FogEnd   = fogSettings.FogEnd;
 }
예제 #7
0
        public void CreatingOwnFogSettingsWillChangeTheCurrentSettings()
        {
            FogSettings defaultSettings = FogSettings.Current;
            var         ownFogSettings  = new FogSettings(Color.Green, 1, 2);

            Assert.AreNotEqual(defaultSettings, ownFogSettings);
            Assert.AreEqual(ownFogSettings, FogSettings.Current);
        }
예제 #8
0
        public void CurrentFogSettingsWillBeFilledWithDefaultValuesIfNoSpecificSettingsAreSet()
        {
            FogSettings defaultSettings = FogSettings.Current;

            Assert.AreNotEqual(0, defaultSettings.FogStart);
            Assert.AreNotEqual(0, defaultSettings.FogEnd);
            Assert.AreNotEqual(0, defaultSettings.FogColor.A);
        }
예제 #9
0
            public static FogSettings ReadFogSettings(this SCMap scMap)
            {
                FogSettings fogSettings = new FogSettings();

                fogSettings.fogColor = scMap.ReadColorRGB();
                fogSettings.fogStart = scMap.ReadFloat();
                fogSettings.fogEnd   = scMap.ReadFloat();
                return(fogSettings);
            }
예제 #10
0
    public void ApplySettings(FogSettings settings)
    {
        RenderSettings.fogStartDistance = 0;
        RenderSettings.fog      = settings.Active;
        RenderSettings.fogColor = settings.Color;
        SetFogDistance(settings.EndDistance);

        CurrentSettings = settings;
    }
예제 #11
0
 public override void ApplyFogSettings(FogSettings fogSettings)
 {
     SetVertexShaderConstant(Matrix.Transpose(worldMatrix));
     // SlimDX optimizes the World matrix to 4x3 we only need for our world position a float3
     IncrementVertexShaderRegister(-4);
     SetVertexShaderConstant(device.CameraInvertedViewMatrix.Translation, false);
     SetVertexShaderConstant(fogSettings.FogColor);
     SetVertexShaderConstants(fogSettings.FogStart, fogSettings.FogEnd, 0.0f, 0.0f);
 }
예제 #12
0
 public static FogSettings Lerp(FogSettings source, FogSettings target, float t)
 {
     return(new FogSettings()
     {
         Density = Mathf.Lerp(source.Density, target.Density, t),
         StartDistance = Mathf.Lerp(source.StartDistance, target.StartDistance, t),
         Height = Mathf.Lerp(source.Height, target.Height, t),
         HeightDensity = Mathf.Lerp(source.HeightDensity, target.HeightDensity, t)
     });
 }
예제 #13
0
        public void SetFog(FogSettings fogSettings, bool isInteriorOrDungeonFog = false)
        {
            // if fog is a outdoor weather fog set currentOutdoorFogSettings so fog settings can be restored when player goes into an interior/dungeon and then back to exterior
            if (isInteriorOrDungeonFog == false)
            {
                currentOutdoorFogSettings = fogSettings;
            }
            else // if in interior or dungeon
            {
                // set fog color to black
                RenderSettings.fogColor = Color.black;
            }

            // set fog mode first
            RenderSettings.fogMode          = fogSettings.fogMode;
            RenderSettings.fogDensity       = fogSettings.density;
            RenderSettings.fogStartDistance = fogSettings.startDistance;
            RenderSettings.fogEndDistance   = fogSettings.endDistance;

            // edit by Nystul: don't disable RenderSettings fog! Rendering Fog != Weather Fog
            //RenderSettings.fog = isFoggy;

            if (fogSettings.excludeSkybox == false)
            {
                //                RenderSettings.fogColor = Color.gray;

                if (postProcessingBehaviour != null)
                {
                    var fogPostProcess = postProcessingBehaviour.profile.fog.settings;
                    fogPostProcess.excludeSkybox = false;
                    postProcessingBehaviour.profile.fog.settings = fogPostProcess;
                }
            }
            else
            {
                // TODO set this based on ... something.
                // ex. time of day/angle of sun so we can get nice sunset/rise atmospheric effects
                // also blend with climate so climates end up having faint 'tints' to them
                //                RenderSettings.fogColor = Color.clear;

                if (postProcessingBehaviour != null)
                {
                    var fogPostProcess = postProcessingBehaviour.profile.fog.settings;
                    fogPostProcess.excludeSkybox = true;
                    postProcessingBehaviour.profile.fog.settings = fogPostProcess;
                }
            }
        }
        public override void ApplyFogSettings(FogSettings fogSettings)
        {
            Vector3D cameraPosition = device.CameraInvertedViewMatrix.Translation;

            shaderValues.CameraPosition = new[]
            {
                cameraPosition.X, cameraPosition.Y, cameraPosition.Z, 1.0f
            };
            shaderValues.FogColorChannels = new[]
            {
                fogSettings.FogColor.RedValue, fogSettings.FogColor.GreenValue,
                fogSettings.FogColor.BlueValue, 1.0f
            };
            shaderValues.FogStart = fogSettings.FogStart;
            shaderValues.FogEnd   = fogSettings.FogEnd;
        }
예제 #15
0
    // continuous settings are lerped continuously from original to target over time seconds. discrete settings are switched from original to target after time seconds
    IEnumerator lerp(FogSettings original, FogSettings target, float time)
    {
        ApplySettings(original);

        float timer = 0;

        while (timer < time)
        {
            float dist = Mathf.Lerp(original.EndDistance, target.EndDistance, timer / time);
            Color col  = Color.Lerp(original.Color, target.Color, timer / time);

            SetFogDistance(dist);
            RenderSettings.fogColor = col;

            timer += Time.deltaTime;
            yield return(null);
        }

        ApplySettings(target);
    }
예제 #16
0
    public bool ParseSCMapFile(string filePath = "")
    {
        if (filePath != "")
        {
            OpenSCMap(filePath);
        }

        fs = scMapFile.Open(FileMode.Open, FileAccess.Read);

        header = this.ReadMapHeader();

        terrain = this.ReadSCTearrain();

        lightingSettings = this.ReadLightingSettings();

        fogSettings = this.ReadFogSettings();

        waterSettings = this.ReadWaterSettings();

        float_8          = this.ReadFloats(20);
        waterTexture     = this.ReadString();
        waterTextureRamp = this.ReadString();
        float_9          = this.ReadFloats(4);

        //Read Waves
        for (int i = 0; i < 4; i++)
        {
            Wave wave = this.ReadWave();
            waves.Add(wave);
        }

        //Read GClass0
        int gClass0Count = this.ReadInt();

        for (int i = 0; i < gClass0Count; i++)
        {
            GClass0 tmpGClass0 = this.ReadGClass0();
            gClass0.Add(tmpGClass0);
        }
        hasGClass0 = !waterSettings.hasWater || gClass0Count > 0;


        unk0 = this.ReadString();

        //Read GClass69
        int gClass69Count = this.ReadInt();

        for (int i = 0; i < gClass69Count; i++)
        {
            Layer tmpLayer = this.ReadGClass69();
            layers.Add(tmpLayer);
        }


        int_9  = this.ReadInt();
        int_10 = this.ReadInt();


        //Read gClass1
        int gClass1Count = this.ReadInt();

        for (int i = 0; i < gClass1Count; i++)
        {
            GClass1 gClass1 = this.ReadDecal();
            gClass1s.Add(gClass1);
        }

        //Read GClass70

        int gClass70Count = this.ReadInt();

        for (int i = 0; i < gClass70Count; i++)
        {
            GClass70 gClass70 = this.ReadGClass70();
            gClass70s.Add(gClass70);
        }

        unk1 = this.ReadInt();
        unk2 = this.ReadInt();

        //Read UnknowArray

        count3 = this.ReadInt();
        int lenght3 = this.ReadInt();

        numArray3 = this.ReadBytes(lenght3);// texture terrain colors?
        for (int i = 1; i < count3; i++)
        {
            lenght3 = this.ReadInt();
            this.SkipBytes(lenght3);
        }

        unk3 = this.ReadInt();

        int lenght2 = this.ReadInt();

        numArray2 = this.ReadBytes(lenght2);// texture?

        unk4 = this.ReadInt();

        toSkip0 = this.ReadInt();
        this.SkipBytes(toSkip0);

        toSkip1 = Mathf.RoundToInt(terrain.size.x / 2 * terrain.size.y / 2);
        this.SkipBytes(toSkip1);
        this.SkipBytes(toSkip1);
        this.SkipBytes(toSkip1);

        byte_0 = this.ReadBytes((int)(terrain.size.x * terrain.size.y));

        if (header.version <= 52)
        {
            unk5 = this.ReadShort();
        }

        //Read Prop

        int propCount = this.ReadInt();

        for (int i = 0; i < propCount; i++)
        {
            Prop prop = this.ReadProp();
            props.Add(prop);
        }

        fs.Close();

        return(true);
    }
예제 #17
0
 public override void ApplyFogSettings(FogSettings fogSettings)
 {
 }
예제 #18
0
 static FogSettings()
 {
     FogSettings     fogSettings = new FogSettings();
     ref FogSettings local       = ref fogSettings;
예제 #19
0
 public void Fade(FogSettings target, float time)
 {
     StartCoroutine(lerp(CurrentSettings, target, time));
 }
예제 #20
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public Scene(QSGame game)
 {
     this.game        = game;
     this.fogSettings = new FogSettings();
 }