Struct create_vox::Voxobject [−][src]
Holds all the information needed to create a vox file.
Implementations
impl Voxobject
[src]
pub fn new(size_x: u16, size_y: u16, size_z: u16) -> Voxobject
[src]
Creates a new voxobject with the given size. Size needs to be between 1-255 on all axis.
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(100,150,100);
pub fn add_gradient(
&mut self,
index1: u8,
index2: u8,
color1: Color,
color2: Color
)
[src]
&mut self,
index1: u8,
index2: u8,
color1: Color,
color2: Color
)
Adds a gradient between the 2 indexes in the palette with the 2 colors.
Example
use create_vox::{Voxobject, Color}; let mut my_vox = Voxobject::new(10,10,10); let color1 = Color::new(255,255,0,255); let color2 = Color::new(0,255,255,255); my_vox.add_gradient(1,100,color1,color2);
pub fn add_voxel(&mut self, new_voxel: Voxel) -> Result<(), &str>
[src]
Adds one voxel to the voxobject.
Example
use create_vox::{Voxobject, Voxel}; let mut my_vox = Voxobject::new(20,20,20); let voxel = Voxel::new(0,0,0,100); my_vox.add_voxel(voxel).unwrap();
pub fn add_voxel_at_pos(
&mut self,
x: u8,
y: u8,
z: u8,
voxel_index: u8
) -> Result<(), &str>
[src]
&mut self,
x: u8,
y: u8,
z: u8,
voxel_index: u8
) -> Result<(), &str>
Adds a voxel at the position specified.
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.add_voxel_at_pos(3,7,3,1).unwrap();
pub fn clear_voxels(&mut self)
[src]
Deletes all voxels in the Voxobject
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.add_voxel_at_pos(3,7,3,1).unwrap(); my_vox.add_voxel_at_pos(3,6,3,2).unwrap(); my_vox.add_voxel_at_pos(3,5,3,3).unwrap(); my_vox.clear_voxels();
pub fn reset_palette(&mut self)
[src]
Resets all indexes in the pallete to the default color
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.set_all_palette_color(255, 100, 0, 255); my_vox.reset_palette();
pub fn num_of_voxels(&self) -> i32
[src]
Number of voxes in the Voxobject
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.add_voxel_at_pos(3,7,3,1).unwrap(); my_vox.add_voxel_at_pos(3,6,3,2).unwrap(); my_vox.add_voxel_at_pos(3,5,3,3).unwrap(); assert_eq!(3, my_vox.num_of_voxels())
pub fn set_size(&mut self, x: u16, y: u16, z: u16)
[src]
Sets the size of a Voxobject
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.set_size(5,5,5);
pub fn set_palette_color(&mut self, index: u8, r: u8, g: u8, b: u8, a: u8)
[src]
Sets the color of a specific index on the palette
Examples
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.set_palette_color(1,255,0,0,255);
pub fn set_all_palette_color(&mut self, r: u8, g: u8, b: u8, a: u8)
[src]
Sets color for all indexes on the palette
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(10,10,10); my_vox.set_all_palette_color(0,255,0,255);
pub fn add_cube(
&mut self,
startx: u8,
starty: u8,
startz: u8,
endx: u8,
endy: u8,
endz: u8,
colorindex: u8
) -> Result<(), &str>
[src]
&mut self,
startx: u8,
starty: u8,
startz: u8,
endx: u8,
endy: u8,
endz: u8,
colorindex: u8
) -> Result<(), &str>
Adds a cube of voxels in the voxobject.
Example
use create_vox::Voxobject; let mut my_vox = Voxobject::new(100,100,100); my_vox.add_cube(25,25,25,75,75,75,1).unwrap();
pub fn save_as_file(&mut self, name: &str)
[src]
Creates a file and saves the voxobject to it.
Example
use create_vox::{Voxobject, Voxel}; let mut my_vox = Voxobject::new(10,10,10); my_vox.set_all_palette_color(255,0,0,255); my_vox.add_voxel(Voxel::new(0,0,0,1)).unwrap(); my_vox.save_as_file("my_vox.vox");
Auto Trait Implementations
impl RefUnwindSafe for Voxobject
impl Send for Voxobject
impl Sync for Voxobject
impl Unpin for Voxobject
impl UnwindSafe for Voxobject
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,