Ejemplo n.º 1
0
        internal UVPoints(SBR block)
        {
            block.VerifyID(TokenID.UV_Points);
            int count = Capacity = block.ReadInt();

            while (count-- > 0)
            {
                SBR subBlock = block.ReadSubBlock();
                subBlock.VerifyID(TokenID.UV_Point);
                Add(new Vector2(subBlock.ReadFloat(), subBlock.ReadFloat()));
                subBlock.VerifyEndOfBlock();
            }
            block.VerifyEndOfBlock();
        }
Ejemplo n.º 2
0
        internal Normals(SBR block)
        {
            block.VerifyID(TokenID.Normals);
            int count = Capacity = block.ReadInt();

            while (count-- > 0)
            {
                SBR subBlock = block.ReadSubBlock();
                subBlock.VerifyID(TokenID.Vector);
                Add(new Vector3(subBlock.ReadFloat(), subBlock.ReadFloat(), subBlock.ReadFloat()));
                subBlock.VerifyEndOfBlock();
            }
            block.VerifyEndOfBlock();
        }
Ejemplo n.º 3
0
        protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder)
        {
            switch (subBlock.ID)
            {
            case TokenID.CarFrequency: CarFrequency = subBlock.ReadFloat(); break;

            case TokenID.CarAvSpeed: CarAverageSpeed = subBlock.ReadFloat(); break;

            case TokenID.OrtsListName: ListName = subBlock.ReadString(); break;

            case TokenID.TrItemId: TrackItemIds.Add(subBlock); break;

            default: base.AddOrModifyObj(subBlock, holder); break;
            }
        }
Ejemplo n.º 4
0
        public PrimaryState(SBR block)
        {
            block.VerifyID(TokenID.Prim_State);

            Name = block.Label;

            Flags       = block.ReadFlags();
            ShaderIndex = block.ReadInt();
            {
                var subBlock = block.ReadSubBlock();
                subBlock.VerifyID(TokenID.Tex_Idxs);
                TextureIndices = new int[subBlock.ReadInt()];
                for (var i = 0; i < TextureIndices.Length; ++i)
                {
                    TextureIndices[i] = subBlock.ReadInt();
                }
                subBlock.VerifyEndOfBlock();
            }
            ZBias            = block.ReadFloat();
            VertexStateIndex = block.ReadInt();
            AlphaTestMode    = block.ReadInt();
            LightConfigIndex = block.ReadInt();
            ZBufferMode      = block.ReadInt();
            block.VerifyEndOfBlock();
        }
Ejemplo n.º 5
0
        internal Colors(SBR block)
        {
            block.VerifyID(TokenID.Colours);
            int count = Capacity = block.ReadInt();

            while (count-- > 0)
            {
                SBR subBlock = block.ReadSubBlock();
                subBlock.VerifyID(TokenID.Colour);

                float alpha = subBlock.ReadFloat();
                Add(new Color(subBlock.ReadFloat(), subBlock.ReadFloat(), subBlock.ReadFloat(), alpha));
                subBlock.VerifyEndOfBlock();
            }
            block.VerifyEndOfBlock();
        }
Ejemplo n.º 6
0
 internal UVCalc(SBR block)
 {
     block.VerifyID(TokenID.Terrain_UVCalc);
     A = block.ReadInt();
     B = block.ReadInt();
     C = block.ReadInt();
     D = (int)block.ReadFloat();
 }
Ejemplo n.º 7
0
 public terrain_uvcalc(SBR block)
 {
     block.VerifyID(TokenID.terrain_uvcalc);
     A = block.ReadInt();
     B = block.ReadInt();
     C = block.ReadInt();
     D = (int)block.ReadFloat();
 }
Ejemplo n.º 8
0
 public UVOperationUniformScale(SBR block)
 {
     block.VerifyID(TokenID.UV_Op_UniformScale);
     TextureAddressMode = block.ReadInt();
     SourceUVIndex      = block.ReadInt();
     UnknownParameter3  = block.ReadFloat();
     block.VerifyEndOfBlock();
     block.TraceInformation(String.Format("{0} was treated as uv_op_copy", block.ID.ToString()));
 }
Ejemplo n.º 9
0
 internal UVOperationUniformScale(SBR block)
 {
     block.VerifyID(TokenID.UV_Op_UniformScale);
     TextureAddressMode = block.ReadInt();
     SourceUVIndex      = block.ReadInt();
     UnknownParameter3  = block.ReadFloat();
     block.VerifyEndOfBlock();
     block.TraceInformation($"{block.ID} was treated as uv_op_copy");
 }
Ejemplo n.º 10
0
        public VolumeSphere(SBR block)
        {
            block.VerifyID(TokenID.Vol_Sphere);
            var vectorBlock = block.ReadSubBlock();

            Vector = new Vector3(vectorBlock.ReadFloat(), vectorBlock.ReadFloat(), vectorBlock.ReadFloat());
            vectorBlock.VerifyEndOfBlock();
            Radius = block.ReadFloat();
            block.VerifyEndOfBlock();
        }
Ejemplo n.º 11
0
 public TcbKey(SBR block)
 {
     block.VerifyID(TokenID.Tcb_Key);
     Frame      = block.ReadInt();
     quaternion = new Quaternion(block.ReadFloat(), block.ReadFloat(), -block.ReadFloat(), block.ReadFloat());
     Tension    = block.ReadFloat();
     Continuity = block.ReadFloat();
     Bias       = block.ReadFloat();
     In         = block.ReadFloat();
     Out        = block.ReadFloat();
     block.VerifyEndOfBlock();
 }
Ejemplo n.º 12
0
 internal WaterLevelOffset(SBR block)
 {
     block.VerifyID(TokenID.Terrain_Water_Height_Offset);
     if (!block.EndOfBlock())
     {
         SW = block.ReadFloat();
     }
     if (!block.EndOfBlock())
     {
         SE = block.ReadFloat();
     }
     if (!block.EndOfBlock())
     {
         NE = block.ReadFloat();
     }
     if (!block.EndOfBlock())
     {
         NW = block.ReadFloat();
     }
 }
Ejemplo n.º 13
0
 public terrain_water_height_offset(SBR block)
 {
     block.VerifyID(TokenID.terrain_water_height_offset);
     if (!block.EndOfBlock())
     {
         SW = block.ReadFloat();
     }
     if (!block.EndOfBlock())
     {
         SE = block.ReadFloat();
     }
     if (!block.EndOfBlock())
     {
         NE = block.ReadFloat();
     }
     if (!block.EndOfBlock())
     {
         NW = block.ReadFloat();
     }
 }
Ejemplo n.º 14
0
 public LightMaterial(SBR block)
 {
     block.VerifyID(TokenID.Light_Material);
     Flags              = block.ReadFlags();
     DiffuseColorIndex  = block.ReadInt();
     AmbientColorIndex  = block.ReadInt();
     SpecularColorIndex = block.ReadInt();
     EmissiveColorIndex = block.ReadInt();
     SpecPower          = block.ReadFloat();
     block.VerifyEndOfBlock();
 }
Ejemplo n.º 15
0
 public Texture(SBR block)
 {
     block.VerifyID(TokenID.Texture);
     ImageIndex    = block.ReadInt();
     FilterMode    = block.ReadInt();
     MipMapLODBias = block.ReadFloat();
     if (!block.EndOfBlock())
     {
         BorderColor = block.ReadFlags();
     }
     block.VerifyEndOfBlock();
 }
Ejemplo n.º 16
0
 private void ReadPosition(SBR block, PositionHolder holder)
 {
     block.VerifyID(TokenID.Matrix3x3);
     holder.Position = new Matrix3x3(block.ReadFloat(), block.ReadFloat(), block.ReadFloat(),
                                     block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat());
     holder.PositionSet = true;
     block.VerifyEndOfBlock();
 }
Ejemplo n.º 17
0
        protected override void AddOrModifyObj(SBR subBlock, PositionHolder holder)
        {
            switch (subBlock.ID)
            {
            case TokenID.SectionIdx: SectionIndex = subBlock.ReadUInt(); break;

            case TokenID.Elevation: Elevation = subBlock.ReadFloat(); break;

            case TokenID.CollideFlags: CollideFlags = subBlock.ReadUInt(); break;

            case TokenID.TrackSections: TrackSections = ReadTrackSections(subBlock); break;

            default: base.AddOrModifyObj(subBlock, holder); break;
            }
        }
Ejemplo n.º 18
0
 internal DistanceLevelHeader(SBR block)
 {
     block.VerifyID(TokenID.Distance_Level_Header);
     {
         SBR subBlock = block.ReadSubBlock();
         subBlock.VerifyID(TokenID.DLevel_Selection);
         DistanceLevelSelection = subBlock.ReadFloat();
         subBlock.VerifyEndOfBlock();
     }
     {
         SBR subBlock = block.ReadSubBlock();
         subBlock.VerifyID(TokenID.Hierarchy);
         Hierarchy = new int[subBlock.ReadInt()];
         for (int i = 0; i < Hierarchy.Length; ++i)
         {
             Hierarchy[i] = subBlock.ReadInt();
         }
         subBlock.VerifyEndOfBlock();
     }
     block.VerifyEndOfBlock();
 }
Ejemplo n.º 19
0
 private void ReadLocation(SBR block)
 {
     block.VerifyID(TokenID.JNodePosn);
     location = new WorldLocation(block.ReadInt(), block.ReadInt(), block.ReadFloat(), block.ReadFloat(), block.ReadFloat());
     block.VerifyEndOfBlock();
 }
Ejemplo n.º 20
0
        private Matrix ReadMatrix(SBR block)
        {
            block.VerifyID(TokenID.Matrix);
            MatrixNames.Add(string.IsNullOrEmpty(block.Label) ? string.Empty : block.Label.ToUpperInvariant());

            Matrix result = new Matrix(
                block.ReadFloat(), block.ReadFloat(), -block.ReadFloat(), 0.0f,
                block.ReadFloat(), block.ReadFloat(), -block.ReadFloat(), 0.0f,
                -block.ReadFloat(), -block.ReadFloat(), block.ReadFloat(), 0.0f,
                block.ReadFloat(), block.ReadFloat(), -block.ReadFloat(), 1.0f);

            block.VerifyEndOfBlock();
            return(result);
        }
Ejemplo n.º 21
0
 public terrain_patchset_patch(SBR block)
 {
     block.VerifyID(TokenID.terrain_patchset_patch);
     Flags       = block.ReadUInt();
     CenterX     = block.ReadFloat(); // 64
     AverageY    = block.ReadFloat(); // 299.9991
     CenterZ     = block.ReadFloat(); // -64
     FactorY     = block.ReadFloat(); // 99.48125
     RangeY      = block.ReadFloat(); // 0
     RadiusM     = block.ReadFloat(); // 64
     ShaderIndex = block.ReadInt();   // 0 , 14, 6 etc  TODO, I think there is something wrong here
     X           = block.ReadFloat(); // 0.001953 or 0.998 or 0.001  (1/512, 511/512, 1/1024) typically, but not always
     Y           = block.ReadFloat(); // 0.001953 or 0.998 or 0.001
     W           = block.ReadFloat(); // 0.06225586 0 -0.06225586  (255/256)/16
     B           = block.ReadFloat(); // 0.06225586 0 -0.06225586
     C           = block.ReadFloat(); // 0.06225586 0 -0.06225586
     H           = block.ReadFloat(); // 0.06225586 0 -0.06225586
     ErrorBias   = block.ReadFloat(); // 0 - 1
 }