Exemplo n.º 1
0
        private void PushConstraintsToGPU(IntPtr solverPtr, FlexContainer cnt, Flex.Memory memory)
        {
            if (cnt.m_springsCount > 0)
            {
                Flex.SetSprings(solverPtr, cnt.m_springIndices, cnt.m_springRestLengths, cnt.m_springCoefficients, cnt.m_springsCount, memory);
            }
            else
            {
                Flex.SetSprings(solverPtr, null, null, null, 0, memory);
            }

            if (cnt.m_shapesCount > 0)
            {
                Flex.SetRigids(solverPtr, cnt.m_shapeOffsets, cnt.m_shapeIndices, cnt.m_shapeRestPositions, null, cnt.m_shapeCoefficients, cnt.m_shapeRotations, cnt.m_shapeTranslations, cnt.m_shapeOffsets.Length - 1, memory);
            }
            else
            {
                Flex.SetRigids(solverPtr, null, null, null, null, null, null, null, 0, memory);
            }

            if (cnt.m_trianglesCount > 0)
            {
                Flex.SetDynamicTriangles(solverPtr, cnt.m_triangleIndices, cnt.m_triangleNormals, cnt.m_trianglesCount, memory);
            }
            else
            {
                Flex.SetDynamicTriangles(solverPtr, null, null, 0, memory);
            }

            if (cnt.m_inflatablesCount > 0)
            {
                Flex.SetInflatables(solverPtr, cnt.m_inflatableStarts, cnt.m_inflatableCounts, cnt.m_inflatableVolumes, cnt.m_inflatablePressures, cnt.m_inflatableStiffness, cnt.m_inflatablesCount, memory);
            }
            else
            {
                Flex.SetInflatables(solverPtr, null, null, null, null, null, 0, memory);
            }
        }