add and improve...

dev-2.0
Michael Aschauer 2017-01-24 20:26:19 +01:00
rodzic 695746f34e
commit 75c1774b8f
4 zmienionych plików z 158 dodań i 167 usunięć

Wyświetl plik

@ -22,11 +22,8 @@
<script type="text/javascript" src="stitchcode/jquery.js"></script> <script type="text/javascript" src="stitchcode/jquery.js"></script>
<script type="text/javascript" src="stitchcode/Filesaver.js"></script> <script type="text/javascript" src="stitchcode/Filesaver.js"></script>
<script type="text/javascript" src="stitchcode/three.js"></script> <script type="text/javascript" src="stitchcode/three.js"></script>
<script type="text/javascript" src="stitchcode/OrbitControls.js"></script> <script type="text/javascript" src="stitchcode/OrbitControls.js"></script>
<script type="text/javascript" src="stitchcode/threee/THREE.MeshLine.js"></script>
<script type="text/javascript" src="stitchcode/turtleShepherd.js"></script> <script type="text/javascript" src="stitchcode/turtleShepherd.js"></script>
<script type="text/javascript" src="stitchcode/blocks.js"></script> <script type="text/javascript" src="stitchcode/blocks.js"></script>
<script type="text/javascript" src="stitchcode/store.js"></script> <script type="text/javascript" src="stitchcode/store.js"></script>
@ -35,7 +32,6 @@
<script type="text/javascript" src="stitchcode/gui-cloud.js"></script> <script type="text/javascript" src="stitchcode/gui-cloud.js"></script>
<script type="text/javascript" src="stitchcode/cloud.js"></script> <script type="text/javascript" src="stitchcode/cloud.js"></script>
<script type="text/javascript"> <script type="text/javascript">
var world; var world;
window.onload = function () { window.onload = function () {

Wyświetl plik

@ -3962,10 +3962,12 @@ SpriteMorph.prototype.bounceOffEdge = function () {
SpriteMorph.prototype.setRotationX = function (absoluteX) { SpriteMorph.prototype.setRotationX = function (absoluteX) {
this.setRotationCenter(new Point(absoluteX, this.yPosition())); this.setRotationCenter(new Point(absoluteX, this.yPosition()));
alert(absoluteX);
}; };
SpriteMorph.prototype.setRotationY = function (absoluteY) { SpriteMorph.prototype.setRotationY = function (absoluteY) {
this.setRotationCenter(new Point(this.xPosition(), absoluteY)); this.setRotationCenter(new Point(this.xPosition(), absoluteY));
alert(absolutexy);
}; };
SpriteMorph.prototype.setRotationCenter = function (absoluteCoordinate) { SpriteMorph.prototype.setRotationCenter = function (absoluteCoordinate) {

Wyświetl plik

@ -32,19 +32,6 @@ IDE_Morph.prototype.createLogo = function () {
this.logo.drawNew(); this.logo.drawNew();
}; };
/*
IDE_Morph.prototype.init = (function init (oldInit) {
return function(isAutoFill) {
var retval = oldInit.call(this, isAutoFill);
this.currentCategory = 'network';
this.maxVisibleNodes = DEFAULT_MAX_VISIBLE_NODES;
this.logoURL = 'edgy_logo.png';
return retval;
}
}(IDE_Morph.prototype.init));
*/
// Single Sprite mode, no corral and no tabs in the scripting area // Single Sprite mode, no corral and no tabs in the scripting area
IDE_Morph.prototype.createCorralBar = nop; IDE_Morph.prototype.createCorralBar = nop;
IDE_Morph.prototype.createCorral = nop; IDE_Morph.prototype.createCorral = nop;
@ -633,7 +620,7 @@ IDE_Morph.prototype.createStatusDisplay = function () {
element = new Morph(); element = new Morph();
element.setHeight(1); element.setHeight(1);
element.setWidth(this.width()); element.setWidth(this.width());
element.setColor(new Color(150, 150, 150)); element.setColor(new Color(200, 200, 200));
element.newLines = 0.5; element.newLines = 0.5;
element.flush = true; element.flush = true;
} else { } else {
@ -701,7 +688,7 @@ IDE_Morph.prototype.createStatusDisplay = function () {
space.newLines = 0.5; space.newLines = 0.5;
elements.push(space); elements.push(space);
elements.push('Total Stitches: '); elements.push(' Total Stitches: ');
element = new StringMorph(); element = new StringMorph();
element.update = function () { element.update = function () {
this.text = (stage.turtleShepherd.getStepCount()).toString()+ " "; this.text = (stage.turtleShepherd.getStepCount()).toString()+ " ";
@ -730,65 +717,71 @@ IDE_Morph.prototype.createStatusDisplay = function () {
elements.push('-'); elements.push('-');
var toogleShowStitchPointsButton = new ToggleMorph(
'checkbox',
null,
function () {
stage.renderer.toggleStitchPoints();
},
'Stitchpoints',
function () {
return stage.renderer.showingStitchPoints;
});
toogleShowStitchPointsButton.columns = 4;
toogleShowStitchPointsButton.newColumn = 1;
elements.push(toogleShowStitchPointsButton);
/* var toogleShowJumpLinesButton = new ToggleMorph(
// Buttons and toggles 'checkbox',
var toogleShowStitchButton = new ToggleMorph( null,
'checkbox', function () {
null, stage.renderer.toggleJumpLines();
function () { },
turtleShepherd.toogleShowStitches(); 'Jumps',
stage.reRender(); function () {
}, return stage.renderer.showingJumpLines;
'Stitches', });
function () { toogleShowJumpLinesButton.columns = 4;
return turtleShepherd.getShowStitches(); toogleShowJumpLinesButton.newColumn = 2;
}); elements.push(toogleShowJumpLinesButton);
toogleShowStitchButton.columns = 3;
toogleShowStitchButton.newColumn = 1;
//toogleShowStitchButton.newLines = 1;
elements.push(toogleShowStitchButton); var toggleGridButton = new ToggleMorph(
'checkbox',
null,
function () {
stage.scene.grid.toggle();
},
'Grid',
function () {
return stage.scene.grid.visible;
});
toggleGridButton.columns = 4;
toggleGridButton.newColumn = 3;
elements.push(toggleGridButton);
var toogleShowJumpsButton = new ToggleMorph( var toogleTurtleButton = new ToggleMorph(
'checkbox', 'checkbox',
null, null,
function () { function () {
turtleShepherd.toogleShowJumpStitches(); stage.renderer.toggleTurtle();
stage.reRender(); },
}, 'Turtle',
'Jump Stitches', function () {
function () { return stage.renderer.showingTurtle;
return turtleShepherd.getShowJumpStitches(); });
});
toogleShowJumpsButton.columns = 3; toogleTurtleButton.newLines = 2;
toogleShowJumpsButton.newColumn = 2; elements.push(toogleTurtleButton);
//toogleShowJumpsButton.newLines = 2; elements.push('-');
elements.push(toogleShowJumpsButton);
var toogleShowGridButton = new ToggleMorph(
'checkbox',
null,
function () {
turtleShepherd.toogleShowGrid();
stage.reRender();
},
'Grid',
function () {
return turtleShepherd.getShowGrid();
});
//toogleShowGridButton.columns = 3;
toogleShowGridButton.newLines = 2;
//toogleShowGridButton.newColumn = 1;
elements.push(toogleShowGridButton);
*/
var space = new Morph();
space.alpha = 0;
space.newLines = 1;
elements.push(space);
var resetCameraButton = new PushButtonMorph(
null,
function () { stage.camera.reset(); },
'Reset View'
);
resetCameraButton.columns = 4;
resetCameraButton.newColumn = 2;
elements.push(resetCameraButton);
var toggleTurboButton = new ToggleMorph( var toggleTurboButton = new ToggleMorph(
'checkbox', 'checkbox',
@ -800,12 +793,13 @@ IDE_Morph.prototype.createStatusDisplay = function () {
function () { function () {
return stage.isFastTracked; return stage.isFastTracked;
}); });
//toggleTurboButton.columns = 1; toggleTurboButton.columns = 4;
//toggleTurboButton.newColumn = 1; toggleTurboButton.newColumn = 1;
toggleTurboButton.newLines = 2;
elements.push(toggleTurboButton); elements.push(toggleTurboButton);
elements.forEach(function(each) { myself.statusDisplay.addElement(each); }); elements.forEach(function(each) { myself.statusDisplay.addElement(each); });
}; };
@ -1347,33 +1341,6 @@ IDE_Morph.prototype.createSpriteBar = function () {
}; };
}; };
// StageMorph user menu
StageMorph.prototype.userMenu = function () {
var ide = this.parentThatIsA(IDE_Morph),
menu = new MenuMorph(this),
shiftClicked = this.world().currentKey === 16,
myself = this;
if (ide && ide.isAppMode) {
// menu.addItem('help', 'nop');
return menu;
}
//menu.addItem("edit", 'edit');
menu.addItem("show all", 'showAll');
menu.addItem(
"pic...",
function () {
window.open(myself.fullImageClassic().toDataURL());
},
'open a new window\nwith a picture of the stage'
);
return menu;
};
IDE_Morph.prototype.createCategories = function () { IDE_Morph.prototype.createCategories = function () {
// assumes the logo has already been created // assumes the logo has already been created
var myself = this; var myself = this;

Wyświetl plik

@ -7,8 +7,10 @@ SpriteMorph.prototype.init = function(globals) {
this.origInit(globals); this.origInit(globals);
this.hide(); this.hide();
this.lastJumped = false; this.lastJumped = false;
this.turtle = null;
}; };
SpriteMorph.prototype.addStitch = function(x1, y1, x2, y2) { SpriteMorph.prototype.addStitch = function(x1, y1, x2, y2) {
var stage = this.parentThatIsA(StageMorph), var stage = this.parentThatIsA(StageMorph),
lineMaterial = new THREE.LineDashedMaterial( lineMaterial = new THREE.LineDashedMaterial(
@ -60,6 +62,7 @@ SpriteMorph.prototype.addJumpLine = function(x1, y1, x2, y2) {
jumpLine.geometry.vertices = jumpLine.points; jumpLine.geometry.vertices = jumpLine.points;
jumpLine.geometry.verticesNeedUpdate = true; jumpLine.geometry.verticesNeedUpdate = true;
jumpLine.line = new THREE.Line(jumpLine.geometry, lineMaterial); jumpLine.line = new THREE.Line(jumpLine.geometry, lineMaterial);
jumpLine.line.visible = stage.renderer.showingJumpLines;
stage.myJumpLines.add(jumpLine.line); stage.myJumpLines.add(jumpLine.line);
@ -68,7 +71,7 @@ SpriteMorph.prototype.addJumpLine = function(x1, y1, x2, y2) {
}; };
SpriteMorph.prototype.addStitchPoint = function(x1, y1) { SpriteMorph.prototype.addStitchPoint = function(x1, y1) {
var stage = this.parentThatIsA(StageMorph); var stage = this.parentThatIsA(StageMorph);
var geometry = new THREE.CircleGeometry( 1.5, 4 ); var geometry = new THREE.CircleGeometry( 1.5, 4 );
geometry.vertices.shift(); geometry.vertices.shift();
@ -76,6 +79,7 @@ SpriteMorph.prototype.addStitchPoint = function(x1, y1) {
var circle = new THREE.Mesh( geometry, material ); var circle = new THREE.Mesh( geometry, material );
circle.translateX(x1); circle.translateX(x1);
circle.translateY(y1); circle.translateY(y1);
circle.visible = stage.renderer.showingStitchPoints;
stage.myStitchPoints.add(circle); stage.myStitchPoints.add(circle);
@ -87,6 +91,7 @@ SpriteMorph.prototype.origForward = SpriteMorph.prototype.forward;
SpriteMorph.prototype.forward = function (steps) { SpriteMorph.prototype.forward = function (steps) {
var dest, var dest,
dist = steps * this.parent.scale || 0; dist = steps * this.parent.scale || 0;
stage = this.parentThatIsA(StageMorph);
oldx = this.xPosition(); oldx = this.xPosition();
oldy = this.yPosition(); oldy = this.yPosition();
@ -101,8 +106,7 @@ SpriteMorph.prototype.forward = function (steps) {
this.setPosition(dest); this.setPosition(dest);
this.positionTalkBubble(); this.positionTalkBubble();
stage.turtleShepherd.moveTo(
this.parentThatIsA(StageMorph).turtleShepherd.moveTo(
oldx, oldy, oldx, oldy,
this.xPosition(), this.yPosition(), this.xPosition(), this.yPosition(),
this.isDown ); this.isDown );
@ -113,12 +117,14 @@ SpriteMorph.prototype.forward = function (steps) {
this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition()); this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition());
} }
this.addStitchPoint(this.xPosition(), this.yPosition()); this.addStitchPoint(this.xPosition(), this.yPosition());
stage.moveTurtle(this.xPosition(), this.yPosition());
//this.changed(); //this.changed();
}; };
SpriteMorph.prototype.origGotoXY = SpriteMorph.prototype.gotoXY; SpriteMorph.prototype.origGotoXY = SpriteMorph.prototype.gotoXY;
SpriteMorph.prototype.gotoXY = function (x, y, justMe) { SpriteMorph.prototype.gotoXY = function (x, y, justMe) {
var stage = this.parentThatIsA(StageMorph);
oldx = this.xPosition(); oldx = this.xPosition();
oldy = this.yPosition(); oldy = this.yPosition();
this.origGotoXY(x, y, justMe); this.origGotoXY(x, y, justMe);
@ -130,16 +136,24 @@ SpriteMorph.prototype.gotoXY = function (x, y, justMe) {
this.xPosition(), this.yPosition(), this.xPosition(), this.yPosition(),
this.isDown ); this.isDown );
if (this.isDown) if (this.isDown)
this.addStitch(oldx, oldy, this.xPosition(), this.yPosition()); this.addStitch(oldx, oldy, this.xPosition(), this.yPosition());
else { else {
this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition()); this.addJumpLine(oldx, oldy, this.xPosition(), this.yPosition());
} }
this.addStitchPoint(this.xPosition(), this.yPosition()); this.addStitchPoint(this.xPosition(), this.yPosition());
//this.changed(); stage.moveTurtle(this.xPosition(), this.yPosition());
} }
}; };
SpriteMorph.prototype.origSetHeading = SpriteMorph.prototype.setHeading;
SpriteMorph.prototype.setHeading = function (degrees) {
var stage = this.parentThatIsA(StageMorph);
this.origSetHeading(degrees);
stage.rotateTurtle(this.heading);
};
SpriteMorph.prototype.drawLine = function (start, dest) {}; SpriteMorph.prototype.drawLine = function (start, dest) {};
SpriteMorph.prototype.origSilentGotoXY = SpriteMorph.prototype.silentGotoXY; SpriteMorph.prototype.origSilentGotoXY = SpriteMorph.prototype.silentGotoXY;
@ -214,11 +228,11 @@ StageMorph.prototype.init = function (globals) {
this.initScene(); this.initScene();
this.initRenderer(); this.initRenderer();
this.initCamera(); this.initCamera();
this.initLights();
this.turtleShepherd = new TurtleShepherd(); this.turtleShepherd = new TurtleShepherd();
this.scene.grid.draw(); this.scene.grid.draw();
this.myObjects = new THREE.Object3D(); this.myObjects = new THREE.Object3D();
this.myStitchPoints = new THREE.Object3D(); this.myStitchPoints = new THREE.Object3D();
this.myStitchLines = new THREE.Object3D(); this.myStitchLines = new THREE.Object3D();
@ -228,7 +242,7 @@ StageMorph.prototype.init = function (globals) {
this.scene.add(this.myStitchLines); this.scene.add(this.myStitchLines);
this.scene.add(this.myJumpLines); this.scene.add(this.myJumpLines);
//this.trailsCanvas = this.renderer.domElement; this.initTurtle();
}; };
StageMorph.prototype.initScene = function () { StageMorph.prototype.initScene = function () {
@ -255,6 +269,7 @@ StageMorph.prototype.initScene = function () {
this.lines = []; this.lines = [];
limit = this.interval.x * 20 limit = this.interval.x * 20
for (x = -limit / this.interval.x; x <= limit / this.interval.x; x++) { for (x = -limit / this.interval.x; x <= limit / this.interval.x; x++) {
p1 = new THREE.Vector3(x * this.interval.x, -limit, 0); p1 = new THREE.Vector3(x * this.interval.x, -limit, 0);
p2 = new THREE.Vector3(x * this.interval.x, limit, 0); p2 = new THREE.Vector3(x * this.interval.x, limit, 0);
@ -279,9 +294,9 @@ StageMorph.prototype.initScene = function () {
this.lines.push(l); this.lines.push(l);
} }
for (y = -limit/10 / this.interval.y; y <= limit/10 / this.interval.y; y++) { for (y = -limit/10 / this.interval.y / 10; y <= limit/10 / this.interval.y / 10 ; y++) {
p1 = new THREE.Vector3(-limit, y * this.interval.y* 10, 0); p1 = new THREE.Vector3(-limit, y * this.interval.y/ 10, 0);
p2 = new THREE.Vector3(limit, y * this.interval.y* 10, 0); p2 = new THREE.Vector3(limit, y * this.interval.y/ 10, 0);
l = myself.scene.addLineFromPointToPointWithColor(p1, p2, color2); l = myself.scene.addLineFromPointToPointWithColor(p1, p2, color2);
l.visible = this.visible; l.visible = this.visible;
this.lines.push(l); this.lines.push(l);
@ -304,16 +319,16 @@ StageMorph.prototype.initScene = function () {
this.scene.grid.toggle = function () { this.scene.grid.toggle = function () {
var myInnerSelf = this; var myInnerSelf = this;
this.visible = !this.visible; this.visible = !this.visible;
this.lines.forEach(function (line){ line.visible = myInnerSelf.visible }); this.lines.forEach(function (line){ line.visible = myInnerSelf.visible; });
myself.reRender(); myself.reRender();
}; };
}; };
StageMorph.prototype.clearAll = function () { StageMorph.prototype.clearAll = function () {
for (var i = this.myObjects.children.length - 1; i >= 0; i--) { /*for (var i = this.myObjects.children.length - 1; i >= 0; i--) {
this.myObjects.remove(this.myObjects.children[i]); this.myObjects.remove(this.myObjects.children[i]);
} }*/
for (i = this.myStitchPoints.children.length - 1; i >= 0; i--) { for (i = this.myStitchPoints.children.length - 1; i >= 0; i--) {
this.myStitchPoints.remove(this.myStitchPoints.children[i]); this.myStitchPoints.remove(this.myStitchPoints.children[i]);
} }
@ -336,49 +351,43 @@ StageMorph.prototype.initRenderer = function () {
}); });
this.renderer.setClearColor(0xffffff, 1); this.renderer.setClearColor(0xffffff, 1);
if (localStorage) {
// ide is not set yet, we're accessing its prototype to circumvent this
this.renderer.setClearColor(IDE_Morph.prototype.getSetting('bgcolor'), 1);
}
this.renderer.changed = false; this.renderer.changed = false;
this.renderer.isWireframeMode = false;
this.renderer.showingAxes = true; this.renderer.showingAxes = true;
this.renderer.showingStitchPoints = true;
this.renderer.showingJumpLines = true;
this.renderer.showingTurtle = true;
this.renderer.isParallelProjection = true; this.renderer.isParallelProjection = true;
this.renderer.toggleWireframe = function () {
this.renderer.toggleJumpLines = function () {
var myInnerSelf = this; var myInnerSelf = this;
this.isWireframeMode = !this.isWireframeMode; this.showingJumpLines = !this.showingJumpLines;
myself.myObjects.children.forEach(function (eachObject) { myself.myJumpLines.children.forEach(function (eachObject) {
eachObject.material.wireframe = myInnerSelf.isWireframeMode; eachObject.visible = myInnerSelf.showingJumpLines;
}); });
myself.reRender(); myself.reRender();
} };
this.renderer.toggleAxes = function () { this.renderer.toggleStitchPoints = function () {
var myInnerSelf = this; var myInnerSelf = this;
this.showingAxes = !this.showingAxes; this.showingStitchPoints = !this.showingStitchPoints;
myself.myStitchPoints.children.forEach(function (eachObject) {
myself.scene.labels.forEach(function (label){ label.visible = myInnerSelf.showingAxes }); eachObject.visible = myInnerSelf.showingStitchPoints;
myself.scene.axes.forEach(function (line){ line.visible = myInnerSelf.showingAxes }); });
myself.children.forEach(function (morph) {
if (morph instanceof SpriteMorph) {
morph.beetle.axes.forEach(function (line){ line.visible = myInnerSelf.showingAxes });
}
})
myself.reRender(); myself.reRender();
} };
this.renderer.toggleTurtle = function () {
var myInnerSelf = this;
this.showingTurtle = !this.showingTurtle;
myself.turtle.visible = myInnerSelf.showingTurtle;
myself.reRender();
};
this.renderer.toggleParallelProjection = function () {
this.isParallelProjection = !this.isParallelProjection;
myself.initCamera();
}
}; };
StageMorph.prototype.render = function () { StageMorph.prototype.render = function () {
//this.pointLight.position.copy(this.camera.position); // lights move with the camera
//this.directionalLight.position.copy(this.camera.position);
this.renderer.render(this.scene, this.camera); this.renderer.render(this.scene, this.camera);
}; };
@ -399,7 +408,7 @@ StageMorph.prototype.initCamera = function () {
var myself = this, var myself = this,
threeLayer; threeLayer;
if (this.scene.camera) { this.scene.remove(this.camera) }; if (this.scene.camera) { this.scene.remove(this.camera); }
var createCamera = function () { var createCamera = function () {
threeLayer = document.createElement('div'); threeLayer = document.createElement('div');
@ -425,11 +434,11 @@ StageMorph.prototype.initCamera = function () {
myself.camera.zoomIn = function () { myself.camera.zoomIn = function () {
this.zoomFactor /= 1.1; this.zoomFactor /= 1.1;
this.applyZoom(); this.applyZoom();
} };
myself.camera.zoomOut = function () { myself.camera.zoomOut = function () {
this.zoomFactor *= 1.1; this.zoomFactor *= 1.1;
this.applyZoom(); this.applyZoom();
} };
myself.camera.applyZoom = function () { myself.camera.applyZoom = function () {
var zoom = myself.camera ? myself.camera.zoomFactor : 82, var zoom = myself.camera ? myself.camera.zoomFactor : 82,
@ -440,12 +449,12 @@ StageMorph.prototype.initCamera = function () {
this.top = height / zoom; this.top = height / zoom;
this.bottom = height / - zoom; this.bottom = height / - zoom;
this.updateProjectionMatrix(); this.updateProjectionMatrix();
} };
myself.camera.reset = function () { myself.camera.reset = function () {
myself.controls = new THREE.OrbitControls(this, threeLayer); myself.controls = new THREE.OrbitControls(this, threeLayer);
myself.controls.addEventListener('change', function (event) { myself.render }); myself.controls.addEventListener('change', function (event) { myself.render(); });
if (myself.renderer.isParallelProjection) { if (myself.renderer.isParallelProjection) {
this.zoomFactor = 2; this.zoomFactor = 2;
@ -458,11 +467,11 @@ StageMorph.prototype.initCamera = function () {
myself.controls.update(); myself.controls.update();
myself.reRender(); myself.reRender();
} };
myself.camera.fitScene = function () { myself.camera.fitScene = function () {
var boundingBox = new THREE.Box3().setFromObject(myself.myObjects), var boundingBox = new THREE.Box3().setFromObject(myself.myStitchLines),
boundingSphere = boundingBox.getBoundingSphere(), boundingSphere = boundingBox.getBoundingSphere(),
center = boundingSphere.center, center = boundingSphere.center,
distance = boundingSphere.radius; distance = boundingSphere.radius;
@ -476,24 +485,41 @@ StageMorph.prototype.initCamera = function () {
myself.controls.dollyOut(1.2); myself.controls.dollyOut(1.2);
myself.controls.update(); myself.controls.update();
myself.reRender(); myself.reRender();
} };
} };
createCamera(); createCamera();
this.scene.add(this.camera); this.scene.add(this.camera);
this.camera.reset(); this.camera.reset();
}; };
StageMorph.prototype.initLights = function () { StageMorph.prototype.initTurtle = function() {
this.directionalLight = new THREE.DirectionalLight(0x4c4c4c, 1); var myself = this;
this.directionalLight.position.set(this.camera.position); var geometry = new THREE.Geometry();
this.scene.add(this.directionalLight); var material = new THREE.MeshBasicMaterial( { color: 0x000000 } );
geometry.vertices = [ new THREE.Vector3(10, 0, 0.01),
this.pointLight = new THREE.PointLight(0xffffff, 1, 2000); new THREE.Vector3(-8, 8, 0.01),
this.pointLight.position.set(this.camera.position); new THREE.Vector3(-8,-8, 0.01),
this.scene.add(this.pointLight); ];
geometry.faces.push(new THREE.Face3(0, 1, 2));
geometry.verticesNeedUpdate = true;
this.turtle = new THREE.Mesh( geometry, material );
this.turtle.visible = this.renderer.showingTurtle;
myself.myObjects.add(this.turtle);
}; };
StageMorph.prototype.moveTurtle = function(x, y) {
this.turtle.position.x = x;
this.turtle.position.y = y;
};
StageMorph.prototype.rotateTurtle = function(h) {
this.turtle.rotation.z = (90 -h) * Math.PI / 180;
this.renderer.changed = true;
};
StageMorph.prototype.originalStep = StageMorph.prototype.step; StageMorph.prototype.originalStep = StageMorph.prototype.step;
StageMorph.prototype.step = function () { StageMorph.prototype.step = function () {
this.originalStep(); this.originalStep();