View Source<!-- NOTE: The following source code may contain generated
content. You can also use your browser's 'View Source' feature.-->
<html><head><meta name="viewport" content="user-scalable=no,initial-scale=1,maximum-scale=1">
<meta charset="utf-8">
<style>
body { margin: 0px; }
canvas { width:100%; height:100%; overflow: hidden; }
</style>
<script type="text/javascript" src="../h3du_min.js"></script>
<script type="text/javascript" src="demoutil.js"></script><script src="../extras/meshjson.js"></script>
<script type="text/javascript" src="../extras/meshjson.js"></script>
</head>
<body>
<canvas id="canvas"></canvas>
<script id="demo">
/* global H3DU */
// <!--
/*
Any copyright to this file is released to the Public Domain.
In case this is not possible, this work is also
licensed under the Unlicense: https://unlicense.org/
*/
// Create the 3D scene; find the HTML canvas and pass it
// to Scene3D.
var scene = new H3DU.Scene3D(document.getElementById("canvas"));
scene.setClearColor("white");
var sub = new H3DU.Batch3D();
sub.getLights().setBasic();
sub.orthoAspect(
-20, 20,
-10, 10,
-20, 20
);
var mesh;
mesh = H3DU.Meshes.createBox(7, 7, 7)
.transform(H3DU.Math.mat4rotated(20, 1, 1, 0));
sub.addShape(
new H3DU.Shape(mesh).setColor("red").setPosition(-15, 5, 0));
mesh = H3DU.Meshes.createSphere(4.5);
sub.addShape(
new H3DU.Shape(mesh).setColor("blue").setPosition(-5, 5, 0));
mesh = H3DU.Meshes.createPointedStar(5, 4.5, 2);
sub.addShape(
new H3DU.Shape(mesh).setColor("lime").setPosition(5, 5, 0));
mesh = H3DU.Meshes.createPartialDisk(1, 4.5, 32, 1, 20, 150);
sub.addShape(
new H3DU.Shape(mesh).setColor("darkorange").setPosition(15, 5, 0));
mesh = H3DU.Meshes.createTorus(1, 3)
.transform(H3DU.Math.mat4rotated(60, 0, 1, 1));
sub.addShape(
new H3DU.Shape(mesh).setColor("yellow").setPosition(-15, -5, 0));
mesh = H3DU.Meshes.createCylinder(4.5, 4.5, 9)
.transform(H3DU.Math.mat4translated(0, 0, -4.5))
.transform(H3DU.Math.mat4rotated(80, 1,0, 0));
sub.addShape(
new H3DU.Shape(mesh).setColor("brown")
.setPosition(-5, -5, 0)
);
mesh = H3DU.Meshes.createPlane(9, 9);
sub.addShape(
new H3DU.Shape(mesh).setColor("darkgreen").setPosition(5, -5, 0));
mesh = H3DU.Meshes.createCylinder(4.5, 0, 9)
.transform(H3DU.Math.mat4translated(0, 0, -4.5))
.transform(H3DU.Math.mat4rotated(85, 1,0, 0));
sub.addShape(
new H3DU.Shape(mesh).setColor("rebeccapurple")
.setPosition(15, -5, 0)
);
H3DU.renderLoop(function(time) {
"use strict";
scene.render(sub);
});
// -->
</script>
</body></html>