コード例 #1
0
        /// <summary>
        /// Writes this material logic entry to a file.
        /// </summary>
        /// <param name="writer">The binary writer for this SegaNN file.</param>
        /// <param name="index">The number of this material logic entry in a linear list.</param>
        /// <param name="ObjectOffsets">The list of offsets this Object chunk uses.</param>
        public void Write(BinaryWriterEx writer, int index, Dictionary <string, uint> ObjectOffsets)
        {
            // Add an entry for this material logic entry into the offset list so we know where it is.
            ObjectOffsets.Add($"LogicOffset{index}", (uint)writer.BaseStream.Position);

            // Write the material logic data.
            writer.Write(Blend);
            writer.FixPadding();
            writer.Write((uint)SRCBlend);
            writer.Write((uint)DSTBlend);
            writer.Write(BlendFactor);
            writer.Write((uint)BlendOperation);
            writer.Write((uint)LogicOperation);
            writer.Write(Alpha);
            writer.FixPadding();
            writer.Write((uint)AlphaFunction);
            writer.Write(AlphaRef);
            writer.Write(ZComparison);
            writer.FixPadding();
            writer.Write((uint)ZComparisonFunction);
            writer.Write(ZUpdate);
            writer.FixPadding();
            writer.Write(Reserved0);
            writer.Write(Reserved1);
            writer.Write(Reserved2);
            writer.Write(Reserved3);
        }
コード例 #2
0
ファイル: NinjaCamera.cs プロジェクト: Knuxfan24/Marathon
        /// <summary>
        /// Write the Ninja Camera to a file.
        /// </summary>
        /// <param name="writer">The binary writer for this SegaNN file.</param>
        public void Write(BinaryWriterEx writer)
        {
            // Write NXCA header.
            writer.Write("NXCA");
            writer.Write("SIZE"); // Temporary entry, is filled in later once we know this chunk's size.
            long HeaderSizePosition = writer.BaseStream.Position;

            writer.AddOffset("dataOffset");
            writer.FixPadding(0x10);

            // Write camera data.
            uint CameraPosition = (uint)writer.BaseStream.Position;

            writer.Write(UnknownUInt32_1);
            writer.Write(UnknownUInt32_2);
            writer.Write(UnknownVector3_1);
            writer.Write(UnknownVector3_2);
            writer.Write(UnknownFloat_1);
            writer.Write(UnknownFloat_2);
            writer.Write(UnknownFloat_3);
            writer.Write(UnknownFloat_4);

            // Write chunk data.
            writer.FillOffset("dataOffset", true);
            writer.Write((uint)Type);
            writer.AddOffset($"CameraData", 0);
            writer.Write(CameraPosition - 0x20);

            // Alignment.
            writer.FixPadding(0x10);

            // Write chunk size.
            long ChunkEndPosition = writer.BaseStream.Position;
            uint ChunkSize        = (uint)(ChunkEndPosition - HeaderSizePosition);

            writer.BaseStream.Position = HeaderSizePosition - 4;
            writer.Write(ChunkSize);
            writer.BaseStream.Position = ChunkEndPosition;
        }