コード例 #1
0
        public void Read(Stream stream)
        {
            using BinaryReader reader = new BinaryReader(stream);
            idx    = reader.ReadUInt32();
            type   = EnumUtils.intToEnum <LightType>(reader.ReadInt32());
            color  = FColor.ReadNew(reader);
            flags  = EnumUtils.intToFlags <LightFlags>(reader.ReadUInt32());
            pos    = new Vector3();
            vec    = new Vector3();
            radius = 0.0f;
            switch (type)
            {
            case LightType.Directional:
                pos = reader.ReadVector3();
                vec = reader.ReadVector3();
                break;

            case LightType.Point:
                radius = reader.ReadSingle();
                pos    = reader.ReadVector3();
                break;

            case LightType.Spot:
                radius = reader.ReadUInt32();
                pos    = reader.ReadVector3();
                vec    = reader.ReadVector3();
                break;
            }
        }
コード例 #2
0
        public void read()
        {
            MemoryStream stream = new MemoryStream(expected, false);

            using BinaryReader reader = new BinaryReader(stream);
            FColor color = FColor.ReadNew(reader);

            Assert.AreEqual(0.1f, color.r);
            Assert.AreEqual(0.3f, color.g);
            Assert.AreEqual(0.7f, color.b);
            Assert.AreEqual(1.0f, color.a);
        }
コード例 #3
0
 public void Read(Stream stream)
 {
     using BinaryReader reader = new BinaryReader(stream);
     worldFile    = reader.ReadZString();
     worldPath    = reader.ReadZString();
     texturePath  = reader.ReadZString();
     ambientLight = FColor.ReadNew(reader);
     v1           = reader.ReadVector3();
     v2           = reader.ReadVector3();
     clearColor   = IColor.ReadNew(reader);
     fogType      = reader.ReadByte();
     if (fogType != 0)
     {
         fogColor    = IColor.ReadNew(reader);
         fogDistance = reader.ReadSingle();
     }
     else
     {
         fogColor    = new IColor();
         fogDistance = 0.0f;
     }
     f1      = reader.ReadSingle();
     farClip = reader.ReadSingle();
 }