public char[] color; // BGRA -- "A" seems to be ignored by the official client public RoGndTileData(BinaryReader bin, GenericFileFormatVersion version) : base(bin, version) { VectorWidth = bin.ReadVector4(); VectorHeight = bin.ReadVector4(); TextureIndex = bin.ReadUInt16(); Lightmap = bin.ReadUInt16(); color = bin.ReadChars(4); }
public RoGndCubeData(BinaryReader bin, GenericFileFormatVersion version) : base(bin, version) { Height = bin.ReadVector4(); TileUp = bin.ReadInt32(); TileSide = bin.ReadInt32(); TileAside = bin.ReadInt32(); }
/// <summary> /// Initializes a new instance of the <see cref="QuatKey"/> class. /// </summary> /// <param name="reader">The reader.</param> /// <param name="type">The type.</param> /// <exception cref="Exception">Invalid eKeyType</exception> public QuatKey(BinaryReader reader, eKeyType type) { this.Time = reader.ReadSingle(); if (type < eKeyType.LINEAR_KEY || type > eKeyType.TBC_KEY) { throw new Exception("Invalid eKeyType"); } this.Value = reader.ReadVector4(); if (type == eKeyType.TBC_KEY) { this.TBC = reader.ReadVector3(); } }
/// <summary> /// Initializes a new instance of the <see cref="NiRotatingParticlesData"/> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiRotatingParticlesData(NiFile file, BinaryReader reader) : base(file, reader) { if (base.Version <= eNifVersion.VER_4_2_2_0) { this.HasRotations2 = reader.ReadBoolean(Version); this.Rotations2 = new Vector4[this.NumVertices]; int num = 0; while ((long)num < (long)((ulong)this.NumVertices)) { this.Rotations2[num] = reader.ReadVector4(); num++; } } }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Position = binaryReader.ReadVector3(); int i; for (i = 0; (i < 4); i = (i + 1)) { this.NodeIndices00[i] = new NodeIndicesBlock(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeIndices00[i].ReadFields(binaryReader))); } for (i = 0; (i < 4); i = (i + 1)) { this.NodeWeights00[i] = new NodeWeightsBlock(); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NodeWeights00[i].ReadFields(binaryReader))); } this.Color = binaryReader.ReadVector4(); this.Normal = binaryReader.ReadVector3(); this.ScreenLength = binaryReader.ReadSingle(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.UserInterfaceScreenWidgetDefinitionFlags = ((Flags)(binaryReader.ReadInt32())); this.ScreenID = ((ScreenIDEnum)(binaryReader.ReadInt16())); this.ButtonKeyType = ((ButtonKeyTypeEnum)(binaryReader.ReadInt16())); this.TextColor = binaryReader.ReadVector4(); this.StringListTag = binaryReader.ReadTagReference(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(76)); this.ShapeGroup = ((ShapeGroupEnum)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.HeaderStringId = binaryReader.ReadStringID(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(12)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8)); this.SourceColor = binaryReader.ReadColorR8G8B8(); this.DestinationColor = binaryReader.ReadColorR8G8B8(); this.AccumulateZoomScaleX = binaryReader.ReadSingle(); this.AccumulateZoomScaleY = binaryReader.ReadSingle(); this.RefractionScaleX = binaryReader.ReadSingle(); this.RefractionScaleY = binaryReader.ReadSingle(); return(pointerQueue); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Type = ((TypeEnum)(binaryReader.ReadInt16())); this.ErrorReportsFlags = ((Flags)(binaryReader.ReadInt16())); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(1)); this.SourceFilename = binaryReader.ReadString32(); this.SourceLineNumber = binaryReader.ReadInt32(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(52)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(64)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(80)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(112)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(144)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(56)); this.fieldpad = binaryReader.ReadBytes(380); this.ReportKey = binaryReader.ReadInt32(); this.NodeIndex = binaryReader.ReadInt32(); this.BoundsX = binaryReader.ReadRange(); this.BoundsY = binaryReader.ReadRange(); this.BoundsZ = binaryReader.ReadRange(); this.Color = binaryReader.ReadVector4(); this.fieldpad0 = binaryReader.ReadBytes(84); return(pointerQueue); }
public ErrorReportTrianglesBlock(BinaryReader binaryReader) { this.points = new Points[3]; for (int i = 0; i < 3; ++i) { this.points[i] = new Points(binaryReader); } this.color = binaryReader.ReadVector4(); }
public StructureBspWeatherPolyhedronPlaneBlock(BinaryReader binaryReader) { this.plane = binaryReader.ReadVector4(); }
/// <summary> /// Initializes a new instance of the <see cref="NiParticlesData"/> class. /// </summary> /// <param name="file">The file.</param> /// <param name="reader">The reader.</param> public NiParticlesData(NiFile file, BinaryReader reader) : base(file, reader) { if (this.File.Header.Version <= eNifVersion.VER_4_0_0_2) { this.NumParticles = reader.ReadUInt16(); } if (this.File.Header.Version <= eNifVersion.VER_10_0_1_0) { this.ParticleRadius = reader.ReadSingle(); } if (this.File.Header.Version >= eNifVersion.VER_10_1_0_0) { this.HasRadii = reader.ReadBoolean(Version); if (this.HasRadii) { this.Radii = reader.ReadFloatArray((int)this.NumVertices); } } this.NumActive = reader.ReadUInt16(); this.HasSizes = reader.ReadBoolean(Version); if (this.HasSizes) { this.Sizes = reader.ReadFloatArray((int)this.NumVertices); } if (this.File.Header.Version >= eNifVersion.VER_10_0_1_0) { this.HasRotations = reader.ReadBoolean(Version); if (this.HasRotations) { this.Rotations = new Vector4[this.NumVertices]; int num = 0; while ((long)num < (long)((ulong)this.NumVertices)) { this.Rotations[num] = reader.ReadVector4(); num++; } } } }
/// <summary> /// Loads the file from the specified stream. /// </summary> /// <param name="stream">The stream to read from.</param> public override void Load(Stream stream) { BinaryReader reader = new BinaryReader(stream, Encoding.GetEncoding("EUC-KR")); string identifier = reader.ReadNullTerminatedString(); int version; if (string.Compare(identifier, FILE_IDENTIFIER_7, false) == 0) { version = 7; } else if (string.Compare(identifier, FILE_IDENTIFIER_8, false) == 0) { version = 8; } else { throw new FileIdentifierMismatchException(FilePath, string.Format("{0} / {1}", FILE_IDENTIFIER_7, FILE_IDENTIFIER_8), identifier); } format = (VertexFormat)reader.ReadInt32(); BoundingBox = new Bounds(reader.ReadVector3(), reader.ReadVector3()); short boneCount = reader.ReadInt16(); for (int i = 0; i < boneCount; i++) { BoneTable.Add(reader.ReadInt16()); } short vertexCount = reader.ReadInt16(); for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = new ModelVertex(); vertex.Position = reader.ReadVector3(); Vertices.Add(vertex); } if (NormalsEnabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.Normal = reader.ReadVector3(); } } if (ColoursEnabled) { for (int i = 0; i < vertexCount; i++) { float a = reader.ReadSingle(); ModelVertex vertex = Vertices[i]; vertex.Colour = new Color(reader.ReadSingle(), reader.ReadSingle(), reader.ReadSingle(), a); } } if (BonesEnabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.BoneWeights = reader.ReadVector4(); vertex.BoneIndices = reader.ReadShortVector4(); } } if (TangentsEnabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.Tangent = reader.ReadVector3(); } } if (TextureCoordinates1Enabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.TextureCoordinates[0] = reader.ReadVector2(); } } if (TextureCoordinates2Enabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.TextureCoordinates[1] = reader.ReadVector2(); } } if (TextureCoordinates3Enabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.TextureCoordinates[2] = reader.ReadVector2(); } } if (TextureCoordinates4Enabled) { for (int i = 0; i < vertexCount; i++) { ModelVertex vertex = Vertices[i]; vertex.TextureCoordinates[3] = reader.ReadVector2(); } } short indexCount = reader.ReadInt16(); for (int i = 0; i < indexCount; i++) { Indices.Add(reader.ReadShortVector3()); } short materialCount = reader.ReadInt16(); for (int i = 0; i < materialCount; i++) { Materials.Add(reader.ReadInt16()); } short stripCount = reader.ReadInt16(); for (int i = 0; i < stripCount; i++) { Strips.Add(reader.ReadInt16()); } if (version >= 8) { Pool = (PoolType)reader.ReadInt16(); } }
public Axes(Stream stream) { BinaryReader reader = new BinaryReader(stream); m_PreQ = reader.ReadVector4(); m_PostQ = reader.ReadVector4(); m_Sgn = reader.ReadVector4(); m_Limit = new Limit(stream); m_Length = reader.ReadSingle(); m_Type = reader.ReadUInt32(); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.fieldpad = binaryReader.ReadBytes(2); this.fieldpad0 = binaryReader.ReadBytes(2); this.fieldpad1 = binaryReader.ReadBytes(16); this.fieldpad2 = binaryReader.ReadBytes(8); this.fieldpad3 = binaryReader.ReadBytes(8); this.fieldpad4 = binaryReader.ReadBytes(16); this.fieldpad5 = binaryReader.ReadBytes(8); this.fieldpad6 = binaryReader.ReadBytes(8); this.OverlayedScreenAlphaMod = binaryReader.ReadSingle(); this.IncTextUpdatePeriod = binaryReader.ReadInt16(); this.IncTextBlockCharacter = binaryReader.ReadInt16(); this.CalloutTextScale = binaryReader.ReadSingle(); this.ProgressBarColor = binaryReader.ReadVector4(); this.NearClipPlaneDistance = binaryReader.ReadSingle(); this.ProjectionPlaneDistance = binaryReader.ReadSingle(); this.FarClipPlaneDistance = binaryReader.ReadSingle(); this.OverlayedInterfaceColor = binaryReader.ReadVector4(); this.fieldpad7 = binaryReader.ReadBytes(12); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(40)); this.SoundTag = binaryReader.ReadTagReference(); this.SoundTag0 = binaryReader.ReadTagReference(); this.SoundTag1 = binaryReader.ReadTagReference(); this.SoundTag2 = binaryReader.ReadTagReference(); this.SoundTag3 = binaryReader.ReadTagReference(); this.SoundTag4 = binaryReader.ReadTagReference(); this.SoundTag5 = binaryReader.ReadTagReference(); this.SoundTag6 = binaryReader.ReadTagReference(); this.SoundTag7 = binaryReader.ReadTagReference(); this.SoundTag8 = binaryReader.ReadTagReference(); this.SoundTag9 = binaryReader.ReadTagReference(); this.TagReference = binaryReader.ReadTagReference(); this.SoundTag10 = binaryReader.ReadTagReference(); this.TagReference0 = binaryReader.ReadTagReference(); this.TagReference1 = binaryReader.ReadTagReference(); this.TagReference2 = binaryReader.ReadTagReference(); this.GlobalBitmapsTag = binaryReader.ReadTagReference(); this.UnicodeStringListTag = binaryReader.ReadTagReference(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(44)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(24)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16)); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(8)); this.ButtonKeyTypeStrings = binaryReader.ReadTagReference(); this.GameTypeStrings = binaryReader.ReadTagReference(); this.TagReference3 = binaryReader.ReadTagReference(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(4)); this.FullScreenHeaderTextFont = ((FullScreenHeaderTextFontEnum)(binaryReader.ReadInt16())); this.LargeDialogHeaderTextFont = ((LargeDialogHeaderTextFontEnum)(binaryReader.ReadInt16())); this.HalfDialogHeaderTextFont = ((HalfDialogHeaderTextFontEnum)(binaryReader.ReadInt16())); this.QtrDialogHeaderTextFont = ((QtrDialogHeaderTextFontEnum)(binaryReader.ReadInt16())); this.DefaultTextColor = binaryReader.ReadVector4(); this.FullScreenHeaderTextBounds = binaryReader.ReadVector2(); this.FullScreenButtonKeyTextBounds = binaryReader.ReadVector2(); this.LargeDialogHeaderTextBounds = binaryReader.ReadVector2(); this.LargeDialogButtonKeyTextBounds = binaryReader.ReadVector2(); this.HalfDialogHeaderTextBounds = binaryReader.ReadVector2(); this.HalfDialogButtonKeyTextBounds = binaryReader.ReadVector2(); this.QtrDialogHeaderTextBounds = binaryReader.ReadVector2(); this.QtrDialogButtonKeyTextBounds = binaryReader.ReadVector2(); this.MainMenuMusic = binaryReader.ReadTagReference(); this.MusicFadeTime = binaryReader.ReadInt32(); return(pointerQueue); }
public ErrorReportsBlock(BinaryReader binaryReader) { this.type = (Type)binaryReader.ReadInt16(); this.flags = (Flags)binaryReader.ReadInt16(); this.paddingtext = binaryReader.ReadBytes(8); this.sourceFilename = binaryReader.ReadString32(); this.sourceLineNumber = binaryReader.ReadInt32(); this.vertices = ReadVertices(binaryReader); this.vectors = ReadVectors(binaryReader); this.lines = ReadLines(binaryReader); this.triangles = ReadTriangles(binaryReader); this.quads = ReadQuads(binaryReader); this.comments = ReadComments(binaryReader); this.padding = binaryReader.ReadBytes(380); this.reportKey = binaryReader.ReadInt32(); this.nodeIndex = binaryReader.ReadInt32(); this.boundsX = binaryReader.ReadRange(); this.boundsY = binaryReader.ReadRange(); this.boundsZ = binaryReader.ReadRange(); this.color = binaryReader.ReadVector4(); this.padding0 = binaryReader.ReadBytes(84); }
public RoRsmMeshPositionFrame(BinaryReader bin, GenericFileFormatVersion version) : base(bin, version) { Frame = bin.ReadInt32(); Position = bin.ReadVector4(); }
Material[] ReadMaterials (BinaryReader reader, Dictionary<string, Texture> textures) { var matCount = reader.ReadInt32(); var mats = new MeshMaterial[matCount]; for (var i = 0; i < matCount; i++) { var name = reader.ReadString(); var mat = new MeshMaterial(null, name); mat.IsTwoSided = reader.ReadBoolean(); mat.IsWireframeEnabled = reader.ReadBoolean(); var shadingMode = (ShadingMode)reader.ReadInt32(); mat.BlendMode = (BlendMode)reader.ReadInt32(); mat.Opacity = reader.ReadSingle(); mat.Shininess = reader.ReadSingle(); mat.ShininessStrength = reader.ReadSingle(); mat.ColorAmbient = reader.ReadVector4(); mat.ColorDiffuse = reader.ReadVector4(); mat.ColorSpecular = reader.ReadVector4(); mat.ColorEmissive = reader.ReadVector4(); mat.ColorTransparent = reader.ReadVector4(); var boneCount = reader.ReadInt32(); var boneSlotCount = reader.ReadInt32(); mat.DiffuseMap = this.ReadTextureStack(reader, textures); mat.NormalMap = this.ReadTextureStack(reader, textures); mat.SpecularMap = this.ReadTextureStack(reader, textures); mat.EmissiveMap = this.ReadTextureStack(reader, textures); var settings = new MeshShaderSettings { MaxLights = 4, BoneCount = boneCount, BoneSlotCount = boneSlotCount, ShadingMode = shadingMode, Diffuse = GetMeshTextureStack(mat.DiffuseMap), Normal = GetMeshTextureStack(mat.NormalMap), Specular = GetMeshTextureStack(mat.SpecularMap), Emissive = GetMeshTextureStack(mat.EmissiveMap) }; mat.Shader = new MeshShader(settings); mats[i] = mat; } return mats; }
public PlanesBlock(BinaryReader binaryReader) { this.plane = binaryReader.ReadVector4(); }
public TransparentPlanesBlock(BinaryReader binaryReader) { this.sectionIndex = binaryReader.ReadInt16(); this.partIndex = binaryReader.ReadInt16(); this.plane = binaryReader.ReadVector4(); }
public ErrorReportsBlock(BinaryReader binaryReader) { this.type = (Type)binaryReader.ReadInt16(); this.flags = (Flags)binaryReader.ReadInt16(); this.paddingtext = binaryReader.ReadBytes(8); this.sourceFilename = binaryReader.ReadString32(); this.sourceLineNumber = binaryReader.ReadInt32(); { var elementSize = Marshal.SizeOf(typeof(ErrorReportVerticesBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); this.vertices = new ErrorReportVerticesBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; this.vertices[i] = new ErrorReportVerticesBlock(binaryReader); } } } { var elementSize = Marshal.SizeOf(typeof(ErrorReportVectorsBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); this.vectors = new ErrorReportVectorsBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; this.vectors[i] = new ErrorReportVectorsBlock(binaryReader); } } } { var elementSize = Marshal.SizeOf(typeof(ErrorReportLinesBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); this.lines = new ErrorReportLinesBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; this.lines[i] = new ErrorReportLinesBlock(binaryReader); } } } { var elementSize = Marshal.SizeOf(typeof(ErrorReportTrianglesBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); this.triangles = new ErrorReportTrianglesBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; this.triangles[i] = new ErrorReportTrianglesBlock(binaryReader); } } } { var elementSize = Marshal.SizeOf(typeof(ErrorReportQuadsBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); this.quads = new ErrorReportQuadsBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; this.quads[i] = new ErrorReportQuadsBlock(binaryReader); } } } { var elementSize = Marshal.SizeOf(typeof(ErrorReportCommentsBlock)); var blamPointer = binaryReader.ReadBlamPointer(elementSize); this.comments = new ErrorReportCommentsBlock[blamPointer.Count]; using (binaryReader.BaseStream.Pin()) { for (int i = 0; i < blamPointer.Count; ++i) { binaryReader.BaseStream.Position = blamPointer[i]; this.comments[i] = new ErrorReportCommentsBlock(binaryReader); } } } this.padding = binaryReader.ReadBytes(380); this.reportKey = binaryReader.ReadInt32(); this.nodeIndex = binaryReader.ReadInt32(); this.boundsX = binaryReader.ReadRange(); this.boundsY = binaryReader.ReadRange(); this.boundsZ = binaryReader.ReadRange(); this.color = binaryReader.ReadVector4(); this.padding0 = binaryReader.ReadBytes(84); }
public ErrorReportQuadsBlock(BinaryReader binaryReader) { this.points = new Points[4]; for (int i = 0; i < 4; ++i) { this.points[i] = new Points(binaryReader); } this.color = binaryReader.ReadVector4(); }
public void LoadFrom(Stream stream) { BinaryReader reader = new BinaryReader(stream); m_Name = reader.ReadNameA4(); m_Rect = new Rectf(stream); m_Offset = reader.ReadVector2(); m_Border = reader.ReadVector4(); m_PixelsToUnits = reader.ReadSingle(); m_Extrude = reader.ReadUInt32(); m_RD = new SpriteRenderData(file, stream); }
public ErrorReportCommentsBlock(BinaryReader binaryReader) { this.paddingtext = binaryReader.ReadBytes(8); this.position = binaryReader.ReadVector3(); this.nodeIndices = new NodeIndices[4]; for (int i = 0; i < 4; ++i) { this.nodeIndices[i] = new NodeIndices(binaryReader); } this.nodeWeights = new NodeWeights[4]; for (int i = 0; i < 4; ++i) { this.nodeWeights[i] = new NodeWeights(binaryReader); } this.color = binaryReader.ReadVector4(); }
public void LoadFrom(Stream stream) { BinaryReader reader = new BinaryReader(stream); texture = new PPtr<Texture2D>(stream, file); int numVertices = reader.ReadInt32(); vertices = new SpriteVertex[numVertices]; for (int i = 0; i < numVertices; i++) { vertices[i] = new SpriteVertex(stream); } int numIndices = reader.ReadInt32(); indices = reader.ReadUInt16Array(numIndices); if ((numIndices & 1) > 0) { reader.ReadBytes(2); } textureRect = new Rectf(stream); textureRectOffset = reader.ReadVector2(); settingsRaw = reader.ReadUInt32(); uvTransform = reader.ReadVector4(); }
public Limit(Stream stream) { BinaryReader reader = new BinaryReader(stream); m_Min = reader.ReadVector4(); m_Max = reader.ReadVector4(); }
public static Camera TryMakeCamera(BinaryReader reader, Matrix4x4 transMat) { Vector2 zoneA = reader.ReadVector2(); reader.SkipBytes(8); Vector2 zoneB = reader.ReadVector2(); Vector2 zoneHeights = reader.ReadVector2(); Vector2 constraintA = reader.ReadVector2(); reader.SkipBytes(8); Vector2 constraintB = reader.ReadVector2(); Vector2 constraintHeights = reader.ReadVector2(); reader.SkipInt32(0); int type = reader.ReadInt32(); reader.SkipInt32(0); int Unknown1 = reader.ReadInt32(); Vector4 Unknown2 = reader.ReadVector4(); Vector2 Unknown3 = reader.ReadVector2(); reader.SkipInt32(0); int Unknown4 = reader.ReadInt32(); Vector2 Unknown5 = reader.ReadVector2(); Vector2 Unknown6 = reader.ReadVector2(); if (type != 1) { Camera cam = new Camera(); Vector3 activeMin = new Vector3(zoneA.x, -zoneHeights.x, zoneA.y); Vector3 activeMax = new Vector3(zoneB.x, -zoneHeights.y, zoneB.y); cam.activeArea = new Bounds(); cam.activeArea.SetMinMax(transMat.MultiplyPoint(activeMin), transMat.MultiplyPoint(activeMax)); Vector3 constraintMin = new Vector3(constraintA.x, -constraintHeights.x, constraintA.y); Vector3 constraintMax = new Vector3(constraintB.x, -constraintHeights.y, constraintB.y); cam.constraintsArea = new Bounds(); cam.constraintsArea.SetMinMax(transMat.MultiplyPoint(constraintMin), transMat.MultiplyPoint(constraintMax)); cam.type = type; cam.Unknown1 = Unknown1; cam.Unknown2 = Unknown2; cam.Unknown3 = Unknown3; cam.Unknown4 = Unknown4; cam.Unknown5 = Unknown5; cam.Unknown6 = Unknown6; return cam; } return null; }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Plane = binaryReader.ReadVector4(); return(pointerQueue); }
public ModelNodeBlock(BinaryReader binaryReader) { this.name = binaryReader.ReadStringID(); this.parentNode = binaryReader.ReadShortBlockIndex1(); this.firstChildNode = binaryReader.ReadShortBlockIndex1(); this.nextSiblingNode = binaryReader.ReadShortBlockIndex1(); this.padding = binaryReader.ReadBytes(2); this.defaultTranslation = binaryReader.ReadVector3(); this.defaultRotation = binaryReader.ReadVector4(); this.defaultInverseScale = binaryReader.ReadSingle(); this.defaultInverseForward = binaryReader.ReadVector3(); this.defaultInverseLeft = binaryReader.ReadVector3(); this.defaultInverseUp = binaryReader.ReadVector3(); this.defaultInversePosition = binaryReader.ReadVector3(); }
public static MapLights ReadLights(string path) { /*string assetPath = path.Replace(".ded", ".asset");*/ GameObject subGO = Scene.BeginEditingPrefab(path, "Lights"); try { MapLights lights = subGO.AddComponent<MapLights>(); BinaryReader reader = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read)); reader.SkipInt16(); //Usually the area's code reader.SkipInt16(); //Usually 1, saw a 20 short globalLightsCount = reader.ReadInt16(); reader.SkipInt16(0); short globalLightsOffset = reader.ReadInt16(); reader.SkipInt16(0); reader.SkipBytes(8, 0); short weirdLightsCount = reader.ReadInt16(); reader.SkipInt16(0); short weirdLightsOffset = reader.ReadInt16(); reader.SkipInt16(0); reader.SkipBytes(8, 0); short lightsCount = reader.ReadInt16(); reader.SkipInt16(0); short lightsOffset = reader.ReadInt16(); reader.SkipInt16(0); reader.SkipBytes(40, 0); short ambientOffset = reader.ReadInt16(); reader.SkipBytes(24, 0); Matrix4x4 transMat = lights.GetComponentInParent<Scene>().GetSH3ToUnityMatrix(); reader.BaseStream.Position = globalLightsOffset; for (int i = 0; i != globalLightsCount; i++) { GlobalLight gl = new GlobalLight(); gl.rotation = reader.ReadQuaternion(); gl.Unknown1 = reader.ReadVector3(); reader.SkipInt16(0); gl.Unknown2 = reader.ReadInt16(); lights.globalLights.Add(gl); } reader.BaseStream.Position = weirdLightsOffset; for (int i = 0; i != weirdLightsCount; i++) { LocalLight ll = new LocalLight(); ll.color = reader.ReadColor(); ll.Unknown1 = reader.ReadSingle(); ll.Range = reader.ReadSingle(); reader.SkipBytes(8, 0); ll.position = reader.ReadVector3YInverted(); reader.SkipInt16(0x0); ll.Unknown2 = reader.ReadInt16(); lights.weirdLights.Add(ll); } reader.BaseStream.Position = lightsOffset; for (int i = 0; i != lightsCount; i++) { LocalLight ll = new LocalLight(); ll.color = reader.ReadColor(); ll.Unknown1 = reader.ReadSingle(); ll.Range = reader.ReadSingle(); reader.SkipBytes(8, 0); ll.position = reader.ReadVector3YInverted(); reader.SkipInt16(0x0); ll.Unknown2 = reader.ReadInt16(); lights.localLights.Add(ll); GameObject lightGO = new GameObject("Light " + i); lightGO.transform.SetParent(subGO.transform); lightGO.transform.localPosition = transMat.MultiplyPoint(ll.position); Light light = lightGO.AddComponent<Light>(); light.type = LightType.Point; light.range = ll.Range * Scene.GLOBAL_SCALE; light.color = ll.color; light.intensity = 8.0f; light.bounceIntensity = 1.0f; } reader.BaseStream.Position = ambientOffset; lights.Unknown1 = reader.ReadVector4(); lights.Unknown2 = reader.ReadVector4(); lights.ambientColor = reader.ReadColor(); lights.Unknown3 = reader.ReadVector4(); reader.Close(); Scene.FinishEditingPrefab(path, subGO); return lights; } catch (Exception e) { Debug.LogException(e); } return null; }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.Anchor = ((AnchorEnum)(binaryReader.ReadInt16())); this.fieldpad = binaryReader.ReadBytes(2); this.fieldpad0 = binaryReader.ReadBytes(32); this.AnchorOffset = binaryReader.ReadPoint(); this.WidthScale = binaryReader.ReadSingle(); this.HeightScale = binaryReader.ReadSingle(); this.HudGlobalsScalingFlags = ((ScalingFlags)(binaryReader.ReadInt16())); this.fieldpad1 = binaryReader.ReadBytes(2); this.fieldpad2 = binaryReader.ReadBytes(20); this.Obsolete1 = binaryReader.ReadTagReference(); this.Obsolete2 = binaryReader.ReadTagReference(); this.UpTime = binaryReader.ReadSingle(); this.FadeTime = binaryReader.ReadSingle(); this.IconColor = binaryReader.ReadVector4(); this.TextColor = binaryReader.ReadVector4(); this.TextSpacing = binaryReader.ReadSingle(); this.ItemMessageText = binaryReader.ReadTagReference(); this.IconBitmap = binaryReader.ReadTagReference(); this.AlternateIconText = binaryReader.ReadTagReference(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(16)); this.DefaultColor = binaryReader.ReadColourA1R1G1B1(); this.FlashingColor = binaryReader.ReadColourA1R1G1B1(); this.FlashPeriod = binaryReader.ReadSingle(); this.FlashDelay = binaryReader.ReadSingle(); this.NumberOfFlashes = binaryReader.ReadInt16(); this.HudGlobalsFlashFlags = ((FlashFlags)(binaryReader.ReadInt16())); this.FlashLength = binaryReader.ReadSingle(); this.DisabledColor = binaryReader.ReadColourA1R1G1B1(); this.fieldpad3 = binaryReader.ReadBytes(4); this.HudMessages = binaryReader.ReadTagReference(); this.DefaultColor0 = binaryReader.ReadColourA1R1G1B1(); this.FlashingColor0 = binaryReader.ReadColourA1R1G1B1(); this.FlashPeriod0 = binaryReader.ReadSingle(); this.FlashDelay0 = binaryReader.ReadSingle(); this.NumberOfFlashes0 = binaryReader.ReadInt16(); this.HudGlobalsHudGlobalsFlashFlags0 = ((HudGlobalsFlashFlags0)(binaryReader.ReadInt16())); this.FlashLength0 = binaryReader.ReadSingle(); this.DisabledColor0 = binaryReader.ReadColourA1R1G1B1(); this.UptimeTicks = binaryReader.ReadInt16(); this.FadeTicks = binaryReader.ReadInt16(); this.TopOffset = binaryReader.ReadSingle(); this.BottomOffset = binaryReader.ReadSingle(); this.LeftOffset = binaryReader.ReadSingle(); this.RightOffset = binaryReader.ReadSingle(); this.fieldpad4 = binaryReader.ReadBytes(32); this.ArrowBitmap = binaryReader.ReadTagReference(); pointerQueue.Enqueue(binaryReader.ReadBlamPointer(104)); this.fieldpad5 = binaryReader.ReadBytes(80); this.HudScaleInMultiplayer = binaryReader.ReadSingle(); this.fieldpad6 = binaryReader.ReadBytes(256); this.fieldpad7 = binaryReader.ReadBytes(16); this.MotionSensorRange = binaryReader.ReadSingle(); this.MotionSensorVelocitySensitivity = binaryReader.ReadSingle(); this.MotionSensorScaleDONTTOUCHEVER = binaryReader.ReadSingle(); this.DefaultChapterTitleBounds = binaryReader.ReadVector2(); this.fieldpad8 = binaryReader.ReadBytes(44); this.TopOffset0 = binaryReader.ReadInt16(); this.BottomOffset0 = binaryReader.ReadInt16(); this.LeftOffset0 = binaryReader.ReadInt16(); this.RightOffset0 = binaryReader.ReadInt16(); this.fieldpad9 = binaryReader.ReadBytes(32); this.IndicatorBitmap = binaryReader.ReadTagReference(); this.SequenceIndex = binaryReader.ReadInt16(); this.MultiplayerSequenceIndex = binaryReader.ReadInt16(); this.Color = binaryReader.ReadColourA1R1G1B1(); this.fieldpad10 = binaryReader.ReadBytes(16); this.DefaultColor1 = binaryReader.ReadColourA1R1G1B1(); this.FlashingColor1 = binaryReader.ReadColourA1R1G1B1(); this.FlashPeriod1 = binaryReader.ReadSingle(); this.FlashDelay1 = binaryReader.ReadSingle(); this.NumberOfFlashes1 = binaryReader.ReadInt16(); this.HudGlobalsHudGlobalsFlashFlags1 = ((HudGlobalsFlashFlags1)(binaryReader.ReadInt16())); this.FlashLength1 = binaryReader.ReadSingle(); this.DisabledColor1 = binaryReader.ReadColourA1R1G1B1(); this.fieldpad11 = binaryReader.ReadBytes(4); this.DefaultColor2 = binaryReader.ReadColourA1R1G1B1(); this.FlashingColor2 = binaryReader.ReadColourA1R1G1B1(); this.FlashPeriod2 = binaryReader.ReadSingle(); this.FlashDelay2 = binaryReader.ReadSingle(); this.NumberOfFlashes2 = binaryReader.ReadInt16(); this.HudGlobalsHudGlobalsFlashFlags2 = ((HudGlobalsFlashFlags2)(binaryReader.ReadInt16())); this.FlashLength2 = binaryReader.ReadSingle(); this.DisabledColor2 = binaryReader.ReadColourA1R1G1B1(); this.fieldpad12 = binaryReader.ReadBytes(4); this.fieldpad13 = binaryReader.ReadBytes(40); this.CarnageReportBitmap = binaryReader.ReadTagReference(); this.LoadingBeginText = binaryReader.ReadInt16(); this.LoadingEndText = binaryReader.ReadInt16(); this.CheckpointBeginText = binaryReader.ReadInt16(); this.CheckpointEndText = binaryReader.ReadInt16(); this.CheckpointSound = binaryReader.ReadTagReference(); this.fieldpad14 = binaryReader.ReadBytes(96); pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(pointerQueue.Concat(this.NewGlobals.ReadFields(binaryReader))); return(pointerQueue); }
private void init(string filename, Stream stream, string contentDirectory, Dictionary<string,Type> materialTypes, List<MaterialFieldBinder> value1BinderTypes, List<MaterialFieldBinder> value2BinderTypes, List<MaterialFieldBinder> value3BinderTypes, List<MaterialFieldBinder> value4BinderTypes, List<MaterialFieldBinder> textureBinderTypes, Dictionary<string,string> fileExtOverrides, int classicInstanceCount, Loader.LoadedCallbackMethod loadedCallback) { try { var reader = new BinaryReader(stream); // meta data if (reader.ReadInt32() != Streams.MakeFourCC('R', 'M', 'F', 'T')) Debug.ThrowError("Error", "Not a ReignModel file: " + filename); float version = reader.ReadSingle(); if (version != 1.0f) Debug.ThrowError("Error", "Unsuported model version: " + version.ToString()); bool compressed = reader.ReadBoolean(); // frames FrameStart = reader.ReadSingle(); FrameEnd = reader.ReadSingle(); FrameCount = FrameEnd - FrameStart; FPS = reader.ReadSingle(); // materials int materialCount = reader.ReadInt32(); Materials = new MaterialI[materialCount]; Textures = new List<ITexture2D>(); for (int i = 0; i != materialCount; ++i) { string name = reader.ReadString(); // create material bool pass = false; foreach (var materialType in (Dictionary<string,Type>)materialTypes) { if (materialType.Key == name) { Materials[i] = (MaterialI)Activator.CreateInstance(materialType.Value); Materials[i].Name = name; pass = true; break; } } if (!pass) Debug.ThrowError("Model", "Failed to find a valid material type for: " + name); var material = Materials[i]; // values1 var values1 = new Dictionary<string,float>(); int valueCount = reader.ReadInt32(); for (int i2 = 0; i2 != valueCount; ++i2) values1.Add(reader.ReadString(), reader.ReadSingle()); bindTypes(material, values1, value1BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder); // values2 var values2 = new Dictionary<string,Vector2>(); valueCount = reader.ReadInt32(); for (int i2 = 0; i2 != valueCount; ++i2) values2.Add(reader.ReadString(), reader.ReadVector2()); bindTypes(material, values2, value2BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder); // values3 var values3 = new Dictionary<string,Vector3>(); valueCount = reader.ReadInt32(); for (int i2 = 0; i2 != valueCount; ++i2) values3.Add(reader.ReadString(), reader.ReadVector3()); bindTypes(material, values3, value3BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder); // values4 var values4 = new Dictionary<string,Vector4>(); valueCount = reader.ReadInt32(); for (int i2 = 0; i2 != valueCount; ++i2) values4.Add(reader.ReadString(), reader.ReadVector4()); bindTypes(material, values4, value4BinderTypes, contentDirectory, fileExtOverrides, handleFoundValueBinder); // textures var textures = new Dictionary<string,string>(); int textureCount = reader.ReadInt32(); for (int i2 = 0; i2 != textureCount; ++i2) textures.Add(reader.ReadString(), reader.ReadString()); bindTypes(material, textures, textureBinderTypes, contentDirectory, fileExtOverrides, handleFoundTextureBinder); } // meshes int meshCount = reader.ReadInt32(); Meshes = new Mesh[meshCount]; for (int i = 0; i != meshCount; ++i) { Meshes[i] = new Mesh(reader, this, classicInstanceCount); } // actions int actionCount = reader.ReadInt32(); Actions = new Action[actionCount]; for (int i = 0; i != actionCount; ++i) { Actions[i] = new Action(reader); } // armatures int armatureCount = reader.ReadInt32(); Armatures = new Armature[armatureCount]; for (int i = 0; i != armatureCount; ++i) { Armatures[i] = new Armature(reader); } // objects int objectCount = reader.ReadInt32(); Objects = new Object[objectCount]; for (int i = 0; i != objectCount; ++i) { string type = reader.ReadString(); if (type == "MESH") Objects[i] = new ObjectMesh(reader, this); else if (type == "ARMATURE") Objects[i] = new ObjectArmature(reader, this); else Debug.ThrowError("Mesh", "Unsuported Object type: " + type); } // link objects foreach (var o in Objects) { o.linkObjects(Objects); } } catch (Exception e) { FailedToLoad = true; Loader.AddLoadableException(e); Dispose(); if (loadedCallback != null) loadedCallback(this, false); return; } if (Textures.Count == 0) { Loaded = true; if (loadedCallback != null) loadedCallback(this, true); } else { new LoadWaiter(Textures.ToArray(), delegate(object sender, bool succeeded) { if (succeeded) { Loaded = true; if (loadedCallback != null) loadedCallback(this, true); } else { FailedToLoad = true; Dispose(); if (loadedCallback != null) loadedCallback(this, false); } }); } }
public ErrorReportVectorsBlock(BinaryReader binaryReader) { this.position = binaryReader.ReadVector3(); this.nodeIndices = new NodeIndices[4]; for (int i = 0; i < 4; ++i) { this.nodeIndices[i] = new NodeIndices(binaryReader); } this.nodeWeights = new NodeWeights[4]; for (int i = 0; i < 4; ++i) { this.nodeWeights[i] = new NodeWeights(binaryReader); } this.color = binaryReader.ReadVector4(); this.normal = binaryReader.ReadVector3(); this.screenLength = binaryReader.ReadSingle(); }
public void LoadFrom(Stream stream) { BinaryReader reader = new BinaryReader(stream); m_GameObject = new PPtr<GameObject>(stream, file); m_Enabled = reader.ReadBoolean(); m_CastShadows = reader.ReadBoolean(); m_ReceiveShadows = reader.ReadBoolean(); m_LightmapIndex = reader.ReadByte(); m_LightmapTilingOffset = reader.ReadVector4(); int numMaterials = reader.ReadInt32(); m_Materials = new List<PPtr<Material>>(numMaterials); for (int i = 0; i < numMaterials; i++) { m_Materials.Add(new PPtr<Material>(stream, file)); } int numSubsetIndices = reader.ReadInt32(); m_SubsetIndices = reader.ReadUInt32Array(numSubsetIndices); m_StaticBatchRoot = new PPtr<Transform>(stream, file); m_UseLightProbes = reader.ReadBoolean(); reader.ReadBytes(3); m_LightProbeAnchor = new PPtr<Transform>(stream, file); m_SortingLayerID = reader.ReadUInt32(); m_SortingOrder = reader.ReadInt16(); reader.ReadBytes(2); }
public StructureBspFogPlaneBlock(BinaryReader binaryReader) { this.scenarioPlanarFogIndex = binaryReader.ReadInt16(); this.padding = binaryReader.ReadBytes(2); this.plane = binaryReader.ReadVector4(); this.flags = (Flags)binaryReader.ReadInt16(); this.priority = binaryReader.ReadInt16(); }