WriteUInt32() публичный Метод

public WriteUInt32 ( uint value ) : void
value uint
Результат void
Пример #1
0
        public override ByteArray Write()
        {
            ByteArray header = new ByteArray();

            int attrib = Write3D(header);

            if (materials.Count > 0)
            {
                attrib |= 256;

                header.WriteByte(materials.Count);

                if (materials.Count == 1)
                {
                    header.WriteUInt32((uint)materials[0]);
                }
                else
                {
                    for (int i = 0; i < materials.Count; i++)
                    {
                        header.WriteUInt32((uint)(materials[i] + 1));
                    }
                }
            }

            if (modifiers.Count > 0)
            {
                attrib |= 512;

                header.WriteByte(modifiers.Count);

                for (int i = 0; i < modifiers.Count; i++)
                {
                    header.WriteUInt32(modifiers[i]);
                }
            }

            ByteArray data = new ByteArray();

            data.WriteUInt16(attrib);
            data.WriteBytes(header.ToArray());

            data.WriteFloats(transform);
            data.WriteUInt32((uint)geometry);

            WriteTags(data);

            return data;
        }
Пример #2
0
        protected int Write3D(ByteArray header)
        {
            int attrib = 0x0000;

            if (parent != -1)
            {
                attrib |= 1;
                header.WriteUInt32((uint)parent);
            }

            return attrib;
        }
Пример #3
0
        public override ByteArray Write()
        {
            ByteArray stream = new ByteArray();

            // update num of vertex
            numVertex = (uint)(vertex.Length / 3);

            int attrib = 0x0000;

            if (isBig) attrib |= 1;
            if (normal != null) attrib |= 4;
            if (tangent != null) attrib |= 8;
            if (uv != null) attrib |= 32;

            stream.WriteUInt16(attrib);

            if (isBig) stream.WriteUInt32(numVertex);
            else stream.WriteUInt16((int)numVertex);

            if (normal != null)
            {
                for (int i = 0; i < normal.Length; i++)
                {
                    stream.WriteFloat(normal[i]);
                }
            }

            if (tangent != null)
            {
                for (int i = 0; i < tangent.Length; i++)
                {
                    stream.WriteFloat(tangent[i]);
                }
            }

            if (uv != null)
            {
                stream.WriteByte(uv.Length);

                for (int i = 0; i < uv.Length; i++)
                {
                    for (int j = 0; j < uv[i].Length; j++)
                    {
                        stream.WriteFloat(uv[i][j]);
                    }
                }
            }

            for (int i = 0; i < vertex.Length; i++)
            {
                stream.WriteFloat(vertex[i]);
            }

            stream.WriteByte(indexes.Length);

            if (isBig)
            {
                for (int i = 0; i < indexes.Length; i++)
                {
                    uint[] idxs = indexes[i];

                    stream.WriteUInt32((uint)(idxs.Length / 3));

                    uint j = 0;
                    while (j < idxs.Length)
                    {
                        stream.WriteUInt32(idxs[j++]);
                    }
                }
            }
            else
            {
                for (int i = 0; i < indexes.Length; i++)
                {
                    uint[] idxs = indexes[i];

                    stream.WriteUInt16(idxs.Length / 3);

                    int j = 0;
                    while (j < idxs.Length)
                    {
                        stream.WriteUInt16((int)idxs[j++]);
                    }
                }
            }

            return stream;
        }
Пример #4
0
        public byte[] Build()
        {
            // Body
            byte[] body = GetBody();

            // Write Bytes
            ByteArray bytes = new ByteArray();

            // Write MAGIC
            bytes.WriteUTFBytes("SEA");

            // Write SIGNATURE
            bytes.WriteUTFBytes("S3D");

            // Write Version
            bytes.WriteUInt24(version);

            // Write Protect Method
            bytes.WriteByte(0);

            // Write Compress Method
            bytes.WriteByte(SEA3DWriter.CompressionID(compressAlgorithm));

            // Write File Count
            bytes.WriteUInt32((uint)_objects.Count);

            // Write Body
            bytes.WriteBytes(body);

            // Write Final
            bytes.WriteUInt24(0x5EA3D1);

            return bytes.ToArray();
        }