示例#1
0
 /// <summary>
 ///   Sets the fog color in the area specified.
 ///   nFogType = FOG_TYPE_* specifies wether the Sun, Moon, or both fog types are set.
 ///   nFogColor = FOG_COLOR_* specifies the color the fog is being set to.
 ///   The fog color can also be represented as a hex RGB number if specific color shades
 ///   are desired.
 ///   The format of a hex specified color would be 0xFFEEDD where
 ///   FF would represent the amount of red in the color
 ///   EE would represent the amount of green in the color
 ///   DD would represent the amount of blue in the color.
 ///   If no valid area (or object) is specified, it uses the area of caller.
 ///   If an object other than an area is specified, will use the area that the object is currently in.
 /// </summary>
 public static void SetFogColor(FogType nFogType, FogColor nFogColor, uint oArea = global::SWLOR.Game.Server.NWN._.OBJECT_INVALID)
 {
     Internal.NativeFunctions.StackPushObject(oArea);
     Internal.NativeFunctions.StackPushInteger((int)nFogColor);
     Internal.NativeFunctions.StackPushInteger((int)nFogType);
     Internal.NativeFunctions.CallBuiltIn(780);
 }
示例#2
0
        protected override void WriteDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            ele.TryPathTo("Color/Ambient", true, out subEle);
            ColorAmbient.WriteXML(subEle, master);

            ele.TryPathTo("Color/Directional", true, out subEle);
            ColorDirectional.WriteXML(subEle, master);

            ele.TryPathTo("Fog/Color", true, out subEle);
            FogColor.WriteXML(subEle, master);

            ele.TryPathTo("Fog/Near", true, out subEle);
            subEle.Value = FogNear.ToString("G15");

            ele.TryPathTo("Fog/Far", true, out subEle);
            subEle.Value = FogFar.ToString("G15");

            ele.TryPathTo("DirectionalRotation/XY", true, out subEle);
            subEle.Value = DirectionalRotationXY.ToString();

            ele.TryPathTo("DirectionalRotation/Z", true, out subEle);
            subEle.Value = DirectionalRotationZ.ToString();

            ele.TryPathTo("DirectionalFade", true, out subEle);
            subEle.Value = DirectionalFade.ToString("G15");

            ele.TryPathTo("Fog/ClipDistance", true, out subEle);
            subEle.Value = FogClipDistance.ToString("G15");

            ele.TryPathTo("Fog/Power", true, out subEle);
            subEle.Value = FogPower.ToString("G15");
        }
示例#3
0
 /// <summary>
 ///   Sets the fog color in the area specified.
 ///   nFogType = FOG_TYPE_* specifies wether the Sun, Moon, or both fog types are set.
 ///   nFogColor = FOG_COLOR_* specifies the color the fog is being set to.
 ///   The fog color can also be represented as a hex RGB number if specific color shades
 ///   are desired.
 ///   The format of a hex specified color would be 0xFFEEDD where
 ///   FF would represent the amount of red in the color
 ///   EE would represent the amount of green in the color
 ///   DD would represent the amount of blue in the color.
 ///   If no valid area (or object) is specified, it uses the area of caller.
 ///   If an object other than an area is specified, will use the area that the object is currently in.
 /// </summary>
 public static void SetFogColor(FogType nFogType, FogColor nFogColor, uint oArea = Core.NWScript.NWScript.OBJECT_INVALID)
 {
     Internal.NativeFunctions.StackPushObject(oArea);
     Internal.NativeFunctions.StackPushInteger((int)nFogColor);
     Internal.NativeFunctions.StackPushInteger((int)nFogType);
     Internal.NativeFunctions.CallBuiltIn(780);
 }
示例#4
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add("m_Fog", Fog);
            node.Add("m_FogColor", FogColor.ExportYAML(container));
            node.Add("m_FogMode", (int)GetExportFogMode(container.Version));
            node.Add("m_FogDensity", FogDensity);
            node.Add("m_LinearFogStart", LinearFogStart);
            node.Add("m_LinearFogEnd", GetExportLinearFogEnd(container.Version));
            node.Add("m_AmbientSkyColor", AmbientSkyColor.ExportYAML(container));
            node.Add("m_AmbientEquatorColor", GetExportAmbientEquatorColor(container.Version).ExportYAML(container));
            node.Add("m_AmbientGroundColor", GetExportAmbientGroundColor(container.Version).ExportYAML(container));
            node.Add("m_AmbientIntensity", GetExportAmbientIntensity(container.Version));
            node.Add("m_AmbientMode", (int)AmbientMode);
            node.Add("m_SubtractiveShadowColor", GetExportSubtractiveShadowColor(container.Version).ExportYAML(container));
            node.Add("m_SkyboxMaterial", SkyboxMaterial.ExportYAML(container));
            node.Add("m_HaloStrength", HaloStrength);
            node.Add("m_FlareStrength", FlareStrength);
            node.Add("m_FlareFadeSpeed", GetExportFlareFadeSpeed(container.Version));
            node.Add("m_HaloTexture", HaloTexture.ExportYAML(container));
            node.Add("m_SpotCookie", SpotCookie.ExportYAML(container));
            node.Add("m_DefaultReflectionMode", DefaultReflectionMode);
            node.Add("m_DefaultReflectionResolution", GetExportDefaultReflectionResolution(container.Version));
            node.Add("m_ReflectionBounces", GetExportReflectionBounces(container.Version));
            node.Add("m_ReflectionIntensity", GetExportReflectionIntensity(container.Version));
            node.Add("m_CustomReflection", CustomReflection.ExportYAML(container));
            node.Add("m_Sun", Sun.ExportYAML(container));
            node.Add("m_IndirectSpecularColor", GetExportIndirectSpecularColor(container.Version).ExportYAML(container));
            return(node);
        }
示例#5
0
 public DungeonLayer(Point _enterCoords)
 {
     Ambient      = new FColor(0, 0, 0.01f, 0.01f);
     EnterCoords  = _enterCoords;
     FogColor     = FColor.FromArgb(255, 100, 100, 100);
     FogLightness = FogColor.Lightness();
 }
示例#6
0
        protected override YAMLMappingNode ExportYAMLRoot(IExportContainer container)
        {
            YAMLMappingNode node = base.ExportYAMLRoot(container);

            node.AddSerializedVersion(GetSerializedVersion(container.Version));
            node.Add(FogName, Fog);
            node.Add(FogColorName, FogColor.ExportYAML(container));
            node.Add(FogModeName, (int)GetExportFogMode(container.Version));
            node.Add(FogDensityName, FogDensity);
            node.Add(LinearFogStartName, LinearFogStart);
            node.Add(LinearFogEndName, GetExportLinearFogEnd(container.Version));
            node.Add(AmbientSkyColorName, AmbientSkyColor.ExportYAML(container));
            node.Add(AmbientEquatorColorName, GetExportAmbientEquatorColor(container.Version).ExportYAML(container));
            node.Add(AmbientGroundColorName, GetExportAmbientGroundColor(container.Version).ExportYAML(container));
            node.Add(AmbientIntensityName, GetExportAmbientIntensity(container.Version));
            node.Add(AmbientModeName, (int)AmbientMode);
            node.Add(SubtractiveShadowColorName, GetExportSubtractiveShadowColor(container.Version).ExportYAML(container));
            node.Add(SkyboxMaterialName, SkyboxMaterial.ExportYAML(container));
            node.Add(HaloStrengthName, HaloStrength);
            node.Add(FlareStrengthName, FlareStrength);
            node.Add(FlareFadeSpeedName, GetExportFlareFadeSpeed(container.Version));
            node.Add(HaloTextureName, HaloTexture.ExportYAML(container));
            node.Add(SpotCookieName, SpotCookie.ExportYAML(container));
            node.Add(DefaultReflectionModeName, DefaultReflectionMode);
            node.Add(DefaultReflectionResolutionName, GetExportDefaultReflectionResolution(container.Version));
            node.Add(ReflectionBouncesName, GetExportReflectionBounces(container.Version));
            node.Add(ReflectionIntensityName, GetExportReflectionIntensity(container.Version));
            node.Add(CustomReflectionName, CustomReflection.ExportYAML(container));
            node.Add(SunName, Sun.ExportYAML(container));
            node.Add(IndirectSpecularColorName, GetExportIndirectSpecularColor(container.Version).ExportYAML(container));
            return(node);
        }
示例#7
0
 protected WorldLayer()
 {
     Blocks       = new Dictionary <Point, MapBlock>();
     FogColor     = FColor.FromArgb(255, 60, 60, 60);
     FogLightness = FogColor.Lightness() / 2;
     ///6;
 }
示例#8
0
        protected override YAMLMappingNode ExportYAMLRoot(IAssetsExporter exporter)
        {
#warning TODO: values acording to read version (current 2017.3.0f3)
            YAMLMappingNode node = base.ExportYAMLRoot(exporter);
            node.AddSerializedVersion(GetSerializedVersion(exporter.Version));
            node.Add("m_Fog", Fog);
            node.Add("m_FogColor", FogColor.ExportYAML(exporter));
            node.Add("m_FogMode", FogMode);
            node.Add("m_FogDensity", FogDensity);
            node.Add("m_LinearFogStart", LinearFogStart);
            node.Add("m_LinearFogEnd", LinearFogEnd);
            node.Add("m_AmbientSkyColor", AmbientSkyColor.ExportYAML(exporter));
            node.Add("m_AmbientEquatorColor", AmbientEquatorColor.ExportYAML(exporter));
            node.Add("m_AmbientGroundColor", AmbientGroundColor.ExportYAML(exporter));
            node.Add("m_AmbientIntensity", AmbientIntensity);
            node.Add("m_AmbientMode", AmbientMode);
            node.Add("m_SubtractiveShadowColor", SubtractiveShadowColor.ExportYAML(exporter));
            node.Add("m_SkyboxMaterial", SkyboxMaterial.ExportYAML(exporter));
            node.Add("m_HaloStrength", HaloStrength);
            node.Add("m_FlareStrength", FlareStrength);
            node.Add("m_FlareFadeSpeed", FlareFadeSpeed);
            node.Add("m_HaloTexture", HaloTexture.ExportYAML(exporter));
            node.Add("m_SpotCookie", SpotCookie.ExportYAML(exporter));
            node.Add("m_DefaultReflectionMode", DefaultReflectionMode);
            node.Add("m_DefaultReflectionResolution", DefaultReflectionResolution);
            node.Add("m_ReflectionBounces", ReflectionBounces);
            node.Add("m_ReflectionIntensity", ReflectionIntensity);
            node.Add("m_CustomReflection", CustomReflection.ExportYAML(exporter));
            node.Add("m_AmbientProbe", AmbientProbe.ExportYAML(exporter));
            node.Add("m_GeneratedSkyboxReflection", GeneratedSkyboxReflection.ExportYAML(exporter));
            node.Add("m_Sun", Sun.ExportYAML(exporter));
            node.Add("m_IndirectSpecularColor", IndirectSpecularColor.ExportYAML(exporter));
            return(node);
        }
示例#9
0
        protected override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("Color/Ambient", false, out subEle))
            {
                ColorAmbient.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Color/Directional", false, out subEle))
            {
                ColorDirectional.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Fog/Color", false, out subEle))
            {
                FogColor.ReadXML(subEle, master);
            }

            if (ele.TryPathTo("Fog/Near", false, out subEle))
            {
                FogNear = subEle.ToSingle();
            }

            if (ele.TryPathTo("Fog/Far", false, out subEle))
            {
                FogFar = subEle.ToSingle();
            }

            if (ele.TryPathTo("DirectionalRotation/XY", false, out subEle))
            {
                DirectionalRotationXY = subEle.ToInt32();
            }

            if (ele.TryPathTo("DirectionalRotation/Z", false, out subEle))
            {
                DirectionalRotationZ = subEle.ToInt32();
            }

            if (ele.TryPathTo("DirectionalFade", false, out subEle))
            {
                DirectionalFade = subEle.ToSingle();
            }

            if (ele.TryPathTo("Fog/ClipDistance", false, out subEle))
            {
                FogClipDistance = subEle.ToSingle();
            }

            if (ele.TryPathTo("Fog/Power", false, out subEle))
            {
                FogPower = subEle.ToSingle();
            }
        }
示例#10
0
 protected override void WriteData(ESPWriter writer)
 {
     ColorAmbient.WriteBinary(writer);
     ColorDirectional.WriteBinary(writer);
     FogColor.WriteBinary(writer);
     writer.Write(FogNear);
     writer.Write(FogFar);
     writer.Write(DirectionalRotationXY);
     writer.Write(DirectionalRotationZ);
     writer.Write(DirectionalFade);
     writer.Write(FogClipDistance);
     writer.Write(FogPower);
 }
示例#11
0
        public void Read(AssetReader reader)
        {
            Name = reader.ReadStringAligned();
            RtBlend0.Read(reader);
            RtBlend1.Read(reader);
            RtBlend2.Read(reader);
            RtBlend3.Read(reader);
            RtBlend4.Read(reader);
            RtBlend5.Read(reader);
            RtBlend6.Read(reader);
            RtBlend7.Read(reader);
            RtSeparateBlend = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);

            if (IsReadZClip(reader.Version))
            {
                ZClip.Read(reader);
            }
            ZTest.Read(reader);
            ZWrite.Read(reader);
            Culling.Read(reader);
            OffsetFactor.Read(reader);
            OffsetUnits.Read(reader);
            AlphaToMask.Read(reader);
            StencilOp.Read(reader);
            StencilOpFront.Read(reader);
            StencilOpBack.Read(reader);
            StencilReadMask.Read(reader);
            StencilWriteMask.Read(reader);
            StencilRef.Read(reader);
            FogStart.Read(reader);
            FogEnd.Read(reader);
            FogDensity.Read(reader);
            FogColor.Read(reader);

            FogMode      = (FogMode)reader.ReadInt32();
            GpuProgramID = reader.ReadInt32();
            Tags.Read(reader);
            LOD      = reader.ReadInt32();
            Lighting = reader.ReadBoolean();
            reader.AlignStream(AlignType.Align4);
        }
示例#12
0
 public void Write(EndianBinaryWriter er)
 {
     er.Write(Signature, Encoding.ASCII, false);
     er.Write(Unknown1);
     er.Write(NrLaps);
     er.Write(Unknown2);
     er.Write((Byte)(FogEnabled ? 1 : 0));
     er.Write(FogTableGenMode);
     er.Write(FogSlope);
     er.Write(UnknownData1, 0, 8);
     er.WriteFx32(FogDensity);
     er.Write((UInt16)(GFXUtil.ConvertColorFormat((uint)FogColor.ToArgb(), ColorFormat.ARGB8888, ColorFormat.XBGR1555) | 0x8000));
     er.Write(FogAlpha);
     er.Write((UInt16)GFXUtil.ConvertColorFormat((uint)KclColor1.ToArgb(), ColorFormat.ARGB8888, ColorFormat.XBGR1555));
     er.Write((UInt16)GFXUtil.ConvertColorFormat((uint)KclColor2.ToArgb(), ColorFormat.ARGB8888, ColorFormat.XBGR1555));
     er.Write((UInt16)GFXUtil.ConvertColorFormat((uint)KclColor3.ToArgb(), ColorFormat.ARGB8888, ColorFormat.XBGR1555));
     er.Write((UInt16)GFXUtil.ConvertColorFormat((uint)KclColor4.ToArgb(), ColorFormat.ARGB8888, ColorFormat.XBGR1555));
     er.WriteFx32(FrustumFar);
     er.Write(UnknownData2, 0, 4);
 }
示例#13
0
 public void Apply(int pass)
 {
     PrepareShaderProgram();
     shaderParams.Set(shaderParamKeys.World, Renderer.World);
     shaderParams.Set(shaderParamKeys.WorldView, Renderer.WorldView);
     shaderParams.Set(shaderParamKeys.WorldViewProj, Renderer.WorldViewProjection);
     shaderParams.Set(shaderParamKeys.ColorFactor, Renderer.ColorFactor.ToVector4());
     shaderParams.Set(shaderParamKeys.DiffuseColor, DiffuseColor.ToVector4());
     shaderParams.Set(shaderParamKeys.FogColor, FogColor.ToVector4());
     shaderParams.Set(shaderParamKeys.FogStart, FogStart);
     shaderParams.Set(shaderParamKeys.FogEnd, FogEnd);
     shaderParams.Set(shaderParamKeys.FogDensity, FogDensity);
     if (skinEnabled)
     {
         shaderParams.Set(shaderParamKeys.Bones, boneTransforms, boneCount);
     }
     PlatformRenderer.SetBlendState(Blending.GetBlendState());
     PlatformRenderer.SetTextureLegacy(CommonMaterialProgram.DiffuseTextureStage, diffuseTexture);
     PlatformRenderer.SetShaderProgram(program);
     PlatformRenderer.SetShaderParams(shaderParamsArray);
 }
        public void Read(EndianStream stream)
        {
            Name = stream.ReadStringAligned();
            RtBlend0.Read(stream);
            RtBlend1.Read(stream);
            RtBlend2.Read(stream);
            RtBlend3.Read(stream);
            RtBlend4.Read(stream);
            RtBlend5.Read(stream);
            RtBlend6.Read(stream);
            RtBlend7.Read(stream);
            RtSeparateBlend = stream.ReadBoolean();
            stream.AlignStream(AlignType.Align4);

            ZTest.Read(stream);
            ZWrite.Read(stream);
            Culling.Read(stream);
            OffsetFactor.Read(stream);
            OffsetUnits.Read(stream);
            AlphaToMask.Read(stream);
            StencilOp.Read(stream);
            StencilOpFront.Read(stream);
            StencilOpBack.Read(stream);
            StencilReadMask.Read(stream);
            StencilWriteMask.Read(stream);
            StencilRef.Read(stream);
            FogStart.Read(stream);
            FogEnd.Read(stream);
            FogDensity.Read(stream);
            FogColor.Read(stream);

            FogMode      = stream.ReadInt32();
            GpuProgramID = stream.ReadInt32();
            Tags.Read(stream);
            LOD      = stream.ReadInt32();
            Lighting = stream.ReadBoolean();
            stream.AlignStream(AlignType.Align4);
        }
示例#15
0
 protected override void ReadData(ESPReader reader)
 {
     using (MemoryStream stream = new MemoryStream(reader.ReadBytes(size)))
         using (ESPReader subReader = new ESPReader(stream, reader.Plugin))
         {
             try
             {
                 ColorAmbient.ReadBinary(subReader);
                 ColorDirectional.ReadBinary(subReader);
                 FogColor.ReadBinary(subReader);
                 FogNear = subReader.ReadSingle();
                 FogFar  = subReader.ReadSingle();
                 DirectionalRotationXY = subReader.ReadInt32();
                 DirectionalRotationZ  = subReader.ReadInt32();
                 DirectionalFade       = subReader.ReadSingle();
                 FogClipDistance       = subReader.ReadSingle();
                 FogPower = subReader.ReadSingle();
             }
             catch
             {
                 return;
             }
         }
 }
示例#16
0
        public override void Read(AssetReader reader)
        {
            base.Read(reader);

            Fog = reader.ReadBoolean();
            if (IsAlign(reader.Version))
            {
                reader.AlignStream(AlignType.Align4);
            }

            FogColor.Read(reader);
            if (IsReadFogMode(reader.Version))
            {
                FogMode = (FogMode)reader.ReadInt32();
            }
            FogDensity = reader.ReadSingle();
            if (IsReadLinearFogStart(reader.Version))
            {
                LinearFogStart = reader.ReadSingle();
                LinearFogEnd   = reader.ReadSingle();
            }
            AmbientSkyColor.Read(reader);
            if (IsReadAmbientEquatorColor(reader.Version))
            {
                AmbientEquatorColor.Read(reader);
                AmbientGroundColor.Read(reader);
                AmbientIntensity = reader.ReadSingle();
            }
            if (IsReadAmbientProbe(reader.Version, reader.Flags))
            {
                if (IsReadAmbientProbeFirst(reader.Version))
                {
                    AmbientProbe.Read(reader);
                }
            }
            if (IsReadAmbientSkyboxLight(reader.Version))
            {
                AmbientSkyboxLight.Read(reader);
            }
            if (IsReadAmbientMode(reader.Version))
            {
                AmbientMode = (AmbientMode)reader.ReadInt32();
                if (IsReadCreateAmbientLight(reader.Version))
                {
                    CreateAmbientLight = reader.ReadBoolean();
                }
                reader.AlignStream(AlignType.Align4);
            }
            if (IsReadSubtractiveShadowColor(reader.Version))
            {
                SubtractiveShadowColor.Read(reader);
            }

            SkyboxMaterial.Read(reader);
            HaloStrength  = reader.ReadSingle();
            FlareStrength = reader.ReadSingle();
            if (IsReadFlareFadeSpeed(reader.Version))
            {
                FlareFadeSpeed = reader.ReadSingle();
            }
            if (IsReadPixelLightCount(reader.Version))
            {
                PixelLightCount = reader.ReadInt32();
            }
            HaloTexture.Read(reader);
            if (IsReadAmbientLightScale(reader.Version))
            {
                AmbientLightScale = reader.ReadSingle();
            }
            if (IsReadSpecularTex(reader.Version))
            {
                SpecularTexture.Read(reader);
            }
            SpotCookie.Read(reader);
            if (IsReadDefaultReflectionMode(reader.Version))
            {
                DefaultReflectionMode = reader.ReadInt32();
            }
            if (IsReadDefaultReflectionResolution(reader.Version))
            {
                DefaultReflectionResolution = reader.ReadInt32();
                ReflectionBounces           = reader.ReadInt32();
                ReflectionIntensity         = reader.ReadSingle();
            }
            if (IsReadCustomReflection(reader.Version))
            {
                CustomReflection.Read(reader);
            }
            if (IsReadAmbientProbe(reader.Version, reader.Flags))
            {
                if (!IsReadAmbientProbeFirst(reader.Version))
                {
                    AmbientProbe.Read(reader);
                }
            }
            if (IsReadAmbientProbeInGamma(reader.Version, reader.Flags))
            {
                AmbientProbeInGamma.Read(reader);
            }
            if (IsReadGeneratedSkyboxReflection(reader.Version, reader.Flags))
            {
                GeneratedSkyboxReflection.Read(reader);
            }
            if (IsReadSun(reader.Version))
            {
                Sun.Read(reader);
            }
            if (IsReadIndirectSpecularColor(reader.Version))
            {
                IndirectSpecularColor.Read(reader);
            }
            if (IsReadUseRadianceAmbientProbe(reader.Version))
            {
                UseRadianceAmbientProbe = reader.ReadBoolean();
            }
        }