@@ -3,6 +3,9 @@ import type { Geometry } from "./geometry";
33import type { Light } from "./light" ;
44import { Mesh } from "./mesh" ;
55
6+
7+ const HUGE = 1024 * 1024 * 10 ;
8+
69export class Scene {
710 projected_buffer ! :ArrayType ;
811 scene_buffer ! :ArrayType ;
@@ -72,14 +75,18 @@ export class Scene{
7275 add_mesh ( geometry :Geometry , color :vec3 = vec3 ( 0.2 , 0.2 , 0.2 ) ) :Mesh {
7376 const scene_size = geometry . indices . length * 4 ;
7477 const proj_size = geometry . vertices . length / 3 * 4 ;
75- const color_size = geometry . vertices . length * 3 ;
76- const raster_color_size = geometry . indices . length * 3 ;
78+ const color_size = geometry . vertices . length ;
79+ const raster_color_size = geometry . indices . length * 3 ;
7780
7881 const scene_view = this . scene_buffer . subarray ( this . scene_cursor , this . scene_cursor + scene_size ) ;
7982 const proj_view = this . projected_buffer . subarray ( this . projected_cursor , this . projected_cursor + proj_size ) ;
8083 const color_view = this . color_buffer . subarray ( this . color_cursor , this . color_cursor + color_size ) ;
8184 const raster_color = this . raster_color . subarray ( this . raster_color_cursor , this . raster_color_cursor + raster_color_size ) ;
8285
86+ console . log ( `Cursors: ${ [ this . scene_cursor , this . projected_cursor , this . color_cursor , this . raster_color_cursor ] } ` ) ;
87+ console . log ( `Scene_size for mesh: ${ scene_size } , proj = ${ proj_size } , color_size = ${ color_size } , raster_color_size = ${ raster_color_size } ` )
88+ console . log ( `Full sizes: ${ [ this . scene_buffer . length , this . projected_buffer . length , this . color_buffer . length , this . raster_color . length ] } ` )
89+
8390 this . scene_cursor += scene_size ;
8491 this . projected_cursor += proj_size ;
8592 this . color_cursor += color_size ;
0 commit comments