Commit Graph

53 Commits (eabca223f5e7c237f5d3bb88183d38a41cb9bced)

Author SHA1 Message Date
Nicolas Hake eabca223f5 Update all copyright notices for 2016 2016-04-03 20:24:42 +02:00
Nicolas Hake 493c276126 Rewrite header inclusions to #include "path/to/file.h" style 2016-04-03 20:24:42 +02:00
Nicolas Hake 64a5388d4d C4Surface: Remove broken "support" for split textures
Most code already didn't handle textures larger than GL_MAX_TEXTURE_SIZE
and only used the first one in case of a split texture.
2016-02-08 17:36:50 +01:00
Nicolas Hake 4fdafbc78a Move StdColors.h ref from C4Surface.h to files that actually need it
C4Surface.h doesn't require anything from StdColors.h, so there's no
reason to reference the latter there.
2016-02-08 02:13:18 +01:00
Günther Brammer 23d34f75ec Remove some dead graphics code 2016-02-06 23:46:58 +01:00
Nicolas Hake e9cf0f6fdc Stop pretending we support 16 bit color
The GTK and OS X platforms already ignored the requested bit depth and
always used 32 bit. Windows and SDL would set a 16 bit color depth for
the screen, but still did all of the rendering short of the final
present in 32 bit.
2016-02-02 00:00:23 +01:00
Nicolas Hake 24b54211c5 Drop Min, Max, Swap for std::min, std::max, std::swap
The C++ standard library comes with perfectly fine implementations of
these functions, so there's no point in reimplementing them just for the
hell of it.
2015-11-15 13:53:01 +01:00
Armin Burgmeier fd285f6656 Create mipmaps only for static textures that are expected to be zoomed
Hopefully fixes #1403.
2015-09-18 21:10:39 -04:00
Armin Burgmeier 20eb0615ee Custom shader for drawing sky
Add a C4ShaderCall parameter to tho most important drawing functions, and
make C4DrawGL's CreateSpriteShader public with additional parameters to
specify additional defines and shader slices. C4Sky uses this to compile its
own shader with OC_SKY defined.
2015-09-12 18:15:34 -04:00
Armin Burgmeier e0d7d44948 Optimize drawing of tiled surfaces
Instead of one draw call for each tile, do the whole operation with a single
draw call by setting GL_REPEAT on the texture. This affects sky, the upper
board and the background.

This also allows to remove some code that was making sure surfaces are big
enough.
2015-09-12 16:11:50 -04:00
Peter Wortmann 30857e835e Shader gamma implementation
In comparison to the old system, this is a downgrade - instead of being
able to set a full color mapping by gamma ramp, we now get just a value
per colour channel.

Upside is that we do not need to play around with the global gamma ramps
any more, which was arguably the wrong way to do it.

This commit will likely break everything that has been using gamma so far.
2015-08-31 17:35:08 +01:00
Armin Burgmeier 0cdafc278b Transform all mesh data to Clonk reference frame on load
Instead of doing the transformation when drawing a mesh. This allows making
the OpenGL normal matrix more consistent, since it does not include the
Ogre-To-Clonk transformation, and so that the transformation does not need
to be inverted in the shader.

As a side effect, all Attach transformations were updated, since before
they were specified in the OGRE reference frame, not the Clonk reference
frame.
2015-08-18 20:30:20 -04:00
Nicolas Hake 5562b09dc4 Remove a lot of disabled legacy code, round 2
Maybe at some point we'll be rid of all the commented-out code that
nobody has looked at in years.
2015-03-25 20:02:53 +01:00
Nicolas Hake e21a5bdd44 Rename BoundBy to Clamp
"BoundBy" sounds like a predicate. "Clamp" is a common function name for
the operation in graphics processing, so it should be familiar to users.
2015-02-12 23:05:55 +01:00
Günther Brammer 5bcedb5bbf Remove some redundant #includes 2015-01-25 18:53:48 +01:00
Nicolas Hake 2ef2c637a7 Remove several instances of disabled legacy code 2015-01-18 22:59:45 +01:00
Nicolas Hake fef96eca9c Replace C4Surface::ppTex by a vector
This should improve cache coherency by having all surface tiles adjacent
instead of strewn across the heap. This will also remove an indirection
in the common case of only using one tile.
2015-01-18 22:59:44 +01:00
Armin Burgmeier e1d1d540c7 Allow independent viewport and light regions in C4FoWRegion (#1211)
With this change, an additional rectangle is stored in C4FoWRegion that
represents the area covered by the viewport in fractional floating point
coordinates. This allows the light texture to be created for an arbitrary
portion of the landscape, and the coordinate transformations for the
shaders will still work.

Also, since the additional rectangle uses floating point precision, the
computed coordinate transformations do now give the exact same result as for
the landscape pixel-by-pixel, and there should not be any offsets left.

I also hope that this change improves or fixes the single-pixel-lines of sky
that are sometimes seen at the edges of the viewport.
2015-01-07 19:44:31 +01:00
Armin Burgmeier 8116a96ed4 Fix fragment coordinate transforms (#1192)
There were two problems with the previous transforms:
  1) For inverting the Y axis for the ambient map, the total height of the
     output window is needed, not only the viewport region.
  2) The Y offset to only use the part of the light texture that is being
     rendered to was not applied.

In order to keep the transformations more readable, a new lightweight class
C4FragTransform has been introduced which can only handle translations
and scales in x and y.
2014-12-26 16:16:09 +01:00
Tobias Zwick 4981182cf8 Merge remote-tracking branch '_origin/master' into lights
Conflicts:
	src/c4group/C4Components.h
2014-12-15 21:16:40 +01:00
Sven Eberhardt 8df39d06e4 Fix texture preview in editor tools dialogue on Windows. 2014-12-14 15:20:57 +01:00
Sven Eberhardt bd1f59cb2d Fix Win32 MinGW build.
I hope...
2014-12-14 13:43:58 +01:00
Sven Eberhardt 296a1b8f8d Auto-select nVidia GPU on Optimus laptops.
Since we're no longer using DirectX, nVidia's automatic detection no longer works classifies OpenClonk as a game to use the high performance GPU. Note that this flag does not work on some old drivers (version<302 according to specs). To support these old drivers, we would have to link against DirectX despite not using it.
2014-12-14 13:24:16 +01:00
Sven Eberhardt 9db21442b7 Fix assertion when drawing boxes on non render targets.
This doesn't fix material preview in editor mode yet but at least there's no more assertion. We should probably create a proper render target surface for that.
2014-12-13 15:14:51 +01:00
Armin Burgmeier 192dddec6f Use the new shader system for rendering sprites
This now also avoids the use of conditionals in shaders by using different
shaders instead.
2014-11-24 14:51:08 -05:00
Armin Burgmeier f550fcdf43 Add C4Draw::GetClipRect()
This will allow to avoid some code duplication when computing the coordinate
transform from fragment coordinates to ambient and light texture coordinates.
2014-11-24 14:51:08 -05:00
Armin Burgmeier 137abb89df Implement normal maps for sprite graphics 2014-11-07 15:29:09 -05:00
Armin Burgmeier aed907e30d Remove old fog of war 2014-11-07 11:53:10 -05:00
Armin Burgmeier 0795715465 Apply lighting on sprites 2014-11-06 15:56:19 -05:00
Armin Burgmeier 73e4f5a89c Remove some unused code in C4Draw 2014-11-04 11:24:55 -05:00
Armin Burgmeier a1bafb937f Implement DrawQuadDw with PerformMultiTris
This simplifies the code further.
2014-11-04 11:02:40 -05:00
Armin Burgmeier 233e5e7c13 Remove CStdGL::BlitLandscape
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.
2014-11-02 11:15:06 -05:00
Armin Burgmeier 50769171f1 Remove manual clipping in C4Draw::BlitUnscaled
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.
2014-11-01 23:11:35 -04:00
Armin Burgmeier 2b2bc56e77 Remove unused PerformBlt function 2014-11-01 22:28:03 -04:00
Armin Burgmeier 65a47623e4 Use PerformMultiTris in the standard blitting code
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.
2014-11-01 22:28:03 -04:00
Armin Burgmeier 25b259ae20 Fix implementation of C4Draw::DrawLineDw (#1164) 2014-10-18 13:14:17 -04:00
Armin Burgmeier b06e10e03b Add PerformMultiTris to draw many texturized triangles at once 2014-10-08 18:33:46 -04:00
Armin Burgmeier a597dc28d7 Use PerformMultiLines where appropriate 2014-10-08 18:33:46 -04:00
Armin Burgmeier c1f1a623fb Remove PerformPix in favor of PerformMultiPix 2014-10-08 18:33:45 -04:00
Günther Brammer 8780a69b51 Improve the messages for path problems
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.
2014-06-09 04:17:17 +02:00
Martin Plicht a4c858f4ee C4Draw::ResetGamma: Implement by applying saved DefRamp (Mac version went all blue using the old implementation) 2014-01-23 17:52:30 +01:00
Nicolas Hake e0dc30c59a Update copyright notices
As discussed in http://forum.openclonk.org/topic_show.pl?tid=2917, I
have merged all copyright notices into a single file and referenced that
merged file from each source file.

For the updated source files, the timeline has been split into three
parts:
 1. Pre-RWD code (before 2001)
 2. RWD code (2001 through 2009)
 3. OpenClonk code (2009 and later)
All pre-RWD copyright notices have been left intact, as have RWD-era
copyright notices where the file did not have a RedWolf design copyright
notice but only individual author ones. All copyright notices of the
OpenClonk era have been replaced by a single notice ranging from the
first recorded year to the current year (2013). Mape code did not get a
OpenClonk Team copyright notice because it is somewhat separate from the
main OpenClonk codebase and has only been touched by Armin Burgmeier.
2013-12-23 13:03:19 +01:00
Sven Eberhardt 395f4c94b0 Reset gamma ramps after game (#842) 2013-11-09 17:11:29 +01:00
Tim Blume 240193ad5a Remove remains of Direct3D support
Direct3D hasn't worked for more than a year now, and there don't seem to
be any efforts to revive it. Remove it and concentrate on better OpenGL
support.
2013-11-02 21:39:34 +01:00
Nicolas Hake c55888f7c3 CStdFont: Encapsulate iLineHgt 2013-10-18 22:30:02 +02:00
Julius Michaelis 1261402357 Zoomed full map screenshots with artefacts and fixed zoom
Signed-off-by: Sven Eberhardt <sven2@goldwipf.de>
2013-09-14 23:36:07 +02:00
Günther Brammer 4e875f4495 Don't store object rotation twice
Rotation was still stored as an integer and as a fixed point number.
Compute the integer on demand from the fixed point instead, like the
position. Rewrite the movement code where the two variables were
temporarily out of sync.
2013-05-25 14:59:58 +02:00
Günther Brammer bc45d417a9 Remove some dead blitting code 2013-05-25 14:47:54 +02:00
Günther Brammer 864c5c7ea8 copyright notices update 2012 2013-01-12 16:31:40 +01:00
Günther Brammer 7967d94a59 Merge StdFont.cpp and C4Fonts.cpp 2012-11-12 02:30:16 +01:00