Commit Graph

41 Commits (376ca5a9dfb6b51ad02253a429ef0bd935d85799)

Author SHA1 Message Date
Julius Michaelis 376ca5a9df Prevent using USE_CONSOLE in lib{misc,c4script} 2016-10-22 17:42:23 +02:00
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 735f9cc06b C4Landscape: Pull everything private out of the header
Since LTCG is enabled now, we don't have to define every function inside
the headers for ~xXx super speed xXx~, which means we can strip the
headers down to their bare minimum and reduce interdependencies and
therefore recompilation times by a lot.
2016-04-03 13:24:24 +02: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
Sven Eberhardt 535fc79c0f Silence a few compiler warnings. 2015-08-29 08:33:00 -04:00
Nicolas Hake 9eb8eedf82 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.
2015-06-17 21:30:56 +02: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 84b758541f 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-16 19:28:11 +01:00
Peter Wortmann fc62f635fa 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-15 22:46:23 +01:00
Peter Wortmann 4bbf96b593 Remove self-shadowing debug code
I believe this isn't needed any more?
2015-03-15 22:46:23 +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 32ecf51029 Don't use std::auto_ptr
Ever.
2015-02-22 17:05:41 +01:00
Sven Eberhardt fe1ecd2424 Implement loading of serialized light sections. 2015-02-17 21:05:52 +01:00
Sven Eberhardt 68eb45732e Log all relevant data for reproduction on tri.fanRY > tri.fanLY assertion.
Just compiling the logged light section and calling CalculateTriangles on it should be used to reproduce the assertion.
2015-02-17 01:31:10 +01:00
Nicolas Hake 4db690b0c6 Add copyright header to files that were missing it 2015-02-16 18:40:52 +01:00
Sven Eberhardt cd3b969fc4 Silence a few warnings in render and SolidMask code. 2015-02-08 12:37:00 +01:00
Peter Wortmann e8bf04840f Fix some refactoring bugs (#1227)
The "b" value returned by the new find_cross function had basically
nothing to do with what the old version did (it was for the other
pair of coordinates *and* sign-switched). This is not cosmetical - the
algorithm depends quite a bit on this being consistent.

Additionally, most of the list modifications in CalculateTriangles were
wrong (didn't reprocess last triangle for ascend shadowing, and the descend
case was removing the wrong triangle). I admit the old code was probably a
bit too tricky with how it handled "i", so I attempted to refactor it to
make it less easy to screw up in future.
2015-01-14 14:23:26 +01:00
Tobias Zwick 3483d1f367 fix clipping problem for real 2014-11-23 22:50:49 +01:00
Tobias Zwick 117758848c Revert "fix clipping bug during the raytracing phase" (no fix after all)
This reverts commit 7a47c95c08.
2014-11-23 21:33:28 +01:00
Tobias Zwick 7a47c95c08 fix clipping bug during the raytracing phase 2014-11-23 21:23:58 +01:00
Tobias Zwick 8850d2e755 replace algorithm to calculate the intermediate fade point with a more failsafe version 2014-11-23 17:45:53 +01:00
Tobias Zwick 294838e0a4 outsource translating coordinates of triangles into a function 2014-11-23 17:42:09 +01:00
Tobias Zwick 800885a21b add const keyword to some methods 2014-11-23 17:40:24 +01:00
Tobias Zwick 6bd5beafde make certain fades a bit smoother by reimplementing PeterW's NEWER_INTERFADE_CODE. This is only a very slight effect, but visible 2014-11-20 23:43:14 +01:00
Tobias Zwick 1b96eaabf2 move find_cross function to a different class, reimplement 2014-11-20 23:43:13 +01:00
Tobias Zwick e7c9c176b1 fix clipping 2014-11-18 00:30:27 +01:00
Tobias Zwick 239cd222e5 implement/fix clipping during rendering of light 2014-11-17 23:02:00 +01:00
Tobias Zwick 96729ef57c refactor C4FoWLightSection::CalculateTriangles to also use the C4FoWBeamTriangle data structure; refactor the variable names 2014-11-17 23:01:59 +01:00
Tobias Zwick eb6bba9c4e fix linker error for G++ and clang 2014-11-16 20:18:09 +01:00
Tobias Zwick fd0163ebc6 refactor and document: C4FoWLightSection only calculates the triangles now, C4FoWLight stitches everything together and renders
* intermediate fade triangles are now calculated in C4FoWLight
* rendering takes also place in C4FoWLight, using different C4FoWDrawStrategies
* solved an old TODO from Peter (int -> int32_t)
* refactor and simplify portions of the light vertex calculation code
2014-11-16 18:57:42 +01:00
Tobias Zwick e6348f0cee add check to clip ray trace calculation for beams outside of viewport 2014-10-19 21:35:15 +02:00
Tobias Zwick 6fda51903a change a macro into an inline function, add documentation, correct indentation 2014-10-19 21:32:04 +02:00
Tobias Zwick c823eea971 fix clipping bug and document more of C4FoWLightSection 2014-10-19 15:07:15 +02:00
Tobias Zwick 5f99f9ca43 add documentation to C4FoWBeam 2014-10-12 21:04:44 +02:00
Tobias Zwick 7963065eb8 rename C4FoWRay to C4FoWBeam, add some documentation 2014-10-12 12:59:25 +02:00
Tobias Zwick d859789d96 fix some build problems 2014-10-12 02:17:05 +02: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