Mikko Rasa [Sat, 25 May 2019 21:00:54 +0000 (00:00 +0300)]
Fix various issues with constant condition elimination
It used to optimize based on the initial values of variables, ignoring
the fact that they may change between loop iterations. A stop-gap fix
was implemented in 8e14c29, but it prevented optimizations of some
conditionals that could safely have been removed. It also caused the
optimizer to ignore any assignments made to any variables after
declaration when evaluating the loop condition, potentially causing
entire loops to be erroneously removed. Finally, unary expressions were
not being handled so ++ and -- operators did not mark the variable as
modified.
Mikko Rasa [Fri, 24 May 2019 15:27:50 +0000 (18:27 +0300)]
Try to simplify object names when exporting a scene
The exporter now tries to find the longest common prefix for objects
sharing the same prototype and exports the prototype using that name.
This avoids having randomly numbered object names.
Mikko Rasa [Sun, 19 May 2019 23:03:41 +0000 (02:03 +0300)]
Implement material maps for exporting objects with multiple materials
This replaces the material texture feature which was removed earlier. The
principle is similar (store material color values in a texture) but the
maps are global, making it possible for multiple objects to use the same
map.
Mikko Rasa [Thu, 16 May 2019 11:38:27 +0000 (14:38 +0300)]
Make resource handling in the Blender exporter more flexible
All resources are now collected into a dict and referenced or inlined as
necessary. This makes it possible for SceneExporter to see the resources
used by objects and export them to the resource collection as separate
items.
Mikko Rasa [Wed, 15 May 2019 21:42:03 +0000 (00:42 +0300)]
Redesign file writing in the Blender exporter
Instead of writing statements directly to the file as string fragments,
construct an in-memory representation of the exported data first. This
allows it to be manipulated and combined easier.
Mikko Rasa [Sun, 12 May 2019 06:59:53 +0000 (09:59 +0300)]
Only use texunit zero in exporter-generated techniques
It does not make much sense to use anything else without shaders, and
accessing the mesh to find out unit numbers is getting in the way of
some other changes.
Mikko Rasa [Sun, 5 May 2019 13:54:37 +0000 (16:54 +0300)]
Rewrite triangle strip generation in the Blender exporter
The old algorithm had many of the right ideas but was too clever by half
and consequently very complex. Use a simpler score-based algorithm
developed by Tom Forsyth. Also reorder vertices to make memory accesses
to them occur in a more linear fashion.
Options related to cache optimization were removed since there's
no good reason not to optimize.
Mikko Rasa [Sat, 4 May 2019 23:16:22 +0000 (02:16 +0300)]
Explicitly triangulate faces in the Blender exporter
Previously they were implicitly triangulated during strip generation,
with the idea that it would be more flexible. However I have some
doubts of its benefits and existing strip generation algorithms tend
to deal exclusively in triangles.
Mikko Rasa [Sat, 4 May 2019 13:42:34 +0000 (16:42 +0300)]
Improve progress reporting in the Blender exporter
Pushing and popping tasks now makes more sense. The Progress object
always exists but it's possible to suppress reporting (see 9b57666) by
giving it a falsy context. Progress reporting has been added to a few
places that previously lacked it.
Mikko Rasa [Fri, 3 May 2019 17:13:45 +0000 (20:13 +0300)]
Major rework of mesh handling in Blender exporter
All of the preprocessing has been moved out of the MeshExporter class and
into a utility function. This should make it easier for other exporter
classes to use meshes.
Mikko Rasa [Tue, 30 Apr 2019 22:00:22 +0000 (01:00 +0300)]
Move most properties from exporters to the relevant types
These properties pertain to the things being exported and should retain
their values between exports. It's getting especially difficult to
specify object-specific properties when exporting an entire scene.
Mikko Rasa [Tue, 3 Jul 2018 23:22:56 +0000 (02:22 +0300)]
Rearrange GLSL qualifier parsing
GLSL 4.20 allows qualifiers to be in any order so there's no sense to
enforce a particular order here. Always output them in a compatible
order though.
Mikko Rasa [Mon, 2 Jul 2018 21:00:28 +0000 (00:00 +0300)]
Have Object provide an identity matrix from get_matrix
It's often useful to have static geometry in a scene directly as an Object
without creating an instance. Many features such as Z-sorting and culling
require a matrix to be available.
Mikko Rasa [Mon, 2 Jul 2018 12:46:13 +0000 (15:46 +0300)]
Explicitly define the number of mipmap levels in textures
Storage() no longer uses the minification filter to decide whether to
allocate mipmaps or not. That functionality has been moved to image(),
specifically the version taking a Graphics::Image.
Mikko Rasa [Sat, 16 Jun 2018 16:38:11 +0000 (19:38 +0300)]
Reorder functions in dependency order
Otherwise the inliner might inline a function to a point before its
original definition. This can break references to other functions
declared after the inlining point, causing the unused function eliminator
to eventually remove them.
Mikko Rasa [Sat, 16 Jun 2018 12:23:01 +0000 (15:23 +0300)]
Fix matrix interpolation parameter calculation
With an x87 FPU and compiler optimizations enabled, the code could end up
taking arccos of a value very slightly larger than one. This would result
in a NaN and destroy the matrix contents.
Mikko Rasa [Wed, 9 May 2018 19:08:23 +0000 (22:08 +0300)]
Fix a bug in ProgramData when all uniforms in a block are removed
Program blocks continued using the previously generated uniform blocks,
but because the uniform values were removed the blocks were not updated
anymore.
Mikko Rasa [Wed, 2 May 2018 19:32:14 +0000 (22:32 +0300)]
Refactor AnimationPlayer ticking
It's not more consistent between single and stacked animations. There
shouldn't be significant performance penalty since the animation states
would be freed upon removing the target anyway.
Mikko Rasa [Wed, 2 May 2018 19:22:23 +0000 (22:22 +0300)]
Fix a stale pointer issue with Animation
Now that keyframe information is stored in a vector it's no longer
guaranteed that pointers to them stay valid after push_back. Re-link
all TimedKeyFrames if the vector gets reallocated.