// Generated by scripts/generate.mjs from bindings/api.mjs. Do not edit.

///|
#external
pub type BufferAttribute

///|
#module("@mizchi/three-mbt/constructors")
pub extern "js" fn BufferAttribute::from_floats(
  values : FixedArray[Double],
  item_size : Int,
) -> BufferAttribute = "float32BufferAttribute"

///|
pub extern "js" fn BufferAttribute::name(self : BufferAttribute) -> String =
  #| (self) => self.name

///|
pub extern "js" fn BufferAttribute::set_name(
  self : BufferAttribute,
  value : String,
) -> Unit =
  #| (self, value) => { self.name = value; }

///|
pub extern "js" fn BufferAttribute::count(self : BufferAttribute) -> Int =
  #| (self) => self.count

///|
pub extern "js" fn BufferAttribute::item_size(self : BufferAttribute) -> Int =
  #| (self) => self.itemSize

///|
pub extern "js" fn BufferAttribute::normalized(self : BufferAttribute) -> Bool =
  #| (self) => self.normalized

///|
pub extern "js" fn BufferAttribute::get_x(
  self : BufferAttribute,
  index : Int,
) -> Double =
  #| (self, index) => self.getX(index)

///|
pub extern "js" fn BufferAttribute::get_y(
  self : BufferAttribute,
  index : Int,
) -> Double =
  #| (self, index) => self.getY(index)

///|
pub extern "js" fn BufferAttribute::get_z(
  self : BufferAttribute,
  index : Int,
) -> Double =
  #| (self, index) => self.getZ(index)

///|
pub extern "js" fn BufferAttribute::get_w(
  self : BufferAttribute,
  index : Int,
) -> Double =
  #| (self, index) => self.getW(index)

///|
pub extern "js" fn BufferAttribute::set_xyz(
  self : BufferAttribute,
  index : Int,
  x : Double,
  y : Double,
  z : Double,
) -> BufferAttribute =
  #| (self, index, x, y, z) => self.setXYZ(index, x, y, z)

///|
pub extern "js" fn BufferAttribute::get_component(
  self : BufferAttribute,
  index : Int,
  component : Int,
) -> Double =
  #| (self, index, component) => self.getComponent(index, component)

///|
pub extern "js" fn BufferAttribute::set_component(
  self : BufferAttribute,
  index : Int,
  component : Int,
  value : Double,
) -> BufferAttribute =
  #| (self, index, component, value) => self.setComponent(index, component, value)

///|
pub extern "js" fn BufferAttribute::mark_needs_update(
  self : BufferAttribute,
) -> Unit =
  #| (self) => { self.needsUpdate = true; }

///|
pub extern "js" fn BufferAttribute::usage(
  self : BufferAttribute,
) -> BufferUsage =
  #| (self) => (self.isInterleavedBufferAttribute ? self.data : self).usage

///|
pub extern "js" fn BufferAttribute::set_usage(
  self : BufferAttribute,
  value : BufferUsage,
) -> BufferAttribute =
  #| (self, value) => { (self.isInterleavedBufferAttribute ? self.data : self).setUsage(value); return self; }

///|
pub extern "js" fn BufferAttribute::add_update_range(
  self : BufferAttribute,
  start : Int,
  count : Int,
) -> Unit =
  #| (self, start, count) => (self.isInterleavedBufferAttribute ? self.data : self).addUpdateRange(start, count)

///|
pub extern "js" fn BufferAttribute::clear_update_ranges(
  self : BufferAttribute,
) -> Unit =
  #| (self) => (self.isInterleavedBufferAttribute ? self.data : self).clearUpdateRanges()

///|
pub extern "js" fn BufferAttribute::update_ranges(
  self : BufferAttribute,
) -> FixedArray[BufferUpdateRange] =
  #| (self) => (self.isInterleavedBufferAttribute ? self.data : self).updateRanges.map(range => ({...range}))

///|
extern "js" fn BufferAttribute::ffi_as_packed(
  self : BufferAttribute,
) -> Nullable[PackedBufferAttribute] =
  #| (self) => self.isBufferAttribute === true ? self : null

///|
pub fn BufferAttribute::as_packed(
  self : BufferAttribute,
) -> PackedBufferAttribute? {
  self.ffi_as_packed().to_option()
}

///|
pub extern "js" fn BufferAttribute::set_x(
  self : BufferAttribute,
  index : Int,
  value : Double,
) -> BufferAttribute =
  #| (self, index, value) => self.setX(index, value)

///|
pub extern "js" fn BufferAttribute::set_y(
  self : BufferAttribute,
  index : Int,
  value : Double,
) -> BufferAttribute =
  #| (self, index, value) => self.setY(index, value)

///|
pub extern "js" fn BufferAttribute::set_z(
  self : BufferAttribute,
  index : Int,
  value : Double,
) -> BufferAttribute =
  #| (self, index, value) => self.setZ(index, value)

///|
pub extern "js" fn BufferAttribute::set_w(
  self : BufferAttribute,
  index : Int,
  value : Double,
) -> BufferAttribute =
  #| (self, index, value) => self.setW(index, value)

///|
pub extern "js" fn BufferAttribute::set_xy(
  self : BufferAttribute,
  index : Int,
  x : Double,
  y : Double,
) -> BufferAttribute =
  #| (self, index, x, y) => self.setXY(index, x, y)

///|
pub extern "js" fn BufferAttribute::set_xyzw(
  self : BufferAttribute,
  index : Int,
  x : Double,
  y : Double,
  z : Double,
  w : Double,
) -> BufferAttribute =
  #| (self, index, x, y, z, w) => self.setXYZW(index, x, y, z, w)

///|
pub extern "js" fn BufferAttribute::apply_matrix4(
  self : BufferAttribute,
  matrix : Matrix4,
) -> BufferAttribute =
  #| (self, matrix) => self.applyMatrix4(matrix)

///|
pub extern "js" fn BufferAttribute::apply_normal_matrix(
  self : BufferAttribute,
  matrix : Matrix3,
) -> BufferAttribute =
  #| (self, matrix) => self.applyNormalMatrix(matrix)

///|
pub extern "js" fn BufferAttribute::transform_direction(
  self : BufferAttribute,
  matrix : Matrix4,
) -> BufferAttribute =
  #| (self, matrix) => self.transformDirection(matrix)