Skip to content

Commit 0a51213

Browse files
authored
Merge pull request #21 from LykenSol/sample-cube
Rename Channel to SampleCube.
2 parents 1d421fd + 76267ee commit 0a51213

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

shaders/src/bubble_buckey_balls.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
//! // Tested on Nvidia GTX 780 Windows 7
99
//! ```
1010
11-
use crate::Channel;
11+
use crate::SampleCube;
1212
use shared::*;
1313
use spirv_std::glam::{vec2, vec3, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
1414

@@ -428,7 +428,7 @@ fn material(surfid: f32, surf: &mut SurfaceData) {
428428
}
429429
}
430430

431-
impl<C0: Channel, C1: Channel> State<C0, C1> {
431+
impl<C0: SampleCube, C1: SampleCube> State<C0, C1> {
432432
fn integrate_dir_light(&self, ldir: Vec3, lcolor: Vec3, surf: SurfaceData) -> Vec3 {
433433
let vdir: Vec3 = (self.cam_origin - surf.point).normalize();
434434

shaders/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ pub mod soft_shadow_variation;
2929
pub mod tileable_water_caustic;
3030
pub mod two_tweets;
3131

32-
pub trait Channel: Copy {
32+
pub trait SampleCube: Copy {
3333
fn sample_cube(self, p: Vec3) -> Vec4;
3434
}
3535

@@ -38,7 +38,7 @@ struct ConstantColor {
3838
color: Vec4,
3939
}
4040

41-
impl Channel for ConstantColor {
41+
impl SampleCube for ConstantColor {
4242
fn sample_cube(self, _: Vec3) -> Vec4 {
4343
self.color
4444
}
@@ -50,7 +50,7 @@ struct RgbCube {
5050
intensity: f32,
5151
}
5252

53-
impl Channel for RgbCube {
53+
impl SampleCube for RgbCube {
5454
fn sample_cube(self, p: Vec3) -> Vec4 {
5555
(p.abs() * self.intensity).extend(self.alpha)
5656
}

shaders/src/playing_marble.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//! // Created by S. Guillitte 2015
77
//! ```
88
9-
use crate::Channel;
9+
use crate::SampleCube;
1010
use shared::*;
1111
use spirv_std::glam::{vec2, vec3, vec4, Mat2, Vec2, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles};
1212

@@ -62,7 +62,7 @@ fn map(mut p: Vec3) -> f32 {
6262
res / 2.0
6363
}
6464

65-
impl<C0: Channel> Inputs<C0> {
65+
impl<C0: SampleCube> Inputs<C0> {
6666
fn raymarch(&self, ro: Vec3, rd: Vec3, tminmax: Vec2) -> Vec3 {
6767
let mut t: f32 = tminmax.x;
6868
let dt: f32 = 0.02;

shaders/src/skyline.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
//! */
1212
//! ```
1313
14-
use crate::Channel;
14+
use crate::SampleCube;
1515
use shared::*;
1616
use spirv_std::glam::{
1717
const_vec2, vec2, vec3, Vec2, Vec2Swizzles, Vec3, Vec3Swizzles, Vec4, Vec4Swizzles,
@@ -497,7 +497,7 @@ fn calc_windows(
497497
normal.x += pits * 0.25;
498498
}
499499

500-
impl<C0: Channel> State<C0> {
500+
impl<C0: SampleCube> State<C0> {
501501
// Input is UV coordinate of pixel to render.
502502
// Output is RGB color.
503503
fn ray_trace(&mut self, frag_coord: Vec2) -> Vec3 {
@@ -982,7 +982,7 @@ impl<C0: Channel> State<C0> {
982982
}
983983
}
984984

985-
impl<C0: Channel> State<C0> {
985+
impl<C0: SampleCube> State<C0> {
986986
// This function breaks the image down into blocks and scans
987987
// through them, rendering 1 block at a time. It's for non-
988988
// realtime things that take a long time to render.

0 commit comments

Comments
 (0)