Пример #1
0
        public static NwEnvironment ToNwEnvironment(Assets.Environment env)
        {
            var e = new NwEnvironment()
            {
                Ambient      = env.Ambient.ToColor4f(),
                CastShadow   = env.CastShadow,
                ColorCollect = new NwColorCollect()
                {
                    Brightness = env.ColorCollect.Brightness,
                    Contrast   = env.ColorCollect.Contrast,
                    Gamma      = env.ColorCollect.Gamma,
                    Hue        = env.ColorCollect.Hue,
                    Saturation = env.ColorCollect.Saturation,
                },
                DirLight = new NwDirectionalLight()
                {
                    Color     = env.DirLightColor.ToColor4f(),
                    Direction = env.DirLightDir.ToVec3f(),
                    Intensity = env.DirLightIntensity,
                },
                EnvMap = GetHash(env.EnvMap),
            };

            return(e);
        }
Пример #2
0
        public static Assets.Environment FromNwEnvironment(NwEnvironment env, TextureCube envMap)
        {
            var e = new Assets.Environment()
            {
                Ambient      = new Color4(env.Ambient.R, env.Ambient.G, env.Ambient.B, env.Ambient.A),
                CastShadow   = env.CastShadow,
                ColorCollect = new ColorCollect()
                {
                    Brightness = env.ColorCollect.Brightness,
                    Contrast   = env.ColorCollect.Contrast,
                    Gamma      = env.ColorCollect.Gamma,
                    Hue        = env.ColorCollect.Hue,
                    Saturation = env.ColorCollect.Saturation,
                },
                DirLightColor     = new Color4(env.DirLight.Color.R, env.DirLight.Color.G, env.DirLight.Color.B, env.DirLight.Color.A),
                DirLightDir       = new Vector3(env.DirLight.Direction.X, env.DirLight.Direction.Y, env.DirLight.Direction.Z),
                DirLightIntensity = env.DirLight.Intensity,

                EnvMap = envMap,
            };

            return(e);
        }