forked from StudioInfinity/dyna3
Name attribute sizes
This commit is contained in:
parent
5a1d8bc201
commit
d5eaf11a17
1 changed files with 4 additions and 3 deletions
|
@ -408,6 +408,8 @@ pub fn Display() -> View {
|
||||||
}
|
}
|
||||||
|
|
||||||
if scene_changed.get() {
|
if scene_changed.get() {
|
||||||
|
const SPACE_DIM: usize = 3;
|
||||||
|
|
||||||
/* INSTRUMENTS */
|
/* INSTRUMENTS */
|
||||||
// measure mean frame interval
|
// measure mean frame interval
|
||||||
frames_since_last_sample += 1;
|
frames_since_last_sample += 1;
|
||||||
|
@ -486,7 +488,6 @@ pub fn Display() -> View {
|
||||||
point(0.0, -0.15, -1.0)
|
point(0.0, -0.15, -1.0)
|
||||||
];
|
];
|
||||||
|
|
||||||
const SPACE_DIM: usize = 3;
|
|
||||||
let asm_to_world_sp = asm_to_world.rows(0, SPACE_DIM);
|
let asm_to_world_sp = asm_to_world.rows(0, SPACE_DIM);
|
||||||
let point_reps_world_sp = point_reps.map(|rep| &asm_to_world_sp * rep);
|
let point_reps_world_sp = point_reps.map(|rep| &asm_to_world_sp * rep);
|
||||||
DMatrix::from_columns(&point_reps_world_sp).cast::<f32>()
|
DMatrix::from_columns(&point_reps_world_sp).cast::<f32>()
|
||||||
|
@ -532,7 +533,7 @@ pub fn Display() -> View {
|
||||||
|
|
||||||
// bind the viewport vertex position buffer to the position
|
// bind the viewport vertex position buffer to the position
|
||||||
// attribute in the vertex shader
|
// attribute in the vertex shader
|
||||||
bind_to_attribute(&ctx, viewport_position_attr, 3, &viewport_position_buffer);
|
bind_to_attribute(&ctx, viewport_position_attr, SPACE_DIM as i32, &viewport_position_buffer);
|
||||||
|
|
||||||
// draw the scene
|
// draw the scene
|
||||||
ctx.draw_arrays(WebGl2RenderingContext::TRIANGLES, 0, VERTEX_CNT as i32);
|
ctx.draw_arrays(WebGl2RenderingContext::TRIANGLES, 0, VERTEX_CNT as i32);
|
||||||
|
@ -545,7 +546,7 @@ pub fn Display() -> View {
|
||||||
// load the point positions into a new buffer and bind it to the
|
// load the point positions into a new buffer and bind it to the
|
||||||
// position attribute in the vertex shader
|
// position attribute in the vertex shader
|
||||||
let point_position_buffer = load_new_buffer(&ctx, point_positions.as_slice());
|
let point_position_buffer = load_new_buffer(&ctx, point_positions.as_slice());
|
||||||
bind_to_attribute(&ctx, point_position_attr, 3, &point_position_buffer);
|
bind_to_attribute(&ctx, point_position_attr, SPACE_DIM as i32, &point_position_buffer);
|
||||||
|
|
||||||
// draw the scene
|
// draw the scene
|
||||||
ctx.draw_arrays(WebGl2RenderingContext::POINTS, 0, point_positions.ncols() as i32);
|
ctx.draw_arrays(WebGl2RenderingContext::POINTS, 0, point_positions.ncols() as i32);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue