Commit Graph

2644 Commits

Author SHA1 Message Date
Bjorn 12d2e32903
Merge pull request #206 from bjornbytes/headset-views
Headset views;
2020-01-29 17:24:34 -08:00
bjorn 9ea76fac7b rm placeholder getFov code; 2020-01-29 17:09:23 -08:00
bjorn c73fadf5a3 Mark compute shaders as available on ES3.2; 2020-01-29 14:08:09 -08:00
bjorn 3c2154c824 Add unused EGL context creation; 2020-01-28 21:42:44 -08:00
bjorn c9a06a37cb Refactor main; Add unused android entrypoint; 2020-01-28 21:38:44 -08:00
bjorn 0aa724116e Headset views;
- lovr.headset.getViewCount
- lovr.headset.getViewPose
- lovr.headset.getViewAngles
2020-01-27 22:11:58 -08:00
bjorn b19a391c32 desktop: emit focus events; 2020-01-27 21:10:27 -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 c7f5406ce2 Make clipping planes consistent across most headset drivers;
The default far clipping plane was changed from 30 to 100 for openvr
and oculus.  oculus_mobile clipping planes can't be changed easily.
2020-01-23 11:25:38 -08:00
bjorn 8c429e89ac Fix -Wshadow; 2020-01-23 11:18:04 -08:00
bjorn 08577ee91b Fix cast-qual warning; 2020-01-23 11:01:27 -08:00
bjorn 4c1917f6ce Fix some prototypes; 2020-01-23 10:55:46 -08:00
bjorn 0f338c3ebd Fix getDirectoryItems on windows; 2020-01-22 16:09:35 -08:00
bjorn ddcdce25dc Minor style stuff; 2020-01-22 15:41:48 -08:00
bjorn 96d3288dae Update header; 2020-01-22 15:38:57 -08:00
bjorn a5424a1932 Microphone:getData supports sampleCount/destination; 2020-01-22 15:36:41 -08:00
Bjorn 3c65d238bc
Merge pull request #193 from alloverse/allo/mic
Sound adjustments: SoundData has-a blob, and mic sample size getter
2020-01-22 14:10:26 -08:00
bjorn f207c4d9a4 zip: Only call munmap if zip file was actually mapped; 2020-01-20 15:59:53 -08:00
mcc ea06f8d7dc Filesystem fixes: Use normalize() in lovrFilesystemMount and dir_resolve; ensure enough room for zero terminator in zip_lookup 2020-01-20 17:12:37 -05:00
Nevyn Bengtsson e10799b8c8 microphone: less throwy, more MAX()y 2020-01-20 08:52:58 +01:00
Nevyn Bengtsson a5c59e2d12 Fixes from review 2020-01-20 08:49:11 +01:00
Nevyn Bengtsson 0bdb7c7c80 More has-a-ification of texturedata
I forgot to stage this yesterday??
2020-01-20 08:48:59 +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 c5edc6dedb
Merge pull request #190 from bjornbytes/android-canvas
Android Canvas
2020-01-17 12:19:49 -08:00
bjorn b1eeda96cb Small safety fix; 2020-01-16 09:32:12 -08:00
bjorn 0ecd8f6b49 Fix lovr.filesystem.getExecutablePath on macOS; 2020-01-16 09:21:21 -08: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 c0d1e28deb Fix ifdef for glTexStorage;
It's always present on GLES.
2020-01-14 19:39:10 -08:00
bjorn da88766e5a oculus_mobile: Discard depth/stencil buffers after rendering;
This was present in lovr-oculus-mobile.
2020-01-14 18:46:00 -08:00
bjorn 541400e0fe oculus_mobile: Create framebuffers from bridged swapchain textures;
This is a change that shifts the responsibility regarding the creation
of OpenGL framebuffers from vrapi-provided swapchain texture handles.
Previously, the LovrApp component of lovr-oculus-mobile was creating
framebuffers and passing native framebuffer IDs to lovr.  With this
change, lovr-oculus-mobile passes vrapi's swapchain textures to lovr
unmodified.  This allows lovr to create canvases using its conventional
method and also means that the properties of the canvases are no longer
hardcoded, so things like resolution and multisampling can be
customized.

There were also some issues with multiview canvases in LÖVR due to some
misconceptions about how multisampled multiview rendering works.  These
issues have also been fixed in this commit.
2020-01-14 18:26:01 -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 0841268d45 Fix garbled text when printing out spaces;
Apparently requesting/rendering zero vertices was clogging stuff
somewhere.  It seems good enough to just explicitly not render
anything if we weren't gonna do it anyway.
2020-01-14 00:37:09 -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 46c685bd27 Make channel creation threadsafe; 2020-01-13 23:49:52 -08:00
bjorn 48b887f7ee Always pass identity matrix for animated shader;
So at least something shows up if you have an unskinned mesh with
a skinned shader.
2020-01-13 20:47:47 -08:00
bjorn 3c68e9e97a Fix some compile warnings/style;
Also I am little unsure about the _unused part.  It seems like we
were passing it ALuint** when the spec says it takes ALuint*.
2020-01-13 20:45:36 -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
Bjorn 180a3adb8f
Merge pull request #180 from alloverse/raw-audiostream
Real-time raw AudioStreams
2020-01-13 19:49:57 -08:00
mcc 2a3b4694f5 Fix crash on lovr.thread.newThread(nil) 2020-01-11 14:56:26 -05:00
Nevyn Bengtsson 972eb108c0 NULL is not valid for buffers in UnqueueBuffers 2020-01-11 16:31:06 +01:00
bjorn dc1c011380 Fix bug with std140 offset logic; 2020-01-09 21:57:25 -08:00
Nevyn Bengtsson 3279c0d3f0 Document buffer unqueueing in source play 2020-01-09 16:37:28 +01:00
bjorn 42c85c39fb rm 1ms sleep from main loop;
It's causing massive problems on windows, and sleeping for zero ms
is good enough to relinquish CPU time to the OS.  VR APIs also do
their own sleeping.
2020-01-08 23:58:11 -08:00
Nevyn Bengtsson ab3e7a52fa AudioStream: fix broken GetDurationInSeconds
d'oh
2020-01-09 00:01:18 +01:00
Nevyn Bengtsson 86ba2feeeb RawAudioStream: Use cursor instead of realloc-remainder
Previous code would wastefully reallocate memory for every time a buffer is too big to fit. New code just uses an index into the next buffer at which to start reading, requiring no extra allocation.
2020-01-08 23:52:08 +01:00
Nevyn Bengtsson 1ca57a073c style fixes after review 2020-01-08 23:44:28 +01: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 3cb7649996 audiostream: what the heck is memory.h
fixes review comment
2020-01-08 17:49:13 +01:00
mcc dac50c4687 Pragma once in core/hash.h 2020-01-06 13:55:39 -05:00
Nevyn Bengtsson ae5877a299 Rewind raw sources on explicit stop
I missed this one in dbe2edd8
2020-01-05 21:26:41 +01:00
Nevyn Bengtsson 1db932d856 Source: Stop, then unqueue buffers
Doing it the other way around is illegal; you may not unqueue unprocessed buffers, so we need to stop first.
2020-01-05 21:26:14 +01:00
Nevyn Bengtsson b3fb31f5a4 Destructor for raw audio stream 2020-01-05 21:19:08 +01:00
Nevyn Bengtsson dbe2edd89d Source: Do rewind on stop like before, and clear buffers
I changed my mind. Let's use rewind to clear buffers on a raw stream like Bjorn suggested, and put rewind at stop like it was before.
2020-01-05 21:08:30 +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 2d681260e5 RawAudioStream: Fix byte/sample confusion
dequeue_raw thought that size was in bytes, but it's in samples.
2020-01-04 23:22:58 +01:00
Nevyn Bengtsson a3720b494b RawAudioStream: Fix use-after-free 2020-01-04 02:02:32 +01:00
Nevyn Bengtsson e85a9b74c6 Audio source: unqueue before playing 2020-01-04 01:58:03 +01:00
Nevyn Bengtsson a274eb05d1 RawAudioStream: Fix a buncha crashes
It's still buggy but at least less so
2020-01-03 23:01:21 +01:00
Nevyn Bengtsson 33bee6ce44 Audio: Rewind on play, not stop
Before, streams were rewound when they stopped, so that next time they're played they're played from the start.

Instead, rewind on play instead, so that it's done when it's needed. This gets us a good point to make sure we're not rewinding raw streams too.
2020-01-03 23:00:58 +01:00
Nevyn Bengtsson c6806f50e1 RawAudioStream: getter for isRaw
And disallow looping raw streams
2020-01-03 22:59:37 +01:00
Nevyn Bengtsson 4fb4f6cdd1 RawAudioStream lua API 2020-01-03 17:15:12 +01:00
Nevyn Bengtsson f6abb8d714 Raw audiostream implementation
Naive unoptimized implementation to get a feel
for the API design.
2020-01-02 20:34:55 +01:00
Jason Dogariu 163367a3ba rm pragma pack to fix OpenVR on Linux and Mac 2020-01-01 17:34:45 -05: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 d228dc95d7 Automatically convert binary resources;
- Teach CMake how to compile binary resources to C headers, like xxd.
- Note: tup is already using xxd to do this.
- gitignore binary resource headers to reduce git noise and avoid problematic
  interactions between git and build systems.
2019-12-29 11:25:30 -08:00
bjorn 12fcaffc3b Slight update to lovrDirSep;
Macro instead of global variable.
2019-12-29 10:30:26 -08:00
bjorn 79fd5ad7d8 Name boot.lua chunk properly;
This makes error messages nicer.
2019-12-28 23:18:03 -08:00
bjorn e538965f77 Add newline to end of stb_image.h; 2019-12-28 23:16:36 -08:00
bjorn a5db2d6c5c mv appveyor config to resources folder; 2019-12-28 20:13:19 -08:00
mcc 21a52368f5 Patch in thread local storage for stb_image vflip
This makes loading images in multiple threads concurrently safe.

Adds a new CMake variable LOVR_USE_THREADLOCAL, by default on
2019-12-20 16:09:18 -05:00
mcc 735d2e1011 Upgrade stb_image from v2.12 to v2.23 2019-12-20 16:24:05 -05:00
bjorn a103637419 Fix ModelData refcounting; 2019-12-20 04:52:55 -08:00
bjorn d1657f401d Fix some memory leaks; 2019-12-20 04:13:38 -08:00
Bjorn ebde129204
Merge pull request #174 from mcclure/android-0.14
Android fixes. Major change is lovrMain() {} is now lovrMain {}
2019-12-17 17:23:50 -08:00
Bjorn 6c6e5bb60d
Merge pull request #173 from mcclure/file
Bring back old File C API (read-only currently)
2019-12-17 17:22:09 -08:00
mcc c563787f7d Android fixes. Major change is lovrMain() {} is now lovrMain {}
The oculus drivers choke on #define lovrMain()
2019-12-17 20:20:09 -05:00
mcc 3ff94d8797 Bring back old File C API (read-only currently)
This code path is not used anywhere in this commit, but aids in developing Lovr addons.
2019-12-17 20:06:42 -05:00
mcc ff1ae2c050 Minor fix to let header files compile in C++ 2019-12-17 20:02:33 -05:00
bjorn fd437423e7 Fix refcount alignment;
Once and for all?  How does alignment even work.
2019-12-15 17:04:26 -08:00
Bjorn 16b93869ee
Merge pull request #143 from bjornbytes/shadow-samplers
Shadow samplers;
2019-12-14 11:34:38 -08:00
bjorn 0d156549f7 Fix remaining references to platform; 2019-12-13 19:59:09 -08:00
bjorn bb279b451c Fix remaining platform references; 2019-12-13 19:58:22 -08:00
bjorn e2d8f8c645 platform -> os;
The function names are staying the same for now.
2019-12-13 19:55:46 -08:00
bjorn 63dc8f6c9b Only use glfw for window creation;
This allows for headless operation.  Currently GLFW throws an error
if you call glfwInit without an X server running, preventing lovr
from starting at all in that situation.

Because GLFW is currently used for time functions, those had to be
moved into the platform layer.  There's lots of duplication here,
ideally the platform layer would just return raw timer values and the
timer module would handle the epoch logic, but it was too difficult to
coordinate that right now.

Also, lovrPlatformInit is guaranteed to set the time epoch to 0 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 33991b41ad tup macOS fixes;
- Need to use dylib suffix.
- Need pagezero stuff (should we only do this when using LuaJIT?)
- rpath is totally different.
- stb_vorbis alloca broke?
2019-12-13 07:27:37 -08:00
bjorn 6f24da9f7f Rework Tupfiles;
- One toplevel Tupfile that makes it more clear what happens.
- Add config flags for -Werror, -fsanitize, and separate debug/optimize flags.
- Automatically integrate with libs built by CMake (build folder, rpath, libs folder).
- Disabling modules actually works, only the stuff that's needed is built.
2019-12-13 06:52:57 -08:00
bjorn 5957d07448 Fix warnings; 2019-12-13 03:41:35 -08:00
bjorn fe422ba60f Use nanosleep instead of usleep;
usleep is deprecated and does not exist on some new Linux systems.
2019-12-13 03:41:02 -08:00
bjorn 1ebe68b934 tup: make CONFIG_ENET=n work; 2019-12-10 15:21:34 -08:00
bjorn e316e6156b lovr.graphics.get/setColorMask; 2019-12-10 13:44:51 -08:00
bjorn c87d6dec3d lovrPlatformGetProcAddress;
Seems nicer than a global and allows for logging/hooks;
2019-12-10 13:15:12 -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 8795ebb31d Windows WIP; 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 d2b0b30faf Texture:encode doesn't use File; 2019-12-10 12:19:50 -08:00
bjorn 8da7df68d8 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 bc948e7ea5 rm trailing whitespace; 2019-12-05 13:40:05 -08:00
bjorn bfd63e3515 Use restrict modifier in curve evaluation;
Allows compiler to emit SIMD, way smaller/faster.
2019-12-05 13:39:04 -08:00
bjorn c07b9e3fec rm unnecessary include; 2019-11-28 16:04:41 -08:00
bjorn 08f90ab1bd Make refcount 64 bits to avoid alignment issues;
There may be a better way to solve this, but I can't think of one
that doesn't also violate strict aliasing.
2019-11-28 16:03:42 -08:00
bjorn 1030c01a35 Stop aligning pool memory;
It isn't necessary anymore since we aren't hiding data in the alignment
bits and it seems to be causing problems in wasm.
2019-11-28 15:59:04 -08:00
bjorn b9f5ece72b Fix arr_splice; 2019-11-28 15:58:38 -08:00
bjorn 3e347f0521 Properly initialize uniform.dirty; 2019-11-28 15:31:27 -08:00
bjorn ad5389b1f4 Improve luax_readquat(nil); 2019-11-28 15:26:52 -08:00
bjorn 898a3f9f35 rm double underscores from glsl;
This naming pattern is reserved.
2019-11-28 15:25:19 -08:00
bjorn b69a5ba1a3 Update conf.version;
opps
2019-11-27 20:48:58 -08:00
bjorn 2a5bae0b18 Improve error messages for unknown types; 2019-11-27 20:45:18 -08:00
bjorn 2ecc1c552f Fix uniform array hashing; 2019-11-26 11:34:39 -08:00
bjorn 31b5792713 ifdef out glfwInitHint on emscripten; 2019-11-22 19:36:30 -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 6ad2d8ccef Add lovrMain macro to shaders (no breaking change); 2019-11-18 23:20:08 -08:00
bjorn c031c0c578 Fix comment; 2019-11-18 03:37:42 -08:00
bjorn bd169a4a4d Fix readable buffers;
Unsynchronized/invalidated mapping doesn't work if the read bit is set.
2019-11-14 12:42:52 -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 0bd5fced12 Use new glfw method for avoiding chdir; 2019-11-03 15:31:21 -08:00
bjorn d21911d010 Add core/map hash table; rm lib/map; 2019-10-30 00:07:05 -07:00
bjorn b35ebc15b6 rm LOVR_USE_SSE;
It doesn't really improve performance on an average LÖVR app and
isn't worth the complexity.
2019-10-22 16:46:54 -07:00
bjorn d51d2b4105 Fix stack balance with luax_checkvariant;
Was breaking Channel:push.
2019-10-22 16:42:10 -07:00
bjorn b940f2d53f Add AABB to OBJ models; 2019-10-21 17:46:28 -07:00
Bjorn d7b3e1cf46
Merge pull request #160 from nevyn/fix/objc_msgsend_cast
Cast objc_msgSend before calling it
2019-10-15 13:12:19 -07:00
Bjorn 0bb3271bb5
Merge pull request #159 from nevyn/fake-controller-position
Desktop driver: Move left controller with mouse
2019-10-15 13:05:36 -07:00
Nevyn Bengtsson ab6e4891e1 Cast objc_msgSend before calling it
Calling objc_msgSend with its vararg signature will only work most
of the time, and fail very weirdly when it doesn't. It's weird,
but you're supposed to always cast it to the signature of the
selector you're calling.

I think this is even required when building on Catalina, or for arm64?
2019-10-15 22:00:15 +02:00
Nevyn Bengtsson e35a5435ca update leftHandTransform in desktop_update
to be consistent with how headTransform is calculated.

also, rename ‘transform’ to ‘headTransform’ for consistency.
2019-10-15 21:50:28 +02:00
bjorn 4d2aa81647 Reset active texture in lovrGpuInit; 2019-10-15 11:34:49 -07:00
bjorn e32c3ea2df v0.13.0; 2019-10-14 18:21:07 -07:00
bjorn d93e17e800 Texture:setCompareMode; Shadow samplers; 2019-10-14 17:12:34 -07:00
bjorn 25fa80f1d5 Fix comment; 2019-10-14 16:10:34 -07:00
bjorn c3f91e9ff3 Actually fix/test the issue with .lovr files on macOS apps; 2019-10-14 15:24:02 -07:00
bjorn f6cd8120ad Add macOS bundle resources; 2019-10-14 15:23:46 -07:00
Nevyn Bengtsson cb75b387e5 Desktop driver: Move left controller with mouse 2019-10-14 10:08:12 +02:00
bjorn 77258ec4dd mat4 multiplication works with vec4; 2019-10-13 16:02:21 -07:00
bjorn ac441ec15b lovrGraphicsGetCamera; 2019-10-12 12:45:11 -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 8c0ae3fbb3 More WebVR (controller) fixes; 2019-10-09 14:54:07 -07:00
bjorn ac53f5a56f Fix Collider:addShape and Collider:removeShape; 2019-10-08 15:45:53 -07:00
bjorn 6ef27ec7cc Merge branch 'master' of github.com:bjornbytes/lovr 2019-10-08 15:29:04 -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 5f404e2b1f WebVR fixes;
- Re-add the maf.c file that exports all the maf symbols.
- Fix lovrGpuTock for WebGL.
2019-10-07 19:50:17 -07: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 eb83962fc6 OpenXR fixes; 2019-10-02 16:29:09 -07:00
bjorn 17dda66b69 boot.lua works without headset module; 2019-10-02 16:20:50 -07:00
bjorn cc858e062c Don't mind me; 2019-09-26 21:58:26 -07:00
Bjorn c210d4e11d
Merge pull request #152 from bjornbytes/mac-bundle
Load .lovr files from the macOS app bundle;
2019-09-26 20:21:50 -07:00
bjorn 2e44926767 Cleanup; 2019-09-26 20:19:50 -07:00
bjorn f4c6e9bd12 oculus_mobile: set error callback based on current coroutine;
Currently:

- load/update/run/etc. take place on the boot.lua coroutine.
- draw happens "asynchronously" on the main thread.

When C needs to throw an error, it doesn't know which thread to
throw the error on.  If it throws it on the wrong thread, you get
a crash instead of an error screen.

One way to fix this is to change the error context based on the
thread that's currently running, so that errors in C are thrown
on the correct thread.  This is the approach that's taken here.

A potentially better approach would be to run all the code on the
same thread, but I ran into issues when I tried to do this.

It may also be possible to (ab)use the Lua panic handler to catch
errors on one of the threads and somehow forward them to the other.
2019-09-26 18:46:19 -07:00
Bjorn d23f2f5810
Merge pull request #151 from sophiabaldonado/oculus-mobile-fix-error-screen
Throw lua errors in the error handler
2019-09-26 18:44:05 -07:00
mcc dc92eb5c58 Oculus mobile vibrate() returns false on illicit second call; style changes 2019-09-26 19:32:12 -04:00
mcc 4a41f98562 Vibrate function for Oculus Quest, first pass
Only does "simple" vibrate (hard on/off). Supports duration but not frequency. Requires a corresponding commit in the lovr-oculus-mobile repo.
2019-09-26 18:40:04 -04:00
bjorn 0129a80b27 Load .lovr files from the macOS app bundle; 2019-09-24 21:37:44 -07:00
sophia ef84a16716 Throw lua errors in the error handler; 2019-09-24 12:04:36 -07:00
bjorn 403b217781 Fix Model destructor memory issues;
- Memory leaks.
- Freeing things that weren't allocated.
2019-09-20 13:46:27 -07:00
bjorn 2c29119e44 Fix non-interpolated cubic spline keyframe evaluation; 2019-09-19 23:01:50 -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 e96c541244 Multithreaded builds on Windows; Formatting; 2019-09-18 16:12:08 -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
Bjorn e4d54f8aa6
Merge pull request #148 from mcclure/signed-lovrViewID
Make lovrViewID signed on Oculus Mobile (fix "mask" example)
2019-09-12 00:01:28 -07:00
mcc 785c7c722b Oculus mobile: Promote Lua print() statements to INFO
This means Lua print() statements can be uniquely filtered out vs anything else (because internal Lovr logging uses loglevel DEBUG and lovr errors use loglevel WARN).
2019-09-11 19:43:44 -04:00
mcc 38f4204661 Make lovrViewID signed on Oculus Mobile
The "mask" example was failing on Oculus Mobile on the line of glsl:
if (lovrViewID == 1) {
because lovrViewID was unsigned and 1 was signed. One way to fix this would be to replace 1 with 1u as that is unsigned, but this would be the wrong fix because lovrViewID is in fact signed on all platforms other than Oculus Mobile. lovrViewID was depending on platform defined to either gl_ViewportIndex (signed), a signed uniform, or gl_ViewID_OVR (unsigned). The solution is to place an explicit cast in the multiview definition of lovrViewID so that it is signed on all platforms.
2019-09-11 18:22:06 -04: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 5ed132635a Fix error screen when headset module is disabled; 2019-09-03 15:34:41 -07:00
bjorn 3e47f958ad Fix mat4:lookAt; 2019-08-31 05:45:19 -07:00
bjorn 39376a10d5 normalTexture -> normalMap; 2019-08-31 05:31:20 -07:00
bjorn 79b5d2962c Fix problem with vector lightuserdata handles; 2019-08-31 03:08:42 -07:00
bjorn 9ea785d210 Fix normal matrix;
Now that lighting is in world space.
2019-08-31 03:00:54 -07:00
bjorn 17ae64baec Fix sphere winding; 2019-08-31 03:00:40 -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 f97031a8ec Fix Android print with multiple arguments; 2019-08-26 16:19:58 -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 f64e2064ef Adjust Canvas padding so it's 128 bytes; 2019-08-23 01:43:35 -07:00
bjorn 80eaea21f1 Adjust Buffer padding so it's 48 bytes; 2019-08-23 01:35:46 -07:00
bjorn 8d8f4eef73 Adjust Texture padding so it's 64 bytes; 2019-08-23 01:34:23 -07:00
bjorn a073206c20 Standard shader: Fix some precision issues in GLES; 2019-08-22 21:57:59 -07:00
bjorn e9654cd067 Fix function prototypes; 2019-08-21 23:19:42 -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 fb279057b8 maf no longer needs to export symbols; 2019-08-21 03:29:37 -07:00
bjorn b51dece762 Fix bug with permanent vectors; 2019-08-20 00:54:42 -07:00
bjorn f91eed3834 Rebuild boot.lua.h; 2019-08-20 00:54:36 -07:00
bjorn 3050d70f3d Slightly better OpenVR head pose; 2019-08-19 14:55:28 -07:00
bjorn e6c9fd1a6e rm error screen buttons; 2019-08-19 14:52:56 -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 2f7743583f Rebuild actions.json.h; 2019-08-19 14:16:37 -07:00
bjorn 584261e21f rm ffi vectors; 2019-08-19 14:13:36 -07:00
bjorn e6bedba0bc Fix OpenVR head pose; 2019-08-17 22:50:35 -07:00
bjorn c703092f87 Add missing timers GraphicsFeature; 2019-08-13 22:11:59 -07:00
bjorn a4781c7013 Fix cylinder winding; 2019-08-12 20:03:32 -07:00
bjorn d3bf51daef Add alphaCutoff shader flag; 2019-08-12 17:38:03 -07:00
bjorn c3af8c14c1 Add uniformScale shader flag;
Used to switch to a faster version of lovrNormalMatrix, can be used
with all shader types.
2019-08-12 17:33:32 -07:00
bjorn 8821ecd340 Standard shader: Tonemap by default; 2019-08-12 02:36:23 -07:00
bjorn 4eb768b13b Fix GLSL type cast; 2019-08-11 18:47:12 -07:00
bjorn 265931e474 Standard shader: Multiply with graphics color;
I guess.
2019-08-11 18:34:16 -07:00
bjorn 51b4064801 Standard shader: Refactoring; 2019-08-11 18:15:43 -07:00
bjorn 3d8313a7f1 Add analytical approximation for specular BRDF lookup; 2019-08-11 17:22:09 -07:00
bjorn 4719e5edbe Well that was broken; 2019-08-10 18:12:16 -07:00
bjorn 93f076acc9 Fix default uniform values;
Not supported in GLES.
2019-08-09 17:36:14 -07:00
bjorn b8cb53e021 Standard shader: Refactoring; 2019-08-09 17:31:30 -07:00
bjorn 948363e7df OpenGL: Enable seamless cubemap filtering;
It is always used in WebGL 2 and OpenGL ES 3.
2019-08-09 17:22:00 -07:00
bjorn 4d3bfea67c Model:getMaterial(name|index); rm Model:setMaterial; 2019-08-09 16:10:46 -07:00
bjorn bd773d2d6c Add materialMap to ModelData; 2019-08-09 15:14:22 -07:00
bjorn 83b2f8d745 Add uniform for controlling light color and intensity; 2019-08-09 00:27:17 -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 851f5f27ec Add more default headset drivers; 2019-08-09 00:00:42 -07:00
bjorn 30ea8995d2 Fix view vector; 2019-08-07 17:53:38 -07:00
bjorn 2c115ce66e Automatically detect mipmap count for IBL; 2019-08-07 15:56:52 -07:00
bjorn b5be93b94b Fix problem with falsy shader flags; 2019-08-07 15:56:13 -07:00
bjorn 289d365866 Better error messages when loading cubemaps; 2019-08-07 15:14:59 -07:00
bjorn fe939213be Initial standard shader flags;
- normalTexture = true
- indirectLighting = true (requires uniform setup!)
- occlusion = true (only affects indirect lighting)
- emissive = true
- tonemap = true
2019-08-06 14:39:14 -07:00
bjorn 54d58c79cd Fix issue where multiple shader flags don't work; 2019-08-06 14:38:49 -07:00
bjorn edd162052c Fix diffuse texture batching; 2019-08-06 11:38:12 -07:00
bjorn b08d9d0b30 Standard shader: Add tonemapping;
ACES.
2019-08-05 15:34:21 -07:00
bjorn 96c47d590c rm lovrEnvironmentTexture from Material; 2019-08-05 15:20:17 -07:00
bjorn e4ab5aa85a Standard shader: Add image-based lighting;
Very WIP, still need to add the BRDF lookup table.
2019-08-05 14:49:09 -07:00