When using AttachMesh() with the flag AM_MatchSkeleton the behaviour was changed. The child mesh no longer uses the transformation of the bone in the parent skeleton by order, but by name.
This was not required before, but now most drawing operations require
the shaders to be loaded from Graphics.ocg. Therefore, move the graphics
resource loading earlier in the startup sequence, and make sure we don't
initialize the message board prematurely in OnResolutionChanged().
This usually means there was a script error in the scenario saving function. Better abort instead of overwriting the existing scenario with garbage data.
Otherwise the default pack alignment is 4, and when the horizontal window dimension
is not a multiple of 4, glReadPixels() would read past the end of the buffer we
provided.
Otherwise, we would partly write files with uninitialized data, such as the
padding bytes in a BMP, or the palette if not specified explicitly. This
mostly fixes corresponding valgrind warnings, but also makes sure we obtain
the same BMP files everytime we store the same StdSurface8 object, bit-by-bit.
This fixes a valgrind warning when creating a savegame, since in that case
the file name is filled with uninitialized junk. It is not used at other
places, since it is an in-memory file, and therefore was probably harmless.
Now we give a useful name to in-memory files based on the address of the
StdBuf object, which might actually be useful when debugging.
Previously, the calculation thread was initialized before the event it was
going to wait for after it is launched. However, since the thread starts its
execution in its constructor, it might access the event before the event
itself has been constructed.
This is fixed by making sure the event is fully constructed before the thread
is constructed (and launched).
This will allow to avoid some code duplication when computing the coordinate
transform from fragment coordinates to ambient and light texture coordinates.
This gives a more consistent normal distribution across directions.
I actually had to make the "normal region" of the light bigger, because
now the Clonk's face would be all dark otherwise. In the end,
everything looks smoother and less flashy now, which is probably as
it should be.
Also slight refactoring.
Now we use the shader to do a proper blend - this avoids some artefacts
that were visible before. Also after some hair-pulling the coordinate
transformation now seems to be more correct than before. Maybe even
with zoom. We'll see.
Turns out we actually can't optimise out the second texture normal
lookup - it makes a noticeable difference in-game. Also there was
possible slice collision, it might be worth warning about this kind
of stuff.
Also removed unused variable, and made error messages more consistent
in terms of whitespace.
The idea here is that we compose shaders out of "slices", which can
come from the engine ("built-in"), from files or possibly even from
models. This should allow us to more easily share the code between
different rendering shaders (e.g. for lights / normals).
TODO: Workarounds not yet implemented, so this might degrade less
gracefully.
This introduces a new texture, an ambient light map, that is generated
automatically at the beginning of the round by the sky portion of the
landscape. This basically makes everything that is close to sky visible
by default.
The shaders have been adapted so that they deploy direction-independent
lighting for the ambient component, and the current (diffuse) behaviour
for the diffuse component. This makes the shaders use an additional
texture unit that represents the ambient light. We can think about merging
this information into the light texture, but the coordinate systems are
different at the moment, so this could be performed at the stage of light
texture generation.
For meshes, the ambient material is not actually used, but instead a
diffuse light from the front is used. This makes many meshes look more
interesting, maybe also because the ambient material setting of most
meshes are not set correctly at the moment.
* intermediate fade triangles are now calculated in C4FoWLight
* rendering takes also place in C4FoWLight, using different C4FoWDrawStrategies
* solved an old TODO from Peter (int -> int32_t)
* refactor and simplify portions of the light vertex calculation code
Otherwise, ResolveAutoParameter() does not set the correct parameter type, and
the code would try to set a sampler2D parameter as a float4. It does not matter
in principle since the shader would not use the texture anyway, but it
generates a GL error that is avoid this way.
This code is only used for the low-resolution landscape that is hardly in use
anymore. The code was mostly a duplicate of the standard C4Surface blit
function, CStdGL::PerformBlt, with some added code for blitting material
textures with higher resolution. However, that code was not enabled anymore
by the classic landscape renderer either, so it seems safe to remove it.
The landscape is now simply drawn by C4Draw::Blit.
This was not working anymore correctly, since it now operated on unzoomed
coordinates. This could have been worked around by only applying it in the
unzoomed case, however I don't think the code is actually used much anymore.
In other cases of the rendering code, such as the mesh rendering, manual
clipping was never implemented and this did not seem to cause any problems.
Therefore, it can probably be removed safely.
This makes blits with overlays to actually use a single pass only, and
applies the GLSL shader also to standard object blits, which might come
handy when the lighting calculations in the lights branch are applied
on sprite objects.
It also removes the last user of C4Draw::PerformBlt, which will be removed
in a subsequent commit.
This includes a reverse view on the list to iterate over and some utility iterator methods. An iterator now stores a copy of its current object link so that the copy's fields can be adjusted in case of object removal and pending iterations will not skip over some objects which would be the case when advancing the iterator position instead of adjusting the copy's fields.
The support is not yet fully implemented; there are some transformations
missing. However, since the FoW support at the moment seems to be broken
(#1168) this feature cannot be tested properly.
Solid/Liquid/Background depend on PixMaps in C4Landscape being updated to currently loaded materials.
PixMaps should really be functions of C4MaterialMap and C4TextureMap. It's probably still broken in mape.
Add a new cmake option WITH_SYSTEM_TINYXML=ON that allows to use the system
tinyxml library and header instead of the bundled copy. Adjust the include
path in the single source file referencing the header and add the thirdparty
path to the include search path if the use system option is unset or off.
This might break some scenarios which for example change the color modulation
of a clonk and then expect that also its shovel or other objects get colored.
Such scenarios need to be fixed by also coloring the attached objects. This
might not be very convenient, and maybe we should introduce an option for
attached meshes to use the old behaviour (take blit parameters from main
object).
However, let's see how this change turns out in practise and then we see
whether further modifications are needed.
* added some class and method documentation, removed some superfluous comments like
void C4FoW::Update(C4Rect r)
{
// Update all lights
...
* added ASK comments that need clarification before proper documentation
This replaces the fragile ShaderRef construction in StdMeshMaterialPass, and
it allows to re-use shaders and/or programs between different materials. This
is some more preparatory work for custom shaders.
Otherwise there are warnings when the user changes the value of a
constant, since it was initialized with a different value at the
time of the previous rendering.
Remove the two dependencies to ::Game from C4MapScript, so that ::Game
does not need to be linked into mape, which would basically drag the
whole rest of the engine after itself.
The lock was from times when the GTK+ widget was updated directly
from the render thread, but this is not the case anymore, so it
can be removed without substitution.
There's no point in splitting the audio library selection into multiple
CPP macros, since there can always only be one anyway. Merge all of them
into a single macro AUDIO_TK (for "toolkit") and have CMake select one
for the user, instead of making him choose (and potentially failing).
Particle chunks were removed from the list (in the particle thread), but never deleted. They must be deleted from the main thread since it will delete GL objects. So simply delete empty chunks in the drawing proc.
<Sven2> Your fix of the parent check for points in the landscape.txt parser. if (!(pToNode->Type() == MCN_Overlay))
<Sven2> It should also allow the poly algo in maps
<Sven2> i.e., make it if (!(pToNode->Type() == MCN_Overlay) && !(pToNode->Type() == MCN_Map))
<Sven2> Actually, better make it if (!pToNode->Overlay())
Global messages are usually important and contain story elements, game goals, etc. So they should stay for a bit longer than e.g. object status messages.
I would prefer to render the models for speaker portraits directly. However, it seems like it's not currently possible to clip or render models to offscreen surfaces.
C4Group::Open would sometimes overwrite more specific error messages or
not mention the problematic path. DirectoryIterator::Read also now mentions
more detail. Two superfluous messages were removed to make space.
"gdk_pixbuf_unref has been deprecated since version 2.0 and should not be
used in newly-written code. Use g_object_unref()."
sys/timeb.h isn't used anymore since 2005.
The distinction between the "aul" and "non-aul" parts of
the script engine are mostly historical accident, and the
current organization of the source code does not use
sub-subdirectories. I'd like to keep it that way.
This reverts commit 69ba06b8d0.
Par() calls and '...' in function calls make functions take varargs
without this being obvious from the header. ExtraWarn about this so people
who care about it can add an ellipsis to the parameter list.
Accepting an ellipsis as the final parameter in a function declaration
makes it immediately obvious that the function can take a variable number
of parameters
If an object moves and other objects are attached to its SolidMask, only objects in front of this plane are moved along with it. Defaults to Plane if zero.
This makes C4Script consistent with C-based languages, and current usage
on master shows that in the majority of cases, the author expected to have
to place a semicolon after the loop anyway.
There have been some bugs and crashes related to unwanted deep comparison (e.g. in the maze scenario). Scripters very rarely need deep comparison, so it should not be the default for the most commonly used operator.
This also changes behaviour of GetIndexOf to do pointer comparison.
This change has Guenther's seal of approval.