Struct blender_mesh::BlenderMesh[][src]

pub struct BlenderMesh { /* fields omitted */ }

All of the data about a mesh

TODO: Rename crate to MeshIr

Implementations

impl BlenderMesh[src]

pub fn combine_vertex_indices(
    &mut self,
    config: &CreateSingleIndexConfig
) -> SingleIndexedVertexAttributes
[src]

We store our exported Blender mesh with indices for positions, normals and uvs because

  1. Easier because we we can unit test that here vs. a blender python script that’s much trickier to test.

  2. Smaller to store the fields indexed than to expand them.


Most rendering pipelines only supports one index buffer, so here we convert our vertex data from having three indices to having one.

This typically requires some duplication of vertex data - we duplicate the minimum amount of vertex data necessary.

TODO: Need to continue refactoring

TODO: Make this function set BlenderMesh.vertex_attributes = VertexData::SingleIndexVertexData

TODO: Don’t work on additionally functionality until we’ve broken up these tests and implementation into smaller, specific pieces.

TODO: There are unexpected (based on the method’s name) mutations in here such as triangulation. Lot’s to refactor in this crate.

impl BlenderMesh[src]

pub fn interleave_vertex_data(&self) -> Vec<u8>

Notable traits for Vec<u8, Global>

impl Write for Vec<u8, Global>
[src]

impl BlenderMesh[src]

pub fn y_up(&mut self)[src]

Blender meshes get exported with a Z up coordinate system. Here we flip our coordinate system to be y up

@see https://gamedev.stackexchange.com/a/7932

TODO: When we have bone data we’ll need to change them to port change-mat4-coordinate-system into here. https://github.com/chinedufn/change-mat4-coordinate-system/blob/master/change-mat4-coordinate-system.js

impl BlenderMesh[src]

pub fn pbr_cube_without_textures() -> Self[src]

Create a default Blender cube with uniform PBR texture inputs.

A 2x2x2 cube centered about the origin.

impl BlenderMesh[src]

pub fn armature_name(&self) -> Option<&String>[src]

The name of this mesh’s parent armature

pub fn set_armature_name(&mut self, armature_name: Option<String>)[src]

Set the name of this mesh’s parent armature

pub fn materials(&self) -> &HashMap<String, PrincipledBSDF>[src]

A map of material name to the material’s data

pub fn materials_mut(&mut self) -> &mut HashMap<String, PrincipledBSDF>[src]

A mutable map of material name to the material’s data

pub fn custom_properties(&self) -> &HashMap<String, CustomProperty>[src]

Custom properties for this mesh

i.e. in Blender this might be found with bpy.context.view_layer.objects.active.keys()

pub fn bounding_box(&self) -> BoundingBox[src]

The smallest box that contains the entire mesh

pub fn set_bounding_box(&mut self, bounding_box: BoundingBox)[src]

Set the mesh’s bounding box.

pub fn name(&self) -> &String[src]

The name of the mesh

pub fn set_name(&mut self, name: String)[src]

Set the name of the mesh

Trait Implementations

impl Clone for BlenderMesh[src]

impl Debug for BlenderMesh[src]

impl Default for BlenderMesh[src]

impl<'de> Deserialize<'de> for BlenderMesh[src]

impl PartialEq<BlenderMesh> for BlenderMesh[src]

impl Serialize for BlenderMesh[src]

impl StructuralPartialEq for BlenderMesh[src]

Auto Trait Implementations

impl RefUnwindSafe for BlenderMesh

impl Send for BlenderMesh

impl Sync for BlenderMesh

impl Unpin for BlenderMesh

impl UnwindSafe for BlenderMesh

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,