Exemple #1
0
 public void SetBendConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList restBends, ObiNativeVector2List bendingStiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices = particleIndices.AsNativeArray <int>();
     this.restBends       = restBends.AsNativeArray <float>();
     this.stiffnesses     = bendingStiffnesses.AsNativeArray <float2>();
     this.lambdas         = lambdas.AsNativeArray <float>();
 }
Exemple #2
0
 public void SetTetherConstraints(ObiNativeIntList particleIndices, ObiNativeVector2List maxLengthScale, ObiNativeFloatList stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices = particleIndices.AsNativeArray <int>();
     this.maxLengthScale  = maxLengthScale.AsNativeArray <float2>();
     this.stiffnesses     = stiffnesses.AsNativeArray <float>();
     this.lambdas         = lambdas.AsNativeArray <float>();
 }
Exemple #3
0
 public void SetStitchConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices = particleIndices.AsNativeArray <int>();
     this.stiffnesses     = stiffnesses.AsNativeArray <float>();
     this.lambdas         = lambdas.AsNativeArray <float>();
     m_ConstraintCount    = count;
 }
 public void SetBendTwistConstraints(ObiNativeIntList orientationIndices, ObiNativeQuaternionList restDarboux, ObiNativeVector3List stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.orientationIndices = orientationIndices.AsNativeArray <int>();
     this.restDarboux        = restDarboux.AsNativeArray <quaternion>();
     this.stiffnesses        = stiffnesses.AsNativeArray <float3>();
     this.lambdas            = lambdas.AsNativeArray <float>();
 }
 public void SetDistanceConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList restLengths, ObiNativeVector2List stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices = particleIndices.AsNativeArray <int>();
     this.restLengths     = restLengths.AsNativeArray <float>();
     this.stiffnesses     = stiffnesses.AsNativeArray <float2>();
     this.lambdas         = lambdas.AsNativeArray <float>();
 }
 public void SetChainConstraints(ObiNativeIntList particleIndices, ObiNativeVector2List restLengths, ObiNativeIntList firstIndex, ObiNativeIntList numIndices, int count)
 {
     this.particleIndices = particleIndices.AsNativeArray <int>();
     this.firstIndex      = firstIndex.AsNativeArray <int>();
     this.numIndices      = numIndices.AsNativeArray <int>();
     this.restLengths     = restLengths.AsNativeArray <float2>();
 }
Exemple #7
0
 public void SetStretchShearConstraints(ObiNativeIntList particleIndices, ObiNativeIntList orientationIndices, ObiNativeFloatList restLengths, ObiNativeQuaternionList restOrientations, ObiNativeVector3List stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices    = particleIndices.AsNativeArray <int>();
     this.orientationIndices = orientationIndices.AsNativeArray <int>();
     this.restLengths        = restLengths.AsNativeArray <float>();
     this.restOrientations   = restOrientations.AsNativeArray <quaternion>();
     this.stiffnesses        = stiffnesses.AsNativeArray <float3>();
     this.lambdas            = lambdas.AsNativeArray <float>();
 }
 public void SetVolumeConstraints(ObiNativeIntList triangles,
                                  ObiNativeIntList firstIndex,
                                  ObiNativeFloatList restVolumes,
                                  ObiNativeVector2List pressureStiffness,
                                  ObiNativeFloatList lambdas,
                                  int count)
 {
     Oni.SetVolumeConstraints(oniBatch, triangles.GetIntPtr(), firstIndex.GetIntPtr(), restVolumes.GetIntPtr(), pressureStiffness.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
 public void SetSkinConstraints(ObiNativeIntList particleIndices, ObiNativeVector4List skinPoints, ObiNativeVector4List skinNormals, ObiNativeFloatList skinRadiiBackstop, ObiNativeFloatList skinCompliance, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices   = particleIndices.AsNativeArray <int>();
     this.skinPoints        = skinPoints.AsNativeArray <float4>();
     this.skinNormals       = skinNormals.AsNativeArray <float4>();
     this.skinRadiiBackstop = skinRadiiBackstop.AsNativeArray <float>();
     this.skinCompliance    = skinCompliance.AsNativeArray <float>();
     this.lambdas           = lambdas.AsNativeArray <float>();
 }
Exemple #10
0
 public void SetPinConstraints(ObiNativeIntList particleIndices, ObiNativeIntList colliderIndices, ObiNativeVector4List offsets, ObiNativeQuaternionList restDarbouxVectors, ObiNativeFloatList stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     this.particleIndices    = particleIndices.AsNativeArray <int>();
     this.colliderIndices    = colliderIndices.AsNativeArray <int>();
     this.offsets            = offsets.AsNativeArray <float4>();
     this.restDarbouxVectors = restDarbouxVectors.AsNativeArray <quaternion>();
     this.stiffnesses        = stiffnesses.AsNativeArray <float2>();
     this.lambdas            = lambdas.AsNativeArray <float>();
 }
 public void SetVolumeConstraints(ObiNativeIntList triangles,
                                  ObiNativeIntList firstIndex,
                                  ObiNativeFloatList restVolumes,
                                  ObiNativeVector2List pressureStiffness,
                                  ObiNativeFloatList lambdas,
                                  int count)
 {
     this.particleIndices   = triangles.AsNativeArray <int>();
     this.firstIndex        = firstIndex.AsNativeArray <int>();
     this.restVolumes       = restVolumes.AsNativeArray <float>();
     this.pressureStiffness = pressureStiffness.AsNativeArray <float2>();
     this.lambdas           = lambdas.AsNativeArray <float>();
 }
Exemple #12
0
 public void InterpolateDiffuseProperties(ObiNativeVector4List properties,
                                          ObiNativeVector4List diffusePositions,
                                          ObiNativeVector4List diffuseProperties,
                                          ObiNativeIntList neighbourCount,
                                          int diffuseCount)
 {
     particleGrid.InterpolateDiffuseProperties(this,
                                               properties.AsNativeArray <float4>(),
                                               diffusePositions.AsNativeArray <float4>(),
                                               diffuseProperties.AsNativeArray <float4>(),
                                               neighbourCount.AsNativeArray <int>(),
                                               diffuseCount).Complete();
 }
 public void SetShapeMatchingConstraints(ObiNativeIntList particleIndices,
                                         ObiNativeIntList firstIndex,
                                         ObiNativeIntList numIndices,
                                         ObiNativeIntList explicitGroup,
                                         ObiNativeFloatList shapeMaterialParameters,
                                         ObiNativeVector4List restComs,
                                         ObiNativeVector4List coms,
                                         ObiNativeQuaternionList orientations,
                                         ObiNativeFloatList lambdas,
                                         int count)
 {
     Oni.SetShapeMatchingConstraints(oniBatch, particleIndices.GetIntPtr(), firstIndex.GetIntPtr(), numIndices.GetIntPtr(), explicitGroup.GetIntPtr(),
                                     shapeMaterialParameters.GetIntPtr(), restComs.GetIntPtr(), coms.GetIntPtr(), orientations.GetIntPtr(), count);
 }
        void ReallocateParticles()
        {
            if (ps == null)
            {
                ps = GetComponent <ParticleSystem>();
                ParticleSystem.MainModule main = ps.main;
                main.simulationSpace = ParticleSystemSimulationSpace.World;
            }

            // Array to get/set particles:
            if (particles == null || particles.Length != ps.main.maxParticles)
            {
                particles      = new ParticleSystem.Particle[ps.main.maxParticles];
                positions      = new ObiNativeVector4List(ps.main.maxParticles);
                velocities     = new ObiNativeVector4List(ps.main.maxParticles);
                neighbourCount = new ObiNativeIntList(ps.main.maxParticles);
            }

            alive = ps.GetParticles(particles);
        }
Exemple #15
0
        public void SetShapeMatchingConstraints(ObiNativeIntList particleIndices,
                                                ObiNativeIntList firstIndex,
                                                ObiNativeIntList numIndices,
                                                ObiNativeIntList explicitGroup,
                                                ObiNativeFloatList shapeMaterialParameters,
                                                ObiNativeVector4List restComs,
                                                ObiNativeVector4List coms,
                                                ObiNativeQuaternionList constraintOrientations,
                                                ObiNativeFloatList lambdas,
                                                int count)
        {
            this.particleIndices         = particleIndices.AsNativeArray <int>();
            this.firstIndex              = firstIndex.AsNativeArray <int>();
            this.numIndices              = numIndices.AsNativeArray <int>();
            this.explicitGroup           = explicitGroup.AsNativeArray <int>();
            this.shapeMaterialParameters = shapeMaterialParameters.AsNativeArray <float>();
            this.restComs = restComs.AsNativeArray <float4>();
            this.coms     = coms.AsNativeArray <float4>();
            this.constraintOrientations = constraintOrientations.AsNativeArray <quaternion>();

            if (Aqq.IsCreated)
            {
                Aqq.Dispose();
            }
            if (deformation.IsCreated)
            {
                deformation.Dispose();
            }

            Aqq = new NativeArray <float4x4>(count, Allocator.Persistent);

            deformation = new NativeArray <float4x4>(count, Allocator.Persistent);
            for (int i = 0; i < count; ++i)
            {
                deformation[i] = float4x4.identity;
            }

            m_ConstraintCount = count;
        }
Exemple #16
0
 public void SetStretchShearConstraints(ObiNativeIntList particleIndices, ObiNativeIntList orientationIndices, ObiNativeFloatList restLengths, ObiNativeQuaternionList restOrientations, ObiNativeVector3List stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetStretchShearConstraints(oniBatch, particleIndices.GetIntPtr(), orientationIndices.GetIntPtr(), restLengths.GetIntPtr(), restOrientations.GetIntPtr(), stiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
Exemple #17
0
 public void SetBendTwistConstraints(ObiNativeIntList orientationIndices, ObiNativeQuaternionList restOrientations, ObiNativeVector3List stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetBendTwistConstraints(oniBatch, orientationIndices.GetIntPtr(), restOrientations.GetIntPtr(), stiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
 public void SetTetherConstraints(ObiNativeIntList particleIndices, ObiNativeVector2List maxLengthScale, ObiNativeFloatList stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetTetherConstraints(oniBatch, particleIndices.GetIntPtr(), maxLengthScale.GetIntPtr(), stiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
Exemple #19
0
 public void InterpolateDiffuseProperties(ObiNativeVector4List properties, ObiNativeVector4List diffusePositions, ObiNativeVector4List diffuseProperties, ObiNativeIntList neighbourCount, int diffuseCount)
 {
 }
Exemple #20
0
 public void SetDistanceConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList restLengths, ObiNativeVector2List stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetDistanceConstraints(oniBatch, particleIndices.GetIntPtr(), restLengths.GetIntPtr(), stiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
 public void SetAerodynamicConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList aerodynamicCoeffs, int count)
 {
     this.particleIndices   = particleIndices.AsNativeArray <int>();
     this.aerodynamicCoeffs = aerodynamicCoeffs.AsNativeArray <float>();
     m_ConstraintCount      = count;
 }
Exemple #22
0
 public void SetChainConstraints(ObiNativeIntList particleIndices, ObiNativeVector2List restLengths, ObiNativeIntList firstIndex, ObiNativeIntList numIndices, int count)
 {
     Oni.SetChainConstraints(oniBatch, particleIndices.GetIntPtr(), restLengths.GetIntPtr(), firstIndex.GetIntPtr(), numIndices.GetIntPtr(), count);
 }
 public void SetStitchConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetStitchConstraints(oniBatch, particleIndices.GetIntPtr(), stiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
Exemple #24
0
 public void InterpolateDiffuseProperties(ObiNativeVector4List properties, ObiNativeVector4List diffusePositions, ObiNativeVector4List diffuseProperties, ObiNativeIntList neighbourCount, int diffuseCount)
 {
     Oni.InterpolateDiffuseParticles(oniSolver, properties.GetIntPtr(), diffusePositions.GetIntPtr(), diffuseProperties.GetIntPtr(), neighbourCount.GetIntPtr(), diffuseCount);
 }
 public void SetPinConstraints(ObiNativeIntList particleIndices, ObiNativeIntList colliderIndices, ObiNativeVector4List offsets, ObiNativeQuaternionList restDarbouxVectors, ObiNativeFloatList stiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetPinConstraints(oniBatch, particleIndices.GetIntPtr(), offsets.GetIntPtr(), restDarbouxVectors.GetIntPtr(), colliderIndices.GetIntPtr(), stiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
 public void SetAerodynamicConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList aerodynamicCoeffs, int count)
 {
     Oni.SetAerodynamicConstraints(oniBatch, particleIndices.GetIntPtr(), aerodynamicCoeffs.GetIntPtr(), count);
 }
Exemple #27
0
 public void SetSkinConstraints(ObiNativeIntList particleIndices, ObiNativeVector4List skinPoints, ObiNativeVector4List skinNormals, ObiNativeFloatList skinRadiiBackstop, ObiNativeFloatList skinCompliance, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetSkinConstraints(oniBatch, particleIndices.GetIntPtr(), skinPoints.GetIntPtr(), skinNormals.GetIntPtr(), skinRadiiBackstop.GetIntPtr(), skinCompliance.GetIntPtr(), lambdas.GetIntPtr(), count);
 }
Exemple #28
0
 public void SetBendConstraints(ObiNativeIntList particleIndices, ObiNativeFloatList restBends, ObiNativeVector2List bendingStiffnesses, ObiNativeFloatList lambdas, int count)
 {
     Oni.SetBendingConstraints(oniBatch, particleIndices.GetIntPtr(), restBends.GetIntPtr(), bendingStiffnesses.GetIntPtr(), lambdas.GetIntPtr(), count);
 }