Commit Graph

112 Commits

Author SHA1 Message Date
bjorn d1dc2f3199 rm pico;
Notes:

- We can actually use a single Activity.java file for oculus/pico now
- We can unconditionally compile os_android.c on Android
- No need for including extra jars in build system
- Headset rendering is guaranteed synchronous now, no need to ref L
- Add an "android flavor" build setting to differentiate between oculus
  and pico devices, since they both use OpenXR.
- Update the pico manifest to reflect their OpenXR sample
- Remove some OpenGL hacks that aren't necessary anymore
2022-03-22 16:03:21 -07:00
bjorn 8462beef00 Fix/improve alpha cutoff;
The current flag did not work because float shader flags are not
supported.  It was also not very useful because it was per-shader
and did not use the alpha cutoff property of glTF materials.

Instead, let's turn the shader flag into an enable/disable boolean,
and add a scalar material property named "alphacutoff" that gets
read by the glTF importer.

When the alphaCutoff flag is enabled, the material property will be
compared against the pixel's alpha value to decide whether it should
get discarded.
2021-12-28 21:10:52 +02:00
bjorn 0daaca7a4f Merge branch 'master' into dev 2021-03-28 10:09:58 -06:00
bjorn e346c3f807 Fix standard shader precision issues;
- Reduce epsilon
- Also use epsilon in D_GGX
- Reduce shader string length to the minimum required supported length
2021-03-28 10:08:10 -06:00
bjorn 1757d30a59 Compute shader feature detection adjustment;
- Compute feature requires compute shaders, image load/store, and SSBOs.
- GLSL 330 is always used, instead of changing depending on compute shader extension.
- Explicitly enable compute shaders, image load/store, and SSBO extensions when needed.

This allows implementations that don't support GLSL 430 to run compute shaders,
and keeps the min supported GL version more consistently at GL3.3.
2021-02-19 14:07:27 -07:00
bjorn 72284c2c5b Merge branch 'master' into dev 2021-02-12 08:16:36 -07:00
bjorn 0919da4091 Improve MSDF font shader; Add spread/padding settings to Font; 2021-02-10 07:08:29 -07:00
bjorn 24484f3930 Fix lovrInstanceID on Android; 2021-01-25 13:10:25 -07:00
bjorn 92ef5ee02d Fix lovrInstanceID on non-singlepass setups; 2020-09-19 17:33:49 -07: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
mcc 6536216aa2 Fix lovr.graphics.skybox() 2020-02-17 18:19:05 -05:00
bjorn 7f205d2fb1 WebGL shader fix; 2020-02-16 01:32:07 -08:00
bjorn 155718d161 shaders: Change abstract parameters to named parameters; 2020-02-11 16:17:54 -08:00
bjorn c502f5b62a Add highp shader flag that sets default fragment precision to highp;
Also, precision qualifier is required to work on desktop GL, so
we don't need ifdefs for it!
2020-02-07 19:44:51 -08:00
bjorn cae8bba522 Remove lovrMain macro;
We want lovrMain to be the entrypoint but we can't figure out how
to do this in a way that wouldn't break things, on all platforms.
2020-02-07 19:25:55 -08:00
Cassie Jones 9845fee2b6 Use different compute #version with OpenGL ES
GLES doesn't like #version 430 for compute, it wants #version 310 es.
We can conditionally compile that.
2020-01-31 06:24:08 -05:00
bjorn a1a53b4bed sampler2DMultiview; textureMultiview; 2020-01-30 17:48:15 -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
bjorn 898a3f9f35 rm double underscores from glsl;
This naming pattern is reserved.
2019-11-28 15:25:19 -08:00
bjorn 6ad2d8ccef Add lovrMain macro to shaders (no breaking change); 2019-11-18 23:20:08 -08: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
bjorn 39376a10d5 normalTexture -> normalMap; 2019-08-31 05:31:20 -07:00
bjorn 9ea785d210 Fix normal matrix;
Now that lighting is in world space.
2019-08-31 03:00:54 -07:00
bjorn a073206c20 Standard shader: Fix some precision issues in GLES; 2019-08-22 21:57:59 -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 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 83b2f8d745 Add uniform for controlling light color and intensity; 2019-08-09 00:27:17 -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 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 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
bjorn bff9399308 Rename skinned flag to animated; 2019-08-04 15:08:21 -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 e9fd052fc6 Start fixing lovr.graphics.fill; 2019-08-02 15:48:35 -07:00
bjorn aab987dbef Fix WebGL gamma correction;
Ugh, WebGL doesn't have sRGB backbuffers.
2019-08-01 13:26:45 -07:00
bjorn 4b9e6849c8 Better boolean shader flags; Multicanvas flag;
Instead of boolean shader flags turning into actual booleans defines
in the shader source, for GLSL they turn into defines.  This lets you
use ifdef, which is the more common intended usage.

Also MULTICANVAS is now a boolean shader flag.  The old MULTICANVAS
define is deprecated.
2019-07-28 18:08:23 -07:00
bjorn f564444641 Fix some WebGL issues; 2019-07-28 17:28:18 -07:00
mcc d391a4750f Use base diffuse color from materials in Standard shader 2019-07-25 15:08:53 -07:00
bjorn 4222be88b5 Use UBO for Camera matrices;
Ugh I don't like the "Camera" concept anymore, but I can't figure
out how to easily get rid of it.  Maybe wait till displays are a thing.
2019-06-27 22:17:50 -07:00
bjorn 928ccee5f1 Multiview; 2019-06-25 01:21:59 -07:00
bjorn 807c519397 Fix typo; 2019-06-20 21:36:07 -07:00