93 Commits
Author SHA1 Message Date
Paweł Kołodziejski 07471abda9 TINYGL: Fixed uninitialized 'z' variable warnings 2026-02-07 19:42:39 +01:00
Le Philousophe be0f3bb638 TINYGL: Fixed uninitialized 'texture' variable warnings 2026-02-07 19:30:37 +01:00
Paweł Kołodziejski 252a4ecff4 TINYGL: Fixed uninitialized 'pz' variable warnings 2026-02-07 19:23:50 +01:00
Paweł Kołodziejski 8e7bab49ce TINYGL: Formatting 2026-02-07 19:22:46 +01:00
Paweł Kołodziejski 9c38dab2f8 TINYGL: Moved few parameters from templates to speed up compilation and lower memory usage. 2026-02-07 17:25:48 +01:00
neuromancer ff5b6d253d TINYGL: extended tglStipple to allow background and foreground colors 2025-10-13 23:51:52 -03:00
Paweł Kołodziejski 83995d9b85 TINYGL: Avoid shifting negative values 2025-10-02 13:22:49 +02:00
Helco f6cf576e03 TINYGL: Add fast-path for default texture environment 2025-09-11 17:30:00 +02:00
Helco ebc33b9abb TINYGL: Add support for texture environments 2025-09-11 17:30:00 +02:00
Le Philousophe 39e41a4ea1 TINYGL: Fix draw when scissor test is enabled
When a test fails we still have to update the different parameters for
the following points.
Instead of returning, jump to the end of the function where the updates
take place.
This should also fix graphical issues with stencils.
2025-04-28 20:44:07 +02:00
Le Philousophe 71ba2fc12d TINYGL: Unify clipping rectangles and use a proper name
Clipping is not scissor.
2025-04-28 20:44:07 +02:00
neuromancer 00a0346983 TINYGL: make sure stipple pattern is copied into the internal states instead of using pointers 2024-06-01 15:33:50 +02:00
neuromancer 4cd57d59a8 TINYGL: removed the usage of stipple pattern from textured triangles 2024-06-01 15:33:50 +02:00
neuromancer e232c9d797 TINYGL: make sure the polygon stipple pattern is copied 2024-06-01 15:33:50 +02:00
neuromancer fdd84fd08a TINYGL: initial implementation of tglPolygonStipple 2024-06-01 15:33:50 +02:00
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