public JobHandle InterpolateDiffuseProperties(BurstSolverImpl solver, NativeArray <float4> properties, NativeArray <float4> diffusePositions, NativeArray <float4> diffuseProperties, NativeArray <int> neighbourCount, int diffuseCount) { NativeArray <int4> offsets = new NativeArray <int4>(8, Allocator.TempJob); offsets[0] = new int4(0, 0, 0, 1); offsets[1] = new int4(1, 0, 0, 1); offsets[2] = new int4(0, 1, 0, 1); offsets[3] = new int4(1, 1, 0, 1); offsets[4] = new int4(0, 0, 1, 1); offsets[5] = new int4(1, 0, 1, 1); offsets[6] = new int4(0, 1, 1, 1); offsets[7] = new int4(1, 1, 1, 1); var interpolateDiffusePropertiesJob = new InterpolateDiffusePropertiesJob { grid = grid, positions = solver.abstraction.positions.AsNativeArray <float4>(), cellOffsets = offsets, properties = properties, diffusePositions = diffusePositions, diffuseProperties = diffuseProperties, neighbourCount = neighbourCount, densityKernel = new Poly6Kernel(solver.abstraction.parameters.mode == Oni.SolverParameters.Mode.Mode2D), gridLevels = grid.populatedLevels.GetKeyArray(Allocator.TempJob), inertialFrame = solver.inertialFrame, mode2D = solver.abstraction.parameters.mode == Oni.SolverParameters.Mode.Mode2D }; return(interpolateDiffusePropertiesJob.Schedule(diffuseCount, 64)); }
public JobHandle GenerateContacts(BurstSolverImpl solver, float deltaTime) { var generateParticleContactsJob = new ParticleGrid.GenerateParticleParticleContactsJob { grid = grid, gridLevels = grid.populatedLevels.GetKeyArray(Allocator.TempJob), positions = solver.positions, orientations = solver.orientations, restPositions = solver.restPositions, velocities = solver.velocities, invMasses = solver.invMasses, radii = solver.principalRadii, fluidRadii = solver.smoothingRadii, phases = solver.phases, particleMaterialIndices = solver.abstraction.collisionMaterials.AsNativeArray <int>(), collisionMaterials = ObiColliderWorld.GetInstance().collisionMaterials.AsNativeArray <BurstCollisionMaterial>(), contactsQueue = particleContactQueue.AsParallelWriter(), fluidInteractionsQueue = fluidInteractionQueue.AsParallelWriter(), dt = deltaTime }; return(generateParticleContactsJob.Schedule(grid.CellCount, 2)); }
public JobHandle GenerateContacts(BurstSolverImpl solver, float deltaTime) { var world = ObiColliderWorld.GetInstance(); var generateColliderContactsJob = new GenerateContactsJob { particleGrid = solver.particleGrid.grid, colliderGrid = grid, gridLevels = grid.populatedLevels.GetKeyArray(Allocator.TempJob), positions = solver.positions, orientations = solver.orientations, velocities = solver.velocities, invMasses = solver.invMasses, radii = solver.principalRadii, phases = solver.phases, particleMaterialIndices = solver.collisionMaterials, transforms = world.colliderTransforms.AsNativeArray <BurstAffineTransform>(), shapes = world.colliderShapes.AsNativeArray <BurstColliderShape>(), bounds = world.colliderAabbs.AsNativeArray <BurstAabb>(), collisionMaterials = world.collisionMaterials.AsNativeArray <BurstCollisionMaterial>(), triangleMeshHeaders = world.triangleMeshContainer.headers.AsNativeArray <TriangleMeshHeader>(), bihNodes = world.triangleMeshContainer.bihNodes.AsNativeArray <BIHNode>(), triangles = world.triangleMeshContainer.triangles.AsNativeArray <Triangle>(), vertices = world.triangleMeshContainer.vertices.AsNativeArray <float3>(), edgeMeshHeaders = world.edgeMeshContainer.headers.AsNativeArray <EdgeMeshHeader>(), edgeBihNodes = world.edgeMeshContainer.bihNodes.AsNativeArray <BIHNode>(), edges = world.edgeMeshContainer.edges.AsNativeArray <Edge>(), edgeVertices = world.edgeMeshContainer.vertices.AsNativeArray <float2>(), distanceFieldHeaders = world.distanceFieldContainer.headers.AsNativeArray <DistanceFieldHeader>(), dfNodes = world.distanceFieldContainer.dfNodes.AsNativeArray <BurstDFNode>(), heightFieldHeaders = world.heightFieldContainer.headers.AsNativeArray <HeightFieldHeader>(), heightFieldSamples = world.heightFieldContainer.samples.AsNativeArray <float>(), contactsQueue = colliderContactQueue.AsParallelWriter(), solverToWorld = solver.solverToWorld, worldToSolver = solver.worldToSolver, is2D = solver.abstraction.parameters.mode == Oni.SolverParameters.Mode.Mode2D, deltaTime = deltaTime }; return(generateColliderContactsJob.Schedule(solver.particleGrid.grid.CellCount, 16)); }
public void UpdateGrid(BurstSolverImpl solver, JobHandle inputDeps) { var identifyMoving = new IdentifyMovingParticles { activeParticles = solver.activeParticles, movingParticles = movingParticles.AsParallelWriter(), radii = solver.principalRadii, fluidRadii = solver.smoothingRadii, positions = solver.positions, cellCoord = solver.cellCoords, particleMaterialIndices = solver.abstraction.collisionMaterials.AsNativeArray <int>(), collisionMaterials = ObiColliderWorld.GetInstance().collisionMaterials.AsNativeArray <BurstCollisionMaterial>(), is2D = solver.abstraction.parameters.mode == Oni.SolverParameters.Mode.Mode2D }; inputDeps = identifyMoving.Schedule(solver.activeParticleCount, 64, inputDeps); var removeInactive = new RemoveInactiveParticles { activeParticles = solver.activeParticles, previousActiveParticles = previousActiveParticles, cellCoords = solver.cellCoords, grid = grid }; inputDeps = removeInactive.Schedule(inputDeps); var updateMoving = new UpdateMovingParticles { movingParticles = movingParticles, grid = grid }; updateMoving.Schedule(inputDeps).Complete(); if (previousActiveParticles.IsCreated) { previousActiveParticles.Dispose(); } previousActiveParticles = solver.activeParticles.ToArray(Allocator.Persistent); }
public void Update(BurstSolverImpl solver, float deltaTime, JobHandle inputDeps) { var calculateCells = new CalculateCellCoords { simplexBounds = solver.simplexBounds, cellCoords = solver.cellCoords, is2D = solver.abstraction.parameters.mode == Oni.SolverParameters.Mode.Mode2D, }; inputDeps = calculateCells.Schedule(solver.simplexCounts.simplexCount, 4, inputDeps); var updateGrid = new UpdateGrid { grid = grid, cellCoords = solver.cellCoords, simplexCount = solver.simplexCounts.simplexCount }; updateGrid.Schedule(inputDeps).Complete(); }
public BurstAerodynamicConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Aerodynamics) { }
public BurstStitchConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Stitch) { }
public BurstTetherConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Distance) { }
public BurstConstraintsImpl(BurstSolverImpl solver, Oni.ConstraintType constraintType) { this.m_ConstraintType = constraintType; this.m_Solver = solver; }
public BurstBendConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Bending) { }
public BurstSkinConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Skin) { }
public BurstBendTwistConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.BendTwist) { }
public BurstParticleCollisionConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.ParticleCollision) { }
public BurstStretchShearConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.StretchShear) { }
public BurstColliderCollisionConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Collision) { }
public BurstVolumeConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Volume) { }
public BurstShapeMatchingConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.ShapeMatching) { }
public BurstDensityConstraints(BurstSolverImpl solver) : base(solver, Oni.ConstraintType.Density) { fluidParticles = new NativeList <int>(Allocator.Persistent); }