public NullVertexMorphAnimation AppendAnimation(int frameRate = 30)
        {
            NullVertexMorphAnimation animation = new NullVertexMorphAnimation(frameRate);

            mAnimationArray.Add(animation);
            return(animation);
        }
Esempio n. 2
0
        protected bool RotateVertexMorphAnimation(NullVertexMorphAnimation vertexMorphAnimation, float angle)
        {
            if (vertexMorphAnimation == null || vertexMorphAnimation.GetFrameCount() == 0)
            {
                return(false);
            }
            bool res = true;

            for (int i = 0; i < vertexMorphAnimation.GetFrameCount(); i++)
            {
                NullVertexMorphAnimationFrame animFrame = vertexMorphAnimation[i];
                res &= RotateVertexMorphAnimationFrame(animFrame, angle);
            }
            return(res);
        }
Esempio n. 3
0
        protected bool RotateVertexMorphAnimations(NullVertexMorphAnimations vertexMorphAnimations, float angle)
        {
            if (vertexMorphAnimations == null || vertexMorphAnimations.GetAnimationCount() == 0)
            {
                return(false);
            }
            bool res = true;

            for (int i = 0; i < vertexMorphAnimations.GetAnimationCount(); i++)
            {
                NullVertexMorphAnimation vertexMorphAnimation = vertexMorphAnimations[i];
                res &= RotateVertexMorphAnimation(vertexMorphAnimation, angle);
            }
            return(res);
        }
Esempio n. 4
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);
        }
Esempio n. 5
0
        public bool ExtractToTriangles()
        {
            bool res = false;

            //try extract mesh-objects and vertex-morph animations
            if (mMeshObjectList != null)
            {
                for (int i = 0; i < mMeshObjectList.GetMeshObjectCount(); i++)
                {
                    List <Vector3Int> originalFaceIndices = new List <Vector3Int>();
                    NullMeshObject    meshObject          = mMeshObjectList[i];
                    res |= meshObject.ExtractToTriangles(originalFaceIndices);
                    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, "");
                                switch (meshObject.GetMeshObjectType())
                                {
                                case NullPrimitiveType.MOT_INDEXED_PRIMITIVES:
                                    res |= morphObject.ExtractToTrianglesFromIndexedPrimitives(originalFaceIndices);
                                    break;
                                    //case NullPrimitiveType.MOT_TRIANGLE_STRIPS:
                                    //    res |= morphObject.ExtractToTrianglesFromStrips(meshObject.GetTriangleCount());
                                    //    break;
                                }
                            }
                        }
                    }
                    originalFaceIndices.Clear();
                }
            }

            //try extract mesh-objects and skeleton-bindings
            if (mSkinObjectList != null)
            {
                for (int i = 0; i < mSkinObjectList.GetMeshObjectCount(); i++)
                {
                    List <Vector3Int> originalFaceIndices = new List <Vector3Int>();
                    NullMeshObject    meshObject          = mSkinObjectList[i];
                    res |= meshObject.ExtractToTriangles(originalFaceIndices);
                    if (mSkeletonBinding != null && mSkeletonBinding.GetSkeletonBindingCount() > 0)
                    {
                        NullSkeletonPiece skeletonPiece = mSkeletonBinding[i];
                        switch (meshObject.GetMeshObjectType())
                        {
                        case NullPrimitiveType.MOT_INDEXED_PRIMITIVES:
                            res |= skeletonPiece.ExtractToTrianglesFromIndexedPrimitives(originalFaceIndices);
                            break;
                            //case HexMeshObject::MOT_TRIANGLE_STRIPS:
                            //    res |= skeletonPiece.ExtractToTrianglesFromStrips(meshObject.GetTriangleCount());
                            //    break;
                        }
                    }
                }
            }

            return(res);
        }