Commit Graph

2997 Commits

Author SHA1 Message Date
Bjorn ce68a9ed68
Merge pull request #265 from mcclure/offset-nosuch
shaderblock:getOffset() crashes on nonexistent field
2020-06-04 10:02:56 -07:00
mcc 0dcf86bc3d Check shaderblock offset exists before reading. Prevents a segfault 2020-06-04 12:10:56 -04:00
Nevyn Bengtsson e34953f064 lovrMicrophoneGetData: fix potential buffer overrun
With the check for samples==0 being done BELOW the assert for offset+samples<soundData->samples,
setting samples to 0 and then having more samples available in the mic than present in
the created buffer would cause buffer overrun
2020-06-04 14:31:24 +02:00
Josip Miskovic 5d18933411 Limit simulation parameters to positive values 2020-06-03 20:13:13 +03:00
Josip Miskovic 139808cab0 Get/set World and Joint simulation parameters
Tightness parameter is amount of force is exerted on collider to resolve
collisions and enforce joint operation. Low values make joints loose,
high values make it tight and can cause collider to overshot the joint
target. With tightness set to 0 the joint loses its function. Going
above 1 puts even more energy into joint oscillations. Tightness
parameter is called ERP in ODE manual.

The responseTime affects the time constant of physics simulation, both
for collisions and for joint inertia. Low responseTime values make
simulation tight and fast, higher values make it sluggish. For
collisions it affects how fast penetration is resolved, with higher
values resulting in spongy objects with more surface penetration and
slower collision resolving. For joints the responseTime is similar to
inertia, with higher responseTime values resulting in slow oscillations.
The oscillation frequency is also affected by collider mass, so
responseTime can be used to tweak the joint to get desired frequency
with specific collider mass. Values higher than 1 are often desirable,
especially for very light objects. Unlike tightness, responseTime is
tweaked in orders of magnitude with useful values (depending on mass)
being between 10^-8 and 10^8.

Both parameters can be applied to World for simulation-wide usage, or
specified per-joint in case of distance and ball joints. Other joints
don't allow customizing these parameters, and will use World settings
instead..
2020-06-03 19:03:38 +03:00
bjorn ada79dbf5d Add CONFIG_WEBXR to default tup config; 2020-05-26 14:00:26 -06:00
bjorn 90e985c45b Fix MSAA Canvas readback; 2020-05-26 09:53:26 -06:00
bjorn 6d2fdac89f Prefix headset implementation files with headset_; 2020-05-24 13:32:13 -06:00
bjorn d6abcdfb0e Fix 2 memory leaks; 2020-05-23 13:03:16 -06:00
bjorn 86ad4f654c Fix bug with Mesh:setVertices; 2020-05-21 00:31:50 -06:00
bjorn 1185fcf6e1 Autodetect integer attribute types;
Fixes inability to use integer attributes with Mesh.
2020-05-21 00:31:49 -06:00
Bjorn 902774e800
Merge pull request #261 from mcclure/shaderblock-blob
shaderBlock:send(blob) does not work
2020-05-20 14:36:11 -07:00
mcc 89cdeb1e4f shaderBlock:send(blob) did not work due to typo 2020-05-20 16:34:19 -04:00
bjorn 75e26f0051 Move core/hash to core/util; 2020-05-19 13:49:40 -06:00
bjorn 17a0205df7 Update contributors; 2020-05-19 13:22:13 -06:00
bjorn 92ac93e6b8 Improve image uniform errors; 2020-05-18 15:14:17 -06:00
bjorn f7dddfe3fd Fix PNG IDAT CRC; 2020-05-18 12:41:49 -06:00
bjorn 21ea7488d1 tup windows support; 2020-05-15 15:01:10 -06:00
bjorn 8cdc92a485 Tuprules: Separate library variables for each platform;
Will make it easier for windows/android...
2020-05-11 18:48:18 -06:00
bjorn 680dc00b5b rm menu button from oculus touch bindings;
Saw an error about this in logs, let's see if it fixes touch controllers.
2020-05-11 18:04:37 -06:00
bjorn ebc69c6c93 win32: AllocConsole if AttachConsole fails;
This may help retrieve stdout when running lovr outside of cmd.
2020-05-11 15:23:35 -06:00
bjorn dab0be7055 World:getColliders; 2020-05-11 12:05:30 -06:00
bjorn 95635b4b02 Support loading 16 bit images;
With 1, 2, or 4 channels;
2020-05-10 02:35:45 -06:00
bjorn 6539bc1bd2 Make physics orientation getters more consistent; 2020-05-10 02:08:36 -06:00
Bjorn 62fbf7e0e3
Merge pull request #257 from jmiskovic/physics-vectors
Physics API support for vectors
2020-05-10 01:04:23 -07:00
bjorn 1e78ac8669 Add r16, rg16, rgba16 texture formats; 2020-05-10 01:59:58 -06:00
Josip Miskovic e2d1b33eed Shapes API accepts both vec3 and number coords 2020-05-10 01:12:45 +03:00
Josip Miskovic 2d6f7802f1 Joints API accepts both vec3 and number coords 2020-05-10 01:12:45 +03:00
Josip Miskovic f2fcc4e5c4 Collider API accepts both vec3 and number coords 2020-05-10 01:12:45 +03:00
Josip Miskovic add346519a Physics API accepts both vec3 and number coords
When creating shapes and joints, arguments accept either coordinate
numbers as before, or vec3 objects. For functions that receive more than
one set of coordinates, any combination of coordinates and vectors is
accepted.
2020-05-10 01:12:45 +03:00
bjorn 0be36da334 Add beacon devices;
There are 4 new devices: beacon/1 through beacon/4.  They represent
tracking reference like StemaVR base stations or Oculus cameras.
There are 4 because that's how many base stations you can have in
a single tracking setup.

Right now only OpenVR exposes poses for them.
2020-05-07 17:11:25 -06:00
Bjorn 195966b964
Merge pull request #251 from jmiskovic/world-vectors
Physics world accepts both vec3 and number coords
2020-05-07 09:32:36 -07:00
Josip Miskovic 2463737722 Physics world accepts both vec3 and number coords
When creating colliders, setting gravity or casting rays on world,
arguments accept either coordinate numbers as before, or vec3 objects.
For functions that receive more than one set of coordinates, any
combination of coordinates and vectors is accepted.
2020-05-07 19:01:30 +03:00
Bjorn 33e7a31b36
Merge pull request #254 from gkrnours/webxr
Add webxr to CMake
2020-05-06 14:36:24 -07:00
l. coues 61e53f09ff Add webxr to CMake
Default to off unless build with emscripten
2020-05-06 23:07:59 +02:00
bjorn 9ba814fe3f omg; 2020-05-04 17:30:41 -06:00
bjorn ed4b8d1f3d rm unneeded internal Source functions;
Now that things are in the same file, setters for internal source
fields are unnecessary, making things a bit simpler.
2020-05-03 13:02:19 -06:00
bjorn c455b0750e rm unused Source functions from header; 2020-05-03 13:00:02 -06:00
bjorn d847dd663a rm unused audio headers; 2020-05-03 12:57:50 -06:00
bjorn b9a2bddd25 Put all the audio stuff in one file;
If there was ever some sort of hypothetical switch to a different
audio library, this would make such a switch easier.
2020-05-03 12:54:35 -06:00
bjorn b0289de9a6 Error instead of crashing when skin has too many joints;
ModelData is still allowed to load skins with more joints, since
the limitation is in the graphics side of things (Model).

Eventually we will use a buffer for joints to alleviate this.
2020-05-02 14:14:29 -06:00
bjorn f160ed75e9 Update ode;
Enables libccd for better collision support.
2020-05-02 13:19:25 -06:00
bjorn c0d73ab541 Add resize event; lovr.resize callback; 2020-05-02 13:09:10 -06:00
bjorn b035f8e4dc core/fs: Use DWORD instead of uint32_t in fs_read and fs_write;
Fixes a warning.
2020-04-30 16:53:10 -06:00
bjorn ce2a28360d Unconditionally cast ref to volatile long on win32;
This was originally a C++-only contribution, but clang also warns
about it on windows when compiling as C.

It's nice to have one less thing specific to C++.
2020-04-30 16:49:53 -06:00
bjorn eea73792a6 Minor formatting; 2020-04-30 14:15:36 -06:00
Bjorn f811be431f
Merge pull request #249 from jmiskovic/init-inertia
Initialize inertia information for new colliders
2020-04-30 11:46:32 -07:00
Josip Miskovic 097d39628a Initialize inertia information for new colliders
Inertia matrix has to be calculated with algorithm specific for each
shape. Without calculated matrix the physics behaves very floaty and
slowed down.
2020-04-29 23:05:11 +03:00
Bjorn 8e13158148
Merge pull request #247 from jmiskovic/fix-orientation
Fix collider setOrientation() and setPose()
2020-04-28 11:33:24 -07:00
Josip Miskovic a4b0d004a1 Fix collider setOrientation() and setPose()
The conversion from angle,ax,ay,az to quaternion is already done in
physics module.
2020-04-28 20:15:09 +03:00