pre facing switch
This commit is contained in:
parent
3f4656939c
commit
dd568a75e3
5 changed files with 117 additions and 33 deletions
src/scene
|
@ -216,8 +216,8 @@ impl EmptyVolume {
|
|||
bottom_roughness.push(128);
|
||||
}
|
||||
else {
|
||||
bottom_colors.push(Vector3 { x: 255, y: 255, z: 255 });
|
||||
bottom_roughness.push(255);
|
||||
bottom_colors.push(Vector3 { x: 0, y: 0, z: 0 });
|
||||
bottom_roughness.push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -242,8 +242,8 @@ impl EmptyVolume {
|
|||
top_roughness.push(128);
|
||||
}
|
||||
else {
|
||||
top_colors.push(Vector3 { x: 255, y: 255, z: 255 });
|
||||
top_roughness.push(255);
|
||||
top_colors.push(Vector3 { x: 0, y: 0, z: 0 });
|
||||
top_roughness.push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -269,8 +269,8 @@ impl EmptyVolume {
|
|||
back_roughness.push(128);
|
||||
}
|
||||
else {
|
||||
back_colors.push(Vector3 { x: 255, y: 255, z: 255 });
|
||||
back_roughness.push(255);
|
||||
back_colors.push(Vector3 { x: 0, y: 0, z: 0 });
|
||||
back_roughness.push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -296,8 +296,8 @@ impl EmptyVolume {
|
|||
front_roughness.push(128);
|
||||
}
|
||||
else {
|
||||
front_colors.push(Vector3 { x: 255, y: 255, z: 255 });
|
||||
front_roughness.push(255);
|
||||
front_colors.push(Vector3 { x: 0, y: 0, z: 0 });
|
||||
front_roughness.push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ impl EmptyVolume {
|
|||
left_roughness.push(128);
|
||||
}
|
||||
else {
|
||||
left_colors.push(Vector3 { x: 255, y: 255, z: 255 });
|
||||
left_roughness.push(255);
|
||||
left_colors.push(Vector3 { x: 0, y: 0, z: 0 });
|
||||
left_roughness.push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -350,8 +350,8 @@ impl EmptyVolume {
|
|||
right_roughness.push(128);
|
||||
}
|
||||
else {
|
||||
right_colors.push(Vector3 { x: 255, y: 255, z: 255 });
|
||||
right_roughness.push(255);
|
||||
right_colors.push(Vector3 { x: 0, y: 0, z: 0 });
|
||||
right_roughness.push(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ pub struct PointLight{
|
|||
|
||||
impl PointLight {
|
||||
pub fn get_buffer_mem_size(&self) -> u32 {
|
||||
4 * 3 + 4 * 3
|
||||
3 + 3
|
||||
}
|
||||
|
||||
pub fn insert_into_memory(&self, mut v: Vec<u32>) -> Vec<u32> {
|
||||
|
@ -19,9 +19,9 @@ impl PointLight {
|
|||
v[self.memory_start + 1] = self.pos.y as u32;
|
||||
v[self.memory_start + 2] = self.pos.z as u32;
|
||||
|
||||
v[self.memory_start + 3] = self.color.x as u32;
|
||||
v[self.memory_start + 4] = self.color.y as u32;
|
||||
v[self.memory_start + 5] = self.color.z as u32;
|
||||
v[self.memory_start + 3] = (self.color.x * 255.0) as u32;
|
||||
v[self.memory_start + 4] = (self.color.y * 255.0) as u32;
|
||||
v[self.memory_start + 5] = (self.color.z * 255.0) as u32;
|
||||
v
|
||||
}
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ use anyhow::Ok;
|
|||
use vulkanalia::prelude::v1_0::*;
|
||||
use anyhow::Result;
|
||||
|
||||
use cgmath::{vec2, vec3};
|
||||
use cgmath::{vec2, vec3, Vector3};
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::rc::Rc;
|
||||
|
@ -14,6 +14,7 @@ use std::rc::Rc;
|
|||
use crate::app_data;
|
||||
use crate::app_data::AppData;
|
||||
use crate::buffer;
|
||||
use crate::primitives::rec_cuboid::Cuboid;
|
||||
use crate::vertex;
|
||||
use crate::primitives::cube::Cube;
|
||||
use crate::primitives::drawable::Drawable;
|
||||
|
@ -117,6 +118,15 @@ impl Scene {
|
|||
None => {}
|
||||
}
|
||||
}
|
||||
|
||||
let cube = Cuboid {
|
||||
pos: vec3(11.0, 11.0, 11.0),
|
||||
color: vec3(shade, 1.0, shade),
|
||||
tex_coord: vec2(0.0, 0.0),
|
||||
size: Vector3 {x: 0.5, y: 0.5, z: 0.5}
|
||||
};
|
||||
let index = self.sized_vertices.len();
|
||||
cube.draw(&data.topology, index, self);
|
||||
|
||||
let mut memory_index = 1; // zero should be the location for the overall length (also will be the invalid memory allocation for pointing to a nonexistant neighbor)
|
||||
for light in &mut self.point_lights {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue