mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 03:25:13 +00:00
LibWeb/WebGL: Implement vertexAttrib{1,2,3,4}fv
This commit is contained in:
parent
4e8ec1e793
commit
ba19328b98
Notes:
github-actions[bot]
2024-12-13 08:20:54 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/ba19328b987 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2878 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/gmta
4 changed files with 25 additions and 7 deletions
|
@ -13,3 +13,6 @@ typedef unrestricted float GLclampf;
|
|||
// WebGL 2.0
|
||||
typedef long long GLint64;
|
||||
typedef unsigned long long GLuint64;
|
||||
|
||||
// FIXME: BufferSource should be a Float32Array
|
||||
typedef (BufferSource or sequence<GLfloat>) Float32List;
|
||||
|
|
|
@ -182,10 +182,10 @@ interface mixin WebGLRenderingContextBase {
|
|||
undefined vertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z);
|
||||
undefined vertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
|
||||
|
||||
[FIXME] undefined vertexAttrib1fv(GLuint index, Float32List values);
|
||||
[FIXME] undefined vertexAttrib2fv(GLuint index, Float32List values);
|
||||
[FIXME] undefined vertexAttrib3fv(GLuint index, Float32List values);
|
||||
[FIXME] undefined vertexAttrib4fv(GLuint index, Float32List values);
|
||||
undefined vertexAttrib1fv(GLuint index, Float32List values);
|
||||
undefined vertexAttrib2fv(GLuint index, Float32List values);
|
||||
undefined vertexAttrib3fv(GLuint index, Float32List values);
|
||||
undefined vertexAttrib4fv(GLuint index, Float32List values);
|
||||
|
||||
undefined vertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLintptr offset);
|
||||
|
||||
|
|
|
@ -9,9 +9,6 @@ typedef (ImageBitmap or
|
|||
// FIXME: VideoFrame
|
||||
) TexImageSource;
|
||||
|
||||
// FIXME: BufferSource should be a Float32Array
|
||||
typedef (BufferSource or sequence<GLfloat>) Float32List;
|
||||
|
||||
// FIXME: BufferSource should be a Int32Array
|
||||
typedef (BufferSource or sequence<GLint>) Int32List;
|
||||
|
||||
|
|
|
@ -709,6 +709,24 @@ public:
|
|||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "vertexAttrib1fv"sv || function.name == "vertexAttrib2fv"sv || function.name == "vertexAttrib3fv"sv || function.name == "vertexAttrib4fv"sv) {
|
||||
auto number_of_vector_elements = function.name.substring_view(12, 1);
|
||||
function_impl_generator.set("number_of_vector_elements", number_of_vector_elements);
|
||||
function_impl_generator.append(R"~~~(
|
||||
if (values.has<Vector<float>>()) {
|
||||
auto& data = values.get<Vector<float>>();
|
||||
glVertexAttrib@number_of_vector_elements@fv(index, data.data());
|
||||
return;
|
||||
}
|
||||
|
||||
auto& typed_array_base = static_cast<JS::TypedArrayBase&>(*values.get<GC::Root<WebIDL::BufferSource>>()->raw_object());
|
||||
auto& float32_array = verify_cast<JS::Float32Array>(typed_array_base);
|
||||
float const* data = float32_array.data().data();
|
||||
glVertexAttrib@number_of_vector_elements@fv(index, data);
|
||||
)~~~");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (function.name == "getParameter"sv) {
|
||||
generate_get_parameter(function_impl_generator);
|
||||
continue;
|
||||
|
|
Loading…
Add table
Reference in a new issue