Loading a mesh is like loading a music, texture or any big resources.
All these asynchronously load must be handle by the onEnter method.
async onEnter() { this.mesh = new Gfx3MeshJSM(); await mesh.loadFromFile('./play/cube.jsm'); this.mesh.setMaterial(new Gfx3Material({ texture: await gfx3TextureManager.loadTexture('./play/cube.png') })); }
update(ts) { this.mesh.update(ts); }
draw() { this.mesh.draw(); gfx3DebugRenderer.drawGrid(UT.MAT4_ROTATE_X(Math.PI * 0.5), 20, 1); }
Each drawable has an "id" property composed of 4 number values.
This "id" property is mostly used by post-process shader to filter what effect should be applied.
Usage | r | g | b | a |
------------ | -- | -- | -- | -- |
Identifier | n | |||
Decals group | n | |||
Light group | n | |||
Pixelation | 1 | |||
Color limit | 2 | |||
Dithering | 4 | |||
Outline | 8 | |||
Shadow vol | 16 |