Commit Graph

5271 Commits

Author SHA1 Message Date
bjorn 30b8ddc2ed Update jolt; 2024-04-18 13:16:07 -07:00
bjorn 48c0b4c167 Rework Buffer formats;
Summary:

- Buffer length can be zero (indicates single value instead of array)
- Internally, arrays aren't coerced to array-of-single-struct
- Removes support for "flat table" data (array-of-structs w/o wrapping
  each struct in a nested table)
- Use consistent syntax for reading table data into buffers:
  - Numbers are numbers
  - Vectors are numbers, tables, or vectors
  - Structs are tables with any combination of integer/string keys
    - Fields are assigned from integer keys in order, then any remaining
      fields use the string keys
  - Arrays are tables of elements, formatted as above
- Try to improve error messages for Buffer:setData errors
2024-04-17 21:35:54 -07:00
bjorn 35e285d53e Add none BlendMode; 2024-04-17 20:53:52 -07:00
Bjorn 72e042f6ae
Merge pull request #763 from jmiskovic/fix/jolt-setmass
Fix setMass; correct terrain sampling
2024-04-11 16:14:45 -07:00
Josip Miskovic 2302c51952 Fix terrain generation horizontal increment 2024-04-11 22:26:15 +02:00
Josip Miskovic aaac317c67 Fix setMass allocation on user side 2024-04-11 20:28:36 +02:00
bjorn e08217e6ca Fix lovr.graphics.newTexture when passing a single image; 2024-04-11 09:27:54 -07:00
bjorn bdeee99953 Tracy; 2024-04-10 14:06:57 -07:00
bjorn aef71192ac Add ConvexShape;
Also luax_readmesh supports ModelData input, and the indices pointer can
be NULL to only request the vertex positions.
2024-04-09 13:01:30 -07:00
bjorn f1ba4d1a1e Clean up Joint lists further; 2024-04-08 11:11:28 -07:00
bjorn 5df8405af3 Cleanup; Methods take vectors;
Ugh this was way worse than I thought
2024-04-07 20:27:10 -07:00
bjorn 2952ed764d Fix issue with Collider:getJoints;
This can probably be simplified somehow...
2024-04-07 15:22:06 -07:00
bjorn 985ba6bd13 Fix collider leak; 2024-04-07 15:13:33 -07:00
bjorn 15649802c8 Rework World Collider/Joint lists;
- Add World:getColliderCount
- Add World:getJointCount
- Add World:getJoints
- Add Joint:isDestroyed
- Destroy joints when either of their colliders are destroyed (Jolt
  seems to require this).
- Fix joint memory leak.
- Change joints to be stored in some crazy graph thing.
  - Reduces allocations, allows constant time insertion/removal.
2024-04-07 15:08:22 -07:00
Bjorn e3b42fe24b
Merge pull request #762 from bjornbytes/compound-shape
CompoundShape
2024-04-07 14:34:28 -07:00
bjorn 060e72c525 Rename CompoundShape 'shape' to 'child';
Maybe slightly less ambiguous/confusing?
2024-04-07 13:47:52 -07:00
bjorn 47dec01772 rm more useless checks; 2024-04-07 13:47:52 -07:00
bjorn 582ee1625f CompoundShape:replaceShape fixes; 2024-04-07 13:47:52 -07:00
bjorn e36374c4cf rm useless check; 2024-04-07 13:47:52 -07:00
bjorn 98601b3425 Collider:setShape accepts nil;
Internally it still uses a teeny tiny sphere (it's kinda like the
collider's shape is a "point").
2024-04-07 13:47:52 -07:00
bjorn 2ac0d6946e Move shape arg to last argument of query callbacks;
Also fix an off-by-one error.
2024-04-07 13:47:52 -07:00
bjorn b589cec975 Collider:getShape takes optional child index;
For convenience when you're trying to dig a leaf shape out of a CompoundShape.

It's ignored if the collider's shape is not a CompoundShape.
2024-04-07 13:47:52 -07:00
bjorn 8bdab9f2d4 Shape:getAABB; 2024-04-07 13:47:52 -07:00
bjorn 5751068728 Move Shape:is/setSensor and Shape:is/setEnabled to Collider; 2024-04-07 13:47:52 -07:00
bjorn 481a9dafa2 newCollider takes optional Shape as first arg; 2024-04-07 13:47:52 -07:00
bjorn 95cc6c2753 Shape fixes;
- Collider always has Shape now.  When left off or set to null, it's a
  tiny sphere (representing a point).
- Preserve shape offset when changing shape.
2024-04-07 13:47:52 -07:00
bjorn f35cda7db8 lovrColliderCreate takes shape;
Jolt requires a shape, also it saves a bit of work.
2024-04-07 13:47:52 -07:00
bjorn 907d89c913 Add Collider:getShapes for backcompat; 2024-04-07 13:47:52 -07:00
bjorn ff0f39fc7b rm unused shape prototypes; 2024-04-07 13:47:52 -07:00
bjorn b809db1d83 ODE compatibility; 2024-04-07 13:47:52 -07:00
bjorn 051266f8ea Collider shape is required I think;
Jolt doesn't really support bodies without shapes.
2024-04-07 13:47:52 -07:00
bjorn 930e713079 Add Collider:get/setShapeOffset; 2024-04-07 13:47:52 -07:00
bjorn 4f26182595 World queries return collider/shapeindex instead of Shape; 2024-04-07 13:47:52 -07:00
bjorn 8cbdda00f3 Require frozen CompoundShapes to have at least 2 children;
If you create a StaticCompoundShape with 1 child, Jolt creates a
RotatedTranslatedShape.  It would be a pain to have to branch on that,
so let's just require 2 children.
2024-04-07 13:47:52 -07:00
bjorn 10f965d69e rm Shape setters;
Jolt doesn't support this and requires you to recreate the shape.  Since
the shape -> collider relationship is 1:N, we can't really create a new
shape because we'd have to figure out which colliders/compoundshapes to
assign it to, which isn't feasible.
2024-04-07 13:47:52 -07:00
bjorn a7bf4ca2a4 CompoundShape fixes; 2024-04-07 13:47:52 -07:00
bjorn c27694fd8e Shapes set their userdata; 2024-04-07 13:47:52 -07:00
bjorn b3e9e55b8a CompoundShape API; 2024-04-07 13:47:52 -07:00
bjorn 6f0b6391df Start CompoundShape; 2024-04-07 13:47:52 -07:00
bjorn ce58619094 Colliders can only have 1 shape; rm shape pose; 2024-04-07 13:47:52 -07:00
bjorn 9b6f58ac1e Update Jolt; 2024-04-07 13:47:52 -07:00
bjorn f4d1161a3d Disable Jolt profiler and debug renderer; 2024-04-07 13:46:57 -07:00
bjorn f4d5c0d758 Add assert for body count; 2024-04-06 00:47:31 -07:00
bjorn 38a68dc4e5 TerrainShape image must be square; 2024-04-06 00:12:50 -07:00
bjorn 5e521b7698 Collider:applyLinear/AngularImpulse; 2024-04-05 19:16:39 -07:00
bjorn fb6b402034 Add Collider:is/setContinuous; 2024-04-05 19:05:25 -07:00
bjorn e9fe088521 Add Collider:get/setGravityScale; Deprecate Collider:get/setGravityIgnored; 2024-04-05 14:22:02 -07:00
bjorn 01194a80c7 Deprecate several World methods;
They still work on ODE, and Jolt makes a best-effort attempt to support
them, but they will be removed in a future version.

- Damping should be set explicitly on colliders.
- Tightness and response time will be supported via spring forces, and
  also some global settings in newWorld will affect joints too.
- Step count will be added to :update soon.  Since the correct value is
  dt-dependent in Jolt, a persistent accessor doesn't make sense.
- Sleeping allowed will be an immutable setting in newWorld soon, but
  otherwise should be changed per-collider.
2024-04-05 14:07:56 -07:00
bjorn ffc23497a9 Details; 2024-04-05 13:58:28 -07:00
bjorn d756cc2b1d Add variant of newWorld that takes an options table; 2024-04-05 13:25:32 -07:00