示例#1
0
        public void Write(AssetWriter writer)
        {
            if (HasCurrentChannels(writer.Version))
            {
                writer.Write(CurrentChannels);
            }
            writer.Write(VertexCount);

            if (HasChannels(writer.Version))
            {
                writer.WriteAssetArray(Channels);
                writer.AlignStream(AlignType.Align4);
            }
            if (HasStreams(writer.Version))
            {
                if (IsStreamStatic(writer.Version))
                {
                    for (int i = 0; i < StaticStreamCount; i++)
                    {
                        writer.WriteAsset(Streams[i]);
                    }
                }
                else
                {
                    writer.WriteAssetArray(Channels);
                }
            }

            writer.WriteArray(Data);
            writer.AlignStream(AlignType.Align4);
        }
示例#2
0
 public void Write(AssetWriter writer)
 {
     writer.WriteAssetArray(MeshData);
     if (HasVertexCount(writer.Version))
     {
         writer.Write(VertexCount);
         writer.Write(NewVertexStart);
         writer.Write(MeshError);
         writer.WriteArray(MorphToVertex);
     }
 }
示例#3
0
        public void Write(AssetWriter writer)
        {
            writer.WriteAssetArray(Vertices);
            writer.WriteAssetArray(Shapes);
            writer.WriteAssetArray(Channels);
            if (IsAlign(writer.Version))
            {
                writer.AlignStream(AlignType.Align4);
            }

            writer.WriteArray(FullWeights);
        }
示例#4
0
 public void Write(AssetWriter writer)
 {
     writer.WriteAssetArray(Faces);
     writer.WriteArray(Strips);
 }
示例#5
0
 public void Write(AssetWriter writer)
 {
     writer.WriteArray(Data);
 }
示例#6
0
        public override void Write(AssetWriter writer)
        {
            base.Write(writer);

            if (HasLODData(writer.Version))
            {
                writer.WriteAssetArray(LODData);
            }
            else
            {
                if (HasUse16bitIndices(writer.Version))
                {
                    writer.Write(Use16BitIndices);
                }
                if (IsIndexBufferFirst(writer.Version))
                {
                    writer.WriteArray(IndexBuffer);
                    writer.AlignStream(AlignType.Align4);
                }
                writer.WriteAssetArray(SubMeshes);
            }

            if (HasBlendShapes(writer.Version))
            {
                if (HasBlendChannels(writer.Version))
                {
                    Shapes.Write(writer);
                }
                else
                {
                    writer.WriteAssetArray(BlendShapes);
                    writer.AlignStream(AlignType.Align4);
                    writer.WriteAssetArray(ShapeVertices);
                }
            }
            if (HasBindPose(writer.Version))
            {
                if (IsBindPoseFirst(writer.Version))
                {
                    writer.WriteAssetArray(BindPose);
                }
            }
            if (HasBoneNameHashes(writer.Version))
            {
                writer.WriteArray(BoneNameHashes);
                writer.Write(RootBoneNameHash);
            }
            if (HasBonesAABB(writer.Version))
            {
                writer.WriteAssetArray(BonesAABB);
                VariableBoneCountWeights.Write(writer);
            }

            if (HasMeshCompression(writer.Version))
            {
                writer.Write((byte)MeshCompression);
            }
            if (HasStreamCompression(writer.Version))
            {
                writer.Write(StreamCompression);
            }
            if (HasIsReadable(writer.Version))
            {
                writer.Write(IsReadable);
                writer.Write(KeepVertices);
                writer.Write(KeepIndices);
            }
            if (IsAlignFlags(writer.Version))
            {
                writer.AlignStream(AlignType.Align4);
            }

            if (HasIndexFormat(writer.Version))
            {
                if (IsIndexFormatCondition(writer.Version))
                {
                    if (MeshCompression == MeshCompression.Off)
                    {
                        writer.Write((int)IndexFormat);
                    }
                }
                else
                {
                    writer.Write((int)IndexFormat);
                }
            }

            if (!HasLODData(writer.Version))
            {
                if (!IsIndexBufferFirst(writer.Version))
                {
                    writer.WriteArray(IndexBuffer);
                    writer.AlignStream(AlignType.Align4);
                }
            }

            if (HasVertexData(writer.Version))
            {
                if (!IsOnlyVertexData(writer.Version))
                {
                    if (MeshCompression != MeshCompression.Off)
                    {
                        writer.WriteAssetArray(Vertices);
                    }
                }
            }
            else
            {
                writer.WriteAssetArray(Vertices);
            }

            if (HasSkin(writer.Version))
            {
                writer.WriteAssetArray(Skin);
            }
            if (HasBindPose(writer.Version))
            {
                if (!IsBindPoseFirst(writer.Version))
                {
                    writer.WriteAssetArray(BindPose);
                }
            }

            if (HasVertexData(writer.Version))
            {
                if (IsOnlyVertexData(writer.Version))
                {
                    VertexData.Write(writer);
                }
                else
                {
                    if (MeshCompression == MeshCompression.Off)
                    {
                        VertexData.Write(writer);
                    }
                    else
                    {
                        writer.WriteAssetArray(UV);
                        writer.WriteAssetArray(UV1);
                        writer.WriteAssetArray(Tangents);
                        writer.WriteAssetArray(Normals);
                        writer.WriteAssetArray(Colors);
                    }
                }
            }
            else
            {
                writer.WriteAssetArray(UV);
                if (HasUV1(writer.Version))
                {
                    writer.WriteAssetArray(UV1);
                }
                if (HasTangentSpace(writer.Version))
                {
                    writer.WriteAssetArray(TangentSpace);
                }
                else
                {
                    writer.WriteAssetArray(Tangents);
                    writer.WriteAssetArray(Normals);
                }
            }
            if (IsAlignVertex(writer.Version))
            {
                writer.AlignStream(AlignType.Align4);
            }

            if (HasCompressedMesh(writer.Version))
            {
                CompressedMesh.Write(writer);
            }

            LocalAABB.Write(writer);
            if (!HasVertexData(writer.Version))
            {
                writer.WriteAssetArray(Colors);
            }
            if (HasCollisionTriangles(writer.Version))
            {
                writer.WriteArray(CollisionTriangles);
                writer.Write(CollisionVertexCount);
            }
            if (HasMeshUsageFlags(writer.Version))
            {
                writer.Write(MeshUsageFlags);
            }

            if (HasCollision(writer.Version))
            {
                CollisionData.Write(writer);
            }
            if (HasMeshMetrics(writer.Version))
            {
                writer.Write(MeshMetrics[0]);
                writer.Write(MeshMetrics[1]);
            }
#if UNIVERSAL
            if (HasMeshOptimization(writer.Version, writer.Flags))
            {
                if (IsMeshOptimizationFlags(writer.Version))
                {
                    writer.Write((int)MeshOptimizationFlags);
                }
                else
                {
                    writer.Write(MeshOptimized);
                }
            }
#endif
            if (HasStreamData(writer.Version))
            {
                writer.AlignStream(AlignType.Align4);
                StreamData.Write(writer);
            }
        }