1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:57:45 +00:00

LibGL+LibSoftGPU: Implement texture coordinate generation

Texture coordinate generation is the concept of automatically
generating vertex texture coordinates instead of using the provided
coordinates (i.e. `glTexCoord`).

This commit implements support for:

* The `GL_TEXTURE_GEN_Q/R/S/T` capabilities
* The `GL_OBJECT_LINEAR`, `GL_EYE_LINEAR`, `GL_SPHERE_MAP`,
  `GL_REFLECTION_MAP` and `GL_NORMAL_MAP` modes
* Object and eye plane coefficients (write-only at the moment)

This changeset allows Tux Racer to render its terrain :^)
This commit is contained in:
Jelle Raaijmakers 2021-12-30 00:56:41 +01:00 committed by Andreas Kling
parent 69da279073
commit c19632128c
5 changed files with 236 additions and 8 deletions

View file

@ -26,6 +26,11 @@
namespace SoftGPU {
struct TexCoordGenerationConfig {
TexCoordGenerationMode mode { TexCoordGenerationMode::EyeLinear };
FloatVector4 coefficients {};
};
struct RasterizerOptions {
bool shade_smooth { true };
bool enable_depth_test { false };
@ -57,6 +62,8 @@ struct RasterizerOptions {
WindingOrder front_face { WindingOrder::CounterClockwise };
bool cull_back { true };
bool cull_front { false };
u8 texcoord_generation_enabled_coordinates { TexCoordGenerationCoordinate::None };
Array<TexCoordGenerationConfig, 4> texcoord_generation_config {};
};
inline static constexpr size_t const num_samplers = 32;