internal IndexedTriList(SBR block) { block.VerifyID(TokenID.Indexed_TriList); VertexIndices = new VertexIndices(block.ReadSubBlock()); { SBR subBlock = block.ReadSubBlock(); subBlock.VerifyID(TokenID.Normal_Idxs); NormalIndices = new int[subBlock.ReadInt()]; for (int i = 0; i < NormalIndices.Length; ++i) { NormalIndices[i] = subBlock.ReadInt(); subBlock.ReadInt(); // skip the '3' value - its purpose unknown } subBlock.VerifyEndOfBlock(); } { SBR subBlock = block.ReadSubBlock(); subBlock.VerifyID(TokenID.Flags); Flags = new uint[subBlock.ReadInt()]; for (int i = 0; i < Flags.Length; ++i) { Flags[i] = subBlock.ReadFlags(); } subBlock.VerifyEndOfBlock(); } block.VerifyEndOfBlock(); }
public GeometryInfo(SBR block) { block.VerifyID(TokenID.Geometry_Info); FaceNormals = block.ReadInt(); TextureLightCmds = block.ReadInt(); NodeXTriListIndices = block.ReadInt(); TriListIndices = block.ReadInt(); LineListIndices = block.ReadInt(); NodeXTriListIndices = block.ReadInt(); TriLists = block.ReadInt(); LineLists = block.ReadInt(); PointLists = block.ReadInt(); NodeXTriLists = block.ReadInt(); GeometryNodes = new GeometryNodes(block.ReadSubBlock()); { var subBlock = block.ReadSubBlock(); subBlock.VerifyID(TokenID.Geometry_Node_Map); GeometryNodeMap = new int[subBlock.ReadInt()]; for (var i = 0; i < GeometryNodeMap.Length; ++i) { GeometryNodeMap[i] = subBlock.ReadInt(); } subBlock.VerifyEndOfBlock(); } block.VerifyEndOfBlock(); }
private void ReadTrackItemId(SBR block) { block.VerifyID(TokenID.TrItemId); block.ReadInt(); //don't mind the database id, should be 0 always (TrackDB) ItemId = block.ReadInt(); block.VerifyEndOfBlock(); }
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(); }
internal PatchSet(SBR block) { block.VerifyID(TokenID.Terrain_PatchSet); while (!block.EndOfBlock()) { using (SBR subBlock = block.ReadSubBlock()) { switch (subBlock.ID) { case TokenID.Terrain_PatchSet_Distance: Distance = subBlock.ReadInt(); break; case TokenID.Terrain_PatchSet_NPatches: PatchSize = subBlock.ReadInt(); break; case TokenID.Terrain_PatchSet_Patches: Patches = new List <Patch>(PatchSize * PatchSize); for (int i = 0; i < (PatchSize * PatchSize); ++i) { Patches.Add(new Patch(subBlock.ReadSubBlock())); } break; } } } }
public UVOperationCopy(SBR block) { block.VerifyID(TokenID.UV_OP_Copy); TextureAddressMode = block.ReadInt(); SourceUVIndex = block.ReadInt(); block.VerifyEndOfBlock(); }
public CullablePrims(SBR block) { block.VerifyID(TokenID.Cullable_Prims); NumPrims = block.ReadInt(); NumFlatSections = block.ReadInt(); NumPrimIndices = block.ReadInt(); block.VerifyEndOfBlock(); }
public VertexSet(SBR block) { block.VerifyID(TokenID.Vertex_Set); VertexStateIndex = block.ReadInt(); StartVertexIndex = block.ReadInt(); VertexCount = block.ReadInt(); block.VerifyEndOfBlock(); }
} // :anim_nodes,AnimNodes . public Animation(SBR block) { block.VerifyID(TokenID.Animation); FrameCount = block.ReadInt(); FrameRate = block.ReadInt(); AnimationNodes = new AnimationNodes(block.ReadSubBlock()); block.VerifyEndOfBlock(); }
public terrain_uvcalc(SBR block) { block.VerifyID(TokenID.terrain_uvcalc); A = block.ReadInt(); B = block.ReadInt(); C = block.ReadInt(); D = block.ReadInt(); }
public terrain_texslot(SBR block) { block.VerifyID(TokenID.terrain_texslot); Filename = block.ReadString(); A = block.ReadInt(); B = block.ReadInt(); block.Skip(); }
internal UVCalc(SBR block) { block.VerifyID(TokenID.Terrain_UVCalc); A = block.ReadInt(); B = block.ReadInt(); C = block.ReadInt(); D = (int)block.ReadFloat(); }
internal TextureSlot(SBR block) { block.VerifyID(TokenID.Terrain_TexSlot); FileName = block.ReadString(); A = block.ReadInt(); B = block.ReadInt(); block.Skip(); }
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())); }
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"); }
private void ReadCrossingData(SBR block) { block.VerifyID(TokenID.LevelCrData); int data = block.ReadInt(); block.ReadInt(); // not used and not known block.VerifyEndOfBlock(); Visible = (data & 0x1) == 0; Silent = !Visible || (data & 0x6) == 0x6; }
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(); }
public GeometryNode(SBR block) { block.VerifyID(TokenID.Geometry_Node); TextureLightCmds = block.ReadInt(); NodeXTextureLightCmds = block.ReadInt(); TriLists = block.ReadInt(); LineLists = block.ReadInt(); PointLists = block.ReadInt(); CullablePrims = new CullablePrims(block.ReadSubBlock()); block.VerifyEndOfBlock(); }
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(); }
internal void Add(SBR block) { block.VerifyID(TokenID.TrItemId); if (block.ReadInt() == 0) { TrackDbItems.Add(block.ReadInt()); } else { RoadDbItems.Add(block.ReadInt()); } block.VerifyEndOfBlock(); }
public VertexState(SBR block) { block.VerifyID(TokenID.Vtx_State); Flags = block.ReadFlags(); MatrixIndex = block.ReadInt(); LightMatrixIndex = block.ReadInt(); LightConfigIndex = block.ReadInt(); LightFlags = block.ReadFlags(); if (!block.EndOfBlock()) { Matrix2 = block.ReadInt(); } block.VerifyEndOfBlock(); }
public UVOperations(SBR block) { block.VerifyID(TokenID.UV_Ops); var count = Capacity = block.ReadInt(); while (count-- > 0) { var subBlock = block.ReadSubBlock(); switch (subBlock.ID) { case TokenID.UV_OP_Copy: Add(new UVOperationCopy(subBlock)); break; case TokenID.UV_Op_ReflectMapFull: Add(new UVOperationReflectMapFull(subBlock)); break; case TokenID.UV_Op_Reflectmap: Add(new UVOperationReflectMap(subBlock)); break; case TokenID.UV_Op_UniformScale: this.Add(new UVOperationUniformScale(subBlock)); break; case TokenID.UV_Op_NonUniformScale: this.Add(new UVOperationNonUniformScale(subBlock)); break; default: throw new System.Exception("Unexpected uv_op: " + subBlock.ID.ToString()); } } block.VerifyEndOfBlock(); }
public LinearKey(SBR block) { block.VerifyID(TokenID.Linear_Key); Frame = block.ReadInt(); position = new Vector3(block.ReadFloat(), block.ReadFloat(), -block.ReadFloat()); block.VerifyEndOfBlock(); }
public SlerpRotation(SBR block) { block.VerifyID(TokenID.Slerp_Rot); Frame = block.ReadInt(); quaternion = new Quaternion(block.ReadFloat(), block.ReadFloat(), -block.ReadFloat(), block.ReadFloat()); block.VerifyEndOfBlock(); }
internal UVOperations(SBR block) { block.VerifyID(TokenID.UV_Ops); int count = Capacity = block.ReadInt(); while (count-- > 0) { SBR subBlock = block.ReadSubBlock(); switch (subBlock.ID) { case TokenID.UV_OP_Copy: Add(new UVOperationCopy(subBlock)); break; case TokenID.UV_Op_ReflectMapFull: Add(new UVOperationReflectMapFull(subBlock)); break; case TokenID.UV_Op_Reflectmap: Add(new UVOperationReflectMap(subBlock)); break; case TokenID.UV_Op_UniformScale: Add(new UVOperationUniformScale(subBlock)); break; case TokenID.UV_Op_NonUniformScale: Add(new UVOperationNonUniformScale(subBlock)); break; default: throw new InvalidDataException($"Unexpected uv_op: {subBlock.ID}"); } } block.VerifyEndOfBlock(); }
internal Samples(SBR block) { block.VerifyID(TokenID.Terrain_Samples); while (!block.EndOfBlock()) { using (SBR subBlock = block.ReadSubBlock()) { switch (subBlock.ID) { case TokenID.Terrain_NSamples: SampleCount = subBlock.ReadInt(); break; case TokenID.Terrain_Sample_Rotation: SampleRotation = subBlock.ReadFloat(); break; case TokenID.Terrain_Sample_Floor: SampleFloor = subBlock.ReadFloat(); break; case TokenID.Terrain_Sample_Scale: SampleScale = subBlock.ReadFloat(); break; case TokenID.Terrain_Sample_Size: SampleSize = subBlock.ReadFloat(); break; case TokenID.Terrain_Sample_YBuffer: SampleBufferY = subBlock.ReadString(); break; case TokenID.Terrain_Sample_EBuffer: SampleBufferE = subBlock.ReadString(); break; case TokenID.Terrain_Sample_NBuffer: SampleBufferN = subBlock.ReadString(); break; case TokenID.Terrain_Sample_AsBuffer: subBlock.Skip(); // TODO parse this break; case TokenID.Terrain_Sample_FBuffer: subBlock.Skip(); // TODO parse this break; case (TokenID)282: // TODO figure out what this is and handle it subBlock.Skip(); break; default: throw new InvalidDataException("Unknown token " + subBlock.ID.ToString()); } } } }
internal Terrain(SBR block) { block.VerifyID(TokenID.Terrain); while (!block.EndOfBlock()) { using (SBR subBlock = block.ReadSubBlock()) { switch (subBlock.ID) { case TokenID.Terrain_ErrThreshold_Scale: ErrorThresholdScale = subBlock.ReadFloat(); break; case TokenID.Terrain_Water_Height_Offset: WaterLevelOffset = new WaterLevelOffset(subBlock); break; case TokenID.Terrain_AlwaysSelect_MaxDist: AlwaysSelectMaxDistance = subBlock.ReadFloat(); break; case TokenID.Terrain_Samples: Samples = new Samples(subBlock); break; case TokenID.Terrain_Shaders: Shaders = new Shader[subBlock.ReadInt()]; for (int i = 0; i < Shaders.Length; ++i) { using (SBR terrain_shadersBlock = subBlock.ReadSubBlock()) Shaders[i] = new Shader(terrain_shadersBlock); } if (!subBlock.EndOfBlock()) { subBlock.Skip(); } break; case TokenID.Terrain_Patches: using (SBR patch_sets_Block = subBlock.ReadSubBlock()) { Patchsets = new PatchSet[patch_sets_Block.ReadInt()]; for (int i = 0; i < Patchsets.Length; ++i) { using (SBR terrain_patchsetBlock = patch_sets_Block.ReadSubBlock()) Patchsets[i] = new PatchSet(terrain_patchsetBlock); } if (!subBlock.EndOfBlock()) { subBlock.Skip(); } } break; } } } }
public SubObjectHeader(SBR block) { block.VerifyID(TokenID.Sub_Object_Header); Flags = block.ReadFlags(); SortVectorIndex = block.ReadInt(); VolumeIndex = block.ReadInt(); SourceVertexFormatFlags = block.ReadFlags(); DestinationVertexFormatFlags = block.ReadFlags(); GeometryInfo = new GeometryInfo(block.ReadSubBlock()); if (!block.EndOfBlock()) { var subBlock = block.ReadSubBlock(); subBlock.VerifyID(TokenID.SubObject_Shaders); SubObjectShaders = new int[subBlock.ReadInt()]; for (var i = 0; i < SubObjectShaders.Length; ++i) { SubObjectShaders[i] = subBlock.ReadInt(); } subBlock.VerifyEndOfBlock(); } if (!block.EndOfBlock()) { var subBlock = block.ReadSubBlock(); subBlock.VerifyID(TokenID.SubObject_Light_Cfgs); SubObjectLightConfigs = new int[subBlock.ReadInt()]; for (var i = 0; i < SubObjectLightConfigs.Length; ++i) { SubObjectLightConfigs[i] = subBlock.ReadInt(); } subBlock.VerifyEndOfBlock(); } if (!block.EndOfBlock()) { SubObjectID = block.ReadInt(); } block.VerifyEndOfBlock(); }
public SubObjects(SBR block) { block.VerifyID(TokenID.Sub_Objects); var count = Capacity = block.ReadInt(); while (count-- > 0) { Add(new SubObject(block.ReadSubBlock())); } block.VerifyEndOfBlock(); }
public DistanceLevels(SBR block) { block.VerifyID(TokenID.Distance_Levels); var count = Capacity = block.ReadInt(); while (count-- > 0) { Add(new DistanceLevel(block.ReadSubBlock())); } block.VerifyEndOfBlock(); }