Commit graph

78 commits

Author SHA1 Message Date
Paweł Kołodziejski
31e3132896
TINYGL: Reduced some forced inlines 2022-07-17 01:10:54 +02:00
Paweł Kołodziejski
4a05ea9eda
TINYGL: Remove left over macro use 2022-06-05 23:58:05 +02:00
Paweł Kołodziejski
cdaec9de8d
TINYGL: Added fog support. 2022-06-05 20:59:38 +02:00
Paweł Kołodziejski
de67c1ae54
TINYGL: Latest TinyGL 0.4.1 is relicensed under MIT license. 2022-03-08 15:47:20 +01:00
Paweł Kołodziejski
20cb0ae228
ALL: Cleanup ResidualVM -> ScummVM 2021-12-26 21:19:38 +01:00
Eugene Sandulenko
abea37c9bb
ALL: Update ScummVM project license to GPLv3+ 2021-12-26 18:48:43 +01:00
D G Turner
70f64dd398 TINYGL: Fix Cut and Paste Error Causing Duplicate Branch
This was detected by GCC's -Wduplicated-branches warning which is
not enabled by default.
2021-12-17 00:44:18 +00:00
Paweł Kołodziejski
b673e0adf5
TINYGL: Janitorial 2021-12-15 23:55:36 +01:00
Paweł Kołodziejski
c98fe1c61c
TINYGL: Eliminate unnecessary branches and code in flow 2021-12-15 23:15:55 +01:00
Paweł Kołodziejski
c66ca22cbb
TINYGL,GRIM: Replace custom shadows to stencil buffer solution 2021-12-10 18:37:24 +01:00
Paweł Kołodziejski
6a591146c8
TINYGL: Added stencil buffer implementation 2021-12-09 21:10:53 +01:00
Paweł Kołodziejski
3b9f9804ee
TINYGL: Rearrange access to TinyGL 2021-12-08 14:52:18 +01:00
Paweł Kołodziejski
87594a052f
TINYGL: Cleanup more FrameBuffer class entries 2021-12-07 22:11:55 +01:00
Paweł Kołodziejski
2368991ab6
TINYGL: Rearrange access gl context access from/to frame buffer class 2021-12-07 19:58:03 +01:00
Paweł Kołodziejski
eab1fe4097
TINYGL: Implemented tglPolygonOffset function 2021-10-26 21:59:04 +02:00
Orgad Shaneh
a05e54f00c JANITORIAL: Remove trailing whitespaces 2021-05-04 11:46:30 +03:00
Eugene Sandulenko
5e7fe2dc57
JANITORIAL: Replace spaces in indentation with tabs 2021-04-15 21:20:36 +02:00
Vincent Pelletier
f8c72b5967 TINYGL: Move texture resampling from create time to render time
Thanks to pixel repacking using cpu data cache, this has a low runtime
cost even for TGL_LINEAR.
Adds support for TGL_NEAREST.
Adds support for TGL_MIRRORED_REPEAT, TGL_CLAMP_TO_EDGE and TGL_REPEAT.
Also, add support for more texture clamping and resampling options.

Mipmaps are not supported, although their sampling modes will be
applied - but to the full-size texture instead of selected mipmap.

Note: Texture sampler is still chosen at texture creation time.
2020-11-12 08:15:39 +01:00
Vincent Pelletier
bcd1066540 TINYGL: Move initialisation code outside of loop
Readability-only change.
Clarifies that these variables will be initialised before they get
accessed in the loop.
Also, initialise update_left and update_right to true, and only clear the
one needed for given triangle.
2017-07-20 01:56:35 +00:00
Vincent Pelletier
218d3214d7 TINYGL: Move remaining line counter decrement near y increment
Readability-only change.
Both represent the same notion, and nb_lines is only accessed as loop
condition.
2017-07-20 01:53:34 +00:00
Vincent Pelletier
290d6a3b6d TINYGL: Initialise a1 in fillTriangleFlat code path
fillTriangleFlat has kDrawLogic == DRAW_FLAT and interpRGB == false,
causing this variable to be used uninitialised.
Found by removing default values on all locals.
2017-05-02 09:42:06 +00:00
Vincent Pelletier
054a2bd920 TINYGL: Fix line color
As in ztriangle, vertex color must be shifted from internal 16-bits
fixed-point format to 8-bits colors.
To do so, define values similar to the ones describing for ST fixed-point
format.
Also, use these in tglClear instead of hard-coded multiplicands, as is
done in tglColor4f and gl_transform_to_viewport.
Also, make tglClear take into account requested clear depth.
2017-05-01 02:21:40 +00:00
Vincent Pelletier
cc42d5cb24 TINYGL: Fix scissor testing in ztriangle.
When dirty rectangles are enabled, fixes drawing outside (below) set scissor
rectangle.
y and pp1 must stay consistent for scissor testing to be relevant. y is
already incremented along with pp1, and pp1 does not get re-assigned on
part == 2, so do not set y either.
2017-04-23 10:35:04 +00:00
Vincent Pelletier
e7e1df886e TINYGL: Merge dead kInterpST code path into kInterpSTZ one.
Texture coordinates interpolation along Z coordinate is an extra behaviour
over texture coordinates interpolation along X and Y coordinates.
2016-07-28 02:46:41 +00:00
Vincent Pelletier
369332e464 TINYGL: Treat alpha the same way as other color components.
When kLightsMode (aka kInterpRGB) is false, "a" is always 0 (vertice data is
not used in caller in corresponding branches), so taking it into account makes
all triangles transparent.
This is not visible in practice, because putPixelTextureMappingPerspective is
only called when (kInterpST || kInterpSTZ) is true, and kInterpRGB is always
true when that's the case. But unifying color processing allows further code
simplification.
2016-07-28 01:55:14 +00:00
Vincent Pelletier
0065f38251 TINYGL: Reuse global const. 2016-07-28 01:55:14 +00:00
Vincent Pelletier
e1d5b811e1 Revert "GRIM: fixed transparency in TinyGL renderer"
This reverts commit b8bddf64da.

Since 9b7548ccf7, alpha test is enabled
when drawing model faces, fixing transparency issues in GRIM which were
corrected by reverted commit.
It is incorrect to test transparency when caller did not enable it.
Also, this change bypasses increments done at the end of
putPixelTextureMappingPerspective, so transparent textures in 16 bits mode
would be stuck on the transparent pixel for the current line's 8-pixel run
in filTriangle, and would ignore z coordinate.
2016-07-28 01:55:14 +00:00
Vincent Pelletier
8b6d362c58 TINYGL: Reuse _enableScissor property.
Should have been part of:
  commit db764b1ca5
  TINYGL: Entirely avoid calling scissorPixel in putPixel when possible.
2016-07-28 01:55:14 +00:00
Vincent Pelletier
18342118dc TINYGL: Fix y coordinate tracking when drawing triangles.
Increment y inside the loop, not outside.
Set y to the topmost vertex y coordinate, which depends on which half of
the triangle is being drawn.
Should have been part of:
  commit 3c2689a65f
  TINYGL: Optimise scissorPixel.

This does not (should not) fix any visible regression, as pixel scissor is
only (?) used when dirty rectangle mecanism is enabled (and it is disabled).
2016-07-28 01:55:10 +00:00
Vincent Pelletier
0a41574079 TINYGL: Process colors in RGBA 32bits internaly. 2016-07-24 01:20:50 +02:00
Vincent Pelletier
cf53e8871d TINYGL: Unroll DRAW_SHADOW and DRAW_SHADOW_MASK.
Also, update z in the second DRAW_SHADOW loop like it is done in the first.
Also, check each shadow mask pixel in DRAW_SHADOW, instead of 1 every 4.
2016-07-22 14:49:16 +02:00
Vincent Pelletier
3c2689a65f TINYGL: Optimise scissorPixel.
Scissor operations happen in a 2d rectangle, but it used to take a buffer
offset as a parameter. As a result, it had to divide that value with its
width, which is an expensive operation, which has to be done for each
pixel candidate for display (even before z-buffer comparison when
applicable, in current implementatoin).
But callers actually generate the buffer offset from rectangular
coordinates, so propagate these instead.
This sadly increases API redundancy, but saves a lot of time in a very
frequent occurrence (especially when enabling dirty rect mechanism,
which is not yet enabled by default).
2016-07-21 15:56:29 +02:00
Vincent Pelletier
03da50312b TINYGL: Move the task of writing to z-buffer to FrameBuffer::writePixel.
Because writePixel may decide to not write anything (alpha test), in which
case no z-buffer write should happen.
Factorises code.
Fixes apparent back-face culling in GRIM behind transparent textures, like
the tube (the 3d-shape Manny takes out, not the flat image in foreground)
in set mo.
2016-07-14 21:30:18 +00:00
Pawel Kolodziejski
b8bddf64da GRIM: fixed transparency in TinyGL renderer 2014-12-25 15:16:50 +01:00
Pawel Kolodziejski
e20ef7a4f8 TINYGL: added support for alpha channel for non texture triangles. 2014-09-12 06:50:17 +02:00
Stefano Musumeci
2cf70d6d76 Merge branch 'master' into tinygl-dirty-rects-fixed
Conflicts:
	graphics/tinygl/ztriangle.cpp
2014-08-16 16:03:27 +02:00
Joni Vähämäki
5bdfbb29eb TINYGL: Do not write to the depth buffer if depth test is disabled. 2014-08-14 22:01:18 +03:00
Stefano Musumeci
f9332da316 TINYGL: Refactored if-else sequence with progressive function calls. 2014-08-13 22:38:24 +02:00
Pawel Kolodziejski
1b48414d7e TINYGL: cleanup license headers 2014-08-13 18:52:52 +02:00
Stefano Musumeci
6e75f6b594 TINYGL: Renamed rasterization functions template parameters with constants naming convention. 2014-08-10 20:31:07 +02:00
Stefano Musumeci
f107e7cf6b TINYGL: Renamed variables to camelCase. 2014-08-09 12:00:43 +02:00
Stefano Musumeci
a4b57371e2 TINYGL: Refactored out duplicated code. 2014-08-08 13:09:44 +02:00
Stefano Musumeci
8c94a65a70 TINYGL: Optimized rasterization routines by moving more data from dynamic evaluation to static evaluation. 2014-08-06 21:52:41 +02:00
Stefano Musumeci
4d2dc3f0aa TINYGL: Added pixel scissoring logic to triangle rasterization. 2014-08-05 13:21:25 +02:00
Pawel Kolodziejski
9a81f8997c TINYGL: properly handle color for FLAT mode and lines drawing. Respect FLAT/SMOOTH mode for triangle drawing 2014-07-05 20:54:14 +02:00
Pawel Kolodziejski
97b03aed01 TINYGL: changed code to allow initialize TinyGL with specific internal texture dimension.
Grim: 256x256, Myst3: 1024x1024
2014-07-05 13:08:34 +02:00
Pawel Kolodziejski
f477946646 TINYGL: allow change internal texture size at compilation time. Now it's 1024x1024 pixels. 2014-07-05 12:13:03 +02:00
Pawel Kolodziejski
2072e51813 Revert "TINYGL: fixing T texture cordinate"
This reverts commit 5d65e40e1f.
2014-07-05 11:08:30 +02:00
Pawel Kolodziejski
5d65e40e1f TINYGL: fixing T texture cordinate 2014-07-05 11:06:34 +02:00
Pawel Kolodziejski
e6924e894c TINYGL: eliminate not clear use of define 2014-07-05 09:29:38 +02:00