Open ghost opened 8 years ago
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>3D ROOM</title> <link rel="stylesheet" href="style.css"> <!--</head>--> </head> <body> <script src="script.js"></script> <script> var scene; var world; var color = "#ffeb3b"; function graph(x,y,z) { var voxel = new voxelcss.Voxel(x*50, y*50, z*50, 50, { mesh: new voxelcss.Mesh(new voxelcss.ColorFace(color)) }); world.add(voxel); voxel.addEventListener("VoxelClick",function() {alert();}); } function init(element) { var PI = Math.PI; scene = new voxelcss.Scene(); var lightSource = new voxelcss.LightSource(300, 300, 300, 750, 0.3, 1); world = new voxelcss.World(scene); scene.rotate(-PI / 8, PI / 4, 0); scene.attach(element); scene.addLightSource(lightSource); for(x=0;x<=100;x++) { for(z=0;z<=100;z++) {graph(x,0,z);} graph(x,100,100); graph(x,100,0); } for(y=0;y<=100;y++) { graph(0,y,0); graph(100,y,0); graph(0,y,100); graph(100,y,100); } for (z=0; z<=100; z++) { graph(0,100,z); graph(100,100,z); } } init(document.body); </script> </body> </html>
Try this. It crashes the browser.
So, it's not good for games.
Try this. It crashes the browser.