Пример #1
0
        private void CacheBuffers()
        {
            bodies = new GPBody[wrapper.GetBuffer("bodies").count];

            var jointsBuffer = wrapper.GetBuffer("distanceJoints");

            joints = new GPDistanceJoint[jointsBuffer.count];
            jointsBuffer.GetData(joints);
        }
Пример #2
0
        private void InitBuffers()
        {
            TryAddBufferOrArray("matrices", data.MatricesBuffer, data.Matrices, sizeof(float) * 16);

            TryCreateBuffer("bodies", data.Bodies, GPBody.Size());
            TryCreateBuffer("sphereColliders", data.SphereColliders, GPSphereCollider.Size());

            TryCreateBuffer("kinematicBodies", data.KinematicsBodies, GPBody.Size());
            TryCreateBuffer("kinematicSphereColliders", data.KinematicsSphereColliders, GPSphereCollider.Size());
            TryCreateBuffer("kinematicsLineSphereColliders", data.KinematicsLineSphereColliders, GPLineSphereCollider.Size());

            TryCreateBuffer("distanceJoints", data.DistanceJoints.Data, GPDistanceJoint.Size());
            TryCreateBuffer("pointJoints", data.PointJoints, GPPointJoint.Size());

            bodiesThreadGroupsNum = Mathf.CeilToInt(wraper.GetBuffer("bodies").count / 1024f);
        }