Skip to content

Commit f7bcc4d

Browse files
committed
edit demos
1 parent 0b438f0 commit f7bcc4d

File tree

5 files changed

+13
-8
lines changed

5 files changed

+13
-8
lines changed

objmtl.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function MtlData(){
2525
* Creates one or more 3D shapes from the data
2626
* in this OBJ file.
2727
* @param {Scene3D} scene 3D scene to load the shape with.
28-
* @return {Array<Shape>} Array of shapes.
28+
* @return {glutil.ShapeGroup} Group of shapes.
2929
*/
3030
ObjData.prototype.toShape=function(scene){
3131
var multi=new ShapeGroup();
@@ -43,7 +43,7 @@ ObjData.prototype.toShape=function(scene){
4343
* @param {Scene3D} scene 3D scene to load the shape with.
4444
* @param {string} name Name from the OBJ file of the portion
4545
* of the model to use.
46-
* @return {Array<Shape>} Array of shapes.
46+
* @return {glutil.ShapeGroup} Group of shapes.
4747
*/
4848
ObjData.prototype.toShapeFromName=function(scene, name){
4949
var multi=new ShapeGroup();

shapes.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
// Create the 3D scene; find the HTML canvas and pass it
1818
// to Scene3D.
1919
var scene=new Scene3D(document.getElementById("canvas"));
20+
scene.setClearColor("white");
2021
scene.setOrthoAspect(
2122
-20,20,
2223
-10,10,

squares.html

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -295,21 +295,23 @@ <h1>Shader Filters</h1>
295295
}
296296

297297
function platonicGroup(scene){
298+
var size=4.5;
299+
var dims=size*2/Math.sqrt(3);
298300
var mesh=Meshes.createBox(dims,dims,dims);
299301
var group=new ShapeGroup();
300302
group.addShape(
301303
scene.makeShape(mesh).setMaterial(shiny("red")).setPosition(-15,5,0))
302304
// this configuration of a sphere results in an octahedron
303-
mesh=Meshes.createSphere(4.5,4,2,true);
305+
mesh=Meshes.createSphere(size,4,2,true);
304306
group.addShape(
305307
scene.makeShape(mesh).setMaterial(shiny("blue")).setPosition(-5,5,0))
306-
mesh=icosahedron(4.5);
308+
mesh=icosahedron(size);
307309
group.addShape(
308310
scene.makeShape(mesh).setMaterial(shiny("lime")).setPosition(5,5,0))
309-
mesh=tetrahedron(4.5);
311+
mesh=tetrahedron(size);
310312
group.addShape(
311313
scene.makeShape(mesh).setMaterial(shiny("darkorange")).setPosition(15,5,0))
312-
mesh=dodecahedron(4.5);
314+
mesh=dodecahedron(size);
313315
group.addShape(
314316
scene.makeShape(mesh).setMaterial(shiny("yellow")).setPosition(-15,-5,0))
315317
return group
@@ -326,7 +328,7 @@ <h1>Shader Filters</h1>
326328
var yy=((y/100)+1)/2
327329
var mesh=Meshes.createPlane(0.2,0.2);
328330
group.addShape(scene.makeShape(mesh)
329-
.setColor(color ? [0,xx,yy] : "white")
331+
.setColor(color ? [0,xx,yy] : [1,0.7,0.7])
330332
.setPosition(x/100+0.1,y/100+0.1,0));
331333
color=!color;
332334
}
@@ -338,7 +340,7 @@ <h1>Shader Filters</h1>
338340
// Create the 3D scene; find the HTML canvas and pass it
339341
// to Scene3D.
340342
var scene=new Scene3D((document.getElementById("canvas")));
341-
var dims=4.5*2/Math.sqrt(3);
343+
scene.setClearColor("white")
342344
var blinds=blindsGroup(scene)
343345
var platonic=platonicGroup(scene)
344346
linknone();

stl.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// Create the 3D scene; find the HTML canvas and pass it
2424
// to Scene3D.
2525
var scene=new Scene3D(document.getElementById("canvas"));
26+
scene.setClearColor("white");
2627
var camera=new Camera(scene,45,1,1000).setDistance(80);
2728
var mat=new Material("red","red")
2829
GLUtil.loadStlFromUrl("holder.stl").then(function(mesh){

surfaces.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -190,6 +190,7 @@
190190
// Create the 3D scene; find the HTML canvas and pass it
191191
// to Scene3D.
192192
var scene=new Scene3D(document.getElementById("canvas"));
193+
scene.setClearColor("white")
193194
var camera=new Camera(scene,45,1,100);
194195
camera.setDistance(5);
195196
var material=new Material().setParams({

0 commit comments

Comments
 (0)