Mikko Rasa [Sun, 23 Jun 2019 19:38:23 +0000 (22:38 +0300)]
Use double for animation curves
Since the t value is raised to the third power, floats with their 24-bit
mantissa started to run out of precision around 30 seconds. Doubles
should be good for several hours. If that somehow turns out to not be
enough I'll invent some way to chain animations.
Mikko Rasa [Tue, 18 Jun 2019 08:42:22 +0000 (11:42 +0300)]
Move vertex array object management out of Mesh
It's called VertexSetup because VertexArray was already in use. On the
other hand I don't want to tie VAOs with the VertexArray class because
instanced rendering will need two VertexArrays in a single VAO.
Mikko Rasa [Sun, 16 Jun 2019 10:15:32 +0000 (13:15 +0300)]
Better checking of the existence of image filepath
Apparently packed images can get funny filepaths like "//../../../../"
in autosaves. Best to check only the basename so there won't be empty
filenames in datafiles.
Mikko Rasa [Tue, 11 Jun 2019 21:07:38 +0000 (00:07 +0300)]
Fix a data corruption issue in mesh exporter
Apparently mathutils.Vector can refer to external data, in this case the
mesh's UV coordinates, which gets deleted with the mesh. Copy the values
to make sure they are retained.
Mikko Rasa [Fri, 7 Jun 2019 23:17:43 +0000 (02:17 +0300)]
Use bezier splines in Animation
Control keyframes can now be added to affect the shape of curves. Zero,
one or two control keyframes can be present between any two regular
keyframes, resulting in a linear, quadratic or cubic segment.
Mikko Rasa [Wed, 5 Jun 2019 22:02:41 +0000 (01:02 +0300)]
Reimplement Animation using splines
Transform interpolation is now performed on individual components rather
than entire matrices. This produces more accurate rotations and later
will allow animations to only affect some components of the transform.
Currently linear splines are used and the slope parameters are ignored.
Pose matrices are also disabled for now because I don't have any suitable
data for testing them. The old implementation was broken in various ways
anyway.
Mikko Rasa [Tue, 4 Jun 2019 10:39:27 +0000 (13:39 +0300)]
Export world transforms for scene objects
The location, rotation and scale properties contain transform components
relative to the somewhat arbitrary basis matrix. Obtain the values from
the world matrix instead. A drawback is that nonuniform or negative
scaling can produce inconsistent results.
Mikko Rasa [Tue, 4 Jun 2019 07:39:17 +0000 (10:39 +0300)]
Add a class to unify loading coordinate transforms
It will also be useful for animations. Euler angles are not the ideal
way of storing rotations but they are relatively easy to understand and
work with. Other rotation types will be added in the future.
Mikko Rasa [Tue, 4 Jun 2019 07:23:39 +0000 (10:23 +0300)]
Do not use the srgb flag for textures that explicitly define storage
Presumably the texture author knows which colorspace the texture uses.
In particular this made it impossible to load non-color textures such
as normal maps which require a linear colorspace if the srgb flag was
set in the containing resource collection.
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.