public MyIntersectionResultLineTriangle(ref MyTriangle_Vertices triangle, ref MyTriangle_BoneIndicesWeigths? boneWeigths, ref Vector3 triangleNormal, double distance)
 {
     InputTriangle = triangle;
     InputTriangleNormal = triangleNormal;
     Distance = distance;
     BoneWeights = boneWeigths;
 }
Esempio n. 2
0
        public MyTriangle_BoneIndicesWeigths?GetBoneIndicesWeights(int triangleIndex)
        {
            if (m_bonesIndicesWeights == null)
            {
                return(null);
            }

            MyTriangleVertexIndices indices = Triangles[triangleIndex];

            MyCompressedBoneIndicesWeights boneIndicesWeightsV0 = m_bonesIndicesWeights[indices.I0];
            MyCompressedBoneIndicesWeights boneIndicesWeightsV1 = m_bonesIndicesWeights[indices.I1];
            MyCompressedBoneIndicesWeights boneIndicesWeightsV2 = m_bonesIndicesWeights[indices.I2];

            Vector4UByte indicesV0 = boneIndicesWeightsV0.Indices.ToVector4UByte();
            Vector4      weightsV0 = boneIndicesWeightsV0.Weights.ToVector4();

            Vector4UByte indicesV1 = boneIndicesWeightsV1.Indices.ToVector4UByte();
            Vector4      weightsV1 = boneIndicesWeightsV1.Weights.ToVector4();

            Vector4UByte indicesV2 = boneIndicesWeightsV2.Indices.ToVector4UByte();
            Vector4      weightsV2 = boneIndicesWeightsV2.Weights.ToVector4();

            MyTriangle_BoneIndicesWeigths ret = new MyTriangle_BoneIndicesWeigths()
            {
                Vertex0 = new MyVertex_BoneIndicesWeights()
                {
                    Indices = indicesV0, Weights = weightsV0
                },
                Vertex1 = new MyVertex_BoneIndicesWeights()
                {
                    Indices = indicesV1, Weights = weightsV1
                },
                Vertex2 = new MyVertex_BoneIndicesWeights()
                {
                    Indices = indicesV2, Weights = weightsV2
                }
            };

            return(ret);
        }
        public VertexBoneIndicesWeights?GetAffectingBoneIndicesWeights(ref List <VertexArealBoneIndexWeight> tmpStorage)
        {
            if (!Triangle.BoneWeights.HasValue)
            {
                return(null);
            }

            if (tmpStorage == null)
            {
                tmpStorage = new List <VertexArealBoneIndexWeight>(4);
            }

            tmpStorage.Clear();

            MyTriangle_BoneIndicesWeigths boneWeights = Triangle.BoneWeights.Value;

            float u, v, w;

            Vector3.Barycentric(IntersectionPointInObjectSpace, Triangle.InputTriangle.Vertex0,
                                Triangle.InputTriangle.Vertex1, Triangle.InputTriangle.Vertex2, out u, out v, out w);

            FillIndicesWeightsStorage(tmpStorage, ref boneWeights.Vertex0, u);
            FillIndicesWeightsStorage(tmpStorage, ref boneWeights.Vertex1, v);
            FillIndicesWeightsStorage(tmpStorage, ref boneWeights.Vertex2, w);

            tmpStorage.Sort(Comparison);

            VertexBoneIndicesWeights indicesWeights = new VertexBoneIndicesWeights();

            FillIndicesWeights(ref indicesWeights, 0, tmpStorage);
            FillIndicesWeights(ref indicesWeights, 1, tmpStorage);
            FillIndicesWeights(ref indicesWeights, 2, tmpStorage);
            FillIndicesWeights(ref indicesWeights, 3, tmpStorage);

            NormalizeBoneWeights(ref indicesWeights);
            return(indicesWeights);
        }
Esempio n. 4
0
        public MyTriangle_BoneIndicesWeigths? GetBoneIndicesWeights(int triangleIndex)
        {
            if (m_bonesIndicesWeights == null)
                return null;

            MyTriangleVertexIndices indices = Triangles[triangleIndex];

            MyCompressedBoneIndicesWeights boneIndicesWeightsV0 = m_bonesIndicesWeights[indices.I0];
            MyCompressedBoneIndicesWeights boneIndicesWeightsV1 = m_bonesIndicesWeights[indices.I1];
            MyCompressedBoneIndicesWeights boneIndicesWeightsV2 = m_bonesIndicesWeights[indices.I2];

            Vector4UByte indicesV0 = boneIndicesWeightsV0.Indices.ToVector4UByte();
            Vector4 weightsV0 = boneIndicesWeightsV0.Weights.ToVector4();

            Vector4UByte indicesV1 = boneIndicesWeightsV1.Indices.ToVector4UByte();
            Vector4 weightsV1 = boneIndicesWeightsV1.Weights.ToVector4();

            Vector4UByte indicesV2 = boneIndicesWeightsV2.Indices.ToVector4UByte();
            Vector4 weightsV2 = boneIndicesWeightsV2.Weights.ToVector4();

            MyTriangle_BoneIndicesWeigths ret = new MyTriangle_BoneIndicesWeigths()
            {
                Vertex0 = new MyVertex_BoneIndicesWeights() { Indices = indicesV0, Weights = weightsV0 },
                Vertex1 = new MyVertex_BoneIndicesWeights() { Indices = indicesV1, Weights = weightsV1 },
                Vertex2 = new MyVertex_BoneIndicesWeights() { Indices = indicesV2, Weights = weightsV2 }
            };
            return ret;
        }