Commit Graph

1140 Commits

Author SHA1 Message Date
bjorn f1b447662d Fix lovr.headset.getDriver when passed a Device; 2020-08-04 12:19:22 -06:00
Bjorn 617d508d68
Merge pull request #269 from jmiskovic/savemount
Config parameter for save directory precedence
2020-07-29 16:26:07 -06:00
bjorn e3aa4c7d5d t.graphics.debug flag; 2020-07-28 16:12:15 -06:00
bjorn b024e71a98 Fix luax_vlog stack balancing; 2020-07-28 15:31:02 -06:00
bjorn ac58a1aeba Pico: Draw the rest of the owl;
Add entrypoints, headset backend code, fill in the Activity, and
add various special cases to account for the asynchronous render loop,
lack of sRGB support, and OpenGL state resets.
2020-07-27 14:56:21 -06:00
bjorn b0b9e38da6 Pico: add pico jar and missing DRIVER_PICO enumerant; 2020-07-27 14:25:57 -06:00
bjorn 9abed055d8 lovr.log;
lovr.log is a new callback that is invoked whenever LÖVR wants to
send the project a message.  For example, this could be a performance
warning from the graphics module, an error message from one of the
headset backends, or an API deprecation notice.

The callback's signature is (message, level, tag).  The message is a
string containing the message to log, level is a string that is currently
one of "debug", "info", "warn", "error", and tag is an optional string
that is used to indicate the source of the message for grouping purposes.

The default implementation of the callback just prints the message,
but the callback can be overridden to do things like filter messages,
write them to a file, or even render them in VR.  Projects can also
invoke the callback directly to log their own messages.
2020-07-06 16:20:55 -06:00
bjorn d045929065 ShaderBlock:getShaderCode: add namespace support; 2020-07-04 17:50:00 -06:00
bjorn 9777306b70 rm oculus mobile; 2020-07-02 10:46:10 -06:00
Bjorn 26b4b58479
Merge pull request #273 from bjornbytes/android-tup
Android Support
2020-07-02 09:26:14 -07:00
bjorn 0dd4a1191c rm getApplicationId; 2020-06-29 18:10:03 -06:00
Josip Miskovic c314824304 Initialize vec3 from mat4
Rotation and scaling is lost, only position is extracted from mat4.
2020-06-28 11:49:43 +03:00
Josip Miskovic 66d7e887c7 Config parameter for save directory precedence 2020-06-21 18:02:36 +03:00
bjorn a1aa3c8ae8 Finish vrapi driver; 2020-06-09 18:02:03 -06:00
bjorn 6bce095660 Fix newComputeShader(nil); 2020-06-07 15:47:53 -06:00
Bjorn 27b2c0abad
Merge pull request #263 from jmiskovic/world-settings
Physics simulation access to global ERP and CFM
2020-06-04 10:06:51 -07:00
mcc 0dcf86bc3d Check shaderblock offset exists before reading. Prevents a segfault 2020-06-04 12:10:56 -04: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 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
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 dab0be7055 World:getColliders; 2020-05-11 12:05:30 -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 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 c0d73ab541 Add resize event; lovr.resize callback; 2020-05-02 13:09:10 -06: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
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
mcc b5e72d8bd9 Restart cookie minor changes for PR review 2020-04-16 10:57:13 -04:00
mcc fbcce7fc59 Reworked quit/restart events (compatibility break)
Based on Slack conversation, the following changes:
- lovr.event.quit("restart") no longer supported
- lovr.event.quit no longer takes restart "cookie"
- When lovr.event.restart() called, lovr.quit() is not called, instead lovr.restart() is called
- Value returned from lovr.restart(), when called, becomes the cookie
- lovr.event.quit takes the lovr.event.quit() return code as an argument

lovr.run() is unchanged, it still returns (exit code | "restart", cookie).
2020-04-16 00:32:54 -04:00
bjorn 37d8df4784 Allow initializing empty TextureData with Blob; 2020-03-29 13:47:57 -06:00
bjorn e553672b5a Fix sampler uniform error message enum;
Surprisingly, this appears to be the only place reading out of enum
arrays like this, so there shouldn't be any other places to fix.
2020-03-14 16:46:35 -07:00
bjorn 6d0369d365 Convert some collider functions to use vectors; 2020-03-07 16:35:32 -08:00
bjorn a01cc5a376 Fix lovr.graphics.getDefaultFilter; 2020-03-05 19:27:08 -08:00
bjorn c02839f5c2 Allow anisotropy to be used with any TextureFilter;
Instead of anisotropic being its own filter, it is now removed and
anisotropy settings can be used with any of the other filter modes.
2020-03-05 09:46:49 -08:00
bjorn 6f6de92d19 Add preliminary WebXR backend; 2020-03-04 22:47:24 -08:00
bjorn 0d098410b3 Shader:send doesn't error on unknown uniform;
Instead it returns a boolean indicating if the send worked.
2020-02-27 20:20:02 -08:00
bjorn 90b605f012 Add restart cookie; lovr.event.restart; arg.restart; 2020-02-26 14:40:40 -08:00
bjorn 69dd0d4674 audio: rm paused and stopped states; rm rewind;
- There is now just one "playing" state.
- Instead of rewind, use :seek(0).

Note that now there is no way to resume or rewind all tracked sources.
This can be improved in the future if there's a need for it, probably
using variadic or table-based variants of the audio module functions.
2020-02-26 00:25:49 -08:00
bjorn f8b8d427d7 Opaque Mesh; Opaque OpenGL; 2020-02-23 00:29:21 -08:00
bjorn 2cf6d7b109 Improve lovr.filesystem.load errors;
Lua was happily compiling nil chunks and making them return empty
strings, which was not a good error experience in situations where
your file couldn't be loaded properly.  Now we return nil plus an
error message, which matches LOVE and other Lua conventions.
2020-02-22 00:30:30 -08:00
bjorn 18dcb07b98 Convert stuff over to use new enum system; 2020-02-16 18:31:02 -08:00
bjorn d5487cbd40 Better luax_checkoption error messages; 2020-02-16 18:06:06 -08:00
bjorn c20a6507d2 Add StringEntry for faster enums; 2020-02-16 17:50:51 -08:00
bjorn d2f4628791 Add pointer devices; 2020-02-14 19:10:37 -08:00
bjorn e218733ee2 Make splay axis 1D; 2020-02-13 15:18:12 -08:00
bjorn 5197d30b94 Add getSkeleton; 2020-02-13 15:08:59 -08:00
bjorn 0e4c42c8b0 Add pinch axis; 2020-02-13 15:08:58 -08:00
bjorn 71e63ddac2 openvr: add curl/splay axes for finger devices; 2020-02-13 15:08:58 -08:00
bjorn d448bdc95c Finger devices/axes; OpenVR finger poses; 2020-02-13 15:08:58 -08:00
bjorn 7edb562732 Add lovr.headset.getTime;
Unlike lovr.timer.getTime, this is the predicted time at which the
current frame will be displayed.  It can be used in place of
lovr.timer.getTime for smoother animations.  It's unclear if this
could be used for a suitable replacement for dt though.
2020-02-09 11:26:23 -08:00
bjorn 67ba5f3a82 Add more graphics stats; 2020-01-31 03:43:52 -08:00
bjorn c9c5d43829 Shader:hasBlock; Shader:sendBlock errors on missing block; 2020-01-30 18:26:05 -08:00
bjorn 78f272247b newCanvas creates array textures when multiview; 2020-01-30 17:48:01 -08:00
bjorn f89998b21f Add eye/left and eye/right devices;
Currently nobody returns data for them, though headset drivers could
start to provide poses estimated from the head pose and IPD info.

This also makes it easier to integrate eye tracking later.
2020-01-29 17:53:03 -08:00
bjorn 0aa724116e Headset views;
- lovr.headset.getViewCount
- lovr.headset.getViewPose
- lovr.headset.getViewAngles
2020-01-27 22:11:58 -08:00
bjorn 56dc8d0b9e Handle stereo shaders better;
- Creating a shader from a DefaultShader will respect the stereo flags.
- Auto shaders will properly be stereo/nonstereo based on the target Canvas.
2020-01-27 16:33:15 -08:00
bjorn 4379d25e1c Organization; 2020-01-27 14:02:54 -08:00
Cassie Jones 3e09120173 Compile shaders using source lengths
The previous implementation relied on glShaderSource inferring source
lengths when the lengths weren't specified. This relies on the sources
being properly null-terminated, however, which isn't the case due to
file loading changes which now use pointer + length. This could cause
intermittent crashes.

Changing this on the shader side meant adding some extra arguments for
passing around shader source lengths. For most of the other cases, where
we're using string literals as the sources, we can just specify -1 as
the length, since OpenGL will calculate the string length for you any
time the length is negative.
2020-01-27 16:13:21 -05:00
bjorn 7ca23bc58a lovr.headset.getDisplayFrequency; 2020-01-24 23:06:30 -08:00
bjorn 4f7bb9e53e lovr.headset.wasPressed; lovr.headset.wasReleased; 2020-01-24 22:48:36 -08:00
bjorn 8c429e89ac Fix -Wshadow; 2020-01-23 11:18:04 -08:00
bjorn 4c1917f6ce Fix some prototypes; 2020-01-23 10:55:46 -08:00
bjorn ddcdce25dc Minor style stuff; 2020-01-22 15:41:48 -08:00
bjorn a5424a1932 Microphone:getData supports sampleCount/destination; 2020-01-22 15:36:41 -08:00
Nevyn Bengtsson a5c59e2d12 Fixes from review 2020-01-20 08:49:11 +01:00
Nevyn Bengtsson 95edb43654 TextureData: holds Blob instead of being Blob, just like SoundData
also replaces TextureData:getPointer with TextureData;getBlob
2020-01-19 22:59:44 +01:00
Nevyn Bengtsson 91cc385340 Remove redundant SoundData:getPointer() 2020-01-19 22:43:13 +01:00
Nevyn Bengtsson 9127dd823c Fix bugs in sounddata-has-blob 2020-01-19 21:22:23 +01:00
Nevyn Bengtsson 7107ecd235 SoundData:getBlob() 2020-01-19 17:50:04 +01:00
Nevyn Bengtsson 790629bc3e SoundData: has-a blob instead of is-a blob 2020-01-19 17:50:04 +01:00
Nevyn Bengtsson 8515cd98fe Add destination buffer size to microphone:getData()
So that we can use OpenAL's internal ring buffer and only dequeue
exactly the amount we need at the moment.
2020-01-19 17:03:35 +01:00
Bjorn 3a5c3ca97c
Merge pull request #189 from bjornbytes/channel-mutex
Channel ownership stuff
2020-01-15 17:54:00 -08:00
bjorn 2a52796c6f Commenting; 2020-01-15 17:56:09 -08:00
bjorn afa5523773 Curve:render always returns 2 points if it's a line; 2020-01-14 01:08:57 -08:00
bjorn f728496608 Make math module work better in threads;
conf doesn't work in threads.  While this seems problematic, it can
kinda be considered the right thing.  Right now the math module can't
be required at all in threads which seems bad, so we'll make it work
and just ignore the "globals" flag for now.
2020-01-14 00:39:38 -08:00
bjorn 3b8d485fe9 Mesh:setVertices(Blob); 2020-01-14 00:22:35 -08:00
bjorn bd6d45cd30 Add comment; 2020-01-13 23:51:59 -08:00
bjorn 056c1e7fe4 Simplify Channel cleanup; 2020-01-13 23:49:52 -08:00
bjorn bb7bcb9b3d Fix lovr.data.newBlob(blob); 2020-01-13 20:39:43 -08:00
Bjorn 5dd35edcb3
Merge pull request #188 from mcclure/newthread-crash
Fix segfault on lovr.thread.newThread(nil)
2020-01-13 19:50:35 -08:00
mcc 2a3b4694f5 Fix crash on lovr.thread.newThread(nil) 2020-01-11 14:56:26 -05:00
Nevyn Bengtsson edbfbf9bdc audiostream: make getDuration consistent between raw and buffer-based
queueLength was in samples, samples was samples/channelCount. Now samples is always samples, and the division by channels occurrs in the new getter
2020-01-08 17:58:25 +01:00
Nevyn Bengtsson af6b3515ef audiostream: use `samples` instead of `queueLength`
Instead of having a bogus samples ivar in AudioStream when it's raw, use it to denote the amount of audio data enqueued.

This means `stream:getDuration()` gets the same meaning as `stream:getQueueLength()` (except in seconds instead of samples), so we can remove the latter.
2020-01-08 17:55:04 +01:00
Nevyn Bengtsson a8b4dc673d Accessor for RawAudioStream:getQueueLength
Useful for determining current amount of latency.
2020-01-05 00:05:29 +01:00
Nevyn Bengtsson 5232aa2ff2 RawAudioStream: Add a limit to amount of queued data
This is useful for making sure the audio subsystem doesn't go haywire with too much generated data
2020-01-04 23:49:58 +01:00
Nevyn Bengtsson 4fb4f6cdd1 RawAudioStream lua API 2020-01-03 17:15:12 +01:00
bjorn c9b1f257bf api: try new file naming convention; Tupfile: cleanup;
I assume full responsibility for any catastrophes this causes.
2019-12-31 19:31:44 -08:00
bjorn 12fcaffc3b Slight update to lovrDirSep;
Macro instead of global variable.
2019-12-29 10:30:26 -08:00
bjorn a103637419 Fix ModelData refcounting; 2019-12-20 04:52:55 -08:00
Bjorn 16b93869ee
Merge pull request #143 from bjornbytes/shadow-samplers
Shadow samplers;
2019-12-14 11:34:38 -08:00
bjorn e2d8f8c645 platform -> os;
The function names are staying the same for now.
2019-12-13 19:55:46 -08:00
bjorn 5957a1d007 Channel:peek also returns status; 2019-12-13 19:53:31 -08:00
bjorn e2f67c106d Thread:start supports up to 4 arguments;
They are passed to the chunk.
2019-12-13 15:50:10 -08:00
bjorn e316e6156b lovr.graphics.get/setColorMask; 2019-12-10 13:44:51 -08:00
bjorn 2f9400a5f7 Adjust includes; 2019-12-10 13:01:28 -08:00
bjorn b518a4c983 rm misc physfs; 2019-12-10 12:38:06 -08:00
bjorn 403ed8d3b0 Windows; 2019-12-10 12:19:50 -08:00
bjorn 488c125c5f Draw the rest of the owl; 2019-12-10 12:19:50 -08:00
bjorn 6a8048765f luax_loadfile uses core/fs; 2019-12-10 12:19:50 -08:00
bjorn f3745a1edc Use uint64_t for seed in luax_checkrandomseed; 2019-12-05 13:46:12 -08:00
bjorn ad5389b1f4 Improve luax_readquat(nil); 2019-11-28 15:26:52 -08:00
bjorn 2a5bae0b18 Improve error messages for unknown types; 2019-11-27 20:45:18 -08:00
Bjorn 539e25897b
Merge pull request #157 from bjornbytes/shape-sensor
Shape:isSensor; Shape:setSensor;
2019-11-20 18:35:24 -08:00
bjorn 9ac34ff190 Add :release to all objects; 2019-11-11 18:42:11 -08:00
bjorn 13136482b9 Fix Channel memory leak;
Channels need to be removed from the global array/map when destroyed.

Note that this exposes an infinite loop in map_remove, which will
be fixed later.

Note also that Channel's are retained if they have any messages in
them, to prevent releasing a channel while it has pending messages.
2019-11-11 18:33:33 -08:00
bjorn 8d12f0b867 Make userdata hashes 64 bit; 2019-11-11 16:39:02 -08:00
bjorn a7e24ab28e Joint:isEnabled; Joint:setEnabled; 2019-11-11 16:39:02 -08:00
bjorn d21911d010 Add core/map hash table; rm lib/map; 2019-10-30 00:07:05 -07:00
bjorn d51d2b4105 Fix stack balance with luax_checkvariant;
Was breaking Channel:push.
2019-10-22 16:42:10 -07:00
bjorn d93e17e800 Texture:setCompareMode; Shadow samplers; 2019-10-14 17:12:34 -07:00
bjorn 77258ec4dd mat4 multiplication works with vec4; 2019-10-13 16:02:21 -07:00
bjorn f0342341af Fix quat:mul accidentally working on vec2/vec4; 2019-10-12 12:43:49 -07:00
bjorn b6093eda2a Shape:isSensor; Shape:setSensor; 2019-10-10 15:36:28 -07:00
bjorn ac53f5a56f Fix Collider:addShape and Collider:removeShape; 2019-10-08 15:45:53 -07:00
programmer2 ba0aa13835 Fix World:Collide to use new luax_checkshape
This appears to have been missed in commit 22fe333
2019-10-08 21:30:03 +02:00
bjorn 0c642a6790 Improve mat4:unpack;
- Orientation is correct when the matrix is scaled
- Orientation calculation is more efficient
2019-10-04 19:26:09 -07:00
bjorn cc858e062c Don't mind me; 2019-09-26 21:58:26 -07:00
sophia ef84a16716 Throw lua errors in the error handler; 2019-09-24 12:04:36 -07:00
bjorn 22beccedc3 Model:getAnimationDuration; 2019-09-19 19:21:31 -07:00
bjorn 1902787b1b Modify GPU timer API;
- lovr.graphics.tock returns the latest value of the timer, or 0.
- Timers are not in the stats table anymore.

This is to prepare for an upcoming internal change that affects timers.
2019-09-18 18:21:38 -07:00
bjorn f82bcb703b Finalize skeletal input API; 2019-09-18 16:12:08 -07:00
bjorn 6c130ebd86 Fix warning; 2019-09-18 16:12:08 -07:00
bjorn b3f1b1db0c mat4:rotate uses y axis by default; 2019-09-13 23:22:29 -07:00
mcc c9cc5362bd model:getAnimationName(idx) and model:getNodeName(idx) 2019-09-04 21:09:54 -04:00
mcc 8b18c735ca model:getMaterialName(idx) 2019-09-04 17:17:56 -04:00
bjorn 3e47f958ad Fix mat4:lookAt; 2019-08-31 05:45:19 -07:00
bjorn 00412e2e79 Add a conf.lua flag for making the window resizable; 2019-08-28 00:59:03 -07:00
bjorn 50a1629dbc Model:get[Animation|Material|Node]Count; 2019-08-27 15:02:24 -07:00
bjorn 31fed6a940 Fix stereo flag for custom shaders; 2019-08-27 14:59:17 -07:00
bjorn 305596adf8 Fix windows build;
LOVR_EXPORT needs to be on the declaration, unfortunately.
2019-08-26 15:53:10 -07:00
bjorn 28344928c9 Simplify arr; 2019-08-21 23:16:58 -07:00
bjorn 9b0e43b249 Fix t.window = nil; 2019-08-21 22:26:31 -07:00
bjorn 13655d0df4 Simplify logging; 2019-08-21 19:02:02 -07:00
bjorn cd09e1e695 rm sds; 2019-08-21 16:30:20 -07:00
bjorn 8d4760167f luax is now api; 2019-08-21 15:27:26 -07:00
bjorn 7c8a44cc57 Cleanup function pointer typedefs; 2019-08-21 14:44:54 -07:00
bjorn b51dece762 Fix bug with permanent vectors; 2019-08-20 00:54:42 -07:00
bjorn 26e7233fde Fix some API issues with lightuserdata; 2019-08-19 14:35:06 -07:00
bjorn b1b97ddb02 quat:direction returns vec3; 2019-08-19 14:19:10 -07:00
bjorn 97e90a8699 Fix checkvariant error message; 2019-08-19 14:16:42 -07:00
bjorn 584261e21f rm ffi vectors; 2019-08-19 14:13:36 -07:00
bjorn c703092f87 Add missing timers GraphicsFeature; 2019-08-13 22:11:59 -07:00
bjorn 93f076acc9 Fix default uniform values;
Not supported in GLES.
2019-08-09 17:36:14 -07:00
bjorn 4d3bfea67c Model:getMaterial(name|index); rm Model:setMaterial; 2019-08-09 16:10:46 -07:00
bjorn a1cc3fb838 rm lovr.headset.getDisplayTime;
It is not useful in its current state, but will be useful later.
2019-08-09 00:01:08 -07:00
bjorn 289d365866 Better error messages when loading cubemaps; 2019-08-07 15:14:59 -07:00
bjorn 96c47d590c rm lovrEnvironmentTexture from Material; 2019-08-05 15:20:17 -07:00
bjorn 06fb8b2503 Simplify fill;
lovr.graphics.fill renders a fullscreen quad, it's convenient because
you don't need to set up a mesh and toggle all the pipeline states.

However, if you are dealing with copying/rendering between stereo
textures, you have to write your own shader for that.  For now.
2019-08-03 16:03:13 -07:00
bjorn 38671d4ca9 Fix warning; 2019-08-01 13:01:41 -07:00
bjorn 7690db28af Windows: Fix all the int warnings; 2019-07-31 17:51:49 -07:00
bjorn ca8e280dcd Fix texture refcounting in lovr.graphics.newTexture;
Also a memory leak with window icons (does anyone use that?)
2019-07-31 14:43:35 -07:00
bjorn 78f2060405 rm lovr.headset.getAcceleration, getAngularAcceleration;
Because OpenXR did...
2019-07-30 20:22:08 -07:00
bjorn 9712f4765c lovr.headset.hands is CURSED; 2019-07-30 20:17:38 -07:00
bjorn 947c468eb1 Don't restart twice on F5; 2019-07-29 11:52:06 -07:00
bjorn 2b19c64aca rm primary DeviceButton and DeviceAxis;
It is confusing and doesn't really solve the intended problem very well.

For now we will all just suffer with our tedious device-specific Lua code.
2019-07-17 17:33:21 -07:00
bjorn c92c0ef3c5 lovr.headset.isTracked; 2019-07-17 17:09:45 -07:00
bjorn 416f28990a Tracking functions return 0 instead of nil; rm lovr.headset.getDirection; 2019-07-17 17:07:33 -07:00
bjorn a04d55d13e Fix quat indexing in vanilla Lua; 2019-07-16 23:03:27 -07:00
bjorn 013d301c35 Fix vec3:sub in vanilla lua; 2019-07-16 22:53:01 -07:00
bjorn 7f445db3cc Update mat4:set for vanilla lua; 2019-07-16 22:51:26 -07:00
bjorn 122143b13a vec4; 2019-07-16 20:30:51 -07:00
bjorn 9156fa2cbf Vector rework; 2019-07-16 20:30:51 -07:00
bjorn 4b4020d3a7 Model:pose; Model:getNodePose; 2019-07-11 20:09:46 -07:00
bjorn 6b87576e6d Channel: cleanup; 2019-07-11 11:29:18 -07:00
bjorn 1f8a7e073f Curve: cleanup; 2019-07-11 11:22:03 -07:00
bjorn 3c07ad6b0b Replace Animator with Model:animate; 2019-07-10 22:08:19 -07:00
bjorn 4372eb293e rm comma operator;
everyone is making fun of me haha
2019-07-10 18:46:51 -07:00
mcc a6936b5649 Fix -DLOVR_ENABLE_THREAD=OFF compile
l_event.c was processing a thread-related event and in the process using a thread struct, even when LOVR_ENABLE_THREAD is undefined and threads do not exist. I caused the thread event type to simply not exist when the thread module is not being built.

Since the event is now only sometimes present, I put it at the end of the enum as slight protection against binary mismatches with dynamically loaded modules.
2019-07-10 16:23:20 -07:00
bjorn 2fb393306c rm skybox args;
They used to always be necessary, now they are almost never necessary.
2019-06-29 21:01:03 -07:00
bjorn d3f08fd1f0 rm logo.png; 2019-06-29 18:28:20 -07:00
bjorn e82ba030a6 lovr.headset.getDisplayTime;
Returns the predicted display time, which is the estimated time at which
the photons of the next frame will hit the eyeballs of a person in the HMD.

This should be used instead of lovr.timer.getTime when used for rendering
something that is time-dependent.  Updating simulations, logic, or access
to high frequency times should still use lovr.timer.getTime.
2019-06-29 17:36:36 -07:00
bjorn d87fc56b63 lovr.headset.getDisplayMask; 2019-06-28 00:13:45 -07:00
bjorn 551dea8c86 Adjust includes; 2019-06-27 13:44:09 -07:00
bjorn fe21de403b lovrGraphicsDrawMesh; 2019-06-27 13:35:43 -07:00
bjorn 928ccee5f1 Multiview; 2019-06-25 01:21:59 -07:00
bjorn 9f3638b018 TextureData:paste; 2019-06-20 23:36:18 -07:00
bjorn 7ebee200ea rm strdup;
It isn't part of C, causing compiler errors on some platforms.
2019-06-20 22:21:31 -07:00
bjorn 879c789a08 Polyfill M_PI;
It technically isn't part of C, which is causing problems on some systems.
2019-06-20 21:43:40 -07:00
bjorn 4611b1c9a3 Add no-op standard shader; 2019-06-20 14:21:35 -07:00
bjorn eb1e257209 Add new array implementation; Upgrade filesystem;
Filesystem:

- Uses streaming file IO.
- Uses less memory when requiring files.
- Simplifies its require path implementation.
2019-06-16 13:30:30 -07:00
bjorn f8f6d98df4 Use better default for identity quat; 2019-06-14 15:04:17 -07:00
bjorn 9c322495fa Fix bug when reading mat4s; 2019-06-14 13:22:13 -07:00
bjorn 2f3c23ed7e Ensure getHands uses 4-element vec3; 2019-06-14 13:04:10 -07:00
bjorn 79083c7df1 Fix warnings on newer versions of gcc; 2019-06-11 19:57:20 -07:00
bjorn e9853ed3c7 t.math.ffi conf flag; 2019-06-10 00:11:20 -07:00
bjorn 98f4365474 Add astc and dxt GraphicsFeatures; 2019-06-09 23:59:57 -07:00
bjorn b0a7d5c122 ASTC textures;
I like typing numbers.
2019-06-09 09:11:29 -07:00
bjorn 06c6b172de vec3 has 4 elements; 2019-06-03 07:20:03 -07:00
Bjorn Swenson 68c1b6a201
Merge pull request #122 from bjornbytes/hand-updates
Hand updates
2019-06-03 00:14:45 -07:00
bjorn 374492c586 Add experimental hotkeys flag;
- Add t.hotkeys flag to conf.lua, which defaults to true.
- If t.hotkeys is truthy, the following hotkeys will be enabled:
  - Escape: Quit the experience
  - F5: Restart the experience
2019-06-02 03:00:12 -07:00
bjorn 22fe333150 Update refcounting (again);
- Ref struct only stores refcount now and is more general.
- Proxy stores a hash of its type name instead of an enum.
- Variants store additional information instead of using a vtable.
- Remove the concept of superclasses from the API.
- Clean up some miscellaneous includes.
2019-06-02 01:02:26 -07:00
bjorn d2bff7d239 lovr.graphics.tick and tock;
Initial support for GPU timer queries.
2019-06-01 17:29:53 -07:00
bjorn 84bd50379d Add primary button/axis;
It's called "primary".
2019-05-31 12:00:15 -07:00
bjorn 7ac3d6938b rm TRACKER devices for now;
This is not the correct way to expose them.  It doesn't seem like
there is consensus on how to expose them yet.  At the very least
LÖVR should instead use the hardcoded OpenVR tracker paths like
/camera, /keyboard, /foot/left, /foot/right, etc.

See these issues:

- https://github.com/ValveSoftware/openvr/issues/1030
- https://github.com/ValveSoftware/openvr/issues/962
2019-05-31 10:57:29 -07:00
bjorn 9674276ff7 Add lovr.headset.getHands;
The iterator is nice and concise, but a table is more conventional
and allows you to easily retrieve the number of tracked hands.  The
iterator version may be removed in favor of the table version, since
you can always iterate over a table yourself.
2019-05-31 10:52:31 -07:00
bjorn af0678f9e9 rm DEVICE_HAND;
If we expose both unhanded hands and handed hands, people need to
deal with handling (haha) both cases in their apps.  It's simpler
to always deal with left and right hands, even though it is a bit
less general.  Still, this is congruent with the current state of
OpenVR and OpenXR, and I think there are still open questions about
the more uncommon cases where there are more than two hands.
2019-05-31 10:41:40 -07:00
bjorn d11e9be175 Lua userdata store their destructor in their metatable; 2019-05-28 16:31:13 -07:00
bjorn c5210deae8 Fix ShaderFlag parsing; 2019-05-28 03:43:12 -07:00
bjorn 9b6f7c35b4 Fix lovr.headset.isTouched; 2019-05-24 15:14:20 -07:00
bjorn 3bf08f0ca3 Add the ability to create default shaders;
lovr.graphics.newShader('font')
2019-05-22 18:00:02 -07:00
bjorn c464bde609 Add DefaultShaders enum; 2019-05-22 16:36:40 -07:00
bjorn 3dc4d06285 Fix eye enum; 2019-05-22 14:37:46 -07:00
bjorn 3804a1c0ee lovrPlatformGetName;
Used in lovr.getOS.
2019-05-20 20:44:39 -07:00
bjorn 4cc154fdfa More number conversions; 2019-05-20 20:35:07 -07:00
bjorn df6b7fc96a Ref is mostly private now;
It's really nice how objects don't need to care about how they're
allocated/managed now.
2019-05-20 15:09:06 -07:00
bjorn 57aad490ae Start sized int conversions; 2019-05-20 14:34:03 -07:00
bjorn e368723248 Improve platform-specific defines; 2019-05-20 04:05:39 -07:00
bjorn 67ddefd0c2 Ensure platform functions have prefix; 2019-05-20 04:02:25 -07:00
bjorn b1e848ef6b Cleanup filesystem module; 2019-05-20 03:51:22 -07:00
bjorn 7645f4c014 Add core folder; 2019-05-20 02:47:33 -07:00
bjorn 4a47afca38 Organize api folder; 2019-05-19 00:31:42 -07:00
bjorn a4e563fe6f Clean up event module; 2019-05-14 04:37:56 -07:00
bjorn 3267bad4fa Add ShaderFlags;
newShader and newComputeShader accept an optional options table
that can contain a table of flags.  Flags are turned into #defines
in the shader source and can be used as specialization constants in
the future.

Currently they can only be bools and ints.  This might change to add
float and/or remove bools.
2019-05-14 03:48:01 -07:00
bjorn 6134abe866 Handle vsync better;
- Add vsync flag to t.window and lovr.graphics.createWindow.
- vsync is 1 by default.
- Some headset drivers override vsync if they have special timing requirements.
2019-05-14 00:18:22 -07:00
bjorn f786c40b4e Rework Buffer updates;
Use unsynchronized mapped buffers on macOS.

Reduce amount of Buffer flushes and stalls by flushing once per
batch instead of once per draw.
2019-05-13 20:35:21 -07:00
bjorn 83b8ee2d08 Audio cleanup; 2019-05-13 03:53:17 -07:00
bjorn 963f496ac1 Lua hides a Type in its userdata; 2019-05-13 03:21:11 -07:00
bjorn 51ce0c1418 rm compat; 2019-05-12 22:28:02 -07:00
bjorn 7c2a119324 SteamVR Input 2019-05-12 22:23:28 -07:00
bjorn 5b0fa8b522 Fix warnings; 2019-05-12 22:23:28 -07:00
bjorn db3c3dbb1e Fix lovr.headset.hands; 2019-05-12 22:23:28 -07:00
bjorn 6ff35420bd More leap fixes;
Also reduce branching in headset accessors.
2019-05-12 22:23:28 -07:00
bjorn 26c1859531 Update WebVR; 2019-05-12 22:23:28 -07:00
bjorn 2ecae65925 trackpad -> touchpad;
Sorry
2019-05-12 22:23:02 -07:00
bjorn 57321db2cd lovr.headset.getDriver accepts devices; 2019-05-12 22:23:02 -07:00
bjorn 5413f6a427 Device iterators; 2019-05-12 22:23:02 -07:00
bjorn 7807b1abd7 lovr.headset.getAcceleration, getAngularAcceleration;
Add missing getBonePose impls.

Refactor some ovr stuff.
2019-05-12 22:23:02 -07:00
bjorn b6e1e5e3b0 lovr.headset.getBonePose; Device shorthands; 2019-05-12 22:23:02 -07:00
bjorn 05f4ba7342 Change everything;
Use enums because they make things easier.
2019-05-12 22:23:02 -07:00
bjorn 89ccf750ba Start compat system; 2019-05-12 22:23:02 -07:00
bjorn c2fc7daf2d Split mat4_getTransform; 2019-05-12 22:22:29 -07:00
bjorn 801f997b0a Use vectors for headset pose accessors; 2019-05-12 22:22:29 -07:00
bjorn 344edd8c30 Add missing OpenXR string constant; 2019-05-12 22:22:29 -07:00
bjorn e22d98e09e Finish Leap backend; 2019-05-12 22:22:29 -07:00
bjorn 5ff49e73c2 Leap WIP; 2019-05-12 22:22:29 -07:00
bjorn 400598735c rm isTracked for now; 2019-05-12 22:22:29 -07:00
bjorn df5de9a35e Use strings for paths;
It's probably slower, but it's way less complicated, so it seems like
a win for now.  Can implement compile-time hashing, tries etc. later
if it's identified as a performance issue for a real person.

Also a bunch of cleanup in openvr.c and oculus.c.
2019-05-12 22:22:29 -07:00
bjorn 45931d005a lovr.headset.isTracked; 2019-05-12 22:22:29 -07:00