2023-01-19 03:43:02 +00:00
|
|
|
export { Camera } from './core/Camera.js'
|
|
|
|
export { Entity } from './core/Entity.js'
|
|
|
|
export { Material } from './core/Material.js'
|
|
|
|
export { Mesh } from './core/Mesh.js'
|
|
|
|
export { Renderer } from './core/Renderer.js'
|
|
|
|
export { Scene } from './core/Scene.js'
|
|
|
|
export { Shader } from './core/Shader.js'
|
|
|
|
export { Mat4 } from './math/Mat4.js'
|
|
|
|
export { Vec3 } from './math/Vec3.js'
|
2023-01-20 02:21:17 +00:00
|
|
|
export { M as Math } from './math/Math.js'
|
|
|
|
export { Cube } from './geometry/Cube.js'
|
|
|
|
export { Sphere } from './geometry/Sphere.js'
|
|
|
|
export { OBJ } from './geometry/OBJ.js'
|
2023-01-19 19:32:58 +00:00
|
|
|
export { File } from './io/File.js'
|
|
|
|
export { Input } from './io/Input.js'
|
|
|
|
export { SimpleController } from './controller/SimpleController.js'
|
|
|
|
export { SimpleShader } from './shader/SimpleShader.js'
|
|
|
|
|
2023-01-19 03:43:02 +00:00
|
|
|
export { Loop }
|
2023-01-19 13:53:44 +00:00
|
|
|
export { DT }
|
2023-01-19 03:43:02 +00:00
|
|
|
|
2023-01-19 18:39:40 +00:00
|
|
|
import { Input } from './io/Input.js'
|
2023-01-20 02:21:17 +00:00
|
|
|
import { gl } from './core/Renderer.js'
|
2023-01-19 18:39:40 +00:00
|
|
|
|
2023-01-19 13:53:44 +00:00
|
|
|
var DT = 0;
|
|
|
|
var last = Date.now()
|
2023-01-19 03:43:02 +00:00
|
|
|
const Loop = (fn) => {
|
2023-01-19 18:39:40 +00:00
|
|
|
Input.setup()
|
2023-01-19 03:43:02 +00:00
|
|
|
const callback = () => {
|
2023-01-19 13:53:44 +00:00
|
|
|
var now = Date.now()
|
|
|
|
DT = ( now - last) / 1000
|
|
|
|
last = now
|
2023-01-20 02:21:17 +00:00
|
|
|
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
|
|
|
|
gl.clearColor(0, 0, 0, 1);
|
2023-01-19 03:43:02 +00:00
|
|
|
fn()
|
|
|
|
window.requestAnimationFrame(callback)
|
|
|
|
}
|
|
|
|
callback()
|
|
|
|
}
|