UNPKG

d2k

Version:

rendering engine from the Dark side of the Force - wip

66 lines (50 loc) 1.32 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>rendering-engine - hello world</title> <style> * { box-sizing: border-box; } html, body { width: 100%; height: 100%; } body { margin: 0; font-family: sans-serif; font-size: 12px; } canvas { position: absolute; left: 0; right: 0; top: 0; bottom: 0; z-index: 100; margin: auto; } </style> </head> <body> <script src="../../src/rendering-engine/index.js"></script> <script> const { Camera, Plane, Renderer, Scene } = d2k; const scene = new Scene(); const camera = new Camera(); camera.position.z = -8; const renderer = new Renderer(); const plane = new Plane( { width: 2, height: 2 } ); scene.add( plane ); document.body.appendChild( renderer.canvas ); window.addEventListener( 'resize', _ => renderer.resize(), false ); renderer.onrender( ( { time } ) => { renderer.render( { scene, camera } ); } ); console.log( { camera, plane, renderer, scene } ); </script> </body> </html>