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 ApplyInterpolation(ObiNativeVector4List startPositions, ObiNativeQuaternionList startOrientations, float stepTime, float unsimulatedTime) { // Interpolate particle positions and orientations. var interpolate = new InterpolationJob() { positions = positions, startPositions = startPositions.AsNativeArray <float4>(), renderablePositions = renderablePositions, orientations = orientations, startOrientations = startOrientations.AsNativeArray <quaternion>(), renderableOrientations = renderableOrientations, deltaTime = stepTime, unsimulatedTime = unsimulatedTime, interpolationMode = m_Solver.parameters.interpolation }; JobHandle jobHandle = interpolate.Schedule(m_Solver.positions.count, 128); // Update deformable triangle normals var updateNormals = new UpdateNormalsJob() { renderPositions = renderablePositions, deformableTriangles = deformableTriangles, normals = normals }; jobHandle = updateNormals.Schedule(jobHandle); // fluid laplacian/anisotropy: var d = constraints[(int)Oni.ConstraintType.Density] as BurstDensityConstraints; if (d != null) { jobHandle = d.CalculateAnisotropyLaplacianSmoothing(jobHandle); } // update axis: var updatePrincipalAxis = new UpdatePrincipalAxisJob() { activeParticles = activeParticles, renderableOrientations = renderableOrientations, phases = phases, principalRadii = principalRadii, principalAxis = anisotropies, }; jobHandle = updatePrincipalAxis.Schedule(activeParticles.Length, 128, jobHandle); jobHandle.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); }
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; }
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 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 ApplyInterpolation(ObiNativeVector4List startPositions, ObiNativeQuaternionList startOrientations, float stepTime, float unsimulatedTime) { }
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>(); m_ConstraintCount = count; }
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 ApplyInterpolation(ObiNativeVector4List startPositions, ObiNativeQuaternionList startOrientations, float stepTime, float unsimulatedTime) { Oni.ApplyPositionInterpolation(oniSolver, startPositions.GetIntPtr(), startOrientations.GetIntPtr(), stepTime, unsimulatedTime); }
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); }