Commit Graph

195 Commits

Author SHA1 Message Date
bjorn c0d73ab541 Add resize event; lovr.resize callback; 2020-05-02 13:09:10 -06:00
bjorn 90b605f012 Add restart cookie; lovr.event.restart; arg.restart; 2020-02-26 14:40:40 -08:00
bjorn d034e8c01b Opaque Canvas; 2020-02-23 00:29:21 -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 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 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 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 d21911d010 Add core/map hash table; rm lib/map; 2019-10-30 00:07:05 -07:00
bjorn ac441ec15b lovrGraphicsGetCamera; 2019-10-12 12:45:11 -07:00
bjorn 17ae64baec Fix sphere winding; 2019-08-31 03:00:40 -07:00
bjorn a4781c7013 Fix cylinder winding; 2019-08-12 20:03:32 -07:00
bjorn edd162052c Fix diffuse texture batching; 2019-08-06 11:38:12 -07:00
bjorn 96c47d590c rm lovrEnvironmentTexture from Material; 2019-08-05 15:20:17 -07:00
bjorn aab987dbef Fix WebGL gamma correction;
Ugh, WebGL doesn't have sRGB backbuffers.
2019-08-01 13:26:45 -07:00
bjorn af29e29e4d Fix lovr.graphics.setProjection;
Needed to be using new frameData stuff.
2019-07-08 14:35:54 -07:00
bjorn 2d6aa18069 Be a little more correct about when draw id is written; 2019-07-02 00:14:01 -07:00
bjorn 775cf5cda1 Don't accidentally draw meshes too many times;
Oops!
2019-07-02 00:09:43 -07:00
bjorn 44da36b610 Write draw ids at the right time (fix flicker); 2019-07-01 02:47:59 -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 e3e930d6cc Set index buffer at the right time;
Just a small ordering issue with previous commit.
2019-06-29 20:39:01 -07:00
bjorn 6256acfc6d Ahhh fix everything;
- If you have an instanced batch, it will use the instanced mesh.  That
  has a drawID attribute that uses the identity buffer, which has a vertex
  divisor.  BUT if you only have one instance, then we won't emit an
  instanced draw, and the use of a divisor'd attribute w/ a non-instanced
  draw is causing mega problems on macOS.
- This also fixes observed macOS bugs like:
  - Needing to have a small UBO
  - Flickering at startup
  - Flicker when writing to the last byte of a UBO
  - etc.
- Also make the generic attribute value for lovrDrawID more correct (scalar instead of vector).
2019-06-29 20:24:36 -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 fa6c4a6b39 Organization; 2019-06-27 21:04:15 -07:00
bjorn 370124c88d Batching cleanup;
- Rename drawMode to topology in some places.
- Batch uses DrawCommand internally to simplify stuff.
- Do less work while flushing.
- Store global head/tail cursors instead of unused per-batch cursors.
2019-06-27 20:58:42 -07:00
bjorn 779949964f More small batching changes;
- Reduce number of batches to 4.  Yeah it's arbitrary, will monitor.
- Just use memcmp for BatchParams.  Since we're using designated initializers,
  we aren't running into issues with memcmp+struct padding bits, and in the
  event it does lead to false positives on some platforms, at worst we'll just
  experience a harmless reduction in batching efficiency.
2019-06-27 19:05:54 -07:00
bjorn 6da17b0a91 Optimize gamma correction;
Currently, we gamma correct colors on every clear and every draw.
It's taking a lot of time.  Instead, we'll gamma correct colors
when they're changed using lovr.graphics.setColor/setBackgroundColor.
2019-06-27 15:41:57 -07:00
bjorn 7e067da8e7 Add defaultCanvas;
Having a normal Canvas object that represents the backbuffer reduces
some indirection where we have to last-minute check if a Canvas is
set.  It also means that all of the draw-related info that was _sometimes_
on the Canvas is now _always_ on the Canvas, which reduces the amount
of redundant information we need to provide for a draw call.

There may be some issues related to changing the width/height/stereo
of the default Canvas.
2019-06-27 15:36:51 -07:00
bjorn 26e474bcfc Simplify Mesh handling;
Removes some indirection from flush (I guess moves it into batch,
not sure what's better).
2019-06-27 14:14:31 -07:00
bjorn 551dea8c86 Adjust includes; 2019-06-27 13:44:09 -07:00
bjorn b8e63adcbf graphics: Cleanup;
Make batching structs and defines private.
2019-06-27 13:38:38 -07:00
bjorn fe21de403b lovrGraphicsDrawMesh; 2019-06-27 13:35:43 -07:00
bjorn 39b0d2d754 graphics: Minor refactoring; 2019-06-27 13:26:39 -07:00
bjorn 297208c205 Minor cleanup to stream buffer code; 2019-06-27 13:01:04 -07:00
bjorn 052990aa47 Make some graphics structs private; 2019-06-27 01:48:35 -07:00
bjorn 928ccee5f1 Multiview; 2019-06-25 01:21:59 -07:00
bjorn a691192af9 lovrBufferDiscard; 2019-06-25 01:21:59 -07:00
bjorn 5cd93b66c6 rm fence syncs;
They are too buggy and are not as efficient as orphaning.
2019-06-24 19:17:55 -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 06c6b172de vec3 has 4 elements; 2019-06-03 07:20:03 -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 29b2420dea Work around macOS flicker bug;
At this point I don't know if maybe I'm just using UBOs wrong but whatever.
2019-05-27 19:05:47 -07:00
bjorn 3bf08f0ca3 Add the ability to create default shaders;
lovr.graphics.newShader('font')
2019-05-22 18:00:02 -07:00
bjorn 7645f4c014 Add core folder; 2019-05-20 02:47:33 -07:00
bjorn a17f10e273 Add modules folder; 2019-05-19 00:38:35 -07:00
Renamed from src/graphics/graphics.c (Browse further)