Application prototype #14
@ -11,16 +11,6 @@ struct vecInv {
|
|||||||
vec2 lt;
|
vec2 lt;
|
||||||
};
|
};
|
||||||
|
|
||||||
vecInv sphere(vec3 center, float radius) {
|
|
||||||
return vecInv(
|
|
||||||
center / radius,
|
|
||||||
vec2(
|
|
||||||
0.5 / radius,
|
|
||||||
0.5 * (dot(center, center) / radius - radius)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- uniforms ---
|
// --- uniforms ---
|
||||||
|
|
||||||
// construction. the SPHERE_MAX array size seems to affect frame rate a lot,
|
// construction. the SPHERE_MAX array size seems to affect frame rate a lot,
|
||||||
@ -35,8 +25,6 @@ uniform vec2 resolution;
|
|||||||
uniform float shortdim;
|
uniform float shortdim;
|
||||||
|
|
||||||
// controls
|
// controls
|
||||||
uniform vec2 ctrl;
|
|
||||||
uniform vec2 radius;
|
|
||||||
uniform float opacity;
|
uniform float opacity;
|
||||||
uniform float highlight;
|
uniform float highlight;
|
||||||
uniform int layer_threshold;
|
uniform int layer_threshold;
|
||||||
|
@ -7,7 +7,6 @@
|
|||||||
// https://stackoverflow.com/a/39684775
|
// https://stackoverflow.com/a/39684775
|
||||||
//
|
//
|
||||||
|
|
||||||
extern crate js_sys;
|
|
||||||
use core::array;
|
use core::array;
|
||||||
use nalgebra::{DMatrix, DVector, Rotation3, Vector3};
|
use nalgebra::{DMatrix, DVector, Rotation3, Vector3};
|
||||||
use sycamore::{prelude::*, motion::create_raf, rt::{JsCast, JsValue}};
|
use sycamore::{prelude::*, motion::create_raf, rt::{JsCast, JsValue}};
|
||||||
@ -343,8 +342,6 @@ fn main() {
|
|||||||
);
|
);
|
||||||
let resolution_loc = ctx.get_uniform_location(&program, "resolution");
|
let resolution_loc = ctx.get_uniform_location(&program, "resolution");
|
||||||
let shortdim_loc = ctx.get_uniform_location(&program, "shortdim");
|
let shortdim_loc = ctx.get_uniform_location(&program, "shortdim");
|
||||||
let ctrl_loc = ctx.get_uniform_location(&program, "ctrl"); /* DEBUG */
|
|
||||||
let radius_loc = ctx.get_uniform_location(&program, "radius"); /* DEBUG */
|
|
||||||
let opacity_loc = ctx.get_uniform_location(&program, "opacity");
|
let opacity_loc = ctx.get_uniform_location(&program, "opacity");
|
||||||
let highlight_loc = ctx.get_uniform_location(&program, "highlight");
|
let highlight_loc = ctx.get_uniform_location(&program, "highlight");
|
||||||
let layer_threshold_loc = ctx.get_uniform_location(&program, "layer_threshold");
|
let layer_threshold_loc = ctx.get_uniform_location(&program, "layer_threshold");
|
||||||
@ -483,8 +480,6 @@ fn main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// pass the control parameters
|
// pass the control parameters
|
||||||
ctx.uniform2f(ctrl_loc.as_ref(), ctrl_x.get() as f32, ctrl_y.get() as f32); /* DEBUG */
|
|
||||||
ctx.uniform2f(radius_loc.as_ref(), radius_x.get() as f32, radius_y.get() as f32); /* DEBUG */
|
|
||||||
ctx.uniform1f(opacity_loc.as_ref(), opacity.get() as f32);
|
ctx.uniform1f(opacity_loc.as_ref(), opacity.get() as f32);
|
||||||
ctx.uniform1f(highlight_loc.as_ref(), highlight.get() as f32);
|
ctx.uniform1f(highlight_loc.as_ref(), highlight.get() as f32);
|
||||||
ctx.uniform1i(layer_threshold_loc.as_ref(), layer_threshold.get() as i32);
|
ctx.uniform1i(layer_threshold_loc.as_ref(), layer_threshold.get() as i32);
|
||||||
|
Loading…
Reference in New Issue
Block a user