diff options
| author | HampusM <hampus@hampusmat.com> | 2026-08-26 15:57:28 +0200 |
|---|---|---|
| committer | HampusM <hampus@hampusmat.com> | 2026-08-26 15:57:28 +0200 |
| commit | d896f416d174fb6ae8e465ad6f4fe87751702659 (patch) | |
| tree | 882c323c553fa85667c2332a1f5c5b248f8ad338 | |
| parent | 1d45911e59b53b598e1af1ebe67ef23396eb8e12 (diff) | |
feat(opengl-bindings): add depth component texture pixel data format
| -rw-r--r-- | opengl-bindings/src/texture.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/opengl-bindings/src/texture.rs b/opengl-bindings/src/texture.rs index 9ed7926..4bf8ac6 100644 --- a/opengl-bindings/src/texture.rs +++ b/opengl-bindings/src/texture.rs @@ -421,6 +421,14 @@ pub enum SrgbaDataType UnsignedByte = crate::sys::UNSIGNED_BYTE, } +#[derive(Debug, Clone, Copy)] +#[non_exhaustive] +#[repr(u32)] +pub enum DepthComponentDataType +{ + Float32 = crate::sys::FLOAT, +} + /// Texture pixel data format. #[derive(Debug, Clone, Copy)] #[non_exhaustive] @@ -430,6 +438,7 @@ pub enum PixelDataFormat Rgba(RgbaDataType), Srgb(SrgbDataType), Srgba(SrgbaDataType), + DepthComponent(DepthComponentDataType), } impl PixelDataFormat @@ -441,6 +450,9 @@ impl PixelDataFormat Self::Rgba(RgbaDataType::UnsignedByte) => crate::sys::RGBA8, Self::Srgb(SrgbDataType::UnsignedByte) => crate::sys::SRGB8, Self::Srgba(SrgbaDataType::UnsignedByte) => crate::sys::SRGB8_ALPHA8, + Self::DepthComponent(DepthComponentDataType::Float32) => { + crate::sys::DEPTH_COMPONENT32F + } } } @@ -449,6 +461,7 @@ impl PixelDataFormat match self { Self::Rgb(_) | Self::Srgb(_) => crate::sys::RGB, Self::Rgba(_) | Self::Srgba(_) => crate::sys::RGBA, + Self::DepthComponent(_) => crate::sys::DEPTH_COMPONENT, } } @@ -459,6 +472,7 @@ impl PixelDataFormat Self::Srgb(ty) => ty as crate::sys::types::GLenum, Self::Rgba(ty) => ty as crate::sys::types::GLenum, Self::Srgba(ty) => ty as crate::sys::types::GLenum, + Self::DepthComponent(ty) => ty as crate::sys::types::GLenum, } } @@ -467,6 +481,7 @@ impl PixelDataFormat match self { Self::Rgb(_) | Self::Srgb(_) => 3, Self::Rgba(_) | Self::Srgba(_) => 4, + Self::DepthComponent(_) => 1, } } } |
