Commit Graph

2846 Commits (stable-6.1)

Author SHA1 Message Date
Nicolas Hake 652c7e43e2 Fix headless build
Several rendering changes have resulted in a non-rendering build that
failed to build from source. Dummy out all of these functions to make it
work again.

Cherry-picked.
Author:    Nicolas Hake <isilkor@openclonk.org>
Date:      Wed Jun 17 21:30:56 2015 +0200
Conflicts:
	src/lib/StdMesh.h
2015-09-23 21:12:56 +02:00
Sven Eberhardt 6b27635bf3 Windows: Fix saving of custom keys (#1313)
The registry compiler couldn't handle strings beginning with a separator, which was used for marking keys defined by scan code.
2015-05-27 22:07:14 +02:00
Nicolas Hake 88ee2f7db8 Set C4VERSION macros from CMake assembled vars
There's no reason to have CMake assemble a version string, then have a
similar (but slightly different) string built by the C preprocessor.
Since CMake already has the values we want, just dump those into the
macros.
2015-05-21 23:09:46 +02:00
Maikel de Vries de185e7937 remove obsolete BuildTurnTo defcore entry 2015-05-14 12:34:53 +02:00
Nicolas Hake d141f1a39f Fix mismatched mape function stub
21500a8 changed a function prototype inside C4Landscape but neglected to
change the mape stub to match. Fix this so the build stops failing.
2015-05-14 12:34:20 +02:00
Sven Eberhardt 9349498f3f Fix pump to clear the last row of pixels (#1057) and allow pumping from pump without source pipe.
ExtractMaterial has been changed to be able to slurp in from the most distant horizontal position rather than the closest to the extraction top center.

Also speed up ExtractMaterial for the common case of no required horizontal shifts.
2015-05-14 12:32:11 +02:00
Sven Eberhardt b424838158 Add Find_InArray (#1073). 2015-05-14 12:31:46 +02:00
Sven Eberhardt 1d66dd426e Change C4FO and C4SO constants to be increasing regularly.
Regular values allows compilers to use jump table optimizations for switch statements and I don't see any upsides of the previous values.
2015-05-14 12:31:36 +02:00
Sven Eberhardt 6699cd3712 Allow CNAT_* constants in VertexCNAT definition of DefCore (#1307)
Also fix decompiling of none-values in bitfields.
2015-05-14 12:31:15 +02:00
Nicolas Hake e2a42de2f2 StdCompilerINIRead: Maintain line break cache for error msgs (#1310)
Deserializing proplists tries to read a boolean variable from the
representation in order to be backwards compatible to old (<6.0)
savegames. Newer savegames do not write this boolean, so StdCompiler
(correctly) throws an exception. This exception uses line numbers, which
StdCompiler used to obtain by scanning through the entire buffer. Having
to scan through the entire buffer for every serialized proplist is
ridiculously slow (and the data isn't used anyway in this instance).
Since line information is still valuable outside of proplist
deserialization, replace the repeated SGetLine calls with an on-demand
cache.
This reduces load times of a 14 MB Game.txt from slightly over 3 minutes
to 7 seconds on my computer.
2015-05-10 20:50:23 +02:00
Martin Plicht 5deb01fff9 C4DrawGLMac: Put OSX 10.9 API usage into #ifdef block 2015-05-10 20:50:10 +02:00
Misty De Meo 2f08800709 StdSchedulerMac: don't call setTolerance:
respondsToSelector isn't properly guarding against calling this method
on unsupported platforms, possibly because it existed as a private
method in OS X before 10.9. For example, attempting to build this on
OS X 10.8 fails with the error:
no visible @interface for 'NSTimer' declares the selector 'setTolerance:'

Since the default tolerance is 0 anyway, this can be removed without
adverse effect.
2015-05-10 20:49:46 +02:00
Nicolas Hake a03283d9e1 C++14 §7
simple-declaration:
   decl-specifier-seq(opt) init-declarator-list ;

Notice something?

The semicolon at the end doesn't have (opt).
2015-03-29 11:19:45 +02:00
Peter Wortmann ccc7382ab9 Another eta, this time for the fade cross check
This was behind the rare "white dots" issues. Boy, floating point numbers
are fiddly to work with - corner cases everywhere.
2015-03-29 11:19:34 +02:00
Peter Wortmann 5d505a5751 Remove self-shadowing debug code
I believe this isn't needed any more?
2015-03-29 11:19:21 +02:00
Nicolas Hake 80b1cb397d Don't use formatting log function for fixed string (#1293) 2015-03-28 15:38:50 +01:00
Maikel de Vries 6d9cb0c411 clonks do not attempt to scale underwater (#1176) 2015-03-28 08:36:37 +01:00
David Dormagen 569e0d0cb3 added Armin's particle fire
http://forum.openclonk.org/topic_show.pl?tid=3070
Only some optimizations have been added.
2015-03-28 08:34:35 +01:00
David Dormagen 2a112b1d00 fixed player names, clonk names and selector info being zoomed (#687) 2015-03-28 08:34:22 +01:00
David Dormagen a9f4ee88d3 fix particles only rendering in one editor viewport by always enabling VBA&VBO workaround in editor mode (#1195)
The problem was caused by every window using an own OpenGL context and certain objects not being shared between those.
The best solution would still be to make all windows use ONE OpenGL context. But this would probably need a more or less large rewrite?

This solution has to be considered a workaround with basically no negative side-effects, as the loss of speed is most likely irrelevant in editor mode.
2015-03-28 08:34:12 +01:00
Nicolas Hake 61ffb0fb28 gl: Use fewer uniform components to upload bones (#1285)
The last row of the bone transformation matrix always is 0,0,0,1 so
there's no point in uploading it. Also reducing the max bone count to 80
which means the uniform array will fit into the available space on 6000
and 7000 series Geforce GPUs.

If we're short on uniform components, don't transpose the transformation
matrix before sending it to the shader, and transpose it in the shader
itself instead, saving 4 components per bone.
2015-03-26 13:30:35 +01:00
Sven Eberhardt 922a87527c Use magic STL instead of magic numbers for TODO file location count. 2015-03-05 16:19:50 +01:00
Sven Eberhardt 90cca08d63 Add /todo message board command.
Adds text to local TODO.txt file. Useful for taking notes quickly e.g. when testing new scenarios in a network game.

TODO filenames are configurable. Default file is TODO.txt in the scenario file (if it's unpacked) and TODO.txt on the current path if access to the first location failed.
2015-03-05 16:04:07 +01:00
Nicolas Hake 179498984d Upload dummy bone for boneless meshes (#1278)
As long as we're not actually using a different shader for meshes
without bones, we need to upload an identity matrix so there's defined
data in the bone slot.
2015-03-05 13:09:40 +01:00
Nicolas Hake 4639ce1675 Merge GPU skinning
Doing skinning on the GPU shows a noticeable performance improvement in
pretty much any situation, but especially so in scenes with lots of
animated objects with high polygon counts.
2015-03-04 12:26:51 +01:00
Maikel de Vries ee0bc7b7ff introduce a constant for no category 2015-03-02 20:42:34 +01:00
Nicolas Hake 2db2992f85 Don't check for errors in C4ShaderCall::Finish
Calling CStdGL::CheckGLError calls glGetError, which is really, really
slow because it has to flush the pipeline to check whether there's an
error or not. Plus it's not like we can do anything about it anyway. If
you want to be notified when an error happens, pass --debug-opengl to
the executable.
2015-03-01 22:42:23 +01:00
Nicolas Hake d13af4dadd Work around g++'s dislike of nonconstant offsetof 2015-02-28 13:42:33 +01:00
Nicolas Hake d2563fe345 Do skinning in hardware
Instead of transforming all vertices on the CPU every time an animation
progresses, we now only recalculate the skeleton, leaving the heavy
lifting for the GPU. This also means we no longer have to push all
vertices onto the bus every frame, because the mesh isn't changing and
can therefore be stored in a GL_STATIC_DRAW VBO when it's first loaded.
The downside of this approach is that there's only a limited number of
uniforms and vertex attributes we can pass to the shader. At the moment
these limits are a maximum of 128 bones per skeleton, and no vertex can
be influenced by more than 8 bones at once. So far this is no problem,
as the most complex skeleton in the base game uses less than 64 bones
and no more than 6 bone weights per vertex.
2015-02-27 21:51:58 +01:00
Nicolas Hake 517e4e6e85 Load default object vertex shader from Graphics.ocg
Instead of having the default vertex shader hard-coded into the engine,
allow to load it from Graphics.ocg. There's still a fall-back version
wired into the engine because we can't return an error from
GetVertexShaderCodeForPass.
2015-02-26 21:04:12 +01:00
Nicolas Hake db295b8678 Add emulation of C++14's std::make_unique
Unlike std::make_shared, std::make_unique was unfortunately missing from
C++11. It's a useful utility though.
Technically, declaring a new name in the std namespace is undefined, but
the other way to make make_unique available to all callers regardless of
C++ version, putting it into a distinct utility namespace and importing
the declaration from std if available, makes for more ugly code.
2015-02-25 23:37:04 +01:00
Nicolas Hake c66833e2db GL: Render meshes out of a VBO
While we're still not doing skinning on the GPU, copying the vertex data
to a VBO immediately after updating the animation allows us to re-use
that data for unanimated meshes. It also allows us to store unanimated
data on the GPU, instead of transferring it over the bus for each frame.
2015-02-24 18:36:58 +01:00
Nicolas Hake 5b0759952e Make C4Landscape::ForPolygon private 2015-02-23 14:00:24 +01:00
Nicolas Hake 344962797d Make ForLine take a functor instead of a raw pointer
This means we can drop the opaque parameter. Where additional data is
required, a lambda is the way to go here. It also means we don't have to
put half of the parameters into a global variable.
2015-02-23 14:00:22 +01:00
Nicolas Hake a2f06c6ac5 Move ForLine function into C4Landscape.cpp
C4Landscape is the sole consumer of this function, so there's no reason
to make it available outside.
2015-02-23 13:39:51 +01:00
Peter Wortmann 65d9953d32 Some clean-ups
Nothing spectacular. Main thing is that the light debug view is now even
more colourful.
2015-02-23 11:54:41 +01:00
Peter Wortmann fc5698444f Make light shine through material that's closer than its size
Makes the whole thing more robust in corner cases. Also means that the
terrain a Clonk walks over doesn't matter that much anymore, which is
probably good.

On the other hand, now walls can be "partially invisible", which can
cause strange light effects. We'll have to see whether this is looks bad
in practice.
2015-02-23 11:54:40 +01:00
Peter Wortmann d976a4b2a7 Reworked CalculateTriangles, fixed descend collision
Descend collision was broken because of two reasons - one complicated and
one easy. Firstly, we would not re-visit beams after eliminations if they
were closer to the light source than the remaining beam. Especially nasty
because the comments claimed the opposite. Secondly, the coordinates
passed to find_cross were actually flipped.

I took the opportunity to clean up the control structure a bit, update
the comments (brr), and fix the bug in one swoop.
2015-02-22 23:12:12 +01:00
Peter Wortmann 52a2f4bb8e Added (optional) debug logging to CalculateTriangles
Sadly it's virtually impossible to tell what's going on without this kind
of thing.
2015-02-22 23:11:44 +01:00
Peter Wortmann 696ebb083f Decrease threshold for eliminating small rays
There's no point in having rays smaller than 1/10 px. This also, again,
prevents floating point rounding causing consistency problems.
2015-02-22 23:11:44 +01:00
Nicolas Hake 72beae8100 Shortcut C4Surface::GetTexAt for unsplit texture
In the very common case where the C4Surface only uses a single texture
to store its data, a lot of work GetTexAt is actually unnecessary. Split
it up so we can inline the fast path and only fallback to the slow path
when the surface is split up into multiple textures.
2015-02-22 17:06:35 +01:00
Nicolas Hake 32ecf51029 Don't use std::auto_ptr
Ever.
2015-02-22 17:05:41 +01:00
Nicolas Hake 75c2b8e61c GL: Dump list of supported extensions with --debug-opengl
glGetString(GL_EXTENSIONS) is deprecated starting with OpenGL 3.0.
Instead, you're now supposed to retrieve the list of extensions one by
one with glGetStringi.
2015-02-22 15:52:38 +01:00
Nicolas Hake bc6ce0251f Make private funcs in C4ParticleValueProvider, well, private
We're not inheriting from C4PVP, and all of these internal functions
really shouldn't be called from outside the class. So private is what
they should be.
2015-02-22 11:30:12 +01:00
Nicolas Hake 39bbcbb9ee Win32: Don't hook assertion handler when debugging
Sven2 reports he can't get reliable stack traces from his debugger when
the assertion handler is installed. Since there's no need for the hook
when we're already running under a debugger, don't install it.
2015-02-21 19:40:35 +01:00
Nicolas Hake 6e41694495 GL: Check for OpenGL 2.1 on startup
We've been using OpenGL 2.1 features for some time now, and hardware has
started supporting OpenGL 2.1 in 2005. I doubt this will make anyone
unable to run the game, and it's certainly better than crashing because
of a nullpointer dereference when some GL function we use can't be
found.
2015-02-19 13:36:01 +01:00
Nicolas Hake bd4e772b7d Win32: Correctly deselect OpenGL context
The MSDN reference for wglMakeCurrent states that the first (hdc)
parameter is ignored when the second one is NULL. This is incorrect: it
checks validity of the hdc parameter before doing any work. Since we
have a DC anyway, it's no problem to pass that to wglMakeCurrent.
2015-02-19 13:04:30 +01:00
Nicolas Hake c1bb56e1f1 Win32: Don't write log to stdout in GUI apps
In applications targeting the GUI subsystem, stdout and stderr aren't
valid file handles, and trying to write to them sets the system error
code to ERROR_INVALID_HANDLE.
2015-02-19 13:02:16 +01:00
Nicolas Hake ceeb322a87 Win32: Keep GL error dialog from immediately closing
GL startup failures call Application.Clear(), which will at some point
before creating the error dialog post a WM_QUIT. When the dialog box's
message loop retrieves that message, it will shut down the dialog box,
thus ensuring that the user will never see it.
So before showing the dialog box, we have to dispatch any pending
messages, then retrieve the WM_QUIT ourselves, run the dialog box, then
re-post the WM_QUIT.
2015-02-18 23:02:34 +01:00
Sven Eberhardt fe1ecd2424 Implement loading of serialized light sections. 2015-02-17 21:05:52 +01:00