WriteFloat() public method

public WriteFloat ( float value ) : void
value float
return void
コード例 #1
0
ファイル: PhysicalTech.cs プロジェクト: sunag/sea3d
        public override ByteArray Write()
        {
            ByteArray data = new ByteArray();

            data.WriteUInt24(color);

            data.WriteFloat(roughness);
            data.WriteFloat(metalness);

            return data;
        }
コード例 #2
0
ファイル: PhongTech.cs プロジェクト: sunag/sea3d
        public override ByteArray Write()
        {
            ByteArray data = new ByteArray();

            data.WriteUInt24(ambientColor);
            data.WriteUInt24(diffuseColor);
            data.WriteUInt24(specularColor);

            data.WriteFloat(specular);
            data.WriteFloat(gloss);

            return data;
        }
コード例 #3
0
ファイル: SEADummy.cs プロジェクト: sunag/sea3d
        public override ByteArray Write()
        {
            ByteArray header = new ByteArray();

            int attrib = Write3D(header);

            ByteArray data = new ByteArray();

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

            data.WriteFloats(transform);
            data.WriteFloat(width);
            data.WriteFloat(height);
            data.WriteFloat(depth);

            WriteTags(data);

            return data;
        }
コード例 #4
0
ファイル: SEALight.cs プロジェクト: sunag/sea3d
        public override ByteArray Write()
        {
            ByteArray header = new ByteArray();

            int attrib = WriteLight(header);

            ByteArray data = new ByteArray();

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

            data.WriteUInt24(color);
            data.WriteFloat(multiplier);

            return data;
        }
コード例 #5
0
ファイル: SEAMaterial.cs プロジェクト: sunag/sea3d
        public override ByteArray Write()
        {
            ByteArray header = new ByteArray();

            int attrib = 0x0000;

            if (doubleSided) attrib |= 1;

            if (!receiveLights) attrib |= 2;
            if (!receiveShadows) attrib |= 4;
            if (!receiveFog) attrib |= 8;

            if (!repeat) attrib |= 16;

            if (alpha != 1)
            {
                attrib |= 32;
                header.WriteFloat(alpha);
            }

            if (blendMode != 0)
            {
                attrib |= 64;
                header.WriteByte(blendMode);
            }

            ByteArray data = new ByteArray();

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

            data.WriteByte(techniques.Count);

            foreach (TechBase tech in techniques)
            {
                ByteArray techData = tech.Write();

                data.WriteUInt16(tech.type);
                data.WriteUInt16((int)techData.Length);
                data.WriteBytes(techData.ToArray());
            }

            return data;
        }
コード例 #6
0
ファイル: SEAGeometry.cs プロジェクト: sunag/sea3d
        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;
        }