Mikko Rasa [Sat, 7 Sep 2013 14:12:15 +0000 (17:12 +0300)]
Use Renderer to bind Lighting
This fixes a problem where the matrix left behind by a pipeline pass could
interfere with the lighting of the next pass. It's also required for
eventually supporting OpenGL 3.0+ without fixed-function lighting.
Mikko Rasa [Sat, 18 May 2013 21:27:42 +0000 (00:27 +0300)]
Use libmspmath to provide vector and matrix operations
Pulling them from a math library enables interoperability for programs
where it is desirable for some parts to avoid an OpenGL dependency. A
full complement of vector operations helps with readable code.
The flag tracking from Matrix was removed as a benchmark showed it to
actually hurt performance with compiler optimizations enabled.
Mikko Rasa [Thu, 11 Apr 2013 19:58:52 +0000 (22:58 +0300)]
Force some c'tors and d'tors to be emitted in the library
Forward declaring class A and having a RefPtr to it in class B causes
trouble if B's constructor or destructor is synthesized at a location
where A's definition is not visible.
Mikko Rasa [Sat, 29 Dec 2012 15:09:17 +0000 (17:09 +0200)]
Improve pipeline render target management
Recreate render targets if number of samples is changed.
Don't create render targets if neither postprocessing nor multisampling is
active. HDR is only useful with postprocessors (maybe postprocessors
should be able to request HDR?).
Call fbo.require_complete to allow trial-and-error autodetection of
rendering configuration.
Mikko Rasa [Sat, 3 Nov 2012 13:35:43 +0000 (15:35 +0200)]
Fix a comparison with restart_index
An incorrect comparison operator caused a batch meeting certain criteria
to unintentionally trigger a primitive restart with its last index instead
of rendering it properly.
Mikko Rasa [Sat, 8 Sep 2012 14:16:55 +0000 (17:16 +0300)]
Notify Renderables about the start and end of a frame
This makes it possible for Renderables to do certain things only once per
frame. This is particularly useful for Effects which need expensive
preparation.
Mikko Rasa [Mon, 3 Sep 2012 19:06:25 +0000 (22:06 +0300)]
Fix vertex array offsets
Since array application order may now be different from the format order,
and VertexArrayBuilder stores components in the latter, calculating the
offsets while applying arrays gives wrong results.
Mikko Rasa [Sun, 2 Sep 2012 17:14:20 +0000 (20:14 +0300)]
Load VertexFormat for Mesh as an array of VertexComponents
The single-token approach made indexed attributes rather ugly. Loading
each component separately also gives better diagnostics in case of
erroneous tokens.
Mikko Rasa [Sun, 2 Sep 2012 14:50:48 +0000 (17:50 +0300)]
Rearrange vertex components
The first 16 component types are now reserved for the library. This
leaves room for adding standard generic attributes, such as TBN vectors.
To make further room, texcoords were limited to four indices.
Generic attributes are limited to 24. Current implementations seem to
only support 16 (the minimum allowed by the spec), so this is not a huge
problem. There's also exactly enough room for another set of 24 generic
integer attributes.
Mikko Rasa [Thu, 30 Aug 2012 19:35:55 +0000 (22:35 +0300)]
Move Batch members around
The helper functions for changing data type don't really need to be
members, so put them in a private namespace. Other functions rearranged
in a more sensible way.
Mikko Rasa [Wed, 29 Aug 2012 21:48:58 +0000 (00:48 +0300)]
Entirely new system for building standard shaders
The old one was becoming such a huge mess that I had to spend two minutes
doing boolean analysis to figure out the conditions for a multiplication
operator. The logic parser was also insufficient for expressing
sophisticated relationships between variables.
The new one operates with expression, starting from a target variable and
pulling in others to compute its value. The logic parser is still there,
buts its burden is greatly reduced, as most of the work is done by the
dependency resolver.
Reflections are missing at the moment, but will be added back soon. They
were pretty broken in the old system anyway, with the assumption that the
environment map is in eye space.
The generated shader code is rather verbose, containing a lot more local
variables than are needed. An optimizer will be implemented in the near
future.
Mikko Rasa [Tue, 28 Aug 2012 10:18:41 +0000 (13:18 +0300)]
Route rendering calls through Renderer and add an exclusion system
This is necessary for generating environment maps for an object, since
the object itself should not be included in the map. The alternative is
to create a separate Scene, but that's rather clumsy.
Mikko Rasa [Tue, 28 Aug 2012 09:10:38 +0000 (12:10 +0300)]
More efficient stack management
Vectors are better than lists, since they don't need to allocate new
memory for every element. A suitably sized reserve() does away with any
initial reallocations in most cases.
ProgramData in Renderer can be stored in a semi-independent stack as
well, since it can only be removed with a pop. State is now devoid of
dynamically allocated memory, making the stack operations even faster.
Mikko Rasa [Tue, 28 Aug 2012 08:30:30 +0000 (11:30 +0300)]
Fix color equations in the standard shaders
The generated shader code assigned a scalar to a vec3 if lighting was
enabled without texture or material. An unnecessary multiplication in
the alpha equation with texture but no material was removed.
Also fix texturing in the shader demo (Mesa does funny things with
uniforms).
Mikko Rasa [Tue, 28 Aug 2012 07:50:17 +0000 (10:50 +0300)]
Provide the necessary uniforms from ShadowMap
With the recent changes to the Effect and Renderer, it's finally possible
to avoid the need to specify the shadow map texture unit everywhere, and
get rid of the hardcoded gl_EyePlane* indices.
Mikko Rasa [Tue, 28 Aug 2012 07:39:19 +0000 (10:39 +0300)]
Tweak the shader functions in Renderer
Since ProgramData is no longer tied to a single Program, we can retain it
over program changes. This opens up some new possibilities, in
particular for Effects.