Third step transitioning to Rust 2018.

This commit is contained in:
Nathan Vegdahl 2018-12-16 12:17:21 -08:00
parent 5fb349cc49
commit 178c0bd6cb
3 changed files with 6 additions and 6 deletions

View File

@ -172,7 +172,7 @@ impl<'a> BVH<'a> {
children_indices, children_indices,
split_axis, split_axis,
} => { } => {
let mut node = unsafe { arena.alloc_uninitialized_with_alignment::<BVHNode>(32) }; let node = unsafe { arena.alloc_uninitialized_with_alignment::<BVHNode>(32) };
let bounds = arena let bounds = arena
.copy_slice_with_alignment(&base.bounds[bounds_range.0..bounds_range.1], 32); .copy_slice_with_alignment(&base.bounds[bounds_range.0..bounds_range.1], 32);
@ -193,7 +193,7 @@ impl<'a> BVH<'a> {
bounds_range, bounds_range,
object_range, object_range,
} => { } => {
let mut node = unsafe { arena.alloc_uninitialized::<BVHNode>() }; let node = unsafe { arena.alloc_uninitialized::<BVHNode>() };
let bounds = arena.copy_slice(&base.bounds[bounds_range.0..bounds_range.1]); let bounds = arena.copy_slice(&base.bounds[bounds_range.0..bounds_range.1]);
*node = BVHNode::Leaf { *node = BVHNode::Leaf {

View File

@ -275,7 +275,7 @@ impl<'a> BVH4<'a> {
.copy_slice_with_alignment(&base.bounds[bounds_range.0..bounds_range.1], 32); .copy_slice_with_alignment(&base.bounds[bounds_range.0..bounds_range.1], 32);
// Build children // Build children
let mut children_mem = unsafe { let children_mem = unsafe {
arena.alloc_array_uninitialized_with_alignment::<BVH4Node>(child_count, 32) arena.alloc_array_uninitialized_with_alignment::<BVH4Node>(child_count, 32)
}; };
for i in 0..child_count { for i in 0..child_count {

View File

@ -37,7 +37,7 @@ impl<'a> TriangleMesh<'a> {
// Copy verts over to a contiguous area of memory, reorganizing them // Copy verts over to a contiguous area of memory, reorganizing them
// so that each vertices' time samples are contiguous in memory. // so that each vertices' time samples are contiguous in memory.
let vertices = { let vertices = {
let mut vertices = let vertices =
unsafe { arena.alloc_array_uninitialized(vert_count * time_sample_count) }; unsafe { arena.alloc_array_uninitialized(vert_count * time_sample_count) };
for vi in 0..vert_count { for vi in 0..vert_count {
@ -53,7 +53,7 @@ impl<'a> TriangleMesh<'a> {
// above. // above.
let normals = match vert_normals { let normals = match vert_normals {
Some(ref vnors) => { Some(ref vnors) => {
let mut normals = let normals =
unsafe { arena.alloc_array_uninitialized(vert_count * time_sample_count) }; unsafe { arena.alloc_array_uninitialized(vert_count * time_sample_count) };
for vi in 0..vert_count { for vi in 0..vert_count {
@ -70,7 +70,7 @@ impl<'a> TriangleMesh<'a> {
// Copy triangle vertex indices over, appending the triangle index itself to the tuple // Copy triangle vertex indices over, appending the triangle index itself to the tuple
let indices = { let indices = {
let mut indices = unsafe { arena.alloc_array_uninitialized(tri_indices.len()) }; let indices = unsafe { arena.alloc_array_uninitialized(tri_indices.len()) };
for (i, tri_i) in tri_indices.iter().enumerate() { for (i, tri_i) in tri_indices.iter().enumerate() {
indices[i] = (tri_i.0 as u32, tri_i.2 as u32, tri_i.1 as u32, i as u32); indices[i] = (tri_i.0 as u32, tri_i.2 as u32, tri_i.1 as u32, i as u32);
} }