pub fn create_attributes_v8(
    data: &MeshObjectData,
) -> ([(u32, AttributeBufferData); 4], MeshAttributes) {
    // 1. Convert the data into the appropriate format based on usage and component count.
    // TODO: Avoid collecting until the end?
    let positions = get_position_data_v8(&data.positions);
    let normals = get_vector_data_v8(&data.normals);
    let tangents = get_vector_data_v8(&data.tangents);
    let texture_coordinates = get_vector_data_v8(&data.texture_coordinates);
    let color_sets = get_color_data_v8(&data.color_sets);

    // 2. Compute the strides + offsets + attributes
    let mut stride0 = 0;
    let mut stride1 = 0;
    let mut mesh_attributes = Vec::new();

    add_attributes_v8(
        &mut mesh_attributes,
        &positions,
        &mut stride0,
        0,
        AttributeUsageV8::Position,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &normals,
        &mut stride0,
        0,
        AttributeUsageV8::Normal,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &tangents,
        &mut stride0,
        0,
        AttributeUsageV8::Tangent,
    );

    add_attributes_v8(
        &mut mesh_attributes,
        &texture_coordinates,
        &mut stride1,
        1,
        AttributeUsageV8::TextureCoordinate,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &color_sets,
        &mut stride1,
        1,
        AttributeUsageV8::ColorSet,
    );

    // 3. Chain the attributes and positions together.
    // TODO: Just return vector instead of SsbhArray?
    (
        [
            (
                stride0,
                AttributeBufferData::DataV8(
                    positions
                        .into_iter()
                        .chain(normals.into_iter())
                        .chain(tangents.into_iter())
                        .collect(),
                ),
            ),
            (
                stride1,
                AttributeBufferData::DataV8(
                    texture_coordinates
                        .into_iter()
                        .chain(color_sets.into_iter())
                        .collect(),
                ),
            ),
            // These last two vertex buffers never seem to contain any attributes.
            (32, AttributeBufferData::DataV8(Vec::new())),
            (0, AttributeBufferData::DataV8(Vec::new())),
        ],
        MeshAttributes::AttributesV8(mesh_attributes.into()),
    )
}
// TODO: More efficient to just take ownership of the vector data?
// TODO: create a struct for returning (strides, data, attributes)
More efficient to just take ownership of the vector data.
TODO: create a struct for returning (strides, data, attributes)
More efficient to just take ownership of the vector data . TODO : create a struct for returning ( strides data attributes )
pub fn create_attributes_v8(
    data: &MeshObjectData,
) -> ([(u32, AttributeBufferData); 4], MeshAttributes) {
    // 1. Convert the data into the appropriate format based on usage and component count.
    // TODO: Avoid collecting until the end?
    let positions = get_position_data_v8(&data.positions);
    let normals = get_vector_data_v8(&data.normals);
    let tangents = get_vector_data_v8(&data.tangents);
    let texture_coordinates = get_vector_data_v8(&data.texture_coordinates);
    let color_sets = get_color_data_v8(&data.color_sets);
    // 2. Compute the strides + offsets + attributes
    let mut stride0 = 0;
    let mut stride1 = 0;
    let mut mesh_attributes = Vec::new();
    add_attributes_v8(
        &mut mesh_attributes,
        &positions,
        &mut stride0,
        0,
        AttributeUsageV8::Position,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &normals,
        &mut stride0,
        0,
        AttributeUsageV8::Normal,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &tangents,
        &mut stride0,
        0,
        AttributeUsageV8::Tangent,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &texture_coordinates,
        &mut stride1,
        1,
        AttributeUsageV8::TextureCoordinate,
    );
    add_attributes_v8(
        &mut mesh_attributes,
        &color_sets,
        &mut stride1,
        1,
        AttributeUsageV8::ColorSet,
    );
    // 3. Chain the attributes and positions together.
    // TODO: Just return vector instead of SsbhArray?
    (
        [
            (
                stride0,
                AttributeBufferData::DataV8(
                    positions
                        .into_iter()
                        .chain(normals.into_iter())
                        .chain(tangents.into_iter())
                        .collect(),
                ),
            ),
            (
                stride1,
                AttributeBufferData::DataV8(
                    texture_coordinates
                        .into_iter()
                        .chain(color_sets.into_iter())
                        .collect(),
                ),
            ),
            // These last two vertex buffers never seem to contain any attributes.
            (32, AttributeBufferData::DataV8(Vec::new())),
            (0, AttributeBufferData::DataV8(Vec::new())),
        ],
        MeshAttributes::AttributesV8(mesh_attributes.into()),
    )
}
pub fn create_attributes_v8 ( data : & MeshObjectData , ) -> ( [ ( u32 , AttributeBufferData ) ; 4 ] , MeshAttributes ) { // 1. Convert the data into the appropriate format based on usage and component count. // TODO: Avoid collecting until the end? let positions = get_position_data_v8 ( & data . positions ) ; let normals = get_vector_data_v8 ( & data . normals ) ; let tangents = get_vector_data_v8 ( & data . tangents ) ; let texture_coordinates = get_vector_data_v8 ( & data . texture_coordinates ) ; let color_sets = get_color_data_v8 ( & data . color_sets ) ; // 2. Compute the strides + offsets + attributes let mut stride0 = 0 ; let mut stride1 = 0 ; let mut mesh_attributes = Vec :: new ( ) ; add_attributes_v8 ( & mut mesh_attributes , & positions , & mut stride0 , 0 , AttributeUsageV8 :: Position , ) ; add_attributes_v8 ( & mut mesh_attributes , & normals , & mut stride0 , 0 , AttributeUsageV8 :: Normal , ) ; add_attributes_v8 ( & mut mesh_attributes , & tangents , & mut stride0 , 0 , AttributeUsageV8 :: Tangent , ) ; add_attributes_v8 ( & mut mesh_attributes , & texture_coordinates , & mut stride1 , 1 , AttributeUsageV8 :: TextureCoordinate , ) ; add_attributes_v8 ( & mut mesh_attributes , & color_sets , & mut stride1 , 1 , AttributeUsageV8 :: ColorSet , ) ; // 3. Chain the attributes and positions together. // TODO: Just return vector instead of SsbhArray? ( [ ( stride0 , AttributeBufferData :: DataV8 ( positions . into_iter ( ) . chain ( normals . into_iter ( ) ) . chain ( tangents . into_iter ( ) ) . collect ( ) , ) , ) , ( stride1 , AttributeBufferData :: DataV8 ( texture_coordinates . into_iter ( ) . chain ( color_sets . into_iter ( ) ) . collect ( ) , ) , ) , // These last two vertex buffers never seem to contain any attributes. ( 32 , AttributeBufferData :: DataV8 ( Vec :: new ( ) ) ) , ( 0 , AttributeBufferData :: DataV8 ( Vec :: new ( ) ) ) , ] , MeshAttributes :: AttributesV8 ( mesh_attributes . into ( ) ) , ) }
TODO: More efficient to just take ownership of the vector data?
TODO : More efficient to just take ownership of the vector data?
data
&MeshObjectData
data
&MeshObjectData