Skip to content

Commit

Permalink
Support 3D textures
Browse files Browse the repository at this point in the history
  • Loading branch information
redstrate committed Apr 30, 2024
1 parent b8f49fa commit 47b2c3f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions src/tex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,27 @@ use crate::physis_Buffer;
use physis::tex::Texture;
use std::ptr::null_mut;
use std::{mem, slice};
use physis::tex::TextureType;

#[repr(C)]
#[derive(Clone, Copy)]
#[cfg(feature = "visual_data")]
pub struct physis_Texture {
texture_type: TextureType,
width: u32,
height: u32,
depth: u32,
rgba_size: u32,
rgba: *mut u8,
}

impl Default for physis_Texture {
fn default() -> Self {
Self {
texture_type: TextureType::TwoDimensional,
width: 0,
height: 0,
depth: 0,
rgba_size: 0,
rgba: null_mut(),
}
Expand All @@ -34,8 +39,10 @@ pub extern "C" fn physis_texture_parse(buffer: physis_Buffer) -> physis_Texture

if let Some(mut texture) = Texture::from_existing(data) {
let tex = physis_Texture {
texture_type: texture.texture_type,
width: texture.width,
height: texture.height,
depth: texture.depth,
rgba_size: texture.rgba.len() as u32,
rgba: texture.rgba.as_mut_ptr(),
};
Expand Down

0 comments on commit 47b2c3f

Please sign in to comment.