Example #1
0
        public bool BuildIndexedPrimitives()
        {
            bool res = false;

            if (mMeshObjectList != null)
            {
                List <NullMergeIndex> indexMapping = new List <NullMergeIndex>();
                for (int i = 0; i < mMeshObjectList.GetMeshObjectCount(); i++)
                {
                    NullMeshObject meshObject = mMeshObjectList[i];
                    res |= meshObject.BuildIndexedPrimitives(indexMapping);
                    if (meshObject.IsVertexAnimationMeshObject() && mVertexMorphAnimations != null)
                    {
                        for (int k = 0; k < mVertexMorphAnimations.GetAnimationCount(); k++)
                        {
                            NullVertexMorphAnimation animation = mVertexMorphAnimations[k];
                            for (int j = 0; j < animation.GetFrameCount(); j++)
                            {
                                NullVertexMorphAnimationFrame animationFrame = animation[j];
                                NullVertexMorphObject         morphObject    = animationFrame.FindMorphAnimationNodeByIndex(i);
                                Assert.IsTrue(morphObject != null, "");
                                res |= morphObject.BuildIndexedPrimitives(indexMapping);
                            }
                        }
                    }
                }
            }

            //try extract mesh-objects and skeleton-bindings
            if (mSkinObjectList != null)
            {
                for (int i = 0; i < mSkinObjectList.GetMeshObjectCount(); i++)
                {
                    List <NullMergeIndex> indexMapping = new List <NullMergeIndex>();
                    NullMeshObject        meshObject   = mSkinObjectList[i];
                    res |= meshObject.BuildIndexedPrimitives(indexMapping);
                    if (mSkeletonBinding != null && indexMapping.Count > 0)
                    {
                        NullSkeletonPiece skeletonPiece = mSkeletonBinding[i];
                        res |= skeletonPiece.BuildIndexedPrimitives(indexMapping);
                    }
                }
            }
            return(res);
        }