35 lines
294 B
JavaScript
35 lines
294 B
JavaScript
|
|
export class Scene {
|
||
|
|
|
||
|
|
constructor( ) {
|
||
|
|
|
||
|
|
this.meshes = [];
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
addMesh( mesh ) {
|
||
|
|
|
||
|
|
this.meshes.push( mesh );
|
||
|
|
|
||
|
|
return this;
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
|
||
|
|
draw( passEncoder ) {
|
||
|
|
|
||
|
|
for ( const mesh of this.meshes ) {
|
||
|
|
|
||
|
|
if ( typeof mesh.draw === "function" ) {
|
||
|
|
|
||
|
|
mesh.draw( passEncoder );
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|