mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 13:48:12 +00:00
LibGL: Add texture sampling to SW Rasterizer
The software rasterizer now samples a texture passed to us from the GL context. This is currently a bit of a hack, as we should be scanning from a list of texture units and checking if they are enabled. For now, this at least gives some visual confirmation that texturing is working as it should
This commit is contained in:
parent
e21ba0cd12
commit
3287709df9
3 changed files with 16 additions and 5 deletions
|
@ -414,10 +414,13 @@ SoftwareRasterizer::SoftwareRasterizer(const Gfx::IntSize& min_size)
|
|||
{
|
||||
}
|
||||
|
||||
void SoftwareRasterizer::submit_triangle(const GLTriangle& triangle)
|
||||
void SoftwareRasterizer::submit_triangle(const GLTriangle& triangle, const Texture& texture)
|
||||
{
|
||||
rasterize_triangle(m_options, *m_render_target, *m_depth_buffer, triangle, [](const FloatVector2&, const FloatVector4& color) -> FloatVector4 {
|
||||
return color;
|
||||
rasterize_triangle(m_options, *m_render_target, *m_depth_buffer, triangle, [&texture](const FloatVector2& uv, const FloatVector4& color) -> FloatVector4 {
|
||||
// TODO: We'd do some kind of multitexturing/blending here
|
||||
// Construct a vector for the texel we want to sample
|
||||
FloatVector4 texel = texture.sample_texel(uv);
|
||||
return texel * color;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue