Commit Graph

3365 Commits (b7cffa5e82d70aec265830dff5102f45d1990424)

Author SHA1 Message Date
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