Commit Graph

8 Commits (652c7e43e23652fb8bf05b4b57e6db36b0eb765c)

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
Nicolas Hake 4db690b0c6 Add copyright header to files that were missing it 2015-02-16 18:40:52 +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
Armin Burgmeier 8686441d45 Make mesh shaders use the C4Shader slice machinery 2014-12-22 22:56:30 +01:00
Armin Burgmeier 88f8f75441 Add ambient lighting
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.
2014-11-17 09:35:50 -05:00
Armin Burgmeier 0795715465 Apply lighting on sprites 2014-11-06 15:56:19 -05:00
Tobias Zwick 21e532da23 split up C4FoW header and source file into one file for each class
* 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
2014-10-11 23:13:10 +02:00