Commit Graph

3486 Commits (544c1cbb4bb6da97d30571ff28772660c7ad5969)

Author SHA1 Message Date
Günther Brammer 27cbdb2177 Remove superfluous mape stubs 2016-01-24 02:09:14 +01:00
Günther Brammer e790d2c327 Remove duplicated stubs for the scriptengine from mape 2016-01-24 02:09:14 +01:00
Günther Brammer 5a570b96f1 Remove now unnecessary stubs from C4ScriptStandaloneStubs 2016-01-24 02:09:14 +01:00
Günther Brammer 6b6dd96719 Move GameScript.GRBroadCast to Game.GRBroadCast
This avoids a dependency on ::Objects from C4ScriptHost.
2016-01-24 02:09:14 +01:00
Günther Brammer e1a38ee010 Move references to ::Objects and ::MaterialMap from C4AulLink to C4Game
This changes the order in which the various parts of the engine are updated
after a definition reload, but they should not interfere with each other.
2016-01-24 02:09:14 +01:00
Günther Brammer a5f797f96b Move miscellaneous global functions from C4Effect.cpp to their users 2016-01-24 02:09:14 +01:00
Günther Brammer 9833c1ef2d Remove never used NeedDefinitionContext
Every function that accepts a definition also accepts an object instead, so
NeedNonGlobalContext is the exception to use.
2016-01-24 02:09:13 +01:00
Günther Brammer b7ecc49a02 Remove a bit of dead code from C4Value 2016-01-24 02:09:13 +01:00
Günther Brammer 78e3457ff7 MSVC: Remove support and workarounds for versions older than 2015
We require that version for its C++14 support anyway.
2016-01-23 23:10:02 +01:00
Günther Brammer a19e7f6ced Use #elif defined() to check for config.h macros instead of plain #elif
This way, the code works with a config.h that does not define those macros.
2016-01-23 23:05:16 +01:00
Günther Brammer 7167459f67 win32: Move PIXELFORMATDESCRIPTOR from C4AbstractApp to CStdGLCtx
That is the only user.
2016-01-23 22:02:52 +01:00
Günther Brammer 34a720ca54 win32: Remove unused CreateContext function taking a HWND 2016-01-23 22:02:52 +01:00
Günther Brammer 37fd0a88c6 win32: Rename C4Window::hRenderWindow to renderwnd to match GTK+ 2016-01-23 22:02:52 +01:00
Günther Brammer 9210c65e85 gtk: Hide usages of X11 behind #ifdef GDK_WINDOWING_X11 2016-01-23 22:02:51 +01:00
Günther Brammer aa931ac623 Drop some dead code in C4App.h and C4WindowGTK.cpp 2016-01-23 20:36:34 +01:00
Günther Brammer 1c15b8f661 gtk: Move OpenURL to the other implementations in PlatfromAbstraction 2016-01-23 20:36:34 +01:00
Günther Brammer 8f48f0275d gtk: Remove unnecessary C4Window::wnd
It was only used to specify a screen for randr, which doesn't need a
particular window.
2016-01-23 20:36:34 +01:00
Günther Brammer 93f12150c4 CMake: Remove obsolete USE_X11 option and add USE_WIN32_WINDOWS
USE_WIN32_WINDOWS was previously defined in PlatformAbstraction.h. Move it
to CMakeLists.txt and config.h like its peers. Replace USE_X11 with USE_GTK
or GDK_WINDOWING_X11 as appropriate.
2016-01-23 20:36:34 +01:00
Günther Brammer 11bbeb2a5b Rename WITH_DEVELOPER_MODE to USE_GTK
This mirrors USE_WIN32_WINDOWS, USE_SDL_MAINLOOP and USE_COCOA.
2016-01-23 20:36:33 +01:00
Günther Brammer d09ed41eea Avoid an OpenGL dependency in C4Surface.h 2016-01-23 20:36:33 +01:00
Nicolas Hake 4fddda20f9 C4Script: Accept array parameter for Min, Max
Min/Max with array parameter will return the smallest/largest value of
all elements of the array. If any array element is not an integer, nor
convertible to integer, the function will fail.
2016-01-23 13:49:10 +01:00
Nicolas Hake 9a9bcd0568 C4AulError: derive from std::exception 2016-01-23 13:49:08 +01:00
Sven Eberhardt fcf870672c Fix overflow when calling DoEnergy with large values #1646 2016-01-22 22:52:09 -05:00
David Dormagen 8418da86d6 custom GUIs: fixed scrollbar offset with active upper board (#1612)
I guess the UI elements expect their position to already be corrected by cgo.X/Y. Or they never cared because they were in front of the upper board.
I am not sure, maybe the correct solution would be to actually position all elements lower (instead of adjusting for it when passing mouse input or drawing)? Currently the position is relative to the upper board's edge.

Anyway, this works for now.
2016-01-21 22:17:47 +01:00
Sven Eberhardt 80676c7ab5 Fix force redirection behavior of non-clonks on permeable SolidMasks.
E.g. if you put a shovel on a wooden bridge, it would always slide left.
2016-01-20 22:49:56 -05:00
David Dormagen 8ba1e042a0 script GUIs: fixed clipping with active upper board
I know that the issue was noticable starting from https://git.openclonk.org/openclonk.git/commit/cd57e474935b283e58c7ae7edd137c049f87f90c
I don't know WHY it was not noticable before, though. It had probably always been a defect.
2016-01-20 22:30:35 +01:00
David Dormagen 9292718ca5 script GUIs: fix auto-height window size with pure text windows
Otherwise, if a window was GUI_FitChildren and the text would NOT trigger a scrollbar, the window height was set to 0 (because the text height was only taken into account when rawTextHeight - 1 > rcBounds.Hgt).
2016-01-20 10:33:11 +01:00
Armin Burgmeier b698557163 Replace obsolete GL_MAX_TEXTURE_UNITS (#1641)
The replacement is GL_MAX_TEXTURE_IMAGE_UNITS.
2016-01-19 18:05:57 -08:00
David Dormagen cd57e47493 script GUIs: fixed text clipping and scrolling (#1605, related to #1612)
Previously, text windows would just change their own size and leave cropping and scrolling to their parent. This made the code easier, but was apparently unintuitive for scripters.
Now text windows do not change their size but show a scrollbar themselves (unless GUI_FitChildren or GUI_NoCrop of course).

This implied some other changes, because now parents without a scroll bar need to clip, too. (Or the clipping needs to be moved to the child window. But then it would have to be made sure that menu decoration can still go out of the bounds.)
And this also needed some script fixes where scripters assumed the text windows would not scroll (and thus made them smaller than 1em).

related to https://git.openclonk.org/openclonk.git/commit/46ad28ea652fad34814a866f3b9c305aa7cc6faa
2016-01-18 21:39:54 +01:00
Armin Burgmeier 4b98e71271 Fix GL state reset of wireframe mode (#1636)
Not sure why this broke, maybe glGetIntegerv does not return the current
polygon mode anymore. Either way, we don't need to remember the previous
setting but can just always reset it to GL_FILL afterwards.
2016-01-17 21:32:48 -08:00
Armin Burgmeier d3d3bb848e Fix index buffer offset calculation (#1635)
This fixes rendering of some meshes with more than one submesh.
2016-01-17 21:14:41 -08:00
Sven Eberhardt b88339a84c Use sched_yield instead of pthread_yield in png save wait loop [cfkoch] 2016-01-17 23:15:34 -05:00
Sven Eberhardt 47add34d8f Use less annoying lobby countdown sounds 2016-01-17 22:35:59 -05:00
Günther Brammer 8257264415 Avoid a gtk runtime warning on empty statusbar text
(openclonk:12546): Gtk-CRITICAL **: gtk_statusbar_push: assertion 'text != NULL' failed
2016-01-17 23:34:29 +01:00
Armin Burgmeier 1349962ac3 Fix release build 2016-01-17 13:36:26 -08:00
Armin Burgmeier d387fdb270 Fix mesh rendering for meshes with more than one submesh
The buffer offset was encoded in the VAO which would be shared across all
submeshes. Instead, don't encode the buffer offset into the VAO but apply it
with glDrawElementsBaseVertex().
2016-01-17 11:37:17 -08:00
Günther Brammer fd61ac7ebe Remove unused IsRenderTarget and MaxTextureSize C4Surface options
They were always false and 0.
2016-01-17 11:37:17 -08:00
Armin Burgmeier b459cb35f1 Remove the OpenGL version check
As long as we can create a core profile context we are good anyway.
And if we don't, we'll get an error during context construction.
2016-01-17 11:37:17 -08:00
Armin Burgmeier ab6152e48c Create an OpenGL core profile context on Windows
I didn't actually test this, but shamelessly stole the code from Isilkor's
opengl-3.2 branch.
2016-01-17 11:37:17 -08:00
Armin Burgmeier e856720e21 Use a OpenGL core profile on Mac OS X
Also, remove obsolete checks for shader support.
2016-01-17 11:37:17 -08:00
Armin Burgmeier d7d24ca36a Enable OGL core profile for linux 2016-01-17 11:37:17 -08:00
Armin Burgmeier e13cda4bd0 Use an IBO for the particle system
glDrawElements needs an IBO when using a core profile. The particle
system's IBO is actually quite static since it's always a triangle
strip with 2 triangles followed by a PRI. Therefore, this reduces the
amount of data we have to send to the GPU compared to the previous
solution.

Also, remove the workaround when glPrimitiveRestartIndex is not
available since it is always available with OpenGL 3.1 and when using
a core profile we are guaranteed to have OpenGL 3.1 anyway.
2016-01-17 11:37:17 -08:00
Armin Burgmeier 686a32764c Use an IBO to render the FoW 2016-01-17 11:37:17 -08:00
Armin Burgmeier 6bda0b4ec8 Use an element array buffer (IBO) for meshes
This is required for glDrawElements() with a core profile. Furthermore, for
meshes that have a fixed face ordering (non-transparent meshes at 100%
completion), this puts more static data on the GPU that we don't have to
upload every frame.

For meshes with non-fixed face ordering, we still have to upload faces every
frame, since the ordering might change if the mesh rotates. We could still
improve this by figuring out if the order actually changed after the sort
step, and only update to the GPU if it has. In many cases it hasn't, so there
is some potential for more optimization there. But that's for later.
2016-01-17 11:37:17 -08:00
Armin Burgmeier 442241dc3e Remove adjusting texture sizes to next power of two
This code was basically never used anyway, since the
ARB_non_power_of_two extension is always available since OpenGL 2.0.
The GLEW check for the extension fails however as soon as we select
a OpenGL 3 core profile, and the texture sizes will be unnecessarily
adjusted again.
2016-01-17 11:37:17 -08:00
Armin Burgmeier aef7538aa1 Switch shader code to OpenGL 3 style 2016-01-17 11:37:17 -08:00
Armin Burgmeier 16d2eb5cb1 Use the core api for shaders instead of the ARB one 2016-01-17 11:37:17 -08:00
Armin Burgmeier bc8db0589e Make the mesh material properties uniform variables
Instead of relying on the obsolete glMaterial call.
2016-01-17 11:37:17 -08:00
Armin Burgmeier 2c2c3f98c8 Switch framebuffer API to OpenGL core API 2016-01-17 11:37:17 -08:00
Armin Burgmeier 5de1bc70a9 Remove a stray glClientActiveTexture call 2016-01-17 11:37:17 -08:00
Armin Burgmeier 28aa1d1812 For each VBO, use a VAO to render it
For OpenGL 3.2 core compatibility, and to reduce the number of state
changes during rendering.
2016-01-17 11:37:17 -08:00
Armin Burgmeier fabb4cbdbf Implement a mechanism that allows using VAOs across contexts
Basically add another layer of indirection around accessing VAOs. The problem
is that VAOs are not shared between OpenGL contexts. This mechanism allows to
treat them mostly as if they were shared if they are only accessed through
the API defined in CStdGL.

This is accomplished by caching all existing VAOs per context. If a VAO is
being accessed, it is checked whether that VAO exists in the currently
selected context. If yes, return it, otherwise create a new VAO and return it,
together with a flag that indicates that the VAO needs to be initialized.
2016-01-17 11:37:17 -08:00
Armin Burgmeier fa9f4c6356 Replace GL_GENERATE_MIPMAP flag by glGenerateMipmap call
The former is not available in a OpenGL 3 core profile, but glGenerateMipmap
is available since OpenGL 3.0, and so is always available when we have a
core profile.
2016-01-17 11:37:17 -08:00
Armin Burgmeier bb8b933417 Revert "Revert "Replace 3D texture in landscape shader by a 2D texture array""
This reverts commit 4a02d3c77b.

This was merged into master even though I only wanted it in stable-7.0.
Oh well, let's just revert it again.
2016-01-17 11:37:17 -08:00
Sven Eberhardt afab6ef464 func PlayerControl: Send nil instead of 0 for non-mouse controls.
The main script function always assumed this, but it was not actually implemented that way.
2016-01-16 22:06:19 -05:00
Sven Eberhardt 0a9cf34e77 Win32 editor: Allow resizing of main console window #1601 2016-01-16 21:01:11 -05:00
Sven Eberhardt f1c4273bb9 Win32 editor: Allow resizing of property window #1601 2016-01-16 19:56:24 -05:00
Sven Eberhardt 148073a956 Fix black NO_OWNER viewport in network mode. 2016-01-16 16:29:23 -05:00
Günther Brammer a5af9089a8 Script: Check parameter types of engine callbacks, too
This prevents a crash when an incompatible engine function is used as an
engine callback function.

Unfortunately, this breaks any scripts that have wrong type information in
engine callbacks and only worked because those were ignored.
2016-01-16 18:26:18 +01:00
Günther Brammer bc3754b871 Merge branch 'editor' 2016-01-16 16:00:57 +01:00
Günther Brammer 21d8a2a64a Use 32 bit math for +1, ++, -1, etc. in script (#1389)
The engine has a few more usages of the operators, but they don't look
prone to overflowing. The other operators in Script already used SetInt,
which always truncates to 32 bit.
2016-01-15 20:19:21 +01:00
Sven Eberhardt 26084af502 Fix crash when grab target is lost. 2016-01-15 08:54:03 -05:00
Sven Eberhardt 4eddeba9aa Fix crash when drawing zero-sized viewports (may happen during editor viewport initialization) 2016-01-15 08:53:00 -05:00
Sven Eberhardt cc613c01f4 Fix action target reset on same procedure only. 2016-01-15 08:14:46 -05:00
Sven Eberhardt cd63c06aaf Fix crash when starting tabbed out. 2016-01-14 22:25:45 -05:00
Sven Eberhardt 579cb7e66c Reset action targets on procedure change #1552 2016-01-14 21:40:42 -05:00
Armin Burgmeier 9208f32d16 Denumerate attached meshes recursively (#1603)
Since mesh instances can now be attached to attached definitions, attached
definitions need to denumerate pointers recursively to make sure that the
reference to the mesh instance is restored correctly.
2016-01-12 18:19:41 -08:00
David Dormagen ba2cf8f096 fix incorrect clipping in script GUI windows (#1592)
I am not sure why the 'isMainWindow' was there. It wasn't there in 7319f7b3cc and got introduced in the major rework in 049088be78 - I guess it was just an oversight that was not noticed because usually the UI windows have the text or other things that need to scroll on a deeper level.

Anyway, checking whether the window is a script-root window does not make any sense as far as I can see now.
2016-01-12 22:18:57 +01:00
Armin Burgmeier bb39597711 main menu: limit player selection to one player (#1529) 2016-01-11 18:33:08 -08:00
Armin Burgmeier 7e19070ef3 Allow to only select a single player in the menu (#1529)
Due to the lack of gamepad support, splitscreen support is somewhat pointless
at the moment.
2016-01-11 18:28:23 -08:00
Armin Burgmeier bd4551c6d4 Disable gamepad controls (#1536)
Gamepad support is currently not working properly as many menus cannot be
navigated with a gamepad. Simply don't load any control assignment sets that
have gamepad enabled.
2016-01-11 18:11:44 -08:00
Armin Burgmeier b6393a7a15 remove windows-specific fonts from default font list on linux and mac (#1573)
Otherwise the font chooser in the startup options shows those fonts, but
loading them will fail. Ideally we replace this by enumerating the system
fonts at some point.
2016-01-10 20:51:17 -08:00
Armin Burgmeier 2935f9622c mac: fix mousewheel event handling (#1575)
Some sort of smooth scroll information was passed down to the engine which
didn't handle it properly, or the units with which they were reported to us
were different from what the engine expected.  For now, just use fixed scroll
offsets until we implement proper delta-y-aware scrolling in C4MouseControl.

The fix for #1574 might have also helped with this in recognizing when Control
is pressed and when it isn't.
2016-01-10 20:01:45 -08:00
Sven Eberhardt e2acb8b9bb Add missing sounds for Grab/UnGrab #1585 2016-01-10 21:17:06 -05:00
Sven Eberhardt bdc0274e3d CommandFailure: Route missing sound effect to failure function playing clonk skin sound. 2016-01-10 21:16:34 -05:00
Armin Burgmeier ef63aa0975 mac: send keydown events for modifier flags change (#1574)
For example, keydown events when pressing/releasing the shift, alt, or control
keys. With this version this is needed ingame e.g. to pick up objects with
Shift.
2016-01-10 18:11:29 -08:00
Günther Brammer 0f94dd2249 Remove obsolete IFT icons
This probably breaks the macosx editor even more.
2016-01-11 01:52:50 +01:00
Günther Brammer 39c2a0e18c gtk: Use glib-compile-resources instead of gdk-pixbuf-csource
Yet another deprecated feature replacement. At least this one makes our
code more concise.
2016-01-11 01:52:49 +01:00
Günther Brammer c20f98dcf9 gtk editor: Support EditCursorCommands, too
Reuse the windows code for this. Both versions had three parts: Enabling
the right menu items, adding the selection-specific ones, and showing the
menu. The second part is now common code, with the platform code in a new
function, since it grew big enough to be worth sharing.
2016-01-11 01:52:49 +01:00
Günther Brammer 9b7b4bf30a Remove unused variable in C4Landscape::DrawBrush
This was forgotten in 47e422f452.
2016-01-11 01:50:34 +01:00
David Dormagen 1c35bdf8e3 particles: fix high severity OpenGL API error
glObjectLabel would result in invalid VBOs if called on a not-instantiated object. glGenBuffers does apparently only reserve the name and not create the buffer itself.
For me the landscape and some objects were drawn completely black.

More information: http://stackoverflow.com/questions/26614130/opengl-debug-extension-with-globjectlabel
Found via --debug-opengl
which lead to
gl: high severity API error: GL_INVALID_VALUE error generated. ObjectLabel: unknown buffer object <name>
2016-01-10 23:31:17 +01:00
Clonkonaut 962b178663 Merge remote-tracking branch 'remotes/origin/revert-opengl-2.1' 2016-01-10 17:27:56 +01:00
Sven Eberhardt c569036d1d Make NO_OWNER viewports black in fullscreen+non-debug for non-observers #1557 2016-01-10 09:50:21 -05:00
Sven Eberhardt 889bba299e Fix /todo as network client.
It would write into a TODO file in the temporary network file.
2016-01-09 21:42:32 -05:00
Günther Brammer 7613393359 gtk editor: Exchange cursor and time information
The toolbar doesn't have enough space by default, and this way we can use
the GtkStatusbar widget.
2016-01-10 00:19:07 +01:00
Günther Brammer a185cae264 gtk editor: Simplify landscape preview drawing
In earlier versions, DrawPatternedCircle was a fairly complicated function.
Nowadays, it just copies pixels in memory, bounded by a circle. Since we
need to convert our surfaces to a format GTK+ can use anyway, combine that
step with the circle boundaries. Also use a cairo surface instead of a
GdkPixbuf. Cairo uses almost the same pixel format, except for
premultiplied alpha. Ignore this for now.
2016-01-10 00:19:07 +01:00
Günther Brammer ab7f4f0bbf gtk editor: Use GTK+ 3 layout widgets
Specifically, GtkGrid. For most cases, this is an increase in lines of
code, but the landscape tools dialog can now be done with just three layout
widgets.

While at it, use a toolbar and move the mode buttons into it, too.
2016-01-10 00:19:07 +01:00
Sven Eberhardt dd25f85e6d Warn when assigning duplicate keys #1170 2016-01-09 17:00:21 -04:00
Armin Burgmeier eb83fc96d0 linux: fix scrollwheel in fullscreen (#1535)
Both "normal" and "smooth" scroll events were handled, and undoing the
effects of one another.
2016-01-08 20:55:07 -08:00
Sven Eberhardt 53a6ec3139 Fix thread handle type for Win32 threads. 2016-01-09 00:19:40 -04:00
Sven Eberhardt 3f7bd627de Fix int type in group info display format. 2016-01-09 00:19:39 -04:00
Sven Eberhardt e89779a8c7 Handle key-up events corresponding to keys that were down even if scope is not matched #1145 2016-01-09 00:19:38 -04:00
Maikel de Vries 4b3f9ce4b9 do collection check more often for faster moving objects
Otherwise falling objects would easily move through the collection zone of the lorry.
2016-01-08 19:46:28 +01:00
Günther Brammer 67bf24f1e1 editor: Always remove previous suggestions before adding new ones
9e771ac moved the Win32 ClearInput implementation into SetInputFunctions,
but broke at least GTK while doing that. 9a7d57c0d2 fixed the assertion
failure in GTK that resulted, but failed to restore the removal of the old
completions.

Fix this by folding ClearInput into SetInputFunctions in all implementations.
2016-01-08 15:22:00 +01:00
Sven Eberhardt 8552b3a8f9 Change return value of InsertMaterial when inserting outside landscape bounds #1509
Fixes clogged pump when pumping outside map.
2016-01-08 01:05:22 -04:00
Sven Eberhardt 102b44aa35 Give system path precedence over user path #831 2016-01-08 00:28:23 -04:00
Sven Eberhardt 6ea51e9f7a Fix order of initialization of C4Game/C4GraphicsSystem.
Game.GraphicsSystem could be constructed after Game, but was accessed in C4Game::Default.
2016-01-07 23:42:18 -04:00
David Dormagen e3553ca0cd particles: replaced "TODO" comment
This was actually part of a larger performance boosting commit, which turned out to not actually boost performance. But I want to retain the comment change even when I won't push the larger commit.
Having a "todo" comment is just misleading.

For an explanation of why that's needed, see http://stackoverflow.com/questions/21652546/what-is-the-role-of-glbindvertexarrays-vs-glbindbuffer-and-what-is-their-relatio
2016-01-07 09:55:35 +01:00
Armin Burgmeier 6200f4f27a Load additional graphics even if no base graphics are present (#1537)
This allows e.g. to have a definition that contains only portraits.
2016-01-06 18:11:23 -08:00
Armin Burgmeier 5ecb393c71 Fix FoW flicker when resizing the FoW texture
We do this by copying the contents of the old texture when resizing it.
2016-01-05 20:23:15 -08:00
Armin Burgmeier 25a19f9922 StdPNG: Fix crash when saving a screenshot on Linux/Mac 64bit
"unsigned long" is 8 bytes on 64-bit Linux and Mac, so we write 4 bytes
past the end of the allocated memory region.
2016-01-05 20:23:15 -08:00
Armin Burgmeier 4a02d3c77b Revert "Replace 3D texture in landscape shader by a 2D texture array"
This reverts commit 790219ac7e.

This commit broke support for Mac OS X since Apple only supports OpenGL 3.0
with a core profile, not a compatibility profile. Revert this commit
temporarily for the 7.0 release, until we port all OpenGL usage to the core
profile with 8.0.

This fixes #1495.
2016-01-04 18:27:44 -08:00
Günther Brammer a115801f0e Script: Rename FnGetLeagueScore to GetLeagueScore 2016-01-04 05:10:10 +01:00
Armin Burgmeier d72b8cc385 Use generic vertex attributes for FoW rendering 2016-01-02 19:11:41 -08:00
Armin Burgmeier 96c8b51eac Use generic vertex attributes for landscape rendering 2016-01-02 17:20:24 -08:00
Jan Heberer 7f1ed15344 Fix clamping of unsigned 16-bit integers in StdCompilerINIRead
Clamp unsigned 16-bit integers to the range 0 to 65535 instead of 0 to 32767
2016-01-02 17:00:36 -08:00
Armin Burgmeier 95774e0e8f Use generic vertex attributes for sprites, meshes, particles 2016-01-02 13:10:03 -08:00
David Dormagen a0dddce691 C4FoWDrawLightTextureStrategy: do not crash when nothing to draw
This would crash for me when starting a game in developer's mode. Not sure if this is the best place for the fix. Maybe there is some other underlying issue. ck?
2016-01-02 13:03:44 +01:00
Armin Burgmeier b80a7ebb01 Use VBOs to render the FoW texture
In doing so, refactor the way C4FoWDrawStrategy works slightly. Get rid of
immediate mode OpenGL, and instead populate a vertex array and an index array
as vertices are added to the draw strategy. Then render everything as
triangles.

The actual rendering is then performed in C4DrawStrategy::End(). It passes
the accumulated vertices to the GL. Also get rid of the notion of multiple
passes in C4DrawStrategy. Instead, C4DrawStrategy::End() can simply just draw
the bunch of vertices multiple times. This allows us to do the vertex
generation and GPU upload only once, instead of repeating it for every pass.
2016-01-01 22:28:22 -08:00
Armin Burgmeier f582ea9f24 fow: persist draw strategies between light renderings
This allows the strategy to keep some state between invocations. I want to
use this in order to store a VBO in the draw strategy, and to avoid having
to re-create the VBO for every rendering.
2016-01-01 22:28:22 -08:00
Armin Burgmeier ecdcf5ac92 fow: Use a VBO to blit the framebuffer 2016-01-01 22:28:22 -08:00
Armin Burgmeier 1f4dbcc260 Particle system: make sure to always use a VBO
We are already using VBOs for meshes, so we can rely on them being available.
VBOs are shared between contexts, so #1195 is not an issue, either. However,
keep the workaround in place for the VAO, which is not shared between
contexts.
2016-01-01 22:28:22 -08:00
Armin Burgmeier b407558d7a Use a VBO to render the landscape 2016-01-01 22:28:22 -08:00
Armin Burgmeier 988fe15e29 Use VBOs to draw sprite graphics
I don't expect much of a performance benefit from this, but it works toward
removal of legacy OpenGL usage. Note that we are already using VBOs for
meshes, so this does not require any functionality that we don't require
already.
2016-01-01 22:26:41 -08:00
Armin Burgmeier 9fd7e88afd Fix crash when changing mesh material of incomplete mesh
Changing the mesh material to something that does not use alpha blending
restores the originial face order. This caused a crash for meshes with
Completion below 1, since all original faces were copied, but the buffer
in the mesh instance was only large enough to hold the number of faces of
the incompleted mesh. To fix this, simply run the standard
select-faces-for-a-given-completion-value procedure.
2016-01-01 17:01:10 -08:00
Armin Burgmeier 795740c6ee C4Surface: fix texture restore on IntUnlock (#1526) 2016-01-01 14:48:33 -08:00
Günther Brammer 38c6242bce Fix out-of-bounds check and bounds collision for non-centric object shapes
The proper way to measure from the center to the right is X+Wdt, not -X
or Wdt/2. And the proper way to measure to the left is -X, not -Wdt/2.
2016-01-01 22:18:41 +01:00
Günther Brammer 00a4c6c428 Replace BorderBound DefCore value with BorderBound object property 2016-01-01 22:18:41 +01:00
Günther Brammer 690b4f9ba0 Move comparison out of C4Object::TargetBounds
This probably enlarges the maximum landscape height for borderbound objects.
The "infinity" constant +1000000 is larger than the biggest C4Fixed, so
would have been truncated to 16960.
2016-01-01 22:18:41 +01:00
Günther Brammer 87c9fc965f Inline pointless ForceLimits function
In the time it took to understand the API of that function, one can read
the entire TargetBounds function which was its sole user.
2016-01-01 22:18:41 +01:00
Armin Burgmeier 26cfbdb059 Fix assertion failure when rendering mesh with degenerate transform (#1519)
The DynamiteBox sets the PictureTransformation to a degenerate matrix, to
prevent it from being rendered. Exit early in this case, since we are not
going to render anything anyway, and avoid the assertion when inverting the
matrix.
2016-01-01 11:34:04 -08:00
Günther Brammer 5db59e8665 Fix C4MessageBoard key binding lifetime
I think C4Game::InitKeyboard relies on the callback targets outliving the
keybindings and every other class is prepared to be deleted before
C4KeyboardInput::Clear(), so needs to hold a ref to the keybinding to
delete that in its destructor.

C4KeyBinding is the class that is used for that, and it sets the reference
count to 1 in the constructor, to represent the reference held in the
owning class.

On the other hand, C4CustomKey gets immediately forgotten by C4Game and the
only reference is held in the keymap.

To prevent this from happening again, make the C4CustomKey constructors
protected and C4Game a friend of the class.

Also remove an unused C4CustomKey constructor.
2016-01-01 16:24:43 +01:00
Armin Burgmeier c0844c10ff Add support for generic attributes to C4Shader
Replace the hardcoded VAI_ constants with that. The VAI constants are now
moved to C4DrawGL as C4SSA_ constants, similar to the C4SSU ones. This allows
to introduce other attributes to replace vertex positions, normals, colors
and texture coordinates with attributes in later commits. This, in turn, is
needed because the built-in attributes are no longer available in the OpenGL
core profile.

Also, while at it, cleanup C4Shader a bit. Use std::vector<> instead of
maintaining an own array of uniform names. Delete the vertex and fragment
objects after the full shader program has been linked. Make sure that
C4Shader::Init keeps the old program in place if the new one cannot be
compiled or linked.
2015-12-31 22:28:23 -08:00
Armin Burgmeier c043795552 Fix memory leak in FoW surfaces
Surfaces are initially created in locked state, and only when unlocked the
memory buffer with the surface data is uploaded to the GPU. The FoW code
however never unlocks the surface but instead operates on the OpenGL texture
directly. To fix this, introduce a new flag for C4Surface to create it in an
unlocked state.

This is not a memory leak in the traditional sense as a pointer to the buffer
is still available and is being freed when the surface is being destructed
at the end of the game. However, during the game there might be several
megabytes allocated that are never used.

I'm not really sold by this Lock/Unlock mechanism. Instead, there should
simply be a function to obtain the current texture data, and a function to
upload new texture data. That's for another time though...
2015-12-31 18:40:38 -08:00
Armin Burgmeier fc4679e3ea Don't upload all texture data twice
For some reason, the C4TexRef constructor first uploaded a set of nulled
texture data, just to be replaced by the actual image data when Unlock()
is called. Skip the unnecessary step and instead just reserve the video
memory in the constructor.
2015-12-31 17:58:22 -08:00
Armin Burgmeier 8766f5123b Remove other usages of built-in GL matrices
Primarily for the FoW rendering, which now also uses (simple) shaders
without ftransform() everywhere. This also removes all GLU calls.
2015-12-31 17:30:21 -08:00
Maikel de Vries a6efefaecc fix float physics for objects moving out of a liquid surface (#1523)
This also fixes objects which previously jumped out of the water continuously, by adding an extra check to also capture faster moving objects. It could be made speed dependent, but that seems to be overkill for the situation.
2015-12-30 12:54:04 +01:00
Nicolas Hake 9b34bf2634 Remove arbitrary inline forward declarations of StdBuf (and derivatives) 2015-12-29 21:42:46 +01:00
Nicolas Hake c0befc6ba0 Remove C4RTF
The only use of C4RTF in its final moments was parsing out plain text
from RTF files anyway, so why even go to all the trouble instead of just
storing plain text in the beginning?
2015-12-29 17:51:43 +01:00
Günther Brammer 77a71c39d3 Require some C++14 support (make_unique, index_sequence) 2015-12-29 15:47:55 +01:00
Günther Brammer 16ef28e05f Drop unused C4VERSIONBUILDNAME and C4ENGINEINFO
This was used to name snapshot releases of the Network2 branch, and has
seen almost no use since.

C4ENGINEINFO(LONG) was a duplicate of C4ENGINENAME and C4ENGINECAPTION.
2015-12-29 15:47:55 +01:00
Nicolas Hake 500229c302 C4Extra: Make ownership of ExtraGroups more explicit 2015-12-29 13:56:06 +01:00
Nicolas Hake d0cd244077 C4Extra: Merge ctor/Default, dtor/Clear 2015-12-29 02:59:02 +01:00
Nicolas Hake 3da14127a4 C4TransferZone: Merge ctor/Default, dtor/Clear 2015-12-29 02:59:01 +01:00
Nicolas Hake 63ab46e293 C4Player: Merge ctor/Default, dtor/Clear 2015-12-29 02:59:00 +01:00
Nicolas Hake 90293d019d C4FoWRegion: Make more private
Code outside of C4FoWRegion should not care about the internals of the
class. Therefore, we remove direct access to the backing surface (and
secondary buffer surface) and replace it instead with accessors that
return those few values that are required by outside code.
2015-12-28 21:45:21 +01:00
Nicolas Hake 5a9baeddbf C4FoWRegion: Turn some owned pointers into std::unique_ptr 2015-12-28 21:45:19 +01:00
Nicolas Hake 46abecded7 C4FoWRegion: Merge Clear() into dtor 2015-12-28 21:45:15 +01:00
Nicolas Hake ddd068c830 C4Viewport: Turn some owned pointers into std::unique_ptr 2015-12-28 21:45:14 +01:00
Nicolas Hake 3590dda85a C4Viewport: Merge ctor/Default, dtor/Clear 2015-12-28 21:43:03 +01:00
Günther Brammer 6a53066c36 Include config.h only from PlatformAbstraction.h
In order to avoid duplication, PlatformAbstraction.h has to be included at
the start of every source file, so that various headers can rely on it
being there. To avoid confusion, always rely on that, instead of sometimes
randomly including it or parts of it again.
2015-12-28 18:50:31 +01:00
Günther Brammer 30e0cdb418 CMake: Re-enable readline support for openclonk-server 2015-12-28 18:48:45 +01:00
Nicolas Hake d737dc1b05 Remove C4Video, StdVideo
Video recording and playback only worked on Windows, and recording only
handled video, not game audio. As such, it was of fairly limited use,
and there's lots of software available these days that handle both.
2015-12-28 11:43:41 +01:00
Nicolas Hake 7475b89bd2 C4MessageBoard: Merge Default/Clear into ctor/dtor 2015-12-28 11:43:40 +01:00
Nicolas Hake 24a7c75a1b C4MessageBoard: Remove unimplemented member DrawLoader 2015-12-28 11:43:39 +01:00
Nicolas Hake fc1189dfe4 C4UpperBoard: Remove empty Default/Clear 2015-12-28 11:43:38 +01:00
Nicolas Hake d65af91694 C4GraphicsSystem: Remove unused function 2015-12-28 11:43:37 +01:00
Nicolas Hake 3c625a00dd C4Game: Turn some owned pointers into std::unique_ptr
Using std::unique_ptr instead of raw pointers makes ownership clear and
avoids leaks.
2015-12-28 11:43:37 +01:00
Nicolas Hake d063e02a3c C4FullScreen: Remove several unimplemented function declarations 2015-12-27 16:49:41 +01:00
Nicolas Hake 4980572c79 C4Game: Remove several unimplemented function declarations 2015-12-27 16:49:41 +01:00