Vincent Pelletier
a6af3a38a3
TINYGL: Fix vertice color when clipped and lighting is disabled
...
longcurrent_color is assigned per vertex, but it is not saved on each
vertex on creation (unlike their "color" attribute, used when lighting
is enabled).
As a consequence, and because rendering happens asynchronously (rather,
following the draw call queue managed by zdirtyrect.cpp when requested
to flip current buffer), longcurrent_color at clipping time can be
different to the one at vertex declaration time, causing color artifacts.
The effect is most noticeable in EMI set shi, in the grog dispenser +
shipyard manager closeup angle, when Guybrush exits the screen by
crossing its right border: dark triangles become visible on his face.
Instead, always use the color attribute, which is already properly
initialised on vertex creation.
2017-07-20 01:51:07 +00:00
Vincent Pelletier
d797461fa9
TINYGL: Clip dirty rectangle to render rectangle.
...
As all dirty rectangles are inflated by 1 pixel to the right and one to the
bottom, they may exceed render rectangle. So clip them again. There should
be very few rectangles at this point, so this should be cheap.
2017-05-02 09:57:09 +00:00
Vincent Pelletier
5f993ac66f
TINYGL: TGL_LINE_STRIP and TGL_LINE_LOOP are one line appart
2017-04-28 21:54:11 +00:00
Vincent Pelletier
fc37fabf0d
TINYGL: Fix assertion failure during EMI intro video.
...
This is a regression introduced by
commit 6a63f544f0
TINYGL: Avoid duplicating gl_transform_to_viewport.
2017-04-25 00:58:24 +00:00
Vincent Pelletier
2a1ab0a622
TINYGL: Do not queue invisible draw calls.
...
When dirty rectangles are enabled, we know at this point whether a draw
operation will have any effect on screen. Do not queue it if it will not.
2017-04-23 12:30:00 +00:00
Vincent Pelletier
bf319b5437
TINYGL: Cache and clip dirty rect on all DrawCall subclasses.
...
getDirtyRegion will be called twice on each DrawCall instance, so make
repeated work as short as possible.
2017-04-23 12:30:00 +00:00
Vincent Pelletier
6a63f544f0
TINYGL: Avoid duplicating gl_transform_to_viewport.
...
Replace local implementation by always setting GLVertex zp property.
Replace pointInsideVolume by clip_code, allowing to properly handle
polygons whose vertices are all off-screen but still have a part visible.
Also, replace 2-pixels offset with a more accurate bounding box
computation.
2017-04-23 12:30:00 +00:00
Vincent Pelletier
064bd1d47b
fixup! TINYGL: ClearBufferDrawCall should obey its parameters.
...
Fixes an undeclared property error.
2017-04-23 11:54:53 +00:00
Vincent Pelletier
6087492dbd
TINYGL: Simplify setting & disabling scissors.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
e1de3407f1
TINYGL: Make scissors follow Common::Rect semantics.
...
As per Common::Rect data model, right and bottom border are excluded, so:
- Make FrameBuffer::scissorPixel reject bottom & right borders.
- Update bounding rectangle definition for dirty rectangle operations
ClearBufferDrawCall::getDirtyRegion is already correct.
- zblit was almost following, except for an off-by-one mistake.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
3acde7d900
TINYGL: static-ify zdirtyrect.cpp
2017-04-23 10:35:04 +00:00
Vincent Pelletier
2fb2d87dc9
TINYGL: Skip drawing when there is no dirty rectangle
2017-04-23 10:35:04 +00:00
Vincent Pelletier
72389d23df
TINYGL: Simplify _drawCallAllocator switch & reset.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
580578fa20
TINYGL: Containment is just a special case of intersection.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
3f4a22354e
TINYGL: Remove redundant condition.
...
Empty call queue condition is tested in contained "for" loop already.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
5cbdabb69d
TINYGL: Continue comparing past first divergence
...
It is common that the same number of calls are done in the same order, so
do not stop comparing after the first divergence. This saves a significant
number of dirty rectangle in crowded scenes, like sets cn and bi where a few
calls may differ in the middle of call sequence, but later calls would stay
the same.
As a consequence, move current-frame-has-fewer-calls handling to its own
loop.
Also, factorise and extend code appending dirty rectangles.
Also, skip conseutive identical rectangles.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
ce97ff4e8f
TINYGL: ClearBufferDrawCall should obey its parameters.
...
Given dirty rectangle may cover more buffer area than what it was told to
clear.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
112ca82363
TINYGL: Manage BlitImages with a refcount.
...
So that zdirtyrect can keep an image alive for longer than its creator
intended.
2016-07-28 23:32:43 +00:00
Vincent Pelletier
47a1e826e7
TINYGL: Free draw call lists in glClose.
2016-07-28 01:55:48 +00:00
Vincent Pelletier
46329cca87
TINYGL: Do not compute dirty region when its result is not used.
2016-07-21 16:42:24 +02:00
Vincent Pelletier
a1418732ec
TINYGL: Typo in disabled code.
2016-07-21 16:41:24 +02:00
Vincent Pelletier
8ec310468d
TINYGL: Replace multiplications by iterative additions.
...
As an iteration is done already anyway.
2016-07-21 16:41:18 +02:00
Vincent Pelletier
a831238a96
TINYGL: Drop some unused locals.
2016-07-21 16:40:36 +02:00
Paweł Kołodziejski
9acb1b9039
Merge pull request #1275 from vpelletier/valgrind
...
TINYGL, GRIM: Fix various errors (mostly memory leaks) found by valgrind
2016-07-20 14:09:52 +02:00
Vincent Pelletier
97dc3881e0
TINYGL: Add free_texture variant taking a GLTexture * argument.
...
To avoid looking texture up in the hash table when caller has a pointer to
it already. Aka, O(0) is better than O(1).
2016-07-18 04:34:09 +02:00
Vincent Pelletier
306fdff963
TINYGL: Dispose of textures beyond the first hash table entry.
2016-07-17 15:06:30 +00:00
Vincent Pelletier
46fa5eb373
TINYGL: Fix off-by-one in TGL_LINE_LOOP/TGL_LINE_STRIP .
...
Also, draw last line from last point to first instead of first point to
last as the latter leaves an unpainted pixel for some reason.
2016-07-11 14:52:36 +00:00
Vincent Pelletier
98696865df
TINYGL: Fix TGL_QUADS with more than one quad.
...
Fixes checkbox border on Copal's computer.
2016-07-11 00:30:58 +00:00
Stefano Musumeci
23385b3a4a
TINYGL: Fixed compiler warnings.
2014-08-16 16:04:20 +02:00
Stefano Musumeci
974f47fa42
TINYGL: Added a way to disable or enable dirty rectangles at runtime.
2014-08-16 16:04:10 +02:00
Stefano Musumeci
41737fcc21
TINYGL: Added/Updated license header in tinyGL files.
2014-08-16 16:03:54 +02:00
Stefano Musumeci
9e807696bc
TINYGL: Minor style/formatting fixes.
2014-08-13 21:20:15 +02:00
Stefano Musumeci
92d8ecc34c
TINYGL: Added depth test enabled state tracking to dirty rects.
2014-08-13 14:33:54 +02:00
Stefano Musumeci
5cd3cfe548
TINYGL: Fixed a bug with triangle strip rendering.
2014-08-11 17:24:21 +02:00
Stefano Musumeci
4b9c5a7633
TINYGL: Wrong commit fixup.
2014-08-10 21:15:41 +02:00
Stefano Musumeci
ff488253e7
TINYGL: Moved variable initialization in the appropriate line.
2014-08-10 19:39:56 +02:00
Stefano Musumeci
986d6a9d8b
TINYGL: Minor line break fixup.
2014-08-10 19:39:38 +02:00
Stefano Musumeci
ca54fd848a
TINYGL: Renamed member functions loadState to captureState.
2014-08-10 19:39:21 +02:00
Stefano Musumeci
28214fe84e
TINYGL: Added preprocessor variable to enable/disable dirty rects debug.
2014-08-10 19:38:46 +02:00
Stefano Musumeci
5adba756e3
TINYGL: Renamed tglBlitScissorRect into tglBlitSetScissorRect
2014-08-10 19:38:06 +02:00
Stefano Musumeci
daa8394adb
TINYGL: Moved DrawCallType enum inside DrawCall.
2014-08-10 19:37:26 +02:00
Stefano Musumeci
a59c1de0ff
TINYGL: Fixed misspelt function name.
2014-08-10 19:05:32 +02:00
Stefano Musumeci
a42d9e2b2d
TINYGL: Added comment to the code.
2014-08-09 14:40:18 +02:00
Stefano Musumeci
688a76455a
TINYGL: Fixed typo in code.
2014-08-09 14:40:08 +02:00
Stefano Musumeci
2b368d960f
TINYGL: Fixed a mistake in while -> loop refactoring.
2014-08-09 14:39:05 +02:00
Stefano Musumeci
a274a50a22
TINYGL: Removed magic numbers in computeDirtyRegion
2014-08-09 14:14:25 +02:00
Stefano Musumeci
563a26e998
TINYGL: Refactored tglPresentBuffer to increase code readability.
2014-08-09 13:43:47 +02:00
Stefano Musumeci
91dc7904f3
TINYGL: Refactored while loops into for loops.
2014-08-09 13:07:46 +02:00
Stefano Musumeci
13698796ec
TINYGL: Rewrote if conditions for more clarity.
2014-08-09 12:34:40 +02:00
Stefano Musumeci
c27be840ea
TINYGL: Added not equality operator for GLVertex and DrawCall.
2014-08-09 12:34:26 +02:00