write normals to tiletree texture
This commit is contained in:
+29
-27
@@ -42,7 +42,7 @@ use rand::{RngExt, SeedableRng, rngs::SmallRng};
|
||||
struct Args {
|
||||
/// use the reference pathtracer instead of the realtime lighting system.
|
||||
#[argh(switch)]
|
||||
pathtracer: Option<bool>,
|
||||
pathtracer: Option<bool>,
|
||||
/// stress test a scene with many lights.
|
||||
#[argh(switch)]
|
||||
many_lights: Option<bool>,
|
||||
@@ -102,14 +102,14 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let pos = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAPosition,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![],
|
||||
);
|
||||
let offset = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAAdd,
|
||||
size: 3,
|
||||
size: 3,
|
||||
},
|
||||
vec![
|
||||
pos[0],
|
||||
@@ -123,14 +123,14 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let sin = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSASin,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![pos[3]],
|
||||
);
|
||||
let offset = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAAdd,
|
||||
size: 3,
|
||||
size: 3,
|
||||
},
|
||||
vec![
|
||||
offset[0],
|
||||
@@ -144,7 +144,7 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let sphere = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSASDFSphere,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![
|
||||
offset[0],
|
||||
@@ -156,7 +156,7 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let torus = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSASDFTorus,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![
|
||||
pos[0],
|
||||
@@ -171,21 +171,21 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let min = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAMin,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![sphere[0], torus[0]],
|
||||
);
|
||||
let scaled_time = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAMul,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![pos[3], SSAInput::Constant(0.2)],
|
||||
);
|
||||
let moving_pos = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAAdd,
|
||||
size: 3,
|
||||
size: 3,
|
||||
},
|
||||
vec![
|
||||
pos[0],
|
||||
@@ -199,7 +199,7 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let pos_times_20 = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAMul,
|
||||
size: 3,
|
||||
size: 3,
|
||||
},
|
||||
vec![
|
||||
moving_pos[0],
|
||||
@@ -213,14 +213,14 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let sine_of_the_times = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSASin,
|
||||
size: 3,
|
||||
size: 3,
|
||||
},
|
||||
pos_times_20,
|
||||
);
|
||||
let sine_of_the_times = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAMul,
|
||||
size: 3,
|
||||
size: 3,
|
||||
},
|
||||
vec![
|
||||
sine_of_the_times[0],
|
||||
@@ -234,28 +234,28 @@ fn create_csg(seed: u64) -> SSATape {
|
||||
let multiply_out_1 = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAMul,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![sine_of_the_times[0], sine_of_the_times[1]],
|
||||
);
|
||||
let multiply_out_2 = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAMul,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![multiply_out_1[0], sine_of_the_times[2]],
|
||||
);
|
||||
let displacement = tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAAdd,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
vec![min[0], multiply_out_2[0]],
|
||||
);
|
||||
tape.push_instruction(
|
||||
SSAOpcodeSized {
|
||||
opcode: SSAOpcode::SSAReturn,
|
||||
size: 1,
|
||||
size: 1,
|
||||
},
|
||||
displacement,
|
||||
);
|
||||
@@ -322,11 +322,11 @@ fn setup_pica_pica(
|
||||
let csg = create_csg(0);
|
||||
|
||||
let tape = Tape {
|
||||
raytracing: MeshRaytracingFlags::OPAQUE,
|
||||
parts: csg,
|
||||
seed: 0,
|
||||
raytracing: MeshRaytracingFlags::OPAQUE,
|
||||
parts: csg,
|
||||
seed: 0,
|
||||
subdivision: 8,
|
||||
time: 0.0,
|
||||
time: 0.0,
|
||||
};
|
||||
let loaded_tape = asset_server.add(tape);
|
||||
|
||||
@@ -356,7 +356,8 @@ fn setup_pica_pica(
|
||||
Transform::from_translation(Vec3::new(0.219417, 2.5764852, 6.9718704)).with_rotation(
|
||||
Quat::from_xyzw(-0.1466768, 0.013738206, 0.002037309, 0.989087),
|
||||
),
|
||||
// Msaa::Off and CameraMainTextureUsages with STORAGE_BINDING are required for Solari
|
||||
// Msaa::Off and CameraMainTextureUsages with STORAGE_BINDING are
|
||||
// required for Solari
|
||||
CameraMainTextureUsages::default().with(TextureUsages::STORAGE_BINDING),
|
||||
Msaa::Off,
|
||||
));
|
||||
@@ -426,7 +427,7 @@ fn setup_many_lights(
|
||||
match plane_mesh.attribute_mut(Mesh::ATTRIBUTE_UV_0).unwrap() {
|
||||
VertexAttributeValues::Float32x2(items) => {
|
||||
items.iter_mut().flatten().for_each(|x| *x *= 3.0);
|
||||
}
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
let plane_mesh = meshes.add(plane_mesh);
|
||||
@@ -534,7 +535,8 @@ fn setup_many_lights(
|
||||
Transform::from_translation(Vec3::new(6.11329, 166.74896, 451.8226)).with_rotation(
|
||||
Quat::from_xyzw(-0.183938, 0.009093744, 0.0017017953, 0.9828943),
|
||||
),
|
||||
// Msaa::Off and CameraMainTextureUsages with STORAGE_BINDING are required for Solari
|
||||
// Msaa::Off and CameraMainTextureUsages with STORAGE_BINDING are
|
||||
// required for Solari
|
||||
CameraMainTextureUsages::default().with(TextureUsages::STORAGE_BINDING),
|
||||
Msaa::Off,
|
||||
Bloom {
|
||||
@@ -740,7 +742,7 @@ fn toggle_lights(
|
||||
#[derive(Component)]
|
||||
struct PatrolPath {
|
||||
path: Vec<(Vec3, Quat)>,
|
||||
i: usize,
|
||||
i: usize,
|
||||
}
|
||||
|
||||
fn patrol_path(mut query: Query<(&mut PatrolPath, &mut Transform)>, time: Res<Time<Virtual>>) {
|
||||
@@ -805,10 +807,10 @@ fn update_control_text(
|
||||
match robot_light_material.and_then(|m| materials.get(&m.0)) {
|
||||
Some(robot_light_material) if robot_light_material.emissive != LinearRgba::BLACK => {
|
||||
text.0.push_str("\n(2): Disable robot emissive light");
|
||||
}
|
||||
},
|
||||
_ => {
|
||||
text.0.push_str("\n(2): Enable robot emissive light");
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user