Skip to content

Commit

Permalink
Add vertex_attrib_4_{i32, u32}
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <[email protected]>
  • Loading branch information
sagudev committed Oct 23, 2024
1 parent dce4d64 commit d7a6626
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1607,6 +1607,10 @@ pub trait HasContext: __private::Sealed {

unsafe fn vertex_attrib_4_f32(&self, index: u32, x: f32, y: f32, z: f32, w: f32);

unsafe fn vertex_attrib_4_i32(&self, index: u32, x: i32, y: i32, z: i32, w: i32);

unsafe fn vertex_attrib_4_u32(&self, index: u32, x: u32, y: u32, z: u32, w: u32);

unsafe fn vertex_attrib_1_f32_slice(&self, index: u32, v: &[f32]);

unsafe fn vertex_attrib_2_f32_slice(&self, index: u32, v: &[f32]);
Expand Down
10 changes: 10 additions & 0 deletions src/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3545,6 +3545,16 @@ impl HasContext for Context {
gl.VertexAttrib4f(index, x, y, z, w);
}

unsafe fn vertex_attrib_4_i32(&self, index: u32, x: i32, y: i32, z: i32, w: i32) {
let gl = &self.raw;
gl.VertexAttribI4i(index, x, y, z, w);
}

unsafe fn vertex_attrib_4_u32(&self, index: u32, x: u32, y: u32, z: u32, w: u32) {
let gl = &self.raw;
gl.VertexAttribI4ui(index, x, y, z, w);
}

unsafe fn vertex_attrib_1_f32_slice(&self, index: u32, v: &[f32]) {
let gl = &self.raw;
gl.VertexAttrib1fv(index, v.as_ptr());
Expand Down
14 changes: 14 additions & 0 deletions src/web_sys.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5155,6 +5155,20 @@ impl HasContext for Context {
}
}

unsafe fn vertex_attrib_4_i32(&self, index: u32, x: i32, y: i32, z: i32, w: i32) {
match self.raw {
RawRenderingContext::WebGl1(ref _gl) => panic!("vertex_attrib_4_i32 not supported"),
RawRenderingContext::WebGl2(ref gl) => gl.vertex_attrib_i4i(index, x, y, z, w),
}
}

unsafe fn vertex_attrib_4_u32(&self, index: u32, x: u32, y: u32, z: u32, w: u32) {
match self.raw {
RawRenderingContext::WebGl1(ref _gl) => panic!("vertex_attrib_4_u32 not supported"),
RawRenderingContext::WebGl2(ref gl) => gl.vertex_attrib_i4ui(index, x, y, z, w),
}
}

unsafe fn vertex_attrib_1_f32_slice(&self, index: u32, v: &[f32]) {
match self.raw {
RawRenderingContext::WebGl1(ref gl) => gl.vertex_attrib1fv_with_f32_array(index, v),
Expand Down

0 comments on commit d7a6626

Please sign in to comment.