예제 #1
0
파일: JTFile.cs 프로젝트: doug8679/libJT
 public JTFile(string filename)
     : this()
 {
     this.filename = filename;
     //reader = new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read));
     reader = new ByteReader(new BinaryReader(new FileStream(filename, FileMode.Open, FileAccess.Read)));
 }
예제 #2
0
        public Vers1ImageFormat(ByteReader reader)
        {
            ImageTexelData = new List<byte>();
            _numBytes = reader.ReadI32();
            if ( _numBytes > 0 ) {
                PixelFormat = reader.ReadU32();
                PixelDataType = reader.ReadU32();
                Dimensionality = reader.ReadI16();
                Width = reader.ReadI32();
                Height = reader.ReadI32();
                MipmapsFlag = reader.ReadU32();
                SharedImageFlag = reader.ReadU32();

                for ( int i = 0; i < _numBytes; i++ ) {
                    ImageTexelData.Add( reader.ReadByte() );
                }

                MipmapMagnificationFilter = reader.ReadI32();
                MipmapMinificationFilter = reader.ReadI32();
                SDimenWrapMode = reader.ReadI32();
                TDimenWrapMode = reader.ReadI32();
                TextureFunctionData = reader.ReadI32();
                BlendColor = reader.ReadRGBA();
                TextureTransform = reader.ReadMx4F32();
            }
        }
예제 #3
0
        protected override void ReadV8(ByteReader reader)
        {
            // First, read the compression header (first element in segment data)
            ElementHeader head = new LogicalElementHeaderZlib();
            head.Read(reader, 8);
            Element e = Element.Create(head, reader, head.ObjectTypeID, 8);
            e.Read(reader, 8);
            Elements.Add(e);

            // Read Graph Elements
            head = new LogicalElementHeader();
            head.Read(reader, 8);
            while (!head.ObjectTypeID.Equals(Element.EndOfElements)) {
                e = Element.Create(head, reader, head.ObjectTypeID, 8);
                e.Read(reader, 8);
                Elements.Add(e);
                head = new LogicalElementHeader();
                head.Read( reader, 8 );
            }

            // Read Property Atoms
            head = new LogicalElementHeader();
            head.Read(reader, 8);
            while (!head.ObjectTypeID.Equals(Element.EndOfElements)) {
                e = Element.Create(head, reader, head.ObjectTypeID, 8);
                e.Read(reader, 8);
                Properties.Add(e);
                head = new LogicalElementHeader();
                head.Read( reader, 8 );
            }

            // Attempt to read property table:
            PropertyTable.Read(reader, 8);
            reader.Inflate();
        }
예제 #4
0
        protected override void ReadV8(ByteReader reader)
        {
            base.ReadV8(reader);

            DataFlags = reader.ReadU16();
            if (( DataFlags & 0x0001 ) == 0x0001) {
                // Pattern bits are valid
                if (( DataFlags & 0x0002 ) == 0x0002) {
                    float c = reader.ReadF32();
                    AmbientColor = new[] {c, c, c, 1.0f};
                } else {
                    AmbientColor = reader.ReadRGBA();
                }
                DiffuseColor = reader.ReadRGBA();
                if ( ( DataFlags & 0x0004 ) == 0x0004 ) {
                    float c = reader.ReadF32();
                    SpecularColor = new[] { c, c, c, 1.0f };
                } else {
                    SpecularColor = reader.ReadRGBA();
                }
                if ( ( DataFlags & 0x0008 ) == 0x0008 ) {
                    float c = reader.ReadF32();
                    EmissionColor = new[] { c, c, c, 1.0f };
                } else {
                    EmissionColor = reader.ReadRGBA();
                }
            } else {
                AmbientColor = reader.ReadRGBA();
                DiffuseColor = reader.ReadRGBA();
                SpecularColor = reader.ReadRGBA();
                EmissionColor = reader.ReadRGBA();
            }
            Shininess = reader.ReadF32();
        }
예제 #5
0
 public QuantizationParameters(ByteReader reader)
 {
     BitsPerVertex = reader.ReadU8();
     NormalBitsFactor = reader.ReadU8();
     BitsPerTextureCoord = reader.ReadU8();
     BitsPerColor = reader.ReadU8();
 }
예제 #6
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     VersionNumber = reader.ReadI16();
     DataFlags = reader.ReadU8();
     PointSize = reader.ReadF32();
 }
예제 #7
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8(reader);
     int children = reader.ReadI32();
     for (int i = 0; i < children; i++) {
         Children.Add(reader.ReadI32());
     }
 }
예제 #8
0
 public MaterialBaseAttribute(ElementHeader head, ByteReader reader, int version)
     : base(head, reader, version)
 {
     AmbientColor = new[] {0.5f, 0.5f, 0.5f, 1.0f};
     DiffuseColor = new[] { 0.5f, 0.5f, 0.5f, 1.0f };
     SpecularColor = new[] { 0.5f, 0.5f, 0.5f, 1.0f };
     EmissionColor = new[] { 0.5f, 0.5f, 0.5f, 1.0f };
 }
예제 #9
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8(reader);
     NormalBinding = reader.ReadI32();
     TextureBinding = reader.ReadI32();
     ColorBinding = reader.ReadI32();
     QuantizationParameters = new QuantizationParameters(reader);
 }
 private void ReadV8(ByteReader reader)
 {
     VersionNumber = reader.ReadI16();
     NormalBinding = (Binding)reader.ReadByte();
     TextureCoordBinding = (Binding)reader.ReadByte();
     ColorBinding = (Binding)reader.ReadByte();
     QuantizationParameters = new QuantizationParameters(reader);
 }
예제 #11
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     LightCount = reader.ReadI32();
     for (int i = 0; i < LightCount; i++) {
         Lights.Add(reader.ReadI32());
     }
 }
예제 #12
0
파일: BaseLight.cs 프로젝트: doug8679/libJT
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8(reader);
     ObjectID = reader.ReadI32();
     AmbientColor = reader.ReadRGBA();
     DiffuseColor = reader.ReadRGBA();
     SpecularColor = reader.ReadRGBA();
     Brightness = reader.ReadF32();
 }
예제 #13
0
 protected override void ReadV9(ByteReader reader)
 {
     VersionNumber = reader.ReadI16();
     NodeFlagsPMI = reader.ReadU32();
     var aCount = reader.ReadI32();
     for ( int i = 0; i < aCount; i++ ) {
         Attributes.Add( reader.ReadI32() );
     }
 }
예제 #14
0
 protected FileSegment(ByteReader reader, TocEntry entry, int version)
     : this()
 {
     // Postion the file stream:
     reader.Position = (long)entry.SegmentOffset;
     // Read the segment header:
     Header.Read(reader);
     //Read(reader, version);
 }
 public VertexBasedShapeCompressedRepData(ByteReader reader, int version)
 {
     if (version < 9)
         ReadV8(reader);
     else if (version < 10)
         ReadV9(reader);
     else
         ReadV10(reader);
 }
예제 #16
0
 public void Read(ByteReader reader, int version)
 {
     if (version < 9)
         ReadV8(reader);
     else if (version < 10)
         ReadV9(reader);
     else
         ReadV10(reader);
 }
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     Direction = reader.ReadDirF32();
     VersionNumber = reader.ReadI16();
     if (VersionNumber == 1) {
         CoordSystem = reader.ReadI32();
     }
 }
예제 #18
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8(reader);
     Vers0DataFlags = reader.ReadU8();
     VersionNumber = reader.ReadI16();
     if (VersionNumber > 0) {
         Vers1DataFlags = reader.ReadU8();
     }
 }
예제 #19
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     Year = reader.ReadI16();
     Month = reader.ReadI16();
     Day = reader.ReadI16();
     Hour = reader.ReadI16();
     Minute = reader.ReadI16();
     Second = reader.ReadI16();
 }
예제 #20
0
        protected override void ReadV8(ByteReader reader)
        {
            /*base.ReadV8(reader);
            VersionNumber = reader.ReadI16();

            Version1Format = new Vers1ImageFormat(reader);
            if (VersionNumber == 2) {
                Version2Format = new Vers2ImageFormat(reader);
            }*/
            reader.Skip(Header.Length);
        }
예제 #21
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     ushort storedMask = reader.ReadU16();
     for ( int i = 0; i < 16; i++ ) {
         if ( ( storedMask & 0x8000 ) == 0x8000 ) {
             Transform[i] = reader.ReadF32();
         }
         storedMask <<= 1;
     }
 }
예제 #22
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     Position = reader.ReadHCoordF32();
     ConstantAttenuation = reader.ReadF32();
     LinearAttenuation = reader.ReadF32();
     QuadraticAttenuation = reader.ReadF32();
     SpreadAngle = reader.ReadF32();
     SpotDirection = reader.ReadDirF32();
     SpotIntensity = reader.ReadI32();
     VersionNumber = reader.ReadI16();
     if ( VersionNumber == 1 ) {
         CoordSystem = reader.ReadI32();
     }
 }
예제 #23
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8(reader);
     VersionNumber = reader.ReadI16();
     if (VersionNumber == 1) {
         EnableFlag = reader.ReadU32();
         EnvMapTextureChannel = reader.ReadI32();
         EnvMapReflectivity = reader.ReadF32();
         BumpMapTextureChannel = reader.ReadI32();
         BumpinessFactor = reader.ReadF32();
         BumpMapNormalSpace = reader.ReadU32();
         PhongShadingFlag = reader.ReadU32();
         ReservedField = reader.ReadU32();
     }
 }
예제 #24
0
        protected override void ReadV8(ByteReader reader)
        {
            base.ReadV8(reader);

            // Read the transformed box
            TransformedBoundingBox = reader.ReadBBoxF32();
            // Read the untransformed box
            UntransformedBoundingBox = reader.ReadBBoxF32();
            Area = reader.ReadF32();
            MinVertexCount = reader.ReadI32();
            MaxVertexCount = reader.ReadI32();
            MinNodeCount= reader.ReadI32();
            MaxNodeCount = reader.ReadI32();
            MinPolygonCount = reader.ReadI32();
            MaxPolygonCount = reader.ReadI32();
            Size = reader.ReadI32();
            CompressionLevel = reader.ReadF32();
        }
 private void ReadV9(ByteReader reader)
 {
 }
 private void ReadV10(ByteReader reader)
 {
 }
예제 #27
0
 protected override void ReadV9(ByteReader reader)
 {
 }
예제 #28
0
 protected override void ReadV8(ByteReader reader)
 {
     base.ReadV8( reader );
     VersionNumber = reader.ReadI16();
 }
예제 #29
0
 public PolygonSetShapeLodElement(ElementHeader head, ByteReader reader, int version)
     : base(head, reader, version)
 {
 }
예제 #30
0
 protected override void ReadV10(ByteReader reader)
 {
     Length = reader.ReadI32();
     ObjectTypeID = reader.ReadGuid();
     ObjectBaseType = (ObjectBaseType)reader.ReadByte();
     ObjectID = reader.ReadI32();
 }