示例#1
0
        public void Write(Stream stream)
        {
            using BinaryWriter writer = new BinaryWriter(stream);
            writer.Write(idx);
            writer.Write((int)type);
            color.Write(writer);
            writer.Write((uint)flags);
            switch (type)
            {
            case LightType.Directional:
                writer.Write(pos);
                writer.Write(vec);
                break;

            case LightType.Point:
                writer.Write(radius);
                writer.Write(pos);
                break;

            case LightType.Spot:
                writer.Write(radius);
                writer.Write(pos);
                writer.Write(vec);
                break;
            }
        }
示例#2
0
        public void write()
        {
            MemoryStream stream = new MemoryStream();

            using BinaryWriter writer = new BinaryWriter(stream);
            FColor color = new FColor(0.1f, 0.3f, 0.7f, 1.0f);

            color.Write(writer);

            byte[] actual = stream.ToArray();
            Assert.AreEqual(actual, expected);
        }
示例#3
0
 public void Write(Stream stream)
 {
     using BinaryWriter writer = new BinaryWriter(stream);
     writer.WriteZString(worldFile);
     writer.WriteZString(worldPath);
     writer.WriteZString(texturePath);
     ambientLight.Write(writer);
     writer.Write(v1);
     writer.Write(v2);
     clearColor.Write(writer);
     writer.Write(fogType);
     if (fogType != 0)
     {
         fogColor.Write(writer);
         writer.Write(fogDistance);
     }
     writer.Write(f1);
     writer.Write(farClip);
 }