1
0
Fork 0
mirror of https://github.com/bjornbytes/lovr.git synced 2024-07-03 04:53:35 +00:00
Commit graph

1140 commits

Author SHA1 Message Date
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
bjorn bb06b211cd Add missing getDirection binding; 2019-05-12 22:22:29 -07:00
bjorn 5c6163580b rm unused headset.h; 2019-05-12 22:22:29 -07:00
bjorn d8581106d4 Support Vive trackers again;
/trackers/1
2019-05-12 22:22:29 -07:00
bjorn 85d461e71c Fixup lovr.headset.getName; 2019-05-12 22:22:29 -07:00
bjorn 50e77fc023 Combine getVelocity and getAngularVelocity impls; 2019-05-12 22:22:29 -07:00
bjorn a9ef3656a1 lovr.headset.getDirection; 2019-05-12 22:22:29 -07:00
bjorn 965f39f834 Do less work in lovr.headset.getPosition/getOrientation; 2019-05-12 22:22:29 -07:00
bjorn 9a8b119a81 Add missing enum; 2019-05-12 22:22:29 -07:00
bjorn 77f848ea8f Update oculus backend; 2019-05-12 22:22:29 -07:00
bjorn f5b976cfae Actually read paths in API; 2019-05-12 22:22:29 -07:00
bjorn e406678b1c rm luax_pushpath; 2019-05-12 22:22:29 -07:00
bjorn 2584809c23 Reorganize path enum; 2019-05-12 22:22:29 -07:00
bjorn 4edb8de0b0 Shorten path enum prefix; 2019-05-12 22:22:29 -07:00
bjorn 86537141ac Add eye path; 2019-05-12 22:22:29 -07:00
bjorn b42c3ffc0e Rename hands to hand; 2019-05-12 22:22:29 -07:00
bjorn 60d2111937 Add proximity to Subpaths; 2019-05-12 22:22:29 -07:00
bjorn b0067233f7 getType -> getName; 2019-05-12 22:22:29 -07:00
bjorn fd985c95ff rm isMounted; 2019-05-12 22:22:29 -07:00
bjorn da6fd4d07c Remove Controllers; 2019-05-12 22:22:29 -07:00
bjorn bd609fc338 rm Controller:getHand; 2019-05-12 22:21:06 -07:00
bjorn cb0a40a4b6 lovr.headset.isDown; lovr.headset.isTouched; 2019-05-12 22:21:06 -07:00
bjorn 45757f2fa3 Fixes; 2019-05-12 22:21:06 -07:00
bjorn b95280006a lovr.headset.newModel; 2019-05-12 22:21:06 -07:00
bjorn cb79973b98 lovr.headset.vibrate;
Signature changed to take strength, duration, and frequency.  All
are optional.
2019-05-12 22:21:06 -07:00
bjorn 36e4529dca lovr.headset.getAxis;
Takes a path and returns 1-3 float values representing the components
of the axis at the path.  The "touchx" and "touchy" axes are now just
"touchpad".
2019-05-12 22:21:06 -07:00
bjorn 5ab8904809 Controller polyfill; rm Controller pose functions; OpenVR paths; 2019-05-12 22:21:06 -07:00
bjorn f87b4e6a25 Read paths; Desktop driver uses paths; 2019-05-12 22:21:06 -07:00
bjorn 48cf7e1874 Start paths; 2019-05-12 22:21:06 -07:00
bjorn 8208238df7 Support multiple tracking drivers;
Now the lovr.headset module initializes one display driver (the
first one in the list) and multiple tracking drivers.  Only drivers
that implement 'renderTo' will be considered for display driver.

Tracking drivers are stored in a linked list, and retrieving pose
information involves trying all of the tracking drivers until the
pose is found.
2019-05-12 22:21:06 -07:00
bjorn c9775c84ac Remove t.gammacorrect flag;
Gamma correct rendering is core in all supported OpenGL versions,
and it's usually a good idea to enable it.
2019-05-03 17:53:33 -07:00
bjorn 594921d2ec newThread: can load thread code from a file or Blob;
Also fix a lifetime issue: If the string containing thread code was
garbage collected before you started the thread, you would have been
running free'd memory as Lua code!
2019-05-02 15:09:54 -07:00
bjorn 0e0cfee6e8 Font:getWidth returns lineCount; 2019-04-27 11:13:37 -07:00
bjorn c021afedae Fix more warnings; 2019-04-20 18:42:25 -07:00
bjorn b95c97ff57 rm unused mat4_setTransform function; 2019-04-20 14:15:43 -07:00
bjorn 0341233876 Also support hexcodes in lovr.graphics.clear; 2019-04-20 13:38:09 -07:00
bjorn f268810d2a Minor cleanup; Fix some undefined behavior; 2019-04-20 13:11:11 -07:00
bjorn ec7afed2cb Update one trailing reference to lib/math.h;
In a comment...
2019-04-20 11:41:29 -07:00
bjorn 196b4ed010 Rename math to maf;
It's funnier and more compatible with some compiler setups,
since it won't get confused with the system <math.h>.
2019-04-20 11:39:20 -07:00
bjorn 9d90e83657 Fix Mesh attribute normalization;
Normalize i8 and u8 attribute by default.

Forward attribute normalization from glTF accessors.
2019-04-13 16:08:58 -07:00
bjorn 44be3608a7 lovr.headset.getDirection; Controller:getDirection; 2019-04-12 15:08:45 -07:00
bjorn fa4f240b7b Fix plane uv argument parsing; 2019-04-05 05:50:43 -07:00
bjorn 011db5f1e5 Revert "Free objects in their destructors;"
This reverts commit d31dca5520.

We can't unconditionally free because sometimes objects are temporarily
allocated on the stack.
2019-04-05 05:45:05 -07:00
bjorn a5891bad92 lovr.graphics.plane uv arguments; 2019-04-05 05:34:28 -07:00
bjorn 941fc1717f headset: forward declarations; 2019-04-05 05:08:03 -07:00
bjorn ee27af1a85 graphics: forward declarations; 2019-04-05 04:59:14 -07:00
bjorn 66b7288764 event: forward declarations; 2019-04-05 04:32:58 -07:00
bjorn 0d30448bd0 audio: forward declarations; 2019-04-05 04:16:34 -07:00
bjorn ae470d8804 Make registertype/extend type a macro;
Just a nice-to-have.
2019-04-05 03:48:36 -07:00
bjorn 6fdeda9e61 Make lovrRelease non-generic;
We know what type we're releasing 99% of the time, we don't need to
play a guessing game in lovrRelease, just have the caller say which
destructor to use.

There is lovrGenericRelease for situations where we need it, which
does the slower lookup of the destructor.
2019-04-05 03:41:03 -07:00
bjorn efbc88073e Write vertices at batch time; 2019-04-05 00:49:50 -07:00
bjorn 7409f34d36 lovr.graphics.getStats does a flush; 2019-04-01 07:37:05 +09:00
bjorn ab42e2ca18 Fix bug when reading point/line/triangle primitive data;
- When reading points from a table of numbers, the array
  indexing was not correct and vertex positions were not
  getting correctly written.
- The normals/texture coordinates weren't getting written,
  so their values were using whatever was in the buffer.
  Now they are always set to zero.
2019-03-31 00:23:02 +09:00
bjorn 85c51399a6 Fix MSVC warnings; 2019-03-17 00:58:13 -07:00
bjorn 7441456aab Rename lovr.graphics.getSupported and getSystemLimits;
"Features" and "Limits" will be the standard terminology used now.
2019-03-14 21:24:25 -07:00
bjorn bf5dd56254 vec3:add and vec3:sub accept numbers; 2019-03-13 20:36:50 -07:00
bjorn 8722b6e296 Improve Canvas attachment errors; 2019-03-13 09:35:28 -07:00
bjorn 921d14014e TextureData:setPixel supports more formats; 2019-03-11 13:36:22 -07:00
bjorn 569c9f7a11 Refactor asynchronous headset render errors;
It's now a more general error stored in the registry instead of
in a global variable.  There are more helper functions.
2019-03-06 23:17:29 -08:00
bjorn d45e56146a Rename fake to desktop; 2019-03-06 23:02:47 -08:00
bjorn d340fc7aaa Polyfill LUA_RIDX_MAINTHREAD;
Instead of using a static variable.
2019-03-06 08:42:32 -08:00
bjorn d4c8382306 Fix improper istype calls in LuaJIT; 2019-03-05 02:45:46 -08:00
bjorn 55670ab408 rm trailing whitespace; 2019-03-05 02:29:21 -08:00
bjorn 3d928c1118 lovr.graphics.newMesh accepts Blob again; 2019-03-05 02:08:53 -08:00
bjorn 27e2c56bee lovr.filesystem.read takes and returns byte count; 2019-03-05 01:59:31 -08:00
bjorn a8e201d89e TextureData:getFormat; 2019-02-28 19:29:30 -08:00
bjorn 5e0c2e531f Source:getPose; Source:setPose; 2019-02-18 18:07:28 -08:00
bjorn 41dbf6115b Source:getOrientation; Source:setOrientation; 2019-02-18 18:01:17 -08:00
bjorn af155ff0c5 Ensure Blob size is positive; 2019-02-17 18:43:52 -08:00
bjorn 0cba1ba28d lovr.audio.getPose; lovr.audio.setPose; 2019-02-17 18:26:56 -08:00
bjorn 075b71e58c Collider:getPose; Collider:setPose; 2019-02-17 18:20:35 -08:00
bjorn 90d6e2b407 Make binding functions static; 2019-02-17 14:52:22 -08:00
bjorn d529620fea rm unused variables; 2019-02-17 14:19:39 -08:00
bjorn 581d1d7a74 Fix warnings; 2019-02-16 23:43:20 -08:00
bjorn 62bce139d3 Fix mat4 constructor; 2019-02-14 10:31:22 -08:00
bjorn 69b6e599e9 Re-add Model:getMaterial and Model:setMaterial; 2019-02-13 23:55:47 -08:00
bjorn b9b719e862 Fix gamma correct issue with built-in Camera; 2019-02-13 21:14:45 -08:00
bjorn be58911276 Fix several Mesh problems; 2019-02-13 17:20:43 -08:00
bjorn a02d4eb659 rm VertexData; 2019-02-13 15:10:52 -08:00
bjorn 9136c7e3c1 Model:getAABB;
It takes animated node transforms into account!  But not skinning.
2019-02-13 15:10:52 -08:00
bjorn a24d7e5447 Bugfixes during testing; 2019-02-13 15:10:52 -08:00
bjorn 3911c9d7c8 Support animation names; 2019-02-13 15:10:52 -08:00
bjorn bea2140676 Animation optimization; Cleanup; 2019-02-13 15:10:52 -08:00
bjorn 09936a8ae2 Load animation names; General testing; 2019-02-13 15:10:52 -08:00
bjorn 540b6a60e0 Refactoring; 2019-02-13 15:10:52 -08:00
bjorn 0a4344577e Skinning work; Bugfixes; 2019-02-13 15:10:52 -08:00
bjorn 70dc871f88 More work on Animator; 2019-02-13 15:10:52 -08:00
bjorn 80bb75968e WIP animator rewrite; 2019-02-13 15:10:52 -08:00
bjorn 6b323e3476 Start parsing glTF; 2019-02-13 15:10:52 -08:00
bjorn 50e86579c2 vec3:min; vec3:max; 2019-02-08 12:39:10 -08:00
bjorn 3c83b36845 LuaJIT: Add .name metafields for compatibility; 2019-02-08 08:13:47 -08:00
bjorn 4a25a0120f Vector rework; 2019-02-08 08:13:47 -08:00
bjorn dc7f9cd0d5 lovr.graphics.getPixelDensity; 2019-02-05 12:46:48 -08:00
bjorn 8e942561f1 Simplify CompareMode handling; 2019-02-01 15:10:12 -08:00
bjorn 85ab7c7c6e Fix comment typo; 2019-02-01 14:44:13 -08:00
mcc 4859360209 Fix compile with -DLOVR_ENABLE_HEADSET=NO 2019-02-01 13:20:28 -08:00
bjorn eae3669fea Rebuild math.lua.h; 2019-01-31 13:54:54 -08:00
bjorn a1361fcd41 mat4:unpack accepts raw flag; rm redundant functions; 2019-01-30 16:18:08 -08:00
bjorn 0eb2789a2d Improve mat4:set;
Ended up removing the diagonal variant, sorry holo.
2019-01-30 16:13:44 -08:00
bjorn 3d4cb166bc Add quat:length; 2019-01-30 00:56:57 -08:00
bjorn bf89216997 Explicitly convert lua_Numbers to floats; 2019-01-29 22:04:04 -08:00
bjorn 03e3e14718 Font:setFlipEnabled; Font:isFlipEnabled; 2019-01-29 21:49:49 -08:00
bjorn 6291a5ad5a Always check malloc result; Less calloc;
Some more questions:

- Should there be some kind of allocation helper so you don't need
  to always check the result?
- Throwing an error on OOM is convenient and is probably correct 90%
  of the time, it even provides a nice error message instead of a
  nil dereference somewhere.  But it's inflexible.  Is it the right
  thing to do?
2019-01-29 16:53:01 -08:00
bjorn 5d29ec2db1 Curve supports vec3; 2019-01-29 16:33:44 -08:00
bjorn a878139e26 rm math out args;
Needs more consideration before it can be added at the desired quality level.
2019-01-29 16:05:48 -08:00
bjorn 6c5ceabe02 Fix quat:set(nil) in vanillua; 2019-01-29 16:05:48 -08:00
bjorn dac289d624 mat4:__mul works with vec3 in vanillua; 2019-01-29 16:05:48 -08:00
bjorn 9839277e8d Fix quat:mul edge case; 2019-01-29 16:05:48 -08:00
bjorn c08cb664e7 mat4:mul; 2019-01-29 16:05:48 -08:00
bjorn 6c961bb404 rm math copy functions;
They are redundant.
2019-01-29 03:57:11 -08:00
bjorn b37fc5dbbe Remove fixed-function mirroring code from headset drivers; 2019-01-28 18:29:50 -08:00
mcc b09c3adeec Fixes to lovr.mirror() requested in PR 2019-01-28 15:03:58 -08:00
mcc aab1bda92d Implementation of getMirrorTexture() 2019-01-28 15:03:58 -08:00
mcc 95fcc3eb0b Attempt to make a lovr.mirror() for Window purposes as discussed in chat.
Adds lovr.graphics.hasWindow()
2019-01-28 15:03:58 -08:00
bjorn b410227990 Font:getRasterizer; Font:setPixelDensity(nil); 2019-01-25 12:54:11 -08:00
bjorn 6fd4b9ef4c Header cleanup; 2019-01-24 17:43:25 -08:00
bjorn cb9f166234 Revert "Replace sprintf with stb version;"
This reverts commit 8f9d24c51f.
2019-01-24 17:39:27 -08:00
bjorn c473bf50e8 Buffers individually keep track of their flush range;
Fixes bugs with attached Mesh attributes, where flushing wasn't
happening when it should have.
2019-01-22 12:11:01 -08:00
bjorn 25606738c5 rm Curve:getDegree; 2019-01-21 09:49:07 -08:00
bjorn 8e0ccbf09a Curve:split -> Curve:slice; 2019-01-20 20:36:42 -08:00
bjorn 5deae0a103 Rename setWindow back to createWindow;
I'm not sure why this was changed.  It doesn't make very much sense
because setWindow can't be called multiple times, and it can't be
called with nil/NULL.
2019-01-20 20:06:40 -08:00
bjorn 8f9d24c51f Replace sprintf with stb version; 2019-01-18 08:55:29 -08:00
bjorn e6d9b82bba Adjust BlockType; getValue -> read; 2019-01-16 10:02:44 -08:00
bjorn ee7544eba8 ShaderBlock:getValue; Shader:send vector fixes;
Allows you to read back values from a ShaderBlock.

- This is also probably useful for Shaders.
- This creates SO MANY tables.  It feels so bad to expose this.  But
  also it's the only way to read values back from a compute operation,
  so it's pretty indispensable.  In the future there could be a Blob
  variant.
2019-01-16 10:02:44 -08:00
bjorn 27000d2238 Rebuild math.lua.h; 2019-01-14 12:30:47 -08:00
bjorn aa56cbc7b0 Fix crash on repeated calls to Channel:peek; 2019-01-12 20:51:50 -08:00
bjorn bb9d354ac9 Fix missing LuaJIT return; 2019-01-12 05:06:57 -08:00
bjorn 6bfc6623ac More consistent matrix out args; 2019-01-12 04:58:05 -08:00
bjorn 577ed57b2d oops, access the two types of Pools properly; 2019-01-12 04:22:11 -08:00
bjorn c41a5c4e3c Math copy functions allow you to specify a Pool; 2019-01-12 03:46:14 -08:00
bjorn 990544d3f4 Fix quat:save in LuaJIT; 2019-01-12 03:06:40 -08:00
bjorn 90cacd03ca Handle numbers more consistently in Lua API;
I still don't know if I should cast or not, but at least now things
will be consistently right or wrong.
2019-01-11 22:37:54 -08:00
bjorn 7338c82d7f Add resizable vector pools;
It seems too dangerous/annoying to have pools error when they run
out of memory.  Instead, we'll make it so you can choose to make
a pool resizable, where it enlarges its memory if it runs out. By
default Pools aren't resizable, but the default math pool is.

Also, reduce the size of the default pool from 640k to 4k.
2019-01-10 14:10:04 -08:00
bjorn f709a6849b Fix crashes with :save'd vectors in LuaJIT; 2019-01-08 02:37:50 -08:00
bjorn dee53f953c Fix vector save functions in LuaJIT; 2019-01-08 00:54:07 -08:00
bjorn 40c7deaefe Vector API improvements; 2019-01-06 03:25:00 -08:00
bjorn c7fa8f8497 Fix vec3:set; 2019-01-05 00:21:56 -08:00
bjorn cc88a0b919 Expose option to flip TextureData on load; 2019-01-04 23:32:25 -08:00
bjorn 379dc74cd5 Mesh fixes; 2019-01-04 18:01:01 -08:00
bjorn 1068dd1081 Rework cylinder; 2019-01-04 18:01:01 -08:00
bjorn ea3a77a73a Many batching improvements; Refactoring; 2019-01-04 18:01:01 -08:00
bjorn d66057ee70 Avoid redundant strlen in font printing; 2019-01-04 18:01:01 -08:00
bjorn 62645cde28 Pipeline -> 4 bytes; lineWidth -> uint8_t; 2019-01-04 18:01:01 -08:00
bjorn 2ceb474b04 DrawCommand -> DrawRequest; 2019-01-04 18:01:01 -08:00
bjorn 779e28353d Rebuild math.lua.h; 2019-01-04 02:19:10 -08:00
bjorn 4f716499b0 Fix declspec for math functions;
LuaJIT can't find math functions on windows unless they are exported.
2019-01-04 02:18:21 -08:00
bjorn 60a12a6b7e Rename thread module init/destroy; 2018-12-19 01:04:42 -08:00
bjorn ab8e86b9a5 Fix vec3() in LuaJIT; 2018-12-17 20:14:10 -08:00
bjorn 68a0bf4a10 mat4:transformPoint; 2018-12-17 20:07:19 -08:00
bjorn b0a146919f Add vec3:length; 2018-12-17 19:32:43 -08:00
bjorn 1fb2d6be02 Always use pushliteral when possible; 2018-12-15 21:45:32 -08:00
bjorn ad10f3bc37 Fix rgb10a2 constant; 2018-12-15 17:35:57 -08:00
bjorn ff581d2e07 Fix Mesh:draw; 2018-12-12 19:39:01 -08:00
bjorn a67f59000f DrawMode -> DrawStyle; MeshDrawMode -> DrawMode;
Renaming enums doesn't really have an impact on the API usage, just
the docs and internal naming of things.
2018-12-12 18:43:04 -08:00
bjorn 2540953422 lovr.graphics.setAlphaSampling for alpha to coverage; 2018-12-11 22:52:58 -08:00
bjorn 2435108d4d rm drawInstanced (last argument of draw instead);
Willing to revert this, but I think this is the cleaner API to use.
2018-12-11 22:16:40 -08:00
bjorn 259dbd5758 completely rm lovrGraphics from opengl.c; 2018-12-11 22:12:19 -08:00
bjorn b02eae30b4 Autoinstancing; 2018-12-11 22:10:29 -08:00
bjorn 18fdd0c062 Autobatching; 2018-12-11 13:27:59 -08:00
bjorn 387a91d5e4 lovr.graphics.flush; 2018-12-11 11:13:46 -08:00
bjorn 2e5c927b92 Expose max UBO size in lovr.graphics.getSystemLimits; 2018-12-11 11:13:02 -08:00
bjorn 7f333ce956 Refactor Mesh attributes; 2018-12-07 19:11:14 -08:00
bjorn e2886d3bb5 Mesh uses Buffer; 2018-12-07 15:57:45 -08:00
bjorn 9a0f7c919a ShaderBlocks use Buffers; 2018-12-06 16:34:14 -08:00
bjorn 3a774354e8 Remove lovrHeadsetGetEyePose;
A lot of drivers didn't bother to support it, it's not used very often,
and there are better ways to expose it that will soon be implemented.
2018-12-02 13:27:55 -08:00
bjorn 9a3ba5fb52 LuaJIT: mat4:scale accepts single number; 2018-12-02 13:03:29 -08:00
bjorn 9d965e1d7a LuaJIT: mat4:translate, rotate, scale support chaining; 2018-12-02 13:02:10 -08:00
bjorn 0054c771b2 Properly release Curves on creation; 2018-12-02 12:51:20 -08:00
bjorn fb455a671c LuaJIT: dereference vector pointers before use;
That way __sub doesn't break due to built-in pointer operator.
2018-12-02 12:48:44 -08:00
bjorn 4e6bf41e67 mat4 fixes; 2018-12-02 12:08:07 -08:00
bjorn ecabec9bf2 Finish LuaJIT API; 2018-12-02 12:08:07 -08:00
bjorn 43567e561a Update lovr.graphics.points/lines to work with vectors; 2018-12-02 12:08:07 -08:00
bjorn 2aadc9bde1 rm Transform; 2018-12-02 12:08:07 -08:00
bjorn c7934b3b13 Update API to work with vectors; 2018-12-02 12:08:07 -08:00
bjorn ba192374dc Start math types; 2018-12-02 12:08:07 -08:00
mcc 778b654f1d Move lovr.android.getApplicationId() to lovr.filesystem.getApplicationId(). Kill Android module
This requires adding an application id function to platform and adding a mini definition to sds into platform.h. All platforms except Android return NULL (no application id)
2018-11-27 15:02:25 -08:00
mcc adabf4c6ef Fix broken android lua module
The LOVR_ENABLE_ANDROID flag wasn't getting passed to C, and the getApplicationId code had bugs
2018-11-27 15:02:25 -08:00
mcc 99026af5ca Fix Android compile 2018-11-27 15:02:25 -08:00
mcc 961bf859f6 Android lua module
Currently provides only a lovr.android.getApplicationId(). This returns an Android-specific identifier that doesn't cleanly map to anything specific in other OSes.
2018-11-27 15:02:25 -08:00
bjorn 0e99d47394 Fix module destruction;
There is a problem when a Thread stops: it destroys all of the modules
that it required.  This is because we unconditionally call luax_atexit
when modules are required, and when the thread lua_State dies it takes
all of the modules with it.  To fix this, lovr<Module>Init will return
whether or not initialization successfully happened, which provides us
with enough info to know if we should place the luax_atexit destructor
2018-11-19 09:24:28 -08:00
bjorn 465e5c2010 Controller:getVelocity; Controller:getAngularVelocity; 2018-11-19 09:24:10 -08:00
bjorn ba60e99890 lovrPlatform: Window creation; 2018-11-16 02:26:56 -08:00
bjorn 005d4b93f2 Move math helpers into lib;
They aren't really part of the math module since they are shared
across several modules, more "util"-y.
2018-11-15 08:03:51 -08:00
bjorn 784d61ef4a Modify module loading;
Dynamically loading things was cool but is causing more pain than
pleasure because it just barely doesn't work everywhere.  Instead,
find a better way to load modules.  Use a data driven luaL_Reg array
to define the module mapping and luaL_register to smoosh it into
package.preload at boot time.  Benefits:

- LOVR_ENABLE_<x> defines are respected and only require a single #if
- Module list is data driven and defined in one place
- It's faster (luax_preloadmodule did a global lookup every invocation)
- It works everywhere

Oh also threads were totally broken and this (mostly) fixes them.
2018-11-15 07:51:21 -08:00
mcc 64b187ef3f Manual merge args-and-physfs PR branch with master 2018-11-13 22:09:47 -05:00
mcc 91daeae634 Style/functional fixes to args for PR. --inside is now --root 2018-11-13 22:07:19 -05:00
mcc 96eed2786c Amend oculus_mobile error handling so headset.c renderHelper drives
Back out lovrHeadsetExtractRenderFn, don't let oculus_mobile.c pcall the render function, instead fit the render error saving inside renderHelper (emscripten/oculusmobile path). The render error is now saved in the environment at _lovrHeadsetRenderError. For this to work, luax now keeps track of a global variable for the current "main" environment.

This does means the render error path now works on emscripten (this has not been tested).
2018-11-13 16:50:31 -08:00
mcc 684fd77316 Various changes around error reporting to support Oculus Mobile
General changes:

- Amended the boot.lua error handling so when an error occurs in the error handler, the inner error is printed before quitting
- Silent quit instead of crash if a user implements lovr.errhand but it doesn't return a function

Oculus Mobile changes:

- The lovr.errhand screen is now correctly invoked for errors that occur inside lovr.draw. Multiple changes were needed to make this work:
    - Instead of calling renderHelper, which uses lua_call (unsafe as Oculus Mobile does not call renderHelper) the oculus driver gets hold of the Lua ref and lua_pcalls itself. A new lovrHeadsetExtractRenderFn is added to make this possible.
    - A mechanism is added where if the coroutine resume in boot.lua returns a value, boot.lua treats this as the string returned from luax_getstack and invokes lovr.errhand.
- Added a custom atpanic that routes through lovrThrow (since stderr gets eaten). With the draw() changes this should never be encountered, but it's good just in case. In current testing the tracebacks this prints don't seem to be right.
- Fix major bug in android_vthrow that meant % codes didn't work in lovrThrow on Android
- Nothing to do with errors, but fix getAxis("trigger")
2018-11-13 16:50:31 -08:00
mcc 2213b3bcfd Allow the mountpoint to be set "inside" a zip file, using an --inside parameter.
This is used in the oculus mobile driver, allowing replacement of the (dubious) recursive-copy-from-zip code.

In order for this to work, the argument parsing must be beefed up a bit and also PhysFS must be updated to the newest master in order to get a new PHYSFS_setRoot. The github submodule source has been changed to one which updates more frequently to get this.
2018-11-13 15:20:04 -05:00
mcc 26af794e3c Adjust the lovr command line construction to follow the lua/love standards. This is a BC-breaking change.
Source for lua standard: https://en.wikibooks.org/wiki/Lua_Programming/command_line_parameter
2018-11-13 16:28:56 -05:00
bjorn a1237029de lovr.graphics.translate: Arguments default to 0; 2018-11-12 19:28:41 -08:00
bjorn 112d775635 Font:hasGlyphs; 2018-11-11 17:29:41 -08:00
bjorn 76c2dc757a Curve:getTangent; 2018-11-08 12:56:45 -08:00
bjorn 2703192f1d Make a constructor; 2018-11-08 12:56:45 -08:00
bjorn 2acf49fb34 Curve; 2018-11-08 12:56:45 -08:00
bjorn bfeb3d2d51 lovr.graphics.discard; 2018-11-08 11:58:31 -08:00
mcc a46b4afbb8 Split out the "oculus mobile" headset type into GEAR and GO. 2018-11-07 14:34:51 -05:00
mcc 8301bd7dd8 Remerge oculus-mobile branch with master 2018-11-02 18:10:08 -04:00
mcc 79b0c19254 Oculus mobile: First round of fixes requested in PR review
Formatting, back out bad change to Win32 build, support getOs()
2018-10-28 22:55:37 -04:00
mcc dd440b2ada Code cleanup after all these changes, fix build 2018-10-28 15:31:27 -04:00
bjorn 654b894ded Add lovr.graphics.setProjection;
It's not very good.  It only takes Transforms and sets the projection
for both eyes.  And the projection gets reset at the beginning and
end of lovr.headset.renderTo.  It's meant to be a backdoor.
2018-10-26 17:17:18 -07:00