mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-05 07:41:01 +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: ba19328b98
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
|
@ -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
Add a link
Reference in a new issue