mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 07:47:37 +00:00
LibGL+LibGPU+LibSoftGPU: Implement matrix stack per texture unit
Each texture unit now has its own texture transformation matrix stack. Introduce a new texture unit configuration that is synced when changed. Because we're no longer passing a silly `Vector` when drawing each primitive, this results in a slightly improved frames per second :^)
This commit is contained in:
parent
1540c56e6c
commit
00d46e5d77
22 changed files with 208 additions and 152 deletions
|
@ -8,7 +8,9 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/Vector.h>
|
||||
#include <LibGL/Tex/Texture2D.h>
|
||||
#include <LibGfx/Matrix4x4.h>
|
||||
|
||||
namespace GL {
|
||||
|
||||
|
@ -49,6 +51,9 @@ public:
|
|||
bool texture_cube_map_enabled() const { return m_texture_cube_map_enabled; };
|
||||
void set_texture_cube_map_enabled(bool texture_cube_map_enabled) { m_texture_cube_map_enabled = texture_cube_map_enabled; }
|
||||
|
||||
FloatMatrix4x4& texture_matrix() { return m_texture_matrix_stack.last(); }
|
||||
Vector<FloatMatrix4x4>& texture_matrix_stack() { return m_texture_matrix_stack; }
|
||||
|
||||
private:
|
||||
GLenum m_alpha_combinator { GL_MODULATE };
|
||||
Array<GLenum, 3> m_alpha_operand { GL_SRC_ALPHA, GL_SRC_ALPHA, GL_SRC_ALPHA };
|
||||
|
@ -69,6 +74,9 @@ private:
|
|||
bool m_texture_2d_enabled { false };
|
||||
bool m_texture_3d_enabled { false };
|
||||
bool m_texture_cube_map_enabled { false };
|
||||
|
||||
// Matrix stack for this unit
|
||||
Vector<FloatMatrix4x4> m_texture_matrix_stack { FloatMatrix4x4::identity() };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue