Moved To ES6

This commit is contained in:
casperlamboo 2015-07-26 15:32:10 +02:00 committed by Simon Voordouw
parent d30a1ed107
commit 0d59a48009
1710 changed files with 1325 additions and 825010 deletions

27
.gitignore vendored
View File

@ -1,27 +1,4 @@
.DS_Store
*.DS_Store
.DS_Store
src/.DS_Store
src/.DS_Store
src/library/.DS_Store
.DS_Store
src/script/.DS_Store
src/.DS_Store
bower_components/
src/oldcode.js
test.html
print_manager.html
testdata.json
test2.html
jspm_packages/*

View File

@ -1,32 +0,0 @@
# Doodle3D-Slicer
The Doodle3D Slicer is designed for developers to make it easier to export 3d models to the Doodle3D WiFi-Box. The slicers includes a gcode slicer and a class designed for communication with the WiFi-Box. All the classes are in the D3D name space.
Three.js, Clipper.js and jQuery are required to run the Doodl3D slicer. All are included in the source.
This is an example of code.
```javascript
var localIp = "192.168.5.1";
var doodleBox = new D3D.Box(localIp);
doodleBox.onload = function () {
"use strict";
var printer = new D3D.Printer(printerSettings, userSettings);
var geometry = new THREE.BoxGeometry(20, 20, 20, 1, 1, 1);
var material = new THREE.MeshBasicMaterial({color: 0x000000, wireframe: true});
var mesh = new THREE.Mesh(geometry, material);
mesh.position.x = 100;
mesh.position.z = 100;
mesh.position.y = 10;
var slicer = new D3D.Slicer().setMesh(mesh);
var gcode = slicer.getGcode(printer);
doodleBox.print(gcode);
};
```
For more information see http://www.doodle3d.com/

95
config.js Normal file
View File

@ -0,0 +1,95 @@
System.config({
"baseURL": "/",
"defaultJSExtensions": true,
"transpiler": "babel",
"babelOptions": {
"optional": [
"runtime"
]
},
"paths": {
"github:*": "jspm_packages/github/*",
"npm:*": "jspm_packages/npm/*"
}
});
System.config({
"map": {
"babel": "npm:babel-core@5.6.20",
"babel-runtime": "npm:babel-runtime@5.6.20",
"clipper-lib": "npm:clipper-lib@1.0.0",
"core-js": "npm:core-js@0.9.18",
"json": "github:systemjs/plugin-json@0.1.0",
"nodeca/js-yaml": "github:nodeca/js-yaml@3.3.1",
"read-yaml": "npm:read-yaml@1.0.0",
"systemjs/plugin-json": "github:systemjs/plugin-json@0.1.0",
"three.js": "github:mrdoob/three.js@master",
"github:jspm/nodelibs-assert@0.1.0": {
"assert": "npm:assert@1.3.0"
},
"github:jspm/nodelibs-path@0.1.0": {
"path-browserify": "npm:path-browserify@0.0.0"
},
"github:jspm/nodelibs-process@0.1.1": {
"process": "npm:process@0.10.1"
},
"github:jspm/nodelibs-util@0.1.0": {
"util": "npm:util@0.10.3"
},
"npm:argparse@1.0.2": {
"assert": "github:jspm/nodelibs-assert@0.1.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"lodash": "npm:lodash@3.10.0",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1",
"sprintf-js": "npm:sprintf-js@1.0.3",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:assert@1.3.0": {
"util": "npm:util@0.10.3"
},
"npm:babel-runtime@5.6.20": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:clipper-lib@1.0.0": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:core-js@0.9.18": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0"
},
"npm:esprima@2.2.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:inherits@2.0.1": {
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:js-yaml@3.3.1": {
"argparse": "npm:argparse@1.0.2",
"esprima": "npm:esprima@2.2.0",
"fs": "github:jspm/nodelibs-fs@0.1.2",
"path": "github:jspm/nodelibs-path@0.1.0",
"process": "github:jspm/nodelibs-process@0.1.1",
"systemjs-json": "github:systemjs/plugin-json@0.1.0",
"util": "github:jspm/nodelibs-util@0.1.0"
},
"npm:lodash@3.10.0": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:path-browserify@0.0.0": {
"process": "github:jspm/nodelibs-process@0.1.1"
},
"npm:read-yaml@1.0.0": {
"fs": "github:jspm/nodelibs-fs@0.1.2",
"js-yaml": "npm:js-yaml@3.3.1",
"xtend": "npm:xtend@4.0.0"
},
"npm:util@0.10.3": {
"inherits": "npm:inherits@2.0.1",
"process": "github:jspm/nodelibs-process@0.1.1"
}
}
});

21
example/app.js Normal file
View File

@ -0,0 +1,21 @@
import THREE from 'three.js';
import PRINTER_SETTINGS from 'settings/printer_settings.json!';
import USER_SETTINGS from 'settings/user_settings.json!';
import * as SLICER from 'src/index';
setTimeout(() => {
var settings = new SLICER.Settings();
settings.updateConfig(PRINTER_SETTINGS["ultimaker2go"]);
settings.updateConfig(USER_SETTINGS);
var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
var slicer = new SLICER.Slicer();
//var slicer = new SLICER.SlicerWorker();
slicer.setGeometry(geometry);
slicer.onfinish = function (gCode) {
document.getElementById('gcode').innerHTML = gCode.replace(/(?:\r\n|\r|\n)/g, '<br />');
};
slicer.slice(settings);
});

27
example/index.html Normal file
View File

@ -0,0 +1,27 @@
<!DOCTYPE>
<html>
<head>
<title>Doodle3D Slicer</title>
<style>
#gcode {
font-family: monospace;
}
</style>
<script type="text/javascript" src="../jspm_packages/system.js"></script>
<script type="text/javascript" src="../config.js"></script>
<script type="text/javascript">
System.import('example/app.js');
</script>
</head>
<body>
<p id="gcode"></p>
</body>
</html>

View File

@ -1,88 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Doedel Drie Dee</title>
<script src="library/jquery.js"></script>
<script src="src/utils.js"></script>
<script src="src/box.js"></script>
<style>
.hidden {display: none;}
</style>
</head>
<body>
<script>
var api = "http://connect.doodle3d.com/api/";
var printers = [];
$(document).ready(function () {
"use strict";
var known = [];
var listSliceTest = $("#printers-slicetest");
var listSliceWebworker = $("#printers-webworker");
var listEditor = $("#printers-editor");
function addPrinter (name, localip) {
known.push(localip);
var slice = $("<li class='hidden'><a href='slice_test.html#" + localip + "'>" + name + "</a></li>");
var webworker = $("<li class='hidden'><a href='webworker_test.html#" + localip + "'>" + name + "</a></li>");
var editor = $("<li class='hidden'><a href='three.js-master/editor_slicer#" + localip + "'>" + name + "</a></li>");
listSliceTest.append(slice);
listSliceWebworker.append(webworker);
listEditor.append(editor);
var box = new D3D.Box(localip).init();
box.onconnect = function () {
slice.removeClass('hidden');
webworker.removeClass('hidden');
editor.removeClass('hidden');
};
box.ondisconnect = function () {
slice.addClass('hidden');
webworker.addClass('hidden');
editor.addClass('hidden');
};
}
function checkNewBoxes () {
getAPI(api + "list.php", function (error, boxes) {
if (error) {
console.warn('It appears that you are not connected to the internet, or the Doodle3D servers are down');
return;
}
for (var i = 0; i < boxes.length; i ++) {
var box = boxes[i];
if (known.indexOf(box.localip) === -1) {
addPrinter(box.wifiboxid, box.localip);
}
}
});
}
addPrinter('Wired Printer', '192.168.5.1');
addPrinter('Node Server', window.location.host + ":3000");
setInterval(checkNewBoxes, 10000);
checkNewBoxes();
});
</script>
<p>Slice Test</p>
<ul id="printers-slicetest"></ul>
<p>Webworkers</p>
<ul id="printers-webworker"></ul>
<p>Editor</p>
<ul id="printers-editor"></ul>
</body>
</html>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

4
library/jquery.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,506 +0,0 @@
solid OpenSCAD_Model
facet normal 0 0 0
outer loop
vertex 24 0 45.03
vertex 12 0 54.03
vertex 20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 8.48528 8.48528 54.03
vertex 12 0 54.03
vertex 20.7846 12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 -20.7846 45.03
vertex -20.7846 -12 45
vertex -12 -20.7846 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 1.46953e-015 54.03
vertex 8.48528 8.48528 54.03
vertex 7.34764e-016 12 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 0 54.03
vertex -8.48528 -8.48528 54.03
vertex 8.48528 -8.48528 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 0 54.03
vertex 8.48528 -8.48528 54.03
vertex 20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 0 54.03
vertex 8.48528 8.48528 54.03
vertex -8.48528 -8.48528 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 7.34764e-016 12 54.03
vertex 1.46953e-015 24 45.03
vertex -12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 20.7846 45.03
vertex 20.7846 12 45
vertex 12 20.7846 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 7.34764e-016 12 54.03
vertex 8.48528 8.48528 54.03
vertex 12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.15 -0.259808 15
vertex 0.15 0.259808 15
vertex 0.15 -0.259808 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 -12 45.03
vertex 12 -20.7846 45
vertex 20.7846 -12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 1.46953e-015 54.03
vertex -20.7846 12 45.03
vertex -24 2.93906e-015 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -24 2.93906e-015 45.03
vertex -20.7846 -12 45
vertex -20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 8.48528 8.48528 54.03
vertex 20.7846 12 45.03
vertex 12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -20.7846 -12 45
vertex -12 -20.7846 45.03
vertex -20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.15 0.259808 15
vertex -12 20.7846 45
vertex 1.46953e-015 24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0.15 0.259808 15
vertex 20.7846 12 45
vertex 0.3 0 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -2.20429e-015 -12 54.03
vertex -4.40858e-015 -24 45.03
vertex 12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -2.20429e-015 -12 54.03
vertex -8.48528 -8.48528 54.03
vertex -12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -24 2.93906e-015 45
vertex -20.7846 12 45.03
vertex -20.7846 12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.15 0.259808 15
vertex -0.15 -0.259808 15
vertex -0.3 3.67382e-017 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 12 45
vertex 20.7846 12 45.03
vertex 24 0 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 12 45.03
vertex 12 0 54.03
vertex 24 0 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -8.48528 -8.48528 54.03
vertex 8.48528 8.48528 54.03
vertex -12 1.46953e-015 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 12 45.03
vertex 20.7846 12 45
vertex 12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 1.46953e-015 24 45.03
vertex -12 20.7846 45
vertex -12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 7.34764e-016 12 54.03
vertex -12 20.7846 45.03
vertex -8.48528 8.48528 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 12 45
vertex 0.15 0.259808 15
vertex 12 20.7846 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 1.46953e-015 24 45.03
vertex 7.34764e-016 12 54.03
vertex 12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -4.40858e-015 -24 45.03
vertex 12 -20.7846 45
vertex 12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 8.48528 -8.48528 54.03
vertex -8.48528 -8.48528 54.03
vertex -2.20429e-015 -12 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 20.7846 45
vertex 1.46953e-015 24 45.03
vertex 1.46953e-015 24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -4.40858e-015 -24 45.03
vertex -2.20429e-015 -12 54.03
vertex -12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.15 -0.259808 15
vertex -20.7846 -12 45
vertex -0.3 3.67382e-017 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.15 0.259808 15
vertex 0.15 0.259808 15
vertex -0.15 -0.259808 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0.15 -0.259808 15
vertex 0.3 0 15
vertex 20.7846 -12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -20.7846 -12 45
vertex -0.15 -0.259808 15
vertex -12 -20.7846 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 -20.7846 45
vertex 20.7846 -12 45.03
vertex 12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0.15 -0.259808 15
vertex 0.15 0.259808 15
vertex 0.3 0 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -24 2.93906e-015 45.03
vertex -20.7846 12 45.03
vertex -24 2.93906e-015 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 1.46953e-015 54.03
vertex -24 2.93906e-015 45.03
vertex -20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 20.7846 45
vertex -20.7846 12 45.03
vertex -12 20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 1.46953e-015 54.03
vertex 7.34764e-016 12 54.03
vertex -8.48528 8.48528 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 1.46953e-015 24 45.03
vertex 12 20.7846 45
vertex 1.46953e-015 24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 1.46953e-015 24 45.03
vertex 12 20.7846 45.03
vertex 12 20.7846 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 -12 45.03
vertex 8.48528 -8.48528 54.03
vertex 12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 8.48528 -8.48528 54.03
vertex -2.20429e-015 -12 54.03
vertex 12 -20.7846 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 20.7846 45
vertex 0.15 0.259808 15
vertex 1.46953e-015 24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0.15 0.259808 15
vertex -0.15 0.259808 15
vertex 1.46953e-015 24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 -20.7846 45
vertex -4.40858e-015 -24 45.03
vertex -4.40858e-015 -24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -4.40858e-015 -24 45.03
vertex -12 -20.7846 45.03
vertex -12 -20.7846 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -4.40858e-015 -24 45.03
vertex -12 -20.7846 45
vertex -4.40858e-015 -24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 -20.7846 45
vertex -0.15 -0.259808 15
vertex -4.40858e-015 -24 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 -20.7846 45
vertex -4.40858e-015 -24 45
vertex 0.15 -0.259808 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -4.40858e-015 -24 45
vertex -0.15 -0.259808 15
vertex 0.15 -0.259808 15
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.15 0.259808 15
vertex -0.3 3.67382e-017 15
vertex -20.7846 12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.3 3.67382e-017 15
vertex -24 2.93906e-015 45
vertex -20.7846 12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 -20.7846 45.03
vertex -8.48528 -8.48528 54.03
vertex -20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -8.48528 -8.48528 54.03
vertex -12 1.46953e-015 54.03
vertex -20.7846 -12 45.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 20.7846 45.03
vertex -20.7846 12 45.03
vertex -8.48528 8.48528 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -20.7846 12 45.03
vertex -12 1.46953e-015 54.03
vertex -8.48528 8.48528 54.03
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 0.3 0 15
vertex 20.7846 12 45
vertex 24 0 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 12 -20.7846 45
vertex 0.15 -0.259808 15
vertex 20.7846 -12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -0.3 3.67382e-017 15
vertex -20.7846 -12 45
vertex -24 2.93906e-015 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -20.7846 -12 45
vertex -24 2.93906e-015 45.03
vertex -24 2.93906e-015 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 12 45
vertex 24 0 45.03
vertex 24 0 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 24 0 45.03
vertex 20.7846 -12 45.03
vertex 20.7846 -12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 24 0 45.03
vertex 20.7846 -12 45
vertex 24 0 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex 20.7846 -12 45
vertex 0.3 0 15
vertex 24 0 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -20.7846 12 45.03
vertex -12 20.7846 45
vertex -20.7846 12 45
endloop
endfacet
facet normal 0 0 0
outer loop
vertex -12 20.7846 45
vertex -0.15 0.259808 15
vertex -20.7846 12 45
endloop
endfacet
endsolid OpenSCAD_Model

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

20
package.json Normal file
View File

@ -0,0 +1,20 @@
{
"jspm": {
"main": "index",
"directories": {
"lib": "src"
},
"dependencies": {
"clipper-lib": "npm:clipper-lib@^1.0.0",
"nodeca/js-yaml": "github:nodeca/js-yaml@^3.3.1",
"read-yaml": "npm:read-yaml@^1.0.0",
"systemjs/plugin-json": "github:systemjs/plugin-json@^0.1.0",
"three.js": "github:mrdoob/three.js@master"
},
"devDependencies": {
"babel": "npm:babel-core@^5.1.13",
"babel-runtime": "npm:babel-runtime@^5.1.13",
"core-js": "npm:core-js@^0.9.4"
}
}
}

View File

@ -13,7 +13,7 @@
"retractionMinDistance": 0.0,
"supportAcceptanceMargin": 1.5,
"supportDistanceY": 0.4,
"supportUse": false,
"supportEnabled": false,
"supportGridSize": 6.0,
"supportMargin": 2.0,
"supportPlateSize": 4.0,
@ -23,11 +23,11 @@
},
"innerLine": {
"flowRate": 1.0,
"speed": 60.0
"speed": 50.0
},
"fill": {
"flowRate": 1.0,
"speed": 100.0
"speed": 50.0
},
"brim": {
"flowRate": 1.0,

View File

@ -1,211 +0,0 @@
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Doedel Drie Dee || Slice Test</title>
<!--<script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>-->
<script src="library/jquery.js"></script>
<script src="library/three.js"></script>
<script src='three.js-master/examples/js/loaders/STLLoader.js'></script>
<script src="library/clipper.js"></script>
<script src="src/utils.js"></script>
<script src="src/box.js"></script>
<script src="src/printer.js"></script>
<script src="src/paths.js"></script>
<script src="src/gcode.js"></script>
<script src="src/slicer.js"></script>
<script src="src/slice.js"></script>
<style>
canvas {border: 1px solid black;}
</style>
</head>
<body>
<canvas id="3d-preview" height="400" width="400"></canvas>
<canvas id="canvas" width="400" height="400"></canvas>
<script>
var USER_SETTINGS, PRINTER_SETTINGS, doodleBox, gcode, scene;
function init () {
"use strict";
scene = createScene();
var localIp = location.hash.substring(1);
doodleBox = new D3D.Box(localIp).init();
var printer = new D3D.Printer().updateConfig(USER_SETTINGS).updateConfig(PRINTER_SETTINGS["ultimaker2go"]);
var loader = new THREE.STLLoader();
loader.load('models/pokemon/pikachu.stl', function (geometry) {
//var geometry = new THREE.BoxGeometry(10, 10, 10, 1, 1, 1);
//var geometry = new THREE.SphereGeometry(10, 20, 10);
var geometry = new THREE.TorusGeometry(20, 10, 30, 30);
/*
var geometry = (function () {
"use strict";
var circle = new THREE.Shape();
circle.absarc(0, 0, 10, 0, Math.PI*2, false);
var hole = new THREE.Path();
hole.absarc(0, 0, 5, 0, Math.PI*2, true );
circle.holes.push(hole);
var matrix = new THREE.Matrix4();
matrix.makeRotationX(Math.PI*1.5);
var geometry = new THREE.ExtrudeGeometry(circle, {
amount: 10,
bevelEnabled: false,
steps: 1
});
geometry.applyMatrix(matrix);
return geometry;
})();
*/
/*var path = [{x: 60, y: 40}, {x: 60, y: 50}, {x: 60, y: 60}, {x: 80, y: 60}, {x: 40, y: 40}, {x: 50, y: 40}, {x: 10, y: 60}];
var geometry = new THREE.Geometry();
for (var i = 0; i < path.length; i ++) {
var point = path[i];
geometry.vertices.push(new THREE.Vector3(point.x, 0, point.y));
geometry.vertices.push(new THREE.Vector3(point.x, 50, point.y));
}
for (var i = 0; i < path.length - 1; i ++) {
var base = i * 2;
geometry.faces.push(new THREE.Face3(base, base + 1, base + 2));
geometry.faces.push(new THREE.Face3(base + 3, base + 2, base + 1));
}*/
var material = new THREE.MeshPhongMaterial({color: 0x00ff00, wireframe: false, side: THREE.DoubleSide});
var mesh = new THREE.Mesh(geometry, material);
//mesh.rotation.x = -Math.PI/2;
//mesh.scale.x = mesh.scale.y = mesh.scale.z = 1;
mesh.position.x = 60;
mesh.position.z = 60;
mesh.updateMatrix();
scene.add(mesh);
var slicer = new D3D.Slicer().setMesh(mesh);
//var canvas = document.getElementById("canvas");
//var context = canvas.getContext("2d");
//var img = slicer.drawPaths(printer, 0, 1);
//context.drawImage(img, 0, 0);
gcode = slicer.getGCode(printer);
});
}
function createScene () {
var scene = new THREE.Scene();
var renderer = new THREE.WebGLRenderer({canvas: document.getElementById("3d-preview"), antialias: true});
renderer.setClearColor(0xffffff, 1);
var camera = new THREE.PerspectiveCamera(75, renderer.domElement.width / renderer.domElement.height, 1, 10000);
scene.add(camera);
var light = new THREE.AmbientLight(0x404040);
scene.add(light);
var directionalLight = new THREE.PointLight(0xffffff, 0.5);
camera.add(directionalLight);
applyMouseControls(renderer, camera, new THREE.Vector3(100, 0, 100), 1000);
function applyMouseControls (renderer, camera, center, maxDistance) {
var distance = 20;
var rotX = 0;
var rotY = 0;
var moveCamera = false;
function updateCamera () {
camera.position.set(
Math.cos(rotY)*Math.sin(rotX)*distance,
Math.sin(rotY)*distance,
Math.cos(rotY)*Math.cos(rotX)*distance
).add(center);
camera.lookAt(center);
}
$(renderer.domElement).on("mousedown", function (e) {
moveCamera = true;
}).on("wheel", function (e) {
var event = e.originalEvent;
event.preventDefault();
distance = THREE.Math.clamp(distance - event.wheelDelta, 1, maxDistance);
updateCamera();
});
$(window).on("mouseup", function (e) {
moveCamera = false;
}).on("mousemove", function (e) {
var event = e.originalEvent;
if (moveCamera === true) {
rotX = (rotX - event.webkitMovementX/100) % (2*Math.PI);
rotY = THREE.Math.clamp(rotY + event.webkitMovementY/100, -Math.PI/2, Math.PI/2);
updateCamera();
}
});
updateCamera();
}
(function animate () {
requestAnimationFrame(animate);
renderer.render(scene, camera);
})();
return scene;
}
//loadSettings;
(function () {
'use strict';
var loadedItems = 0;
function loaded () {
loadedItems ++;
if (loadedItems === 2) {
init();
}
}
$.ajax({
url: 'settings/user_settings.json',
dataType: 'json',
success: function (response) {
USER_SETTINGS = response;
loaded();
}
});
$.ajax({
url: 'settings/printer_settings.json',
dataType: 'json',
success: function (response) {
PRINTER_SETTINGS = response;
loaded();
}
});
})();
</script>
</body>
</html>

View File

@ -1,431 +0,0 @@
/******************************************************
*
* WiFi-Box
* Representation of de Doodle3D-WiFi Box
* Handles all communication with the doodle box
* Check http://www.doodle3d.com/help/api-documentation
*
******************************************************/
D3D.Box = function (localIp) {
"use strict";
var scope = this;
this.alive = false;
this.batchSize = 512;
this.maxBufferedLines = 4096;
this.localIp = localIp;
this.api = "http://" + localIp + "/d3dapi/";
this.config = {};
this.status = {};
this._printBatches = [];
this._currentBatch = 0;
this.loaded = false;
};
D3D.Box.prototype.init = function () {
"use strict";
var scope = this;
this.getNetworkAlive(function (error, data) {
if (error) {
if (scope.alive) {
scope.alive = false;
if (scope.ondisconnect !== undefined) {
scope.ondisconnect();
}
}
console.warn(error);
setTimeout(function () {
scope.init();
}, 1000);
return;
}
scope.alive = true;
if (scope.onconnect !== undefined) {
scope.onconnect();
}
scope.getConfigAll(function (error, data) {
if (error) {
console.warn(error);
scope.init();
}
scope.config = data;
if (!scope.loaded) {
scope.loaded = true;
if (scope.onload !== undefined) {
scope.onload();
}
}
scope._updateState();
});
});
return this;
};
D3D.Box.prototype._updateLoop = function () {
"use strict";
var scope = this;
if (this._printBatches.length > 0 && (this.status["buffered_lines"] + this._printBatches[0].length) <= this.maxBufferedLines) {
//if (this._printBatches.length > 0 ) {
this._printBatch();
}
else {
setTimeout(function () {
scope._updateState();
}, 1000);
}
};
D3D.Box.prototype._updateState = function () {
//que api calls so they don't overload the d3d box
"use strict";
var scope = this;
this.getInfoStatus(function (error, data) {
if (error) {
console.warn(error);
scope.init();
return;
}
scope.status = data;
if (scope.onupdate !== undefined) {
scope.onupdate(data);
}
scope._updateLoop();
});
};
D3D.Box.prototype.print = function (gcode) {
"use strict";
this._currentBatch = 0;
gcode = gcode.split("\n");
//split gcode in batches
while (gcode.length > 0) {
var gcodeBatch = gcode.splice(0, Math.min(this.batchSize, gcode.length));
this._printBatches.push(gcodeBatch);
}
return this;
};
D3D.Box.prototype._printBatch = function () {
"use strict";
var scope = this;
var gcode = this._printBatches.shift();
this.setPrinterPrint({
"start": ((this._currentBatch === 0) ? true : false),
"first": ((this._currentBatch === 0) ? true : false),
"gcode": gcode.join("\n"),
"last": ((this._printBatches.length === 0) ? true : false) //only for debug purposes
}, function (error, data) {
if (error) {
scope._printBatches.unshift(gcode);
console.warn(error);
scope.init();
return;
}
console.log("batch sent: " + scope._currentBatch, data);
if (scope._printBatches.length > 0) {
scope._currentBatch ++;
}
else {
console.log("Finish sending model to printer");
}
scope._updateState();
});
};
D3D.Box.prototype.stopPrint = function (printer) {
"use strict";
var scope = this;
this._printBatches = [];
this._currentBatch = 0;
this.setPrinterStop({
"gcode": printer.getEndCode()
}, function (error, data) {
if (error) {
console.warn(error);
scope.init();
return;
}
console.log("Printer stop command sent");
});
return this;
};
//COMMUNICATION SHELL
//see http://www.doodle3d.com/help/api-documentation
D3D.Box.prototype.getConfig = function (keys, callback) {
"use strict";
getAPI(this.api + "config/?" + keys.join("=&") + "=", callback);
return this;
};
D3D.Box.prototype.getConfigAll = function (callback) {
"use strict";
getAPI(this.api + "config/all", callback);
return this;
};
D3D.Box.prototype.setConfig = function (data, callback) {
"use strict";
var scope = this;
sendAPI(this.api + "config", data, function (response) {
for (var i in response.validation) {
if (response.validation[i] === "ok") {
scope[i] = data[i];
}
}
if (callback !== undefined) {
callback(response);
}
});
return this;
};
D3D.Box.prototype.getInfo = function (callback) {
"use strict";
getAPI(this.api + "info", callback);
return this;
};
D3D.Box.prototype.getInfoStatus = function (callback) {
"use strict";
getAPI(this.api + "info/status", callback);
return this;
};
D3D.Box.prototype.downloadInfoLogFiles = function () {
//works in google chrome... not tested in other browsers
//some browsers may redirect using this code
"use strict";
window.location = this.api + "info/logfiles";
};
D3D.Box.prototype.getInfoAcces = function (callback) {
"use strict";
getAPI(this.api + "info/access", callback);
return this;
};
D3D.Box.prototype.getNetworkScan = function (callback) {
"use strict";
getAPI(this.api + "network/scan", callback);
return this;
};
D3D.Box.prototype.getNetworkKnown = function (callback) {
"use strict";
getAPI(this.api + "network/known", callback);
return this;
};
D3D.Box.prototype.getNetworkStatus = function (callback) {
"use strict";
getAPI(this.api + "network/status", callback);
return this;
};
D3D.Box.prototype.setNetworkAssosiate = function (data, callback) {
"use strict";
sendAPI(this.api + "network/associate", data, callback);
return this;
};
D3D.Box.prototype.setNetworkDisassosiate = function (callback) {
//not tested
"use strict";
sendAPI(this.api + "network/disassociate", {}, callback);
return this;
};
D3D.Box.prototype.setNetworkOpenAP = function (callback) {
//not tested
"use strict";
sendAPI(this.api + "network/openap", {}, callback);
return this;
};
D3D.Box.prototype.setNetworkRemove = function (ssid, callback) {
"use strict";
sendAPI(this.api + "network/remove", {
"ssid": ssid
}, callback);
return this;
};
D3D.Box.prototype.getNetworkSignin = function (callback) {
"use strict";
getAPI(this.api + "network/signin", callback);
return this;
};
D3D.Box.prototype.getNetworkAlive = function (callback) {
"use strict";
getAPI(this.api + "network/alive", callback);
return this;
};
D3D.Box.prototype.getPrinterTemperature = function (callback) {
"use strict";
getAPI(this.api + "printer/temperature", callback);
return this;
};
D3D.Box.prototype.getPrinterProgress = function (callback) {
"use strict";
getAPI(this.api + "printer/progress", callback);
return this;
};
D3D.Box.prototype.getPrinterState = function (callback) {
"use strict";
getAPI(this.api + "printer/state", callback);
return this;
};
D3D.Box.prototype.getPrinterListAll = function (callback) {
"use strict";
getAPI(this.api + "printer/listall", callback);
return this;
};
D3D.Box.prototype.setPrinterHeatup = function (callback) {
"use strict";
sendAPI(this.api + "printer/heatup", {}, callback);
return this;
};
D3D.Box.prototype.setPrinterPrint = function (data, callback) {
"use strict";
sendAPI(this.api + "printer/print", data, callback);
return this;
};
D3D.Box.prototype.setPrinterStop = function (data, callback) {
"use strict";
sendAPI(this.api + "printer/stop", data, callback);
return this;
};
D3D.Box.prototype.getSketch = function (id, callback) {
"use strict";
getAPI(this.api + "sketch/?id=" + id, callback);
return this;
};
D3D.Box.prototype.setSketch = function (data, callback) {
"use strict";
sendAPI(this.api + "sketch", {
"data": data
}, callback);
return this;
};
D3D.Box.prototype.getSketchStatus = function (callback) {
"use strict";
getAPI(this.api + "sketch/status", callback);
return this;
};
D3D.Box.prototype.setSketchClear = function (callback) {
"use strict";
sendAPI(this.api + "sketch/clear", callback);
return this;
};
D3D.Box.prototype.getSystemVersions = function (callback) {
"use strict";
getAPI(this.api + "system/fwversions", callback);
return this;
};
D3D.Box.prototype.getUpdateStatus = function (callback) {
"use strict";
getAPI(this.api + "update/status", callback);
return this;
};
D3D.Box.prototype.setUpdateDownload = function (callback) {
//not tested
"use strict";
sendAPI(this.api + "update/download", {}, callback);
return this;
};
D3D.Box.prototype.setUpdateInstall = function (callback) {
//not tested
"use strict";
sendAPI(this.api + "update/install", {}, callback);
return this;
};
D3D.Box.prototype.setUpdateClear = function (callback) {
//not tested
"use strict";
sendAPI(this.api + "update/clear", {}, callback);
return this;
};

View File

@ -1,182 +1,164 @@
/******************************************************
*
* GCode
*
* Manages the gcode
* Also handles different flavours of gcode
* TODO
* calculate extrusion length and total time
*
******************************************************/
import THREE from 'three.js';
D3D.GCode = function () {
"use strict";
export default class {
constructor () {
this.gcode = "";
this.current = {};
this.gcode = "";
this.current = {};
this.extruder = 0.0;
this.bottom = true;
this.isRetracted = false;
this.isFanOn = false;
this._nozzlePosition = new THREE.Vector2(0, 0);
};
D3D.GCode.prototype._addGCode = function (command) {
"use strict";
var str = "";
var first = true;
for (var i in command) {
if (first) {
str = i + command[i];
first = false;
}
else if (this.current[i] !== command[i]) {
str += " " + i + command[i];
this.current[i] = command[i];
}
}
this.gcode += str + "\n";
};
D3D.GCode.prototype.setSettings = function (printer) {
"use strict";
this.settings = printer;
return this;
};
D3D.GCode.prototype.turnFanOn = function (fanSpeed) {
"use strict";
this.isFanOn = true;
var gcode = {
"M": 106
};
if (fanSpeed !== undefined) {
gcode["S"] = fanSpeed;
}
this._addGCode(gcode);
return this;
};
D3D.GCode.prototype.turnFanOff = function () {
"use strict";
this.isFanOn = false;
this._addGCode({
"M": 107
});
return this;
};
D3D.GCode.prototype.moveTo = function (x, y, layer) {
"use strict";
var layerHeight = this.settings.config["layerHeight"];
var travelSpeed = this.settings.config["travelSpeed"];
var z = (layer + 1) * layerHeight;
var speed = travelSpeed * 60;
this._addGCode({
"G": 0,
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
"F": speed.toFixed(3)
});
this._nozzlePosition.set(x, y);
return this;
};
D3D.GCode.prototype.lineTo = function (x, y, layer, type) {
"use strict";
var newNozzlePosition = new THREE.Vector2(x, y);
var layerHeight = this.settings.config["layerHeight"];
var nozzleDiameter = this.settings.config["nozzleDiameter"];
var filamentThickness = this.settings.config["filamentThickness"];
var travelSpeed = this.settings.config["travelSpeed"];
var profile = this.settings.config[(this.bottom ? "bottom" : type)];
var speed = profile["speed"] * 60;
var flowRate = profile["flowRate"];
var z = (layer + 1) * layerHeight;
var lineLength = this._nozzlePosition.distanceTo(newNozzlePosition);
var filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
this.extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate;
this._addGCode({
"G": 1,
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
"F": speed.toFixed(3),
"E": this.extruder.toFixed(3)
});
this._nozzlePosition.copy(newNozzlePosition);
return this;
};
D3D.GCode.prototype.unRetract = function () {
"use strict";
var retractionEnabled = this.settings.config["retractionEnabled"];
var retractionMinDistance = this.settings.config["retractionMinDistance"];
var retractionSpeed = this.settings.config["retractionSpeed"];
if (this.isRetracted && retractionEnabled) {
this.extruder = 0.0;
this.bottom = true;
this.isRetracted = false;
var speed = retractionSpeed * 60;
if (this.extruder > retractionMinDistance) {
this._addGCode({
"G": 0,
"E": this.extruder.toFixed(3),
"F": speed.toFixed(3)
});
}
this.isFanOn = false;
this._nozzlePosition = new THREE.Vector2(0, 0);
}
return this;
};
D3D.GCode.prototype.retract = function () {
"use strict";
var retractionAmount = this.settings.config["retractionAmount"];
var retractionEnabled = this.settings.config["retractionEnabled"];
var retractionMinDistance = this.settings.config["retractionMinDistance"];
var retractionSpeed = this.settings.config["retractionSpeed"];
if (!this.isRetracted && retractionEnabled) {
this.isRetracted = true;
var speed = retractionSpeed * 60;
_addGCode (command) {
var str = "";
var first = true;
if (this.extruder > retractionMinDistance && retractionEnabled) {
this._addGCode({
"G": 0,
"E": (this.extruder - retractionAmount).toFixed(3),
"F": speed.toFixed(3)
});
for (var i in command) {
if (first) {
str = i + command[i];
first = false;
}
else if (this.current[i] !== command[i]) {
str += " " + i + command[i];
this.current[i] = command[i];
}
}
this.gcode += str + "\n";
}
setSettings (settings) {
this.settings = settings;
return this;
};
D3D.GCode.prototype.getGCode = function () {
"use strict";
return this;
}
turnFanOn (fanSpeed) {
this.isFanOn = true;
return this.settings.getStartCode() + this.gcode + this.settings.getEndCode();
};
var gcode = {
"M": 106
}
if (fanSpeed !== undefined) {
gcode["S"] = fanSpeed;
}
this._addGCode(gcode);
return this;
}
turnFanOff () {
this.isFanOn = false;
this._addGCode({
"M": 107
});
return this;
}
moveTo (x, y, layer) {
var layerHeight = this.settings.config["layerHeight"];
var travelSpeed = this.settings.config["travelSpeed"];
var z = (layer + 1) * layerHeight;
var speed = travelSpeed * 60;
this._addGCode({
"G": 0,
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
"F": speed.toFixed(3)
});
this._nozzlePosition.set(x, y);
return this;
}
lineTo (x, y, layer, type) {
var newNozzlePosition = new THREE.Vector2(x, y);
var layerHeight = this.settings.config["layerHeight"];
var nozzleDiameter = this.settings.config["nozzleDiameter"];
var filamentThickness = this.settings.config["filamentThickness"];
var travelSpeed = this.settings.config["travelSpeed"];
var profile = this.settings.config[(this.bottom ? "bottom" : type)];
var speed = profile["speed"] * 60;
var flowRate = profile["flowRate"];
var z = (layer + 1) * layerHeight;
var lineLength = this._nozzlePosition.distanceTo(newNozzlePosition);
var filamentSurfaceArea = Math.pow((filamentThickness / 2), 2) * Math.PI;
this.extruder += lineLength * nozzleDiameter * layerHeight / filamentSurfaceArea * flowRate;
this._addGCode({
"G": 1,
"X": x.toFixed(3), "Y": y.toFixed(3), "Z": z.toFixed(3),
"F": speed.toFixed(3),
"E": this.extruder.toFixed(3)
});
this._nozzlePosition.copy(newNozzlePosition);
return this;
}
unRetract () {
var retractionEnabled = this.settings.config["retractionEnabled"];
var retractionMinDistance = this.settings.config["retractionMinDistance"];
var retractionSpeed = this.settings.config["retractionSpeed"];
if (this.isRetracted && retractionEnabled) {
this.isRetracted = false;
var speed = retractionSpeed * 60;
if (this.extruder > retractionMinDistance) {
this._addGCode({
"G": 0,
"E": this.extruder.toFixed(3),
"F": speed.toFixed(3)
});
}
}
return this;
}
retract () {
var retractionAmount = this.settings.config["retractionAmount"];
var retractionEnabled = this.settings.config["retractionEnabled"];
var retractionMinDistance = this.settings.config["retractionMinDistance"];
var retractionSpeed = this.settings.config["retractionSpeed"];
if (!this.isRetracted && retractionEnabled) {
this.isRetracted = true;
var speed = retractionSpeed * 60;
if (this.extruder > retractionMinDistance && retractionEnabled) {
this._addGCode({
"G": 0,
"E": (this.extruder - retractionAmount).toFixed(3),
"F": speed.toFixed(3)
});
}
}
return this;
}
getGCode () {
return this.settings.startCode() + this.gcode + this.settings.endCode();
}
}

5
src/index.js Normal file
View File

@ -0,0 +1,5 @@
import Slicer from './slicer.js';
import SlicerWorker from './slicerworker.js';
import Settings from './settings.js';
export {Slicer, SlicerWorker, Settings};

View File

@ -1,251 +1,236 @@
/******************************************************
*
* Path
*
* Abstraction layer for annoying clipper js
* ! inherrits from Array !
*
******************************************************/
import ClipperLib from 'clipper-lib';
import THREE from 'three.js';
D3D.Paths = function (paths, closed) {
'use strict';
export default class Paths extends Array {
constructor (paths = [], closed = true) {
super();
Array.call(this);
this.setPaths(paths || []);
this.closed = (closed !== undefined) ? closed : true;
};
D3D.Paths.prototype = Object.create(Array.prototype);
D3D.Paths.prototype.setPaths = function (paths) {
'use strict';
for (var i = 0; i < paths.length; i ++) {
var path = paths[i];
if (path.length > 0) {
this.push(path);
}
this.setPaths(paths);
this.closed = closed;
}
return this;
};
D3D.Paths.prototype._clip = function (path, type) {
'use strict';
setPaths (paths) {
for (var path of paths) {
if (path.length > 0) {
this.push(path);
}
}
var solution = new ClipperLib.PolyTree();
return this;
}
var clipper = new ClipperLib.Clipper();
clipper.AddPaths(this, ClipperLib.PolyType.ptSubject, this.closed);
clipper.AddPaths(path, ClipperLib.PolyType.ptClip, path.closed);
clipper.Execute(type, solution);
_clip (path, type) {
var solution = new ClipperLib.PolyTree();
var paths = this.closed ? ClipperLib.Clipper.ClosedPathsFromPolyTree(solution) : ClipperLib.Clipper.OpenPathsFromPolyTree(solution);
var clipper = new ClipperLib.Clipper();
clipper.AddPaths(this, ClipperLib.PolyType.ptSubject, this.closed);
clipper.AddPaths(path, ClipperLib.PolyType.ptClip, path.closed);
clipper.Execute(type, solution);
return new D3D.Paths(paths, this.closed);
};
D3D.Paths.prototype.union = function (path) {
'use strict';
if (this.closed) {
var paths = ClipperLib.Clipper.ClosedPathsFromPolyTree(solution);
}
else {
var paths = ClipperLib.Clipper.OpenPathsFromPolyTree(solution);
}
return this._clip(path, ClipperLib.ClipType.ctUnion);
};
D3D.Paths.prototype.difference = function (path) {
'use strict';
return new Paths(paths, this.closed);
}
union (path) {
return this._clip(path, ClipperLib.ClipType.ctUnion);
}
return this._clip(path, ClipperLib.ClipType.ctDifference);
};
D3D.Paths.prototype.intersect = function (path) {
'use strict';
difference (path) {
return this._clip(path, ClipperLib.ClipType.ctDifference);
}
return this._clip(path, ClipperLib.ClipType.ctIntersection);
};
D3D.Paths.prototype.xor = function () {
'use strict';
intersect (path) {
return this._clip(path, ClipperLib.ClipType.ctIntersection);
}
return this._clip(path, ClipperLib.ClipType.ctXor);
};
D3D.Paths.prototype.offset = function (offset) {
'use strict';
xor (path) {
return this._clip(path, ClipperLib.ClipType.ctXor);
}
var solution = new ClipperLib.Paths();
var co = new ClipperLib.ClipperOffset(1, 1);
co.AddPaths(this, ClipperLib.JoinType.jtSquare, ClipperLib.EndType.etClosedPolygon);
co.Execute(solution, offset);
offset (offset) {
var solution = new ClipperLib.Paths();
var co = new ClipperLib.ClipperOffset(1, 1);
co.AddPaths(this, ClipperLib.JoinType.jtSquare, ClipperLib.EndType.etClosedPolygon);
co.Execute(solution, offset);
return new D3D.Paths(solution);
};
D3D.Paths.prototype.scaleUp = function (factor) {
'use strict';
return new Paths(solution);
}
var path = ClipperLib.JS.ScaleUpPaths(this, factor);
scaleUp (factor) {
ClipperLib.JS.ScaleUpPaths(this, factor);
return this;
};
D3D.Paths.prototype.scaleDown = function (factor) {
'use strict';
return this;
}
var path = ClipperLib.JS.ScaleDownPaths(this, factor);
scaleDown (factor) {
ClipperLib.JS.ScaleDownPaths(this, factor);
return this;
};
D3D.Paths.prototype.lastPoint = function () {
'use strict';
return this;
}
var lastPath = this[this.length - 1];
var lastPoint = this.closed ? lastPath[0] : lastPath[lastPath.length - 1];
return new THREE.Vector2(lastPoint.X, lastPoint.Y);
};
D3D.Paths.prototype.optimizePath = function (start) {
'use strict';
lastPoint () {
var lastPath = this[this.length - 1];
var lastPoint = this.closed ? lastPath[0] : lastPath[lastPath.length - 1];
return new THREE.Vector2(lastPoint.X, lastPoint.Y);
}
var optimizedPaths = new D3D.Paths([], this.closed);
var donePaths = [];
optimizePath (start) {
var optimizedPaths = new Paths([], this.closed);
var donePaths = [];
while (optimizedPaths.length !== this.length) {
var minLength = false;
var reverse;
var minPath;
var offset;
var pathIndex;
while (optimizedPaths.length !== this.length) {
var minLength = false;
var reverse;
var minPath;
var offset;
var pathIndex;
for (var i = 0; i < this.length; i ++) {
var path = this[i];
for (var i = 0; i < this.length; i += 1) {
var path = this[i];
if (donePaths.indexOf(i) === -1) {
if (donePaths.indexOf(i) === -1) {
if (this.closed) {
for (var j = 0; j < path.length; j ++) {
var point = new THREE.Vector2(path[j].X, path[j].Y);
var length = point.sub(start).length();
if (this.closed) {
for (var j = 0; j < path.length; j += 1) {
var point = new THREE.Vector2(path[j].X, path[j].Y);
var length = point.sub(start).length();
if (minLength === false || length < minLength) {
minPath = path;
minLength = length;
offset = j;
pathIndex = i;
}
}
}
else {
var startPoint = new THREE.Vector2(path[0].X, path[0].Y);
var length = startPoint.sub(start).length();
if (minLength === false || length < minLength) {
minPath = path;
minLength = length;
offset = j;
reverse = false;
pathIndex = i;
}
var endPoint = new THREE.Vector2(path[path.length - 1].X, path[path.length - 1].Y);
var length = endPoint.sub(start).length();
if (length < minLength) {
minPath = path;
minLength = length;
reverse = true;
pathIndex = i;
}
}
}
else {
var startPoint = new THREE.Vector2(path[0].X, path[0].Y);
var length = startPoint.sub(start).length();
if (minLength === false || length < minLength) {
minPath = path;
minLength = length;
reverse = false;
pathIndex = i;
}
var endPoint = new THREE.Vector2(path[path.length - 1].X, path[path.length - 1].Y);
var length = endPoint.sub(start).length();
if (length < minLength) {
minPath = path;
minLength = length;
reverse = true;
pathIndex = i;
}
}
if (this.closed) {
minPath = minPath.concat(minPath.splice(0, offset));
var point = minPath[0];
}
else {
if (reverse) {
minPath.reverse();
}
var point = minPath[minPath.length - 1];
}
donePaths.push(pathIndex);
start = new THREE.Vector2(point.X, point.Y);
optimizedPaths.push(minPath);
}
return optimizedPaths;
}
areas () {
var areas = [];
for (var shape of this) {
if (shape.closed) {
var area = Math.abs(ClipperLib.Clipper.Area(shape));
areas.push(area);
}
}
if (this.closed) {
minPath = minPath.concat(minPath.splice(0, offset));
var point = minPath[0];
return areas;
}
area () {
var areas = this.areas();
var totalArea = 0;
for (area of areas) {
totalArea += area;
}
else {
if (reverse) {
minPath.reverse();
return totalArea;
}
tresholdArea (minArea) {
// code not tested yet
for (var shape of this) {
var area = ClipperLib.Clipper.Area(shape);
if (area < minArea) {
this.splice(i, 1);
i -= 1;
}
var point = minPath[minPath.length - 1];
}
donePaths.push(pathIndex);
start = new THREE.Vector2(point.X, point.Y);
optimizedPaths.push(minPath);
}
return optimizedPaths;
};
D3D.Paths.prototype.areas = function () {
'use strict';
var areas = [];
for (var i = 0; i < this.length; i ++) {
var shape = this[i];
var area = Math.abs(ClipperLib.Clipper.Area(shape));
areas.push(area);
}
return areas;
};
D3D.Paths.prototype.tresholdArea = function (minArea) {
//code not tested yet
'use strict';
for (var i = 0; i < this.length; i ++) {
var shape = this[i];
var area = ClipperLib.Clipper.Area(shape);
if (area < minArea) {
this.splice(i, 1);
i --;
}
}
return areas;
};
D3D.Paths.prototype.join = function (path) {
'use strict';
for (var i = 0; i < path.length; i ++) {
this.push(path[i]);
join (path) {
for (var i = 0; i < path.length; i += 1) {
this.push(path[i]);
}
return this;
}
return this;
};
D3D.Paths.prototype.clone = function () {
'use strict';
clone () {
return new Paths(ClipperLib.JS.Clone(this), this.closed);
}
return new D3D.Paths(ClipperLib.JS.Clone(this), this.closed);
};
D3D.Paths.prototype.bounds = function () {
'use strict';
bounds () {
return ClipperLib.Clipper.GetBounds(this);
}
return ClipperLib.Clipper.GetBounds(this);
};
D3D.Paths.prototype.clean = function (cleanDelta) {
'use strict';
clean (cleanDelta) {
return new Paths(ClipperLib.Clipper.CleanPolygons(this, cleanDelta), this.closed);
}
return new D3D.Paths(ClipperLib.Clipper.CleanPolygons(this, cleanDelta), this.closed);
boundSize () {
var bounds = this.bounds();
var width = bounds.right - bounds.left;
var height = bounds.top - bounds.bottom;
return width * height;
}
draw (context, color) {
context.strokeStyle = color;
for (var i = 0; i < this.length; i += 1) {
var shape = this[i];
// var point = shape[0];
// context.fillText(i, point.X*2, point.Y*2);
context.beginPath();
for (var j = 0; j < shape.length; j += 1) {
var point = shape[j % shape.length];
context.lineTo(point.X * 2, point.Y * 2);
}
if (this.closed) {
context.closePath();
}
context.stroke();
}
}
}
D3D.Paths.prototype.boundSize = function () {
'use strict';
var bounds = this.bounds();
var width = bounds.right - bounds.left;
var height = bounds.top - bounds.bottom;
return width * height;
};
D3D.Paths.prototype.draw = function (context, color) {
'use strict';
context.strokeStyle = color;
for (var i = 0; i < this.length; i ++) {
var shape = this[i];
//var point = shape[0];
//context.fillText(i, point.X*2, point.Y*2);
context.beginPath();
for (var j = 0; j < shape.length; j ++) {
var point = shape[j % shape.length];
context.lineTo(point.X * 2, point.Y * 2);
}
if (this.closed) {
context.closePath();
}
context.stroke();
}
};

View File

@ -1,68 +0,0 @@
/******************************************************
*
* Printer
* Representation of the connected printer
*
******************************************************/
D3D.Printer = function () {
"use strict";
this.config = {};
};
D3D.Printer.prototype.updateConfig = function (config) {
"use strict";
for (var i in config) {
this.config[i] = config[i];
}
return this;
};
D3D.Printer.prototype.getStartCode = function () {
"use strict";
var gcode = this.config["startCode"];
gcode = this._subsituteVariables(gcode);
return gcode;
};
D3D.Printer.prototype.getEndCode = function () {
"use strict";
var gcode = this.config["endCode"];
gcode = this._subsituteVariables(gcode);
return gcode;
};
D3D.Printer.prototype._subsituteVariables = function (gcode) {
"use strict";
var temperature = this.config["temperature"];
var bedTemperature = this.config["bedTemperature"];
var preheatTemperature = this.config["heatupTemperature"];
var preheatBedTemperature = this.config["heatupBedTemperature"];
var travelSpeed = this.config["travelSpeed"] * 60;
var printerType = this.config["type"];
var heatedbed = this.config["heatedbed"];
switch (printerType) {
case "makerbot_replicator2": printerType = "r2"; break;
case "makerbot_replicator2x": printerType = "r2x"; break;
case "makerbot_thingomatic": printerType = "t6"; break;
case "makerbot_generic": printerType = "r2"; break;
case "_3Dison_plus": printerType = "r2"; break;
}
var heatedBedReplacement = heatedbed ? "" : ";";
gcode = gcode.replace(/{printingTemp}/gi, temperature);
gcode = gcode.replace(/{printingBedTemp}/gi, bedTemperature);
gcode = gcode.replace(/{preheatTemp}/gi, preheatTemperature);
gcode = gcode.replace(/{preheatBedTemp}/gi, preheatBedTemperature);
gcode = gcode.replace(/{printerType}/gi, printerType);
gcode = gcode.replace(/{travelSpeed}/gi, travelSpeed);
gcode = gcode.replace(/{if heatedBed}/gi, heatedBedReplacement);
return gcode;
};

58
src/settings.js Normal file
View File

@ -0,0 +1,58 @@
export default class {
constructor () {
this.config = {};
}
updateConfig (config) {
for (var i in config) {
this.config[i] = config[i];
}
return this;
}
startCode () {
var gcode = this.config["startCode"];
gcode = this._subsituteVariables(gcode);
return gcode;
}
endCode () {
var gcode = this.config["endCode"];
gcode = this._subsituteVariables(gcode);
return gcode;
}
_subsituteVariables (gcode) {
var temperature = this.config["temperature"];
var bedTemperature = this.config["bedTemperature"];
var preheatTemperature = this.config["heatupTemperature"];
var preheatBedTemperature = this.config["heatupBedTemperature"];
var travelSpeed = this.config["travelSpeed"] * 60;
var printerType = this.config["type"];
var heatedbed = this.config["heatedbed"];
switch (printerType) {
case "makerbot_replicator2": printerType = "r2"; break;
case "makerbot_replicator2x": printerType = "r2x"; break;
case "makerbot_thingomatic": printerType = "t6"; break;
case "makerbot_generic": printerType = "r2"; break;
case "_3Dison_plus": printerType = "r2"; break;
}
var heatedBedReplacement = heatedbed ? "" : ";";
gcode = gcode.replace(/{printingTemp}/gi, temperature);
gcode = gcode.replace(/{printingBedTemp}/gi, bedTemperature);
gcode = gcode.replace(/{preheatTemp}/gi, preheatTemperature);
gcode = gcode.replace(/{preheatBedTemp}/gi, preheatBedTemperature);
gcode = gcode.replace(/{printerType}/gi, printerType);
gcode = gcode.replace(/{travelSpeed}/gi, travelSpeed);
gcode = gcode.replace(/{if heatedBed}/gi, heatedBedReplacement);
return gcode;
}
}

View File

@ -1,120 +1,109 @@
/******************************************************
*
* Slice
*
******************************************************/
import Paths from './paths.js';
D3D.Slice = function () {
'use strict';
this.parts = [];
};
D3D.Slice.prototype.optimizePaths = function (start) {
'use strict';
if (this.brim !== undefined && this.brim.length > 0) {
this.brim = this.brim.optimizePath(start);
start = this.brim.lastPoint();
export default class {
constructor () {
this.parts = [];
}
var parts = [];
while (this.parts.length > 0) {
var closestDistance = Infinity;
var closestPart;
for (var i = 0; i < this.parts.length; i ++) {
var part = this.parts[i];
if (part.closed) {
var bounds = part.outerLine.bounds();
}
else {
var bounds = part.intersect.bounds();
}
var top = bounds.top - start.y;
var bottom = start.y - bounds.bottom;
var left = bounds.left - start.x;
var right = start.x - bounds.right;
var distance = Math.max(top, bottom, left, right);
if (distance < closestDistance) {
closestDistance = distance;
closestPart = i;
}
optimizePaths (start) {
if (this.brim !== undefined && this.brim.length > 0) {
this.brim = this.brim.optimizePath(start);
start = this.brim.lastPoint();
}
var part = this.parts.splice(closestPart, 1)[0];
parts.push(part);
var parts = [];
if (part.closed) {
if (part.outerLine.length > 0) {
part.outerLine = part.outerLine.optimizePath(start);
start = part.outerLine.lastPoint();
}
while (this.parts.length > 0) {
for (var j = 0; j < part.innerLines.length; j ++) {
var innerLine = part.innerLines[j];
if (innerLine.length > 0) {
part.innerLines[j] = innerLine.optimizePath(start);
start = part.innerLines[j].lastPoint();
var closestDistance = Infinity;
var closestPart;
for (var i = 0; i < this.parts.length; i ++) {
var part = this.parts[i];
if (part.intersect.closed) {
var bounds = part.outerLine.bounds();
}
else {
var bounds = part.intersect.bounds();
}
var top = bounds.top - start.y;
var bottom = start.y - bounds.bottom;
var left = bounds.left - start.x;
var right = start.x - bounds.right;
var distance = Math.max(top, bottom, left, right);
if (distance < closestDistance) {
closestDistance = distance;
closestPart = i;
}
}
if (part.fill.length > 0) {
part.fill = part.fill.optimizePath(start);
start = part.fill.lastPoint();
var part = this.parts.splice(closestPart, 1)[0];
parts.push(part);
if (part.intersect.closed) {
if (part.outerLine.length > 0) {
part.outerLine = part.outerLine.optimizePath(start);
start = part.outerLine.lastPoint();
}
for (var j = 0; j < part.innerLines.length; j ++) {
var innerLine = part.innerLines[j];
if (innerLine.length > 0) {
part.innerLines[j] = innerLine.optimizePath(start);
start = part.innerLines[j].lastPoint();
}
}
if (part.fill.length > 0) {
part.fill = part.fill.optimizePath(start);
start = part.fill.lastPoint();
}
}
else {
part.intersect.optimizePath(start);
start = part.intersect.lastPoint();
}
}
this.parts = parts;
if (this.support !== undefined && this.support.length > 0) {
this.support = this.support.optimizePath(start);
start = this.support.lastPoint();
}
return start;
}
getOutline () {
var outLines = new Paths([], true);
for (var i = 0; i < this.parts.length; i ++) {
var part = this.parts[i];
if (part.intersect.closed) {
outLines.join(this.parts[i].outerLine);
}
}
else {
part.intersect.optimizePath(start);
start = part.intersect.lastPoint();
return outLines;
}
add (intersect) {
var parts = {
intersect
};
if (intersect.closed) {
parts.innerLines = [];
parts.outerLine = new Paths([], true);
parts.fill = new Paths([], false);
}
this.parts.push(parts);
}
this.parts = parts;
if (this.support !== undefined && this.support.length > 0) {
this.support = this.support.optimizePath(start);
start = this.support.lastPoint();
}
return start;
};
D3D.Slice.prototype.getOutline = function () {
'use strict';
var outLines = new D3D.Paths([], true);
for (var i = 0; i < this.parts.length; i ++) {
var part = this.parts[i];
if (part.closed) {
outLines.join(this.parts[i].outerLine);
}
}
return outLines;
};
D3D.Slice.prototype.add = function (intersect) {
'use strict';
if (intersect.closed) {
this.parts.push({
intersect: intersect,
innerLines: [],
outerLine: new D3D.Paths([], true),
fill: new D3D.Paths([], false),
closed: true
});
}
else {
this.parts.push({
intersect: intersect,
closed: false
});
}
};
}

File diff suppressed because it is too large Load Diff

View File

@ -1,100 +1,96 @@
D3D.SlicerWorker = function () {
'use strict';
import THREE from 'three.js';
import Settings from './settings.js';
this.worker = new Worker(window.location.origin + '/webworker/worker.js');
export default class {
constructor () {
this.worker = new Worker('./worker.js');
var scope = this;
this.worker.addEventListener('message', function (event) {
switch (event.data['cmd']) {
case 'PROGRESS':
var scope = this;
this.worker.addEventListener('message', function (event) {
switch (event.data['cmd']) {
case 'PROGRESS':
if (scope.onprogress !== undefined) {
var progress = event.data['progress'];
if (scope.onprogress !== undefined) {
var progress = event.data['progress'];
scope.onprogress(progress);
}
break;
scope.onprogress(progress);
}
break;
case 'GCODE':
if (scope.onfinish !== undefined) {
var reader = new FileReader();
reader.addEventListener("loadend", function() {
var gcode = reader.result;
scope.onfinish(gcode);
});
reader.readAsBinaryString(event.data['gcode']);
}
break;
case 'GCODE':
if (scope.onfinish !== undefined) {
var reader = new FileReader();
reader.addEventListener("loadend", function() {
var gcode = reader.result;
scope.onfinish(gcode);
});
reader.readAsBinaryString(event.data['gcode']);
}
break;
}
}, false);
this.worker.onerror = function (error) {
console.warn(error);
};
}
setMesh (mesh) {
mesh.updateMatrix();
this.setGeometry(mesh.geometry, mesh.matrix);
return this;
}
setGeometry (geometry, matrix) {
if (geometry.type === 'Geometry') {
geometry = new THREE.BufferGeometry().fromGeometry(geometry);
}
else if (geometry.type === 'BufferGeometry') {
geometry = geometry.clone();
}
else {
console.warn('Geometry is not an instance of BufferGeometry or Geometry');
return;
}
}, false);
this.worker.onerror = function (error) {
console.warn("Error in webworker", error);
};
}
D3D.SlicerWorker.prototype.setSettings = function (USER_SETTINGS, PRINTER_SETTINGS) {
'use strict';
if (!(matrix instanceof THREE.Matrix4)) {
matrix = new THREE.Matrix4();
}
this.worker.postMessage({
'cmd': 'SET_SETTINGS',
'USER_SETTINGS': USER_SETTINGS,
'PRINTER_SETTINGS': PRINTER_SETTINGS
});
var buffers = [];
for (var i = 0; i < geometry.attributesKeys.length; i ++) {
var key = geometry.attributesKeys[i];
buffers.push(geometry.attributes[key].array.buffer);
}
return this;
};
D3D.SlicerWorker.prototype.setMesh = function (mesh) {
'use strict';
this.worker.postMessage({
'cmd': 'SET_MESH',
'geometry': {
'attributes': geometry.attributes,
'attributesKeys': geometry.attributesKeys
},
'matrix': matrix.toArray()
}, buffers);
mesh.updateMatrix();
this.setGeometry(mesh.geometry, mesh.matrix);
return this;
};
D3D.SlicerWorker.prototype.setGeometry = function (geometry, matrix) {
'use strict';
if (geometry instanceof THREE.Geometry) {
geometry = new THREE.BufferGeometry().fromGeometry(geometry);
}
else {
geometry = geometry.clone();
return this;
}
var buffers = [];
slice (settings) {
this.worker.postMessage({
'cmd': 'SLICE',
'settings': settings.config
});
for (var i = 0; i < geometry.attributesKeys.length; i ++) {
var key = geometry.attributesKeys[i];
buffers.push(geometry.attributes[key].array.buffer);
return this;
}
this.worker.postMessage({
'cmd': 'SET_MESH',
'geometry': {
'attributes': geometry.attributes,
'attributesKeys': geometry.attributesKeys
},
'matrix': matrix.toArray()
}, buffers);
close () {
this.worker.postMessage({
'cmd': 'CLOSE'
});
return this;
};
D3D.SlicerWorker.prototype.slice = function () {
'use strict';
this.worker.postMessage({
'cmd': 'SLICE'
});
return this;
};
D3D.SlicerWorker.prototype.close = function () {
'use strict';
this.worker.postMessage({
'cmd': 'CLOSE'
});
return this;
};
return this;
}
}

View File

@ -1,93 +0,0 @@
/******************************************************
*
* Utils
* dependices Three.js
*
******************************************************/
var D3D = {
'version': '0.1',
'website': 'http://www.doodle3d.com/',
'contact': 'develop@doodle3d.com'
};
THREE.Vector2.prototype.normal = function () {
"use strict";
var x = this.y;
var y = -this.x;
this.x = x;
this.y = y;
return this;
};
function sendAPI (url, data, callback) {
'use strict';
$.ajax({
url: url,
type: 'POST',
data: data,
dataType: 'json',
timeout: 10000,
success: function (response) {
if (response.status === 'success') {
if (callback !== undefined) {
callback(null, response);
}
}
else {
callback(response.msg);
}
}
}).fail(function () {
callback('Failed connecting to ' + url);
});
}
function getAPI (url, callback) {
'use strict';
$.ajax({
url: url,
dataType: 'json',
timeout: 5000,
success: function (response) {
if (response.status === 'success') {
if (callback !== undefined) {
callback(null, response.data);
}
}
else {
callback(response.msg);
}
}
}).fail(function () {
callback('Failed connecting to ' + url);
});
}
//button doesnt work in firefox!!!
function downloadFile (file, data) {
'use strict';
var blob = new Blob([data], {type: 'text/plain'});
var button = document.createElement('a');
button.download = file;
button.href = window.URL.createObjectURL(blob);
button.click();
}
Array.prototype.clone = function () {
'use strict';
var array = [];
for (var i = 0; i < this.length; i ++) {
array[i] = this[i];
}
return array;
}

59
src/worker.js Normal file
View File

@ -0,0 +1,59 @@
importScripts('../jspm_packages/system.js');
importScripts('../config.js');
var Slicer, Settings, THREE;
function init () {
var slicer = new Slicer();
slicer.onProgress = function (progress) {
self.postMessage({
'cmd': 'PROGRESS',
'progress': progress
});
};
self.addEventListener('message', function (event) {
switch (event.data['cmd']) {
case 'SET_MESH':
//hack...
//because boundings loses prototype functions when converting
event.data['geometry'].boundingBox = event.data['geometry'].boundingSphere = null;
var geometry = new THREE.Geometry().fromBufferGeometry(event.data['geometry']);
var matrix = new THREE.Matrix4().fromArray(event.data['matrix']);
slicer.setGeometry(geometry, matrix);
break;
case 'SLICE':
var settings = new Settings().updateConfig(event.data['settings']);
var gcode = slicer.slice(settings);
var blob = new Blob([gcode], {type: 'text/plain'});
self.postMessage({
'cmd': 'GCODE',
'gcode': blob
});
//self.close();
break;
case 'CLOSE':
self.close();
break;
}
});
}
Promise.all([
System.import('./slicer'),
System.import('./settings'),
System.import('three.js')
]).then(function(modules) {
Slicer = modules[0].default;
Settings = modules[1].default;
THREE = modules[2];
init();
});

View File

@ -1,4 +0,0 @@
.DS_Store
*.swp
.project
node_modules

View File

@ -1,27 +0,0 @@
### The issues section is for bug reports and feature requests only. If you need help, please use [stackoverflow](http://stackoverflow.com/questions/tagged/three.js).
Before reporting a bug
---
1. Search issue tracker for similar issues.
2. Try the latest dev branch version of three.js.
3. Refer to the [Migration Guide](https://github.com/mrdoob/three.js/wiki/Migration) when upgrading to the dev version.
How to report a bug
---
1. Specify the revision number of the three.js library where the bug occurred.
2. Specify your browser version, operating system, and graphics card. (for example, Chrome 23.0.1271.95, Windows 7, Nvidia Quadro 2000M)
3. Describe the problem in detail. Explain what happened, and what you expected would happen.
4. Provide a small test-case (http://jsfiddle.net). If a test-case is not possible, provide a link to a live version of your application.
5. If helpful, include a screenshot. Annotate the screenshot for clarity.
How to contribute to three.js
---
1. Make sure you have a GitHub account.
2. Fork the repository on GitHub.
3. Check the [Contribution Guidelines](https://github.com/mrdoob/three.js/wiki/How-to-contribute-to-three.js).
4. Make changes to your clone of the repository.
5. Submit a pull request.

View File

@ -1,21 +0,0 @@
The MIT License
Copyright © 2010-2015 three.js authors
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -1,68 +0,0 @@
three.js
========
#### JavaScript 3D library ####
The aim of the project is to create a lightweight 3D library with a very low level of complexity — in other words, for dummies. The library provides &lt;canvas&gt;, &lt;svg&gt;, CSS3D and WebGL renderers.
[Examples](http://threejs.org/examples/) — [Documentation](http://threejs.org/docs/) — [Migrating](https://github.com/mrdoob/three.js/wiki/Migration) — [Help](http://stackoverflow.com/questions/tagged/three.js)
### Usage ###
Download the [minified library](http://threejs.org/build/three.min.js) and include it in your html.
Alternatively see [how to build the library yourself](https://github.com/mrdoob/three.js/wiki/build.py,-or-how-to-generate-a-compressed-Three.js-file).
```html
<script src="js/three.min.js"></script>
```
This code creates a scene, a camera, and a geometric cube, and it adds the cube to the scene. It then creates a &lt;canvas&gt; renderer for the scene and camera, and it adds that viewport to the document.body element. Finally it animates the cube within the scene for the camera.
```html
<script>
var scene, camera, renderer;
var geometry, material, mesh;
init();
animate();
function init() {
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 75, window.innerWidth / window.innerHeight, 1, 10000 );
camera.position.z = 1000;
geometry = new THREE.BoxGeometry( 200, 200, 200 );
material = new THREE.MeshBasicMaterial( { color: 0xff0000, wireframe: true } );
mesh = new THREE.Mesh( geometry, material );
scene.add( mesh );
renderer = new THREE.WebGLRenderer();
renderer.setSize( window.innerWidth, window.innerHeight );
document.body.appendChild( renderer.domElement );
}
function animate() {
requestAnimationFrame( animate );
mesh.rotation.x += 0.01;
mesh.rotation.y += 0.02;
renderer.render( scene, camera );
}
</script>
```
If everything went well you should see [this](http://jsfiddle.net/f17Lz5ux/).
### Change log ###
[releases](https://github.com/mrdoob/three.js/releases)

View File

@ -1,26 +0,0 @@
{
"name": "three.js",
"homepage": "http://threejs.org/",
"description": "JavaScript 3D library",
"main": "build/three.js",
"keywords": [
"three",
"threejs",
"three.js",
"3D",
"webgl"
],
"license": "MIT",
"ignore": [
"**/.*",
"*.md",
"docs",
"editor",
"examples/*",
"!examples/js",
"src",
"test",
"utils",
"LICENSE"
]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,7 +0,0 @@
Contributing to the documentation
=================================
- To link to the page for `ClassName`, use `[page:ClassName link title]` (or just `[page:ClassName]`). Use `[page:ClassName.memberName]` to link to a class member (a property or method) called `memberName` on the page for `ClassName`. You can write `[page:.memberName]` to link to a property or method called `memberName` on the same page.
- Use `[example:exampleName title]` (ot just `[example:exampleName]`) to link to the example `threejs.org/examples/#exampleName`.
- Document a property by writing `<h3>[property:TypeName propertyName]</h3>`.
- Document a method using `<h3>[method:ReturnType methodName]</h3>`.

View File

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">todo</div>
<h2>Example</h2>
<code>todo</code>
<h2>Constructor</h2>
<h3>todo</h3>
<div></div>
<h2>Properties</h2>
<h3>todo</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>todo</h3>
<div>todo</div>
<div>
todo
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,50 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
[page:Object3D] &rarr;
<h1>[name]</h1>
<div class="desc">Abstract base class for cameras. This class should always be inherited when you build a new camera.</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
This constructor sets the following properties to the correct type: matrixWorldInverse and projectionMatrix.
</div>
<h2>Properties</h2>
<h3>[property:Matrix4 matrixWorldInverse]</h3>
<div>This is the inverse of matrixWorld. MatrixWorld contains the Matrix which has the world transform of the Camera.</div>
<h3>[property:Matrix4 projectionMatrix]</h3>
<div>This is the matrix which contains the projection.</div>
<h2>Methods</h2>
<h3>[method:null lookAt]( [page:Vector3 vector] )</h3>
<div>
vector — point to look at<br />
<br />
This makes the camera look at the vector position in the global space as long as the parent of this camera is the scene or at position (0,0,0).
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,83 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
[page:Object3D] &rarr;
<h1>[name]</h1>
<div class="desc">Creates 6 cameras that render to a [page:WebGLRenderTargetCube].</div>
<h2>Examples</h2>
<div>[example:webgl_materials_cubemap_dynamic materials / cubemap / dynamic ]</div>
<div>[example:webgl_materials_cubemap_dynamic2 materials / cubemap / dynamic2 ]</div>
<div>[example:webgl_materials_cubemap_dynamic2 shading / physical ]</div>
<code>//Create cube camera
var cubeCamera = new THREE.CubeCamera( 1, 100000, 128 );
scene.add( cubeCamera );
//Create car
var chromeMaterial = new THREE.MeshLambertMaterial( { color: 0xffffff, envMap: cubeCamera.renderTarget } );
var car = new Mesh( carGeometry, chromeMaterial );
scene.add( car );
//Update the render target cube
car.setVisible( false );
cubeCamera.position.copy( car.position );
cubeCamera.updateCubeMap( renderer, scene );
//Render the scene
car.setVisible( true );
renderer.render( scene, camera );
</code>
<h2>Constructor</h2>
<h3>[name]([page:number near], [page:number far], [page:number cubeResolution])</h3>
<div>
near -- The near clipping distance. <br />
far -- The far clipping distance <br />
cubeResolution -- Sets the width of the cube.
</div>
<div>
Constructs a CubeCamera that contains 6 [page:PerspectiveCamera PerspectiveCameras] that then
render to a [page:WebGLRenderTargetCube]
</div>
<h2>Properties</h2>
<h3>[property:WebGLRenderTargetCube renderTarget]</h3>
<div>
The cube texture that gets generated.
</div>
<h2>Methods</h2>
<h3>[method:todo updateCubeMap]([page:todo renderer], [page:todo scene])</h3>
<div>
renderer -- The current WebGL renderer <br />
scene -- The current scene
</div>
<div>
Call this to update the renderTarget.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,70 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
[page:Object3D] &rarr; [page:Camera] &rarr;
<h1>[name]</h1>
<div class="desc">Camera with orthographic projection.</div>
<h2>Example</h2>
<code>var camera = new THREE.OrthographicCamera( width / - 2, width / 2, height / 2, height / - 2, 1, 1000 );
scene.add( camera );</code>
<h2>Constructor</h2>
<h3>[name]( [page:Float left], [page:Float right], [page:Float top], [page:Float bottom], [page:Float near], [page:Float far] )</h3>
<div>
left — Camera frustum left plane.<br />
right — Camera frustum right plane.<br />
top — Camera frustum top plane.<br />
bottom — Camera frustum bottom plane.<br />
near — Camera frustum near plane.<br />
far — Camera frustum far plane.
</div>
<h2>Properties</h2>
<h3>[property:Float left]</h3>
<div>Camera frustum left plane.</div>
<h3>[property:Float right]</h3>
<div>Camera frustum right plane.</div>
<h3>[property:Float top]</h3>
<div>Camera frustum top plane.</div>
<h3>[property:Float bottom]</h3>
<div>Camera frustum bottom plane.</div>
<h3>[property:Float near]</h3>
<div>Camera frustum near plane.</div>
<h3>[property:Float far]</h3>
<div>Camera frustum far plane.</div>
<h2>Methods</h2>
<h3>[method:null updateProjectionMatrix]()</h3>
<div>
Updates the camera projection matrix. Must be called after change of parameters.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,119 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
[page:Object3D] &rarr; [page:Camera] &rarr;
<h1>[name]</h1>
<div class="desc">Camera with perspective projection.</div>
<h2>Example</h2>
<code>var camera = new THREE.PerspectiveCamera( 45, width / height, 1, 1000 );
scene.add( camera );</code>
<h2>Constructor</h2>
<h3>[name]( [page:Float fov], [page:Float aspect], [page:Float near], [page:Float far] )</h3>
<div>
fov — Camera frustum vertical field of view.<br />
aspect — Camera frustum aspect ratio.<br />
near — Camera frustum near plane.<br />
far — Camera frustum far plane.
</div>
<h2>Properties</h2>
<h3>[property:Float fov]</h3>
<div>Camera frustum vertical field of view, from bottom to top of view, in degrees.</div>
<h3>[property:Float aspect]</h3>
<div>Camera frustum aspect ratio, window width divided by window height.</div>
<h3>[property:Float near]</h3>
<div>Camera frustum near plane.</div>
<h3>[property:Float far]</h3>
<div>Camera frustum far plane.</div>
<h2>Methods</h2>
<h3>[method:null setLens]( [page:Float focalLength], [page:Float frameSize] )</h3>
<div>
focalLength — focal length<br />
frameSize — frame size
</div>
<div>
Uses focal length (in mm) to estimate and set FOV 35mm (fullframe) camera is used if frame size is not specified.<br />
Formula based on [link:http://www.bobatkins.com/photography/technical/field_of_view.html]
</div>
<h3>[method:null setViewOffset]( [page:Float fullWidth], [page:Float fullHeight], [page:Float x], [page:Float y], [page:Float width], [page:Float height] )</h3>
<div>
fullWidth — full width of multiview setup<br />
fullHeight — full height of multiview setup<br />
x — horizontal offset of subcamera<br />
y — vertical offset of subcamera<br />
width — width of subcamera<br />
height — height of subcamera
</div>
<div>
Sets an offset in a larger frustum. This is useful for multi-window or multi-monitor/multi-machine setups.
</div>
<div>
For example, if you have 3x2 monitors and each monitor is 1920x1080 and the monitors are in grid like this:<br />
<pre>+---+---+---+
| A | B | C |
+---+---+---+
| D | E | F |
+---+---+---+</pre>
then for each monitor you would call it like this:<br />
<code>var w = 1920;
var h = 1080;
var fullWidth = w * 3;
var fullHeight = h * 2;
// A
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 0, w, h );
// B
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 0, w, h );
// C
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 0, w, h );
// D
camera.setViewOffset( fullWidth, fullHeight, w * 0, h * 1, w, h );
// E
camera.setViewOffset( fullWidth, fullHeight, w * 1, h * 1, w, h );
// F
camera.setViewOffset( fullWidth, fullHeight, w * 2, h * 1, w, h );
</code>
Note there is no reason monitors have to be the same size or in a grid.
</div>
<h3>[method:null updateProjectionMatrix]()</h3>
<div>
Updates the camera projection matrix. Must be called after change of parameters.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,44 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>Custom Blending Equation Constants</h1>
<h2>Equations</h2>
<div>
THREE.AddEquation<br />
THREE.SubtractEquation<br />
THREE.ReverseSubtractEquation<br />
THREE.MinEquation<br />
THREE.MaxEquation
</div>
<h2>Destination Factors</h2>
<div>
THREE.ZeroFactor<br />
THREE.OneFactor<br />
THREE.SrcColorFactor<br />
THREE.OneMinusSrcColorFactor<br />
THREE.SrcAlphaFactor<br />
THREE.OneMinusSrcAlphaFactor<br />
THREE.DstAlphaFactor<br />
THREE.OneMinusDstAlphaFactor
</div>
<h2>Source Factors</h2>
<div>
THREE.DstColorFactor<br />
THREE.OneMinusDstColorFactor<br />
THREE.SrcAlphaSaturateFactor
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/Three.js src/Three.js]
</body>
</html>

View File

@ -1,30 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>GL State Constants</h1>
<h2>Cull Face</h2>
<div>
THREE.CullFaceNone<br />
THREE.CullFaceBack<br />
THREE.CullFaceFront<br />
THREE.CullFaceFrontBack
</div>
<h2>Front Face Direction</h2>
<div>
THREE.FrontFaceDirectionCW<br />
THREE.FrontFaceDirectionCCW<br />
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/Three.js src/Three.js]
</body>
</html>

View File

@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>Material Constants</h1>
<h2>Side</h2>
<div>
THREE.FrontSide<br />
THREE.BackSide<br />
THREE.DoubleSide
</div>
<h2>Shading</h2>
<div>
THREE.NoShading<br />
THREE.FlatShading<br />
THREE.SmoothShading
</div>
<h2>Colors</h2>
<div>
THREE.NoColors<br />
THREE.FaceColors<br />
THREE.VertexColors
</div>
<h2>Blending Mode</h2>
<div>
THREE.NoBlending<br />
THREE.NormalBlending<br />
THREE.AdditiveBlending<br />
THREE.SubtractiveBlending<br />
THREE.MultiplyBlending<br />
THREE.CustomBlending
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/Three.js src/Three.js]
</body>
</html>

View File

@ -1,23 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>Shadowing Type Constants</h1>
<h2>Shadow Map</h2>
<div>
THREE.BasicShadowMap<br />
THREE.PCFShadowMap<br />
THREE.PCFSoftShadowMap
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/Three.js src/Three.js]
</body>
</html>

View File

@ -1,95 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>Texture Constants</h1>
<h2>Operations</h2>
<div>
THREE.MultiplyOperation<br />
THREE.MixOperation<br />
THREE.AddOperation
</div>
<h2>Mapping Modes</h2>
<div>
THREE.UVMapping<br />
THREE.CubeReflectionMapping<br />
THREE.CubeRefractionMapping<br />
THREE.EquirectangularReflectionMapping<br />
THREE.EquirectangularRefractionMapping<br />
THREE.SphericalReflectionMapping
</div>
<h2>Wrapping Modes</h2>
<div>
THREE.RepeatWrapping<br />
THREE.ClampToEdgeWrapping<br />
THREE.MirroredRepeatWrapping
</div>
<h2>Filters</h2>
<div>
THREE.NearestFilter<br />
THREE.NearestMipMapNearestFilter<br />
THREE.NearestMipMapLinearFilter<br />
THREE.LinearFilter<br />
THREE.LinearMipMapNearestFilter<br />
THREE.LinearMipMapLinearFilter
</div>
<h2>Data Types</h2>
<div>
THREE.UnsignedByteType<br />
THREE.ByteType<br />
THREE.ShortType<br />
THREE.UnsignedShortType<br />
THREE.IntType<br />
THREE.UnsignedIntType<br />
THREE.FloatType<br />
THREE.HalfFloatType
</div>
<h2>Pixel Types</h2>
<div>
THREE.UnsignedShort4444Type<br />
THREE.UnsignedShort5551Type<br />
THREE.UnsignedShort565Type
</div>
<h2>Pixel Formats</h2>
<div>
THREE.AlphaFormat<br />
THREE.RGBFormat<br />
THREE.RGBAFormat<br />
THREE.LuminanceFormat<br />
THREE.LuminanceAlphaFormat<br />
THREE.RGBEFormat
</div>
<h2>DDS / ST3C Compressed Texture Formats</h2>
<div>
THREE.RGB_S3TC_DXT1_Format<br />
THREE.RGBA_S3TC_DXT1_Format<br />
THREE.RGBA_S3TC_DXT3_Format<br />
THREE.RGBA_S3TC_DXT5_Format
</div>
<h2>PVRTC Compressed Texture Formats</h2>
<div>
THREE.RGB_PVRTC_4BPPV1_Format<br />
THREE.RGB_PVRTC_2BPPV1_Format<br />
THREE.RGBA_PVRTC_4BPPV1_Format<br />
THREE.RGBA_PVRTC_2BPPV1_Format
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/Three.js src/Three.js]
</body>
</html>

View File

@ -1,105 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
This class stores data for an attribute associated with a [page:BufferGeometry]. See that page for details and a usage example. This class is used to store builtin attributes such as vertex position, normals, color, etc., but can also be used in your code to store custom attributes in a [page:BufferGeometry].
</div>
<h2>Constructor</h2>
<h3>[name]([page:Array array], [page:Integer itemSize])</h3>
<div>
Instantiates this attibute with data from the associated buffer. The array can either be a regular Array or a Typed Array.
itemSize gives the number of values of the array that should be associated with a particular vertex.
</div>
<h2>Properties</h2>
<h3>[property:Array array]</h3>
<div>
Stores the data associated with this attribute; can be an Array or a Typed Array. This element should have <code>itemSize * numVertices</code> elements, where numVertices is the number of vertices in the associated [page:BufferGeometry geometry].
</div>
<h3>[property:Integer itemSize]</h3>
<div>
Records how many items of the array are associated with a particular vertex. For instance, if this
attribute is storing a 3-component vector (such as a position, normal, or color), then itemSize should be 3.
</div>
<h3>[property:Integer length]</h3>
<div>
Gives the total number of elements in the array.
</div>
<h3>[property:Boolean needsUpdate]</h3>
<div>
Flag to indicate that this attribute has changed and should be re-send to the GPU. Set this to true when you modify the value of the array.
</div>
<h2>Methods</h2>
<h3>[method:null copyAt] ( [page:Integer index1], attribute, [page:Integer index2] ) </h3>
<div>
Copies itemSize values in the array from the vertex at index2 to the vertex at index1.
</div>
<h3>[method:null set] ( [page:Array value] ) </h3>
<div>
Sets the associated array with values from the passed array.
</div>
<h3>[method:null setX]( index, x ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x
</div>
<h3>[method:null setY]( index, y ) </h3>
<div>
Sets the value of the array at <code>index * itemSize + 1</code> to y
</div>
<h3>[method:null setZ]( index, z ) </h3>
<div>
Sets the value of the array at <code>index * itemSize + 2</code> to z
</div>
<h3>[method:null setXY]( index, x, y ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x and
sets the value of the array at <code>index * itemSize + 1</code> to y
</div>
<h3>[method:null setXYZ]( index, x, y, z ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x,
the value of the array at <code>index * itemSize + 1</code> to y, and
the value of the array at <code>index * itemSize + 2</code> to z.
</div>
<h3>[method:null setXYZW]( index, x, y, z, w ) </h3>
<div>
Sets the value of the array at <code>index * itemSize</code> to x,
the value of the array at <code>index * itemSize + 1</code> to y,
the value of the array at <code>index * itemSize + 2</code> to z, and
the value of the array at <code>index * itemSize + 3</code> to w.
</div>
<h3>[method:BufferAttribute clone]() </h3>
<div>
Copies this attribute.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,237 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
<p>
This class is an efficient alternative to [page:Geometry], because it stores all data, including
vertex positions, face indices, normals, colors, UVs, and custom attributes within buffers; this
reduces the cost of passing all this data to the GPU.
This also makes BufferGeometry harder to work with than [page:Geometry]; rather than accessing
position data as [page:Vector3] objects, color data as [page:Color] objects, and so on, you have to
access the raw data from the appropriate [page:BufferAttribute attribute] buffer. This makes
BufferGeometry best-suited for static objects where you don't need to manipulate the geometry much
after instantiating it.
</p>
<h3>Example</h3>
<code>
var geometry = new THREE.BufferGeometry();
// create a simple square shape. We duplicate the top left and bottom right
// vertices because each vertex needs to appear once per triangle.
var vertexPositions = [
[-1.0, -1.0, 1.0],
[ 1.0, -1.0, 1.0],
[ 1.0, 1.0, 1.0],
[ 1.0, 1.0, 1.0],
[-1.0, 1.0, 1.0],
[-1.0, -1.0, 1.0]
];
var vertices = new Float32Array( vertexPositions.length * 3 ); // three components per vertex
// components of the position vector for each vertex are stored
// contiguously in the buffer.
for ( var i = 0; i < vertexPositions.length; i++ )
{
vertices[ i*3 + 0 ] = vertexPositions[i][0];
vertices[ i*3 + 1 ] = vertexPositions[i][1];
vertices[ i*3 + 2 ] = vertexPositions[i][2];
}
// itemSize = 3 because there are 3 values (components) per vertex
geometry.addAttribute( 'position', new THREE.BufferAttribute( vertices, 3 ) );
var material = new THREE.MeshBasicMaterial( { color: 0xff0000 } );
var mesh = new THREE.Mesh( geometry, material );
</code>
<p>More examples: [example:webgl_buffergeometry Complex mesh with non-indexed faces], [example:webgl_buffergeometry_uint Complex mesh with indexed faces], [example:webgl_buffergeometry_lines Lines], [example:webgl_buffergeometry_lines_indexed Indexed Lines], [example:webgl_buffergeometry_particles Particles], and [example:webgl_buffergeometry_rawshader Raw Shaders].</p>
<h3>Accessing attributes</h3>
<p>
WebGL stores data associated with individual vertices of a geometry in <emph>attributes</emph>.
Examples include the position of the vertex, the normal vector for the vertex, the vertex color,
and so on. When using [page:Geometry], the [page:WebGLRenderer renderer] takes care of wrapping
up this information into typed array buffers and sending this data to the shader. With
BufferGeometry, all of this data is stored in buffers associated with an individual attributes.
This means that to get the position data associated with a vertex (for instance), you must call
[page:.getAttribute] to access the 'position' [page:BufferAttribute attribute], then access the individual
x, y, and z coordinates of the position.
</p>
<p>
The following attributes are set by various members of this class:
</p>
<h4>[page:BufferAttribute position] (itemSize: 3)</h4>
<div>
Stores the x, y, and z coordinates of each vertex in this geometry. Set by [page:.fromGeometry]().
</div>
<h4>[page:BufferAttribute normal] (itemSize: 3)</h4>
<div>
Stores the x, y, and z components of the face or vertex normal vector of each vertex in this geometry.
Set by [page:.fromGeometry]().
</div>
<h4>[page:BufferAttribute color] (itemSize: 3)</h4>
<div>
Stores the red, green, and blue channels of vertex color of each vertex in this geometry.
Set by [page:.fromGeometry]().
</div>
<h4>[page:BufferAttribute tangent] (itemSize: 3)</h4>
<div>
Stores the x, y, and z components of the tangent vector of each vertex in this geometry. Set by [page:.computeTangents]().
</div>
<h4>[page:BufferAttribute index] (itemSize: 3)</h4>
Allows for vertices to be re-used across multiple triangles; this is called using "indexed triangles," and works much the same as it does in [page:Geometry]: each triangle is associated with the index of three vertices. This attribute therefore stores the index of each vertex for each triangular face.
If this attribute is not set, the [page:WebGLRenderer renderer] assumes that each three contiguous positions represent a single triangle.
</div>
<p>
In addition to the the built-in attributes, you can set your own custom attributes using the addAttribute method. With [page:Geometry], these attributes are set and stored on the [page:Material]. In BufferGeometry, the attributes are stored with the geometry itself. Note that you still need to set the attributes information on the material as well, but the value of each attribute is stored in the BufferGeometry.
</p>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
This creates a new [name]. It also sets several properties to a default value.
</div>
<h2>Properties</h2>
<h3>[property:Integer id]</h3>
<div>
Unique number for this buffergeometry instance.
</div>
<h3>[property:Hashmap attributes]</h3>
<div>
This hashmap has as id the name of the attribute to be set and as value the [page:BufferAttribute buffer] to set it to.
Rather than accessing this property directly, use addAttribute and getAttribute to access attributes of this geometry.
</div>
<!--
<h3>[property:Boolean dynamic]</h3>
<div>
When set, it holds certain buffers in memory to have faster updates for this object. When unset, it deletes those buffers and saves memory.
</div> -->
<h3>[property:Array drawCalls] (previously [property:Array offsets])</h3>
<div>
For geometries that use indexed triangles, this Array can be used to split the object into multiple WebGL draw calls. Each draw call will draw some subset of the vertices in this geometry using the configured [page:Material shader]. This may be necessary if, for instance, you have more than 65535 vertices in your object.
Each element is an object of the form:
<code>{ start: Integer, count: Integer, index: Integer }</code>
where start specifies the index of the first vertex in this draw call, count specifies how many vertices are included, and index specifies an optional offset.
Use addDrawCall to add draw calls, rather than modifying this array directly.
</div>
<h3>[property:Box3 boundingBox]</h3>
<div>
Bounding box.
<code>{ min: new THREE.Vector3(), max: new THREE.Vector3() }</code>
</div>
<h3>[property:Sphere boundingSphere]</h3>
<div>
Bounding sphere.
<code>{ radius: float }</code>
</div>
<h3>[property:Array morphTargets]</h3>
<div>
Array of morph targets. Each morph target is a Javascript object:
<code>{ name: "targetName", vertices: [ new THREE.Vertex(), ... ] }</code>
Morph vertices match number and order of primary vertices.
</div>
<h3>[property:boolean hasTangents]</h3>
<div>
True if BufferGeometry has tangents. Set in [page:.computeTangents].
</div>
<h2>Methods</h2>
<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
<h3>[property:null addAttribute]( [page:String name], [page:BufferAttribute attribute] )</h3>
<div>
Adds an attribute to this geometry. Use this rather than the attributes property,
because an internal array of attributes is maintained to speed up iterating over
attributes.
</div>
<h3>[method:null addDrawCall]( [page:Integer start], [page:Integer count], [page:Integer indexOffset] )</h3>
<div>
Adds a draw call to this geometry; see the drawcalls property for details.
</div>
<h3>[method:null applyMatrix]( [page:Matrix4 matrix] )</h3>
<div>
Bakes matrix transform directly into vertex coordinates.
</div>
<h3>[method:null computeVertexNormals]()</h3>
<div>
Computes vertex normals by averaging face normals.<br />
</div>
<h3>[method:null computeTangents]()</h3>
<div>
Computes vertex tangents.<br />
Based on [link:http://www.terathon.com/code/tangent.html]<br />
Geometry must have vertex [page:UV UVs] (layer 0 will be used).
</div>
<h3>[method:null computeBoundingBox]()</h3>
<div>
Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.<br />
Bounding boxes aren't computed by default. They need to be explicitly computed, otherwise they are *null*.
</div>
<h3>[method:null computeBoundingSphere]()</h3>
<div>
Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.<br />
Bounding spheres aren't computed by default. They need to be explicitly computed, otherwise they are *null*.
</div>
<h3>[method:null dispose]()</h3>
<div>
Disposes the object from memory. <br />
You need to call this when you want the bufferGeometry removed while the application is running.
</div>
<h3>[method:null fromGeometry]( [page:Geometry] )</h3>
<div>
Populates this BufferGeometry with data from a [page:Geometry] object.
</div>
<h3>[method:BufferAttribute getAttribute]( [page:String name] )</h3>
<div>
Returns the [page:BufferAttribute attribute] with the specified name.
</div>
<h3>[method:null normalizeNormals]()</h3>
<div>
Every normal vector in a geometry will have a magnitude of 1.
This will correct lighting on the geometry surfaces.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,82 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">Object for keeping track of time.</div>
<h2>Constructor</h2>
<h3>[name]( [page:Boolean autoStart] )</h3>
<div>
autoStart — Automatically start the clock.
</div>
<h2>Properties</h2>
<h3>[property:Boolean autoStart]</h3>
<div>
If set, starts the clock automatically when the first update is called.
</div>
<h3>[property:Float startTime]</h3>
<div>
When the clock is running, It holds the start time of the clock. <br />
This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
</div>
<h3>[property:Float oldTime]</h3>
<div>
When the clock is running, It holds the previous time from a update.<br />
This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
</div>
<h3>[property:Float elapsedTime]</h3>
<div>
When the clock is running, It holds the time elapsed between the start of the clock to the previous update.<br />
This counted from the number of milliseconds elapsed since 1 January 1970 00:00:00 UTC.
</div>
<h3>[property:Boolean running]</h3>
<div>
This property keeps track whether the clock is running or not.
</div>
<h2>Methods</h2>
<h3>[method:null start]()</h3>
<div>
Starts clock.
</div>
<h3>[method:null stop]()</h3>
<div>
Stops clock.
</div>
<h3>[method:Float getElapsedTime]()</h3>
<div>
Get the seconds passed since the clock started.
</div>
<h3>[method:Float getDelta]()</h3>
<div>
Get the seconds passed since the last call to this method.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">JavaScript events for custom objects.<br />
<a href="https://github.com/mrdoob/eventdispatcher.js">https://github.com/mrdoob/eventdispatcher.js</a></div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
Creates EventDispatcher object.
</div>
<h2>Methods</h2>
<h3>[method:null addEventListener]( [page:String type], [page:Function listener] )</h3>
<div>
type - The type of event to listen to.<br />
listener - The function that gets called when the event is fired.
</div>
<div>
Adds a listener to an event type.
</div>
<h3>[method:Boolean hasEventListener]( [page:String type], [page:Function listener] )</h3>
<div>
type - The type of event to listen to.<br />
listener - The function that gets called when the event is fired.
</div>
<div>
Checks if listener is added to an event type.
</div>
<h3>[method:null removeEventListener]( [page:String type], [page:Function listener] )</h3>
<div>
type - The type of the listener that gets removed.<br />
listener - The listener function that gets removed.
</div>
<div>
Removes a listener from an event type.
</div>
<h3>[method:null dispatchEvent]( [page:String type] )</h3>
<div>
type - The type of event that gets fired.
</div>
<div>
Fire an event type.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,96 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
Triangle face.
</div>
<h2>Example</h2>
<code>var normal = new THREE.Vector3( 0, 1, 0 );
var color = new THREE.Color( 0xffaa00 );
var face = new THREE.Face3( 0, 1, 2, normal, color, 0 );</code>
<h2>Constructor</h2>
<h3>[name]( [page:Integer a], [page:Integer b], [page:Integer c], [page:Vector3 normal], [page:Color color], [page:Integer materialIndex] )</h3>
<div>
a — Vertex A index.<br />
b — Vertex B index.<br />
c — Vertex C index.<br />
normal — Face normal or array of vertex normals.<br />
color — Face color or array of vertex colors.<br />
materialIndex — Material index.
</div>
<h2>Properties</h2>
<h3>[property:Integer a]</h3>
<div>
Vertex A index.
</div>
<h3>[property:Integer b]</h3>
<div>
Vertex B index.
</div>
<h3>[property:Integer c]</h3>
<div>
Vertex C index.
</div>
<h3>[property:Vector3 normal]</h3>
<div>
Face normal.
</div>
<h3>[property:Color color]</h3>
<div>
Face color.
</div>
<h3>[property:Array vertexNormals]</h3>
<div>
Array of 3 vertex normals.
</div>
<h3>[property:Array vertexColors]</h3>
<div>
Array of 3 vertex colors.
</div>
<h3>[property:Array vertexTangents]</h3>
<div>
Array of 3 vertex tangents.
</div>
<h3>[property:Integer materialIndex]</h3>
<div>
Material index (points to [page:MeshFaceMaterial MeshFaceMaterial.materials]).
</div>
<h2>Methods</h2>
<h3>[method:Face3 clone]()</h3>
<div>
Creates a new clone of the Face3 object.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,253 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
Base class for geometries.<br />
A geometry holds all data necessary to describe a 3D model.
</div>
<h2>Example</h2>
<code>var geometry = new THREE.Geometry();
geometry.vertices.push(
new THREE.Vector3( -10, 10, 0 ),
new THREE.Vector3( -10, -10, 0 ),
new THREE.Vector3( 10, -10, 0 )
);
geometry.faces.push( new THREE.Face3( 0, 1, 2 ) );
geometry.computeBoundingSphere();
</code>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
The constructor takes no arguments.
</div>
<h2>Properties</h2>
<h3>[property:Integer id]</h3>
<div>
Unique number for this geometry instance.
</div>
<h3>[property:String name]</h3>
<div>
Name for this geometry. Default is an empty string.
</div>
<h3>[property:Array vertices]</h3>
<div>
Array of [page:Vector3 vertices].<br />
The array of vertices holds every position of points in the model.<br />
To signal an update in this array, [page:Geometry Geometry.verticesNeedUpdate] needs to be set to true.
</div>
<h3>[property:Array colors]</h3>
<div>
Array of vertex [page:Color colors], matching number and order of vertices.<br />
Used in [page:PointCloud] and [page:Line].<br />
[page:Mesh Meshes] use per-face-use-of-vertex colors embedded directly in faces.<br />
To signal an update in this array, [page:Geometry Geometry.colorsNeedUpdate] needs to be set to true.
</div>
<h3>[property:Array faces]</h3>
<div>
Array of [page:Face3 triangles].<br />
The array of faces describe how each vertex in the model is connected with each other.<br />
To signal an update in this array, [page:Geometry Geometry.elementsNeedUpdate] needs to be set to true.
</div>
<h3>[property:Array faceVertexUvs]</h3>
<div>
Array of face [page:UV] layers.<br />
Each UV layer is an array of [page:UV]s matching the order and number of vertices in faces.<br />
To signal an update in this array, [page:Geometry Geometry.uvsNeedUpdate] needs to be set to true.
</div>
<h3>[property:Array morphTargets]</h3>
<div>
Array of morph targets. Each morph target is a Javascript object:
<code>{ name: "targetName", vertices: [ new THREE.Vector3(), ... ] }</code>
Morph vertices match number and order of primary vertices.
</div>
<h3>[property:Array morphColors]</h3>
<div>
Array of morph colors. Morph colors have similar structure as morph targets, each color set is a Javascript object:
<code>morphColor = { name: "colorName", colors: [ new THREE.Color(), ... ] }</code>
Morph colors can match either the number and order of faces (face colors) or the number of vertices (vertex colors).
</div>
<h3>[property:Array morphNormals]</h3>
<div>
Array of morph normals. Morph normals have similar structure as morph targets, each normal set is a Javascript object:
<code>morphNormal = { name: "NormalName", normals: [ new THREE.Vector3(), ... ] }</code>
</div>
<h3>[property:Array skinWeights]</h3>
<div>
Array of skinning weights, matching number and order of vertices.
</div>
<h3>[property:Array skinIndices]</h3>
<div>
Array of skinning indices, matching number and order of vertices.
</div>
<h3>[property:Object boundingBox]</h3>
<div>
Bounding box.
<code>{ min: new THREE.Vector3(), max: new THREE.Vector3() }</code>
</div>
<h3>[property:Object boundingSphere]</h3>
<div>
Bounding sphere.
<code>{ radius: float }</code>
</div>
<h3>[property:Boolean hasTangents]</h3>
<div>
True if geometry has tangents. Set in [page:Geometry Geometry.computeTangents].
</div>
<h3>[property:Boolean dynamic]</h3>
<div>
Set to *true* if attribute buffers will need to change in runtime (using "dirty" flags).<br/>
Unless set to true internal typed arrays corresponding to buffers will be deleted once sent to GPU.<br/>
Defaults to true.
</div>
<h3>[property:Boolean verticesNeedUpdate]</h3>
<div>
Set to *true* if the vertices array has been updated.
</div>
<h3>[property:Boolean elementsNeedUpdate]</h3>
<div>
Set to *true* if the faces array has been updated.
</div>
<h3>[property:Boolean uvsNeedUpdate]</h3>
<div>
Set to *true* if the uvs array has been updated.
</div>
<h3>[property:Boolean normalsNeedUpdate]</h3>
<div>
Set to *true* if the normals array has been updated.
</div>
<h3>[property:Boolean tangentsNeedUpdate]</h3>
<div>
Set to *true* if the tangents in the faces has been updated.
</div>
<h3>[property:Boolean colorsNeedUpdate]</h3>
<div>
Set to *true* if the colors array has been updated.
</div>
<h3>[property:Boolean lineDistancesNeedUpdate]</h3>
<div>
Set to *true* if the linedistances array has been updated.
</div>
<h3>[property:array lineDistances]</h3>
<div>
An array containing distances between vertices for Line geometries.
This is required for LinePieces/LineDashedMaterial to render correctly.
Line distances can also be generated with computeLineDistances.
</div>
<h2>Methods</h2>
<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
<h3>[method:null applyMatrix]( [page:Matrix4 matrix] )</h3>
<div>
Bakes matrix transform directly into vertex coordinates.
</div>
<h3>[method:null computeFaceNormals]()</h3>
<div>
Computes face normals.
</div>
<h3>[method:null computeVertexNormals]()</h3>
<div>
Computes vertex normals by averaging face normals.<br />
Face normals must be existing / computed beforehand.
</div>
<h3>[method:null computeMorphNormals]()</h3>
<div>
Computes morph normals.
</div>
<h3>[method:null computeTangents]()</h3>
<div>
Computes vertex tangents.<br />
Based on [link:http://www.terathon.com/code/tangent.html]<br />
Geometry must have vertex [page:UV UVs] (layer 0 will be used).
</div>
<h3>[method:null computeBoundingBox]()</h3>
<div>
Computes bounding box of the geometry, updating [page:Geometry Geometry.boundingBox] attribute.
</div>
<h3>[method:null computeBoundingSphere]()</h3>
<div>
Computes bounding sphere of the geometry, updating [page:Geometry Geometry.boundingSphere] attribute.
</div>
<div>Neither bounding boxes or bounding spheres are computed by default. They need to be explicitly computed, otherwise they are *null*.</div>
<h3>[method:null merge]( [page:Geometry geometry], [page:Matrix4 matrix], [page:Integer materialIndexOffset] )</h3>
<div>Merge two geometries or geometry and geometry from object (using object's transform)</div>
<h3>[method:null mergeVertices]()</h3>
<div>
Checks for duplicate vertices using hashmap.<br />
Duplicated vertices are removed and faces' vertices are updated.
</div>
<h3>[method:Geometry clone]()</h3>
<div>
Creates a new clone of the Geometry.
</div>
<h3>[method:null dispose]()</h3>
<div>
Removes The object from memory. <br />
Don't forget to call this method when you remove a geometry because it can cause memory leaks.
</div>
<h3>[method:null computeLineDistances]()</h3>
<div>
Compute distances between vertices for Line geometries.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,309 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">Base class for scene graph objects.</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
The constructor takes no arguments.
</div>
<h2>Properties</h2>
<h3>[property:Integer id]</h3>
<div>
readonly Unique number for this object instance.
</div>
<h3>[property:String uuid]</h3>
<div>
[link:http://en.wikipedia.org/wiki/Universally_unique_identifier UUID] of this object instance.
This gets automatically assigned, so this shouldn't be edited.
</div>
<h3>[property:String name]</h3>
<div>
Optional name of the object (doesn't need to be unique).
</div>
<h3>[property:Object3D parent]</h3>
<div>
Object's parent in the scene graph.
</div>
<h3>[property:Object3D children]</h3>
<div>
Array with object's children.
</div>
<h3>[property:Vector3 position]</h3>
<div>
Object's local position.
</div>
<h3>[property:Euler rotation]</h3>
<div>
Object's local rotation (<a href="https://en.wikipedia.org/wiki/Euler_angles" target="_blank">Euler angles</a>), in radians.
</div>
<h3>[property:Vector3 scale]</h3>
<div>
Object's local scale.
</div>
<h3>[property:Vector3 up]</h3>
<div>
Up direction.
</div>
<h3>[property:Matrix4 matrix]</h3>
<div>
Local transform.
</div>
<h3>[property:Quaternion quaternion]</h3>
<div>
Object's local rotation as [page:Quaternion Quaternion].
</div>
<h3>[property:Boolean visible]</h3>
<div>
Object gets rendered if *true*.
</div>
<div>
default true
</div>
<h3>[property:Boolean castShadow]</h3>
<div>
Gets rendered into shadow map.
</div>
<div>
default false
</div>
<h3>[property:Boolean receiveShadow]</h3>
<div>
Material gets baked in shadow receiving.
</div>
<div>
default false
</div>
<h3>[property:Boolean frustumCulled]</h3>
<div>
When this is set, it checks every frame if the object is in the frustum of the camera. Otherwise the object gets drawn every frame even if it isn't visible.
</div>
<div>
default true
</div>
<h3>[property:Boolean matrixAutoUpdate]</h3>
<div>
When this is set, it calculates the matrix of position, (rotation or quaternion) and scale every frame and also recalculates the matrixWorld property.
</div>
<div>
default true
</div>
<h3>[property:Boolean matrixWorldNeedsUpdate]</h3>
<div>
When this is set, it calculates the matrixWorld in that frame and resets this property to false.
</div>
<div>
default false
</div>
<h3>[property:Boolean rotationAutoUpdate]</h3>
<div>
When this is set, then the rotationMatrix gets calculated every frame.
</div>
<div>
default true
</div>
<h3>[property:object userData]</h3>
<div>
An object that can be used to store custom data about the Object3d. It should not hold references to functions as these will not be cloned.
</div>
<h3>[property:Matrix4 matrixWorld]</h3>
<div>
The global transform of the object. If the Object3d has no parent, then it's identical to the local transform.
</div>
<h2>Methods</h2>
<h3>[page:EventDispatcher EventDispatcher] methods are available on this class.</h3>
<h3>[method:null applyMatrix]( [page:Matrix4 matrix])</h3>
<div>
matrix - matrix
</div>
<div>
This updates the position, rotation and scale with the matrix.
</div>
<h3>[method:null translateX]( [page:Float distance] )</h3>
<div>
distance - Distance.<br />
</div>
<div>
Translates object along x axis by distance.
</div>
<h3>[method:null translateY]( [page:Float distance] )</h3>
<div>
distance - Distance.<br />
</div>
<div>
Translates object along y axis by distance.
</div>
<h3>[method:null translateZ]( [page:Float distance] )</h3>
<div>
distance - Distance.<br />
</div>
<div>
Translates object along z axis by distance.
</div>
<h3>[method:Vector3 localToWorld]( [page:Vector3 vector] )</h3>
<div>
vector - A local vector.<br />
</div>
<div>
Updates the vector from local space to world space.
</div>
<h3>[method:Vector3 worldToLocal]( [page:Vector3 vector] )</h3>
<div>
vector - A world vector.<br />
</div>
<div>
Updates the vector from world space to local space.
</div>
<h3>[method:null lookAt]( [page:Vector3 vector] )</h3>
<div>
vector - A world vector to look at.<br />
</div>
<div>
Rotates object to face point in space.
</div>
<h3>[method:null add]( [page:Object3D object], ... )</h3>
<div>
object - An object.<br />
</div>
<div>
Adds *object* as child of this object. An arbitrary number of objects may be added.
</div>
<h3>[method:null remove]( [page:Object3D object], ... )</h3>
<div>
object - An object.<br />
</div>
<div>
Removes *object* as child of this object. An arbitrary number of objects may be removed.
</div>
<h3>[method:null traverse]( [page:Function callback] )</h3>
<div>
callback - A function with as first argument an object3D object.<br />
</div>
<div>
Executes the callback on this object and all descendants.
</div>
<h3>[method:null traverseVisible]( [page:Function callback] )</h3>
<div>
callback - A function with as first argument an object3D object.<br />
</div>
<div>
Like traverse, but the callback will only be executed for visible objects.
Descendants of invisible objects are not traversed.
</div>
<h3>[method:null traverseAncestors]( [page:Function callback] )</h3>
<div>
callback - A function with as first argument an object3D object.<br />
</div>
<div>
Executes the callback on this object and all ancestors.
</div>
<h3>[method:null updateMatrix]()</h3>
<div>
Updates local transform.
</div>
<h3>[method:null updateMatrixWorld]( [page:Boolean force] )</h3>
<div>
Updates global transform of the object and its children.
</div>
<h3>[method:Object3D clone]()</h3>
<div>
Creates a new clone of this object and all descendants.
</div>
<h3>[method:Object3D getObjectByName]([page:String name])</h3>
<div>
name -- String to match to the children's Object3d.name property. <br />
</div>
<div>
Searches through the object's children and returns the first with a matching name.
</div>
<h3>[method:Object3D getObjectById]([page:Integer id])</h3>
<div>
id -- Unique number of the object instance<br />
</div>
<div>
Searches through the object's children and returns the first with a matching id.
</div>
<h3>[method:Object3D translateOnAxis]([page:Vector3 axis], [page:Float distance])</h3>
<div>
axis -- A normalized vector in object space.<br />
distance -- The distance to translate.
</div>
<div>
Translate an object by distance along an axis in object space. The axis is assumed to be normalized.
</div>
<h3>[method:Object3D rotateOnAxis]([page:Vector3 axis], [page:Float angle])</h3>
<div>
axis -- A normalized vector in object space. <br />
angle -- The angle in radians.
</div>
<div>
Rotate an object along an axis in object space. The axis is assumed to be normalized.
</div>
<h3>[method:Array raycast]([page:Raycaster raycaster], [page:Array intersects])</h3>
<div>
Abstract method to get intersections between a casted ray and this object. Subclasses such as [page:Mesh], [page:Line], and [page:PointCloud] implement this method in order to participate in raycasting.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,177 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
This class makes raycasting easier. Raycasting is used for picking and more.
</div>
<h2>Example</h2>
<code>
var raycaster = new THREE.Raycaster();
var mouse = new THREE.Vector2();
function onMouseMove( event ) {
// calculate mouse position in normalized device coordinates
// (-1 to +1) for both components
mouse.x = ( event.clientX / window.innerWidth ) * 2 - 1;
mouse.y = - ( event.clientY / window.innerHeight ) * 2 + 1;
}
function render() {
// update the picking ray with the camera and mouse position
raycaster.setFromCamera( mouse, camera );
// calculate objects intersecting the picking ray
var intersects = raycaster.intersectObjects( scene.children );
for ( var i = 0; i < intersects.length; i++ ) {
intersects[ i ].object.material.color.set( 0xff0000 );
}
renderer.render( scene, camera );
}
window.addEventListener( 'mousemove', onMouseMove, false );
window.requestAnimationFrame(render);
</code>
<div>Examples: [example:webgl_interactive_cubes Raycasting to a Mesh],
[example:webgl_interactive_cubes_ortho Raycasting to a Mesh in using an OrthographicCamera],
[example:webgl_interactive_buffergeometry Raycasting to a Mesh with BufferGeometry],
[example:webgl_interactive_lines Raycasting to a Line],
[example:webgl_interactive_raycasting_pointcloud Raycasting to a PointCloud],
[example:webgl_geometry_terrain_raycast Terrain raycasting],
[example:webgl_octree_raycasting Raycasting using an octree],
[example:webgl_interactive_voxelpainter Raycasting to paint voxels]</div>
<div>
</div>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 origin], [page:Vector3 direction], [page:Float near], [page:Float far] ) {</h3>
<div>
[page:Vector3 origin] — The origin vector where the ray casts from.<br />
[page:Vector3 direction] — The direction vector that gives direction to the ray.<br />
[page:Float near] — All results returned are further away than near. Near can't be negative. Default value is 0.<br />
[page:Float far] — All results returned are closer then far. Far can't be lower then near . Default value is Infinity.
</div>
<div>
This creates a new raycaster object.<br />
</div>
<h2>Properties</h2>
<h3>[property:Ray ray]</h3>
<div>
The Ray used for the raycasting.
</div>
<h3>[property:float near]</h3>
<div>
The near factor of the raycaster. This value indicates which objects can be discarded based on the distance.<br />
This value shouldn't be negative and should be smaller than the far property.
</div>
<h3>[property:float far]</h3>
<div>
The far factor of the raycaster. This value indicates which objects can be discarded based on the distance.<br />
This value shouldn't be negative and should be larger than the near property.
</div>
<h3>[property:float precision]</h3>
<div>
The precision factor of the raycaster when intersecting [page:Mesh] objects.
</div>
<h3>.[page:float linePrecision]</h3>
<div>
The precision factor of the raycaster when intersecting [page:Line] objects.
</div>
<h2>Methods</h2>
<h3>[method:null set]( [page:Vector3 origin], [page:Vector3 direction] )</h3>
<div>
[page:Vector3 origin] — The origin vector where the ray casts from.<br />
[page:Vector3 direction] — The direction vector that gives direction to the ray.
</div>
<div>
Updates the ray with a new origin and direction.
</div>
<h3>[method:null setFromCamera]( [page:Vector2 coords], [page:Camera camera] )</h3>
<div>
[page:Vector2 coords] — 2D coordinates of the mouse, in normalized device coordinates (NDC)---X and Y components should be between -1 and 1.<br />
[page:Camera camera] — camera from which the ray should originate
</div>
<div>
Updates the ray with a new origin and direction.
</div>
<h3>[method:Array intersectObject]( [page:Object3D object], [page:Boolean recursive] )</h3>
<div>
<p>
[page:Object3D object] — The object to check for intersection with the ray.<br />
[page:Boolean recursive] — If set, it also checks all descendants. Otherwise it only checks intersecton with the object.
</p>
</div>
<div>
Checks all intersection between the ray and the object with or without the descendants. Intersections are returned sorted by distance, closest first. An array of intersections is returned...
<code>
[ { distance, point, face, faceIndex, indices, object }, ... ]
</code>
<p>
[page:Float distance] distance between the origin of the ray and the intersection<br />
[page:Vector3 point] point of intersection, in world coordinates<br />
[page:Face3 face] intersected face<br />
[page:Integer faceIndex] index of the intersected face<br />
[page:Array indices] indices of vertices comprising the intersected face<br />
[page:Object3D object] the intersected object
</p>
<p>
When intersecting a [page:Mesh] with a [page:BufferGeometry], the *faceIndex* will be *undefined*, and *indices* will be set; when intersecting a [page:Mesh] with a [page:Geometry], *indices* will be *undefined*.
</p>
<p>
*Raycaster* delegates to the [page:Object3D.raycast raycast] method of the passed object, when evaluating whether the ray intersects the object or not. This allows [page:Mesh meshes] to respond differently to ray casting than [page:Line lines] and [page:PointCloud pointclouds].
</p>
<p>
*Note* that for meshes, faces must be pointed towards the origin of the [page:.ray ray] in order to be detected; intersections of the ray passing through the back of a face will not be detected. To raycast against both faces of an object, you'll want to set the [page:Mesh.material material]'s [page:Material.side side] property to *THREE.DoubleSide*.
</p>
</div>
<h3>[method:Array intersectObjects]( [page:Array objects], [page:Boolean recursive] )</h3>
<div>
[page:Array objects] — The objects to check for intersection with the ray.<br />
[page:Boolean recursive] — If set, it also checks all descendants of the objects. Otherwise it only checks intersecton with the objects.
</div>
<div>
Checks all intersection between the ray and the objects with or without the descendants. Intersections are returned sorted by distance, closest first. Intersections are of the same form as those returned by [page:.intersectObject].
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,142 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
Represents a lookup table for colormaps. It is used to determine the color values from a range of data values.
</div>
<h2>Example</h2>
<code>var lut = new THREE.Lut( "rainbow", 512 );</code>
<code>var data = [0, 10.1, 4.2, 3.4, 63, 28];</code>
<code>lut.setMax(63);</code>
<code>color = lut.getColor(10);</code>
<h2>Constructor</h2>
<h3>[name]( colormap, numberOfColors )</h3>
<div>
colormap - optional argument that sets a colormap from predefined colormaps. Available colormaps are : "rainbow", "cooltowarm", "blackbody".
numberOfColors - optional argument that sets the number of colors used to represent the data array.
</div>
<h2>Properties</h2>
<h3>[property:Float minV]</h3>
<div>
The minimum value to be represented with the lookup table. Default is 0.
</div>
<h3>[property:Float maxV]</h3>
<div>
The maximum value to be represented with the lookup table. Default is 1.
</div>
<h3>.[legend]</h3>
<div>
The legend of the lookup table.
</div>
<h2>Methods</h2>
<h3>[method:null copy]( [page:Lut lut] ) [page:Lut this]</h3>
<div>
color — Lut to copy.
</div>
<div>
Copies given lut.
</div>
<h3>.setLegendOn [parameters]</h3>
<div>
parameters - { layout: value, position: { x: value, y: value, z: value }, dimensions: { width: value, height: value } }
layout — Horizontal or vertical layout. Default is vertical.<br />
position — The position x,y,z of the legend.<br />
dimensions — The dimensions (width and height) of the legend.<br />
</div>
<div>
Sets this Lut with the legend on.
</div>
<h3>.setLegendOff</h3>
<div>
</div>
<div>
Sets this Lut with the legend off.
</div>
<h3>.setLegendLabels [parameters, callback]</h3>
<div>
parameters - { fontsize: value, fontface: value, title: value, um: value, ticks: value, decimal: value, notation: value }
fontsize — Font size to be used for labels.<br />
fontface — Font type to be used for labels.<br />
title — The title of the legend.<br />
um — The unit of measurements of the legend.<br />
ticks — The number of ticks to be displayed.<br />
decimal — The number of decimals to be used for legend values.<br />
notation — Legend notation: standard (default) or scientific.<br />
callback — An optional callback to be used to format the legend labels.<br />
</div>
<div>
Sets the labels of the legend of this Lut.
</div>
<h3>[method:Lut setminV]( [page:Float minV] )</h3>
<div>
minV — The minimum value to be represented with the lookup table.<br />
</div>
<div>
Sets this Lut with the minimum value to be represented.
</div>
<h3>[method:Lut setmaxV]( [page:Float maxV] )</h3>
<div>
maxV — The maximum value to be represented with the lookup table.<br />
</div>
<div>
Sets this Lut with the maximum value to be represented.
</div>
<h3>[method:Lut changeNumberOfColors]( [page:Float numberOfColors] )</h3>
<div>
numberOfColors — The number of colors to be used to represent the data array.<br />
</div>
<div>
Sets this Lut with the number of colors to be used.
</div>
<h3>[method:Lut changeColorMap]( [page:Float colorMap] )</h3>
<div>
colorMap — The name of the color map to be used to represent the data array.<br />
</div>
<div>
Sets this Lut with the colormap to be used.
</div>
<h3>[method:Lut addColorMap]( colorMapName, arrayOfColors )</h3>
<div>
Insert a new color map into the set of available color maps.
</div>
<h3>[method:Lut getColor]( value ) [page:Lut this]</h3>
<div>
value -- the data value to be displayed as a color.
</div>
<div>
Returns a Three.Color.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/examples/js/math/[path].js examples/js/math/[path].js]
</body>
</html>

View File

@ -1,187 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Camera] &rarr;
<h1>[name]</h1>
<div class="desc">A general purpose camera, for setting FOV, Lens Focal Length,
and switching between perspective and orthographic views easily.
Use this only if you do not wish to manage
both an Orthographic and Perspective Camera</div>
<h2>Constructor</h2>
<h3>[name]([page:Number width], [page:Number height], [page:Number fov], [page:Number near], [page:Number far], [page:Number orthoNear], [page:Number orthoFar])</h3>
<div>
width -- Camera frustum width.<br />
height -- Camera frustum height.<br />
fov — Camera frustum vertical field of view in perspective view.<br />
near — Camera frustum near plane in perspective view.<br />
far — Camera frustum far plane in perspective view.<br />
orthoNear — Camera frustum near plane in orthographic view.<br />
orthoFar — Camera frustum far plane in orthographic view.
</div>
<div>
Creates a [name]. This initializes 2 cameras, an OrthographicCamera and a PerspectiveCamera. The default is the perspective Camera.
</div>
<h2>Properties</h2>
<h3>[property:Number fov]</h3>
<div>
Gets or sets the camera frustum vertical field of view in perspective view.
</div>
<h3>[property:number left]</h3>
<div>
Gets or sets the camera frustum left plane in orthographic view.
</div>
<h3>[property:Number right]</h3>
<div>
Gets or sets the camera frustum right plane in orthographic view.
</div>
<h3>[property:number top]</h3>
<div>
Gets or sets the camera frustum top plane in orthographic view.
</div>
<h3>[property:Number bottom]</h3>
<div>
Gets or sets the camera frustum bottom plane in orthographic view.
</div>
<h3>[property:number zoom]</h3>
<div>
Gets or sets the zoom factor of the camera.
</div>
<h3>[property:number near]</h3>
<div>
Gets camera frustum near plane.
</div>
<h3>[property:number far]</h3>
<div>
Gets camera frustum far plane.
</div>
<h3>[property:OrthographicCamera cameraO]</h3>
<div>
Gets or sets the internal OrthographicCamera used as camera.
</div>
<h3>[property:PerspectiveCamera cameraP]</h3>
<div>
Gets or sets the internal PerspectiveCamera used as camera.
</div>
<h3>[property:boolean inOrthographicMode]</h3>
<div>
Gets whether the combinedCamera is in Orthographic Mode.
</div>
<h3>[property:boolean inPerspectiveMode]</h3>
<div>
Gets whether the combinedCamera is in Perspective Mode.
</div>
<h2>Methods</h2>
<h3>[method:null setFov]([page:Number fov])</h3>
<div>
fov -- Camera frustum vertical field of view in perspective view.
</div>
<div>
sets the camera frustum vertical field of view in perspective view.
</div>
<h3>[method:null setZoom]([page:Number zoom])</h3>
<div>
zoom -- The zoom factor.
</div>
<div>
Sets the zoomfactor.
</div>
<h3>[method:null setLens]([page:number focalLength], [page:Number frameHeight])</h3>
<div>
focalLength -- The focal length of a lens is defined as the distance from the optical center of a lens (or, the secondary principal point for a complex lens like a camera lens) to the focal point (sensor) when the lens is focused on an object at infinity. <br />
frameHeight -- the size of the frame in mm. (default is *35*)
</div>
<div>
Sets the fov based on lens data.
</div>
<h3>[method:null toFrontView]()</h3>
<div>
Sets the camera to view the front of the target.
</div>
<h3>[method:null toBackView]()</h3>
<div>
Sets the camera to view the back of the target.
</div>
<h3>[method:null toLeftView]()</h3>
<div>
Sets the camera to view the left of the target.
</div>
<h3>[method:null toRightView]()</h3>
<div>
Sets the camera to view the right of the target.
</div>
<h3>[method:null toTopView]()</h3>
<div>
Sets the camera to view the top.
</div>
<h3>[method:null toBottomView]()</h3>
<div>
Sets the camera to view the bottom.
</div>
<h3>[method:null setSize]([page:Number width], [page:Number height])</h3>
<div>
width -- The width of the orthographic view.<br />
height -- The height of the orthographic view.
</div>
<div>
Sets the size of the orthographic view.
</div>
<h3>[method:null toOrthographic]()</h3>
<div>
Change the camera to orthographic view.
</div>
<h3>[method:null toPerspective]()</h3>
<div>
Change the camera to Perspective view.
</div>
<h3>[method:null updateProjectionMatrix]()</h3>
<div>
Updates the ProjectionMatrix.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,114 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">A class for text operations in three.js (See [page:TextGeometry])</div>
<h2>Properties</h2>
<h3>[property:number divisions]</h3>
<div>
The amount of segments in a curve. Default is 10.
</div>
<h3>[property:string style]</h3>
<div>
The style of the used font. Default is "normal".
</div>
<h3>[property:string weight]</h3>
<div>
The weight of the used font. Default is "normal".
</div>
<h3>[property:string face]</h3>
<div>
The name of the font. Default is "helvetiker".
</div>
<h3>[property:object faces]</h3>
<div>
All Fonts which are already loaded in.
</div>
<h3>[property:number size]</h3>
<div>
The size of the used Font. Default is 150.
</div>
<h2>Methods</h2>
<h3>[method:Object drawText]([page:string text])</h3>
<div>
text -- The text to draw.
</div>
<div>
Calculates the path and offset of the text in the used font. It returns an object like { paths : fontPaths, offset : width }.
</div>
<h3>[method:Array Triangulate]([page:Array contour], [page:Boolean indices])</h3>
<div>
contour -- Array of vector2 to define an contour <br />
indices -- A boolean indicating if you need to return indices.
</div>
<div>
Triangulates a contour into an array of faces.
</div>
<h3>[method:Object extractGlyphPoints]([page:string c], [page:string face], [page:number scale], [page:number offset], [page:Path path])</h3>
<div>
c -- The character to extract. <br />
face -- The face to use. <br />
scale -- The scale of the character. <br />
offset -- The offset of the character compared to begin of the path. <br />
path -- The path to which to add the character points.
</div>
<div>
This ectracts the glyphPoints of the character of the face and returns an object containing the path and the new offset.
</div>
<h3>[method:Array generateShapes]([page:string text], [page:Object parameters])</h3>
<div>
text -- The text to generate the shapes from.<br />
parameters -- The parameter containing <br />
size -- Default is 100.
curveSegments -- Default is 4.
font -- Default is "helvetiker".
weight -- Default is "normal".
style -- Default is "normal".
</div>
<div>
Generates shapes from the text and return them as an Array of [page:Shape].
</div>
<h3>[method:Object loadFace]([page:Object data])</h3>
<div>
data -- The data of the face.
</div>
<div>
This loads and saves the data of the face and return the data. When you add the font Data as javascriptfile, then this automatically get called. So there is no need to do this yourself.
</div>
<h3>[method:Object getFace]()</h3>
<div>
Returns the used font its data based on its style and weight.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,59 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">Contains handy functions geometry manipulations.</div>
<h2>Methods</h2>
<h3> .merge( [page:Geometry geometry1] , [page:Geometry geometry2], [page:Integer materialIndexOffset] )</h3>
<div>
geometry1 — Parent geometry element <br />
geometry2 — Geometry that need to be added in parent <br />
materialIndexOffset — Offset applied to the materialIndex of all the new faces in the merged geometry. Default : 0 <br />
</div>
<h3> .randomPointInTriangle( [page:Vector VectorA] , [page:Vector VectorB] , [page:Vector VectorC])</h3>
<div>
VectorA — Vector <br />
VectorB — Vector <br />
VectorC — Vector <br />
returns [page:Int Point]
</div>
<h3> .center ( [page:Vector VectorA] , [page:Vector VectorB] , [page:Vector VectorC]) </h3>
<div>
VectorA — Vector <br />
VectorB — Vector <br />
VectorC — Vector <br />
returns [page:Int Area]
</div>
<h3> .center ( [page:Geometry geometry] ) </h3>
<div>
Geometry — Geometry to Center position
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,104 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">A Helper class to ease the loading of images of different types.</div>
<h2>Properties</h2>
<h3>[property:string crossOrigin]</h3>
<div>
The crossOrigin string to implement CORS for loading the image from a different domain that allows CORS.
</div>
<h2>Methods</h2>
<h3>[method:DataTexture generateDataTexture]([page:Number width], [page:Number height], [page:Number color])</h3>
<div>
width -- The width of the texture. <br />
height -- The height of the texture. <br />
color -- The hexadecimal value of the color.
</div>
<div>
Generates a texture of a single color. It is a DataTexture with format, RGBFormat.
</div>
<h3>[method:CompressedTexture parseDDS]([page:String buffer], [page:boolean loadMipmaps])</h3>
<div>
buffer -- A string containing the data of the dds. <br />
loadMipmaps -- A boolean to indicate if you need to load the mipmaps. Default is True.
</div>
<div>
Parses a DDS Image from the string into a CompressedTexture.
</div>
<h3>[method:todo loadCompressedTexture]([page:todo url], [page:todo mapping], [page:todo onLoad], [page:todo onError])</h3>
<div>
url -- todo <br />
mapping -- todo <br />
onLoad -- todo <br />
onError -- todo
</div>
<div>
todo
</div>
<h3>[method:todo loadTexture]([page:String url], [page:UVMapping mapping], [page:Function onLoad], [page:Function onError])</h3>
<div>
url -- the url of the texture<br />
mapping -- Can be an instance of [page:UVMapping THREE.UVMapping], [page:CubeReflectionMapping THREE.CubeReflectionMapping] or [page:SphericalReflectionMapping THREE.SphericalReflectionMapping]. Describes how the image is applied to the object.<br />Use undefined instead of null as a default value. See mapping property of [page:Texture texture] for more details. <br/>
onLoad -- callback function<br />
onError -- callback function
</div>
<div>
todo
</div>
<h3>[method:todo getNormalMap]([page:todo image], [page:todo depth])</h3>
<div>
image -- todo <br />
depth -- todo
</div>
<div>
todo
</div>
<h3>[method:todo loadCompressedTextureCube]([page:todo array], [page:todo mapping], [page:todo onLoad], [page:todo onError])</h3>
<div>
array -- todo <br />
mapping -- todo <br />
onLoad -- todo <br />
onError -- todo
</div>
<div>
todo
</div>
<h3>[method:todo loadTextureCube]([page:todo array], [page:todo mapping], [page:todo onLoad], [page:todo onError])</h3>
<div>
array -- todo <br />
mapping -- todo <br />
onLoad -- todo <br />
onError -- todo
</div>
<div>
todo
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,52 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../list.js"></script>
<script src="../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">A class containing useful utility functions for scene manipulation.</div>
<h2>Methods</h2>
<h3>[method:Object3D createMultiMaterialObject]([page:Geometry geometry], [page:Array materials])</h3>
<div>
geometry -- The geometry for the Object. <br />
materials -- The materials for the object.
</div>
<div>
Creates an new Object3D an new mesh for each material defined in materials. Beware that this is not the same as Meshfacematerial which defines multiple material for 1 mesh.<br />
This is mostly useful for object that need a material and a wireframe implementation.
</div>
<h3>[method:null attach]([page:Object3D child], [page:Object3D scene], [page:Object3D parent])</h3>
<div>
child -- The object to add to the parent <br />
scene -- The scene to detach the object on. <br />
parent -- The parent to attach the object from.
</div>
<div>
Attaches the object to the parent without the moving the object in the worldspace.
</div>
<h3>[method:null detach]([page:Object3D child], [page:Object3D parent], [page:Object3D scene])</h3>
<div>
child -- The object to remove from the parent <br />
scene -- The scene to attach the object on. <br />
parent -- The parent to detach the object from.
</div>
<div>
Detaches the object from the parent and adds it back to the scene without moving in worldspace.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,127 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">This class animates an object based on an hierarchy. This hierarchy can be Object3ds or bones.</div>
<h2>Constructor</h2>
<h3>[name]([page:Object3d root], [page:String name])</h3>
<div>
root -- The mesh to animate. <br />
name -- The name of the animation
</div>
<div>
Creates an animation for root. The animation data is gathered from AnimationHandler based on its name.
</div>
<h2>Properties</h2>
<h3>[property:Object3d root]</h3>
<div>
The root object of the animation.
</div>
<h3>[property:Object data]</h3>
<div>
The data containing the animation
</div>
<h3>[property:Array hierarchy]</h3>
<div>
The objects that are influenced by the animation.
</div>
<h3>[property:number currentTime]</h3>
<div>
The time elapsed since the last start/restart of the animation.
</div>
<h3>[property:number timeScale]</h3>
<div>
The timez
</div>
<h3>[property:boolean isPlaying]</h3>
<div>
Indicates whether the animation is playing. This shouldn't be adapted by user code.
</div>
<h3>[property:boolean isPaused]</h3>
<div>
Indicates whether the animation is paused. This shouldn't be adapted by user code.
</div>
<h3>[property:boolean loop]</h3>
<div>
Set to make the animation restart when the animation ends.
</div>
<h3>[property:number interpolationType]</h3>
<div>
The type to indicate how to interpolate between 2 data points.
</div>
<h2>Methods</h2>
<h3>[method:null play]([page:Number startTime])</h3>
<div>
Starts the animation from a moment startTime in the animation.
</div>
<h3>[method:null stop]()</h3>
<div>
Stops the animation.
</div>
<h3>[method:Boolean update]([page:Number deltaTimeMS])</h3>
<div>
deltaTimeMS -- The time of the between the previous frame and this frame in miliseconds.
</div>
<div>
Updates the animation in time. This shouldn't be called by user code. The animationHandler calls this method.
</div>
<h3>[method:array interpolateCatmullRom]([page:Array points], [page:Number scale])</h3>
<div>
points -- The 4 control point to calculate CatMullRom <br />
scale -- The scale between the previous key and the nex key
</div>
<div>
Interpolates the point based on the key. Is used in update.
</div>
<h3>[method:Object getNextKeyWith]([page:String type], [page:Object h], [page:Number key])</h3>
<div>
type -- The animationtype for the key. Can be "pos", "rot" and "scl".<br />
h -- The object of the hierarchy that catins the key <br />
key -- The index of the next possible key.
</div>
<div>
Gets the next key. Is used in Update.
</div>
<h3>[method:Object getPrevKeyWith]([page:String type], [page:Object h], [page:Number key])</h3>
<div>
type -- The animationtype for the key. Can be "pos", "rot" and "scl".<br />
h -- The object of the hierarchy that contains the key. <br />
key -- The index of the prev possible key.
</div>
<div>
Gets the previous key. Is used in Update.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,101 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">
The AnimationHandler handles the initialisation of the Animation data and
the animations itself. It keeps track of every animation and if it's active or not.
It also update all animations which are active if its method *update* is called.
</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
The animationHandler can't be called as constructor.
</div>
<h2>Properties</h2>
<h3>[property:number CATMULLROM]</h3>
<div>
Enum Value to indicate that the animation needs to be interpolated as CATMULLROM.
</div>
<h3>[property:number CATMULLROM_FORWARD]</h3>
<div>
Enum Value to indicate that the animation needs to be interpolated as CATMULLROM_FORWARD.
</div>
<h3>[property:number LINEAR]</h3>
<div>
Enum Value to indicate that the animation needs to be interpolated as LINEAR.
</div>
<h2>Methods</h2>
<h3>[method:null removeFromUpdate]([page:Animation animation])</h3>
<div>
animation -- The Animation to remove from the update.
</div>
<div>
Removes the animation from the update cycle. This gets called when the animation stops. This shouldn't be called by usercode.
</div>
<h3>[method:Object get]([page:String name])</h3>
<div>
name -- The name of the animationData
</div>
<div>
Gets the animationData from its library.
</div>
<h3>[method:null update]([page:Number deltaTimeMS]) </h3>
<div>
deltaTimeMS -- Time elapsed since last update in milliseconds.
</div>
<div>
Updates all active animations with deltaTime.
</div>
<h3>[method:null parse]([page:Object root])</h3>
<div>
root -- object
</div>
<div>
Parses the object to get the hierachy.
</div>
<h3>[method:null add]([page:object data])</h3>
<div>
data -- The animationData
</div>
<div>
Adds the animationData from its library.
</div>
<h3>[method:null addToUpdate]([page:Animation animation]) </h3>
<div>
animation -- The Animation to add from the update.
</div>
<div>
Adds the animation from the update cycle. This gets called when the animation starts. This shouldn't be called by user code.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,105 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">todo</div>
<h2>Constructor</h2>
<h3>[name]([page:todo root], [page:todo data])</h3>
<div>
root -- todo <br />
data -- todo
</div>
<div>
todo
</div>
<h2>Properties</h2>
<h3>[property:todo root]</h3>
<div>
todo
</div>
<h3>[property:todo data]</h3>
<div>
todo
</div>
<h3>[property:todo hierarchy]</h3>
<div>
todo
</div>
<h3>[property:number currentTime]</h3>
<div>
todo
</div>
<h3>[property:number timeScale]</h3>
<div>
todo
</div>
<h3>[property:boolean isPlaying]</h3>
<div>
todo
</div>
<h3>[property:boolean isPaused]</h3>
<div>
todo
</div>
<h3>[property:boolean loop]</h3>
<div>
todo
</div>
<h3>[property:number influence]</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>[method:todo play]()</h3>
<div>
todo
</div>
<h3>[method:todo pause]()</h3>
<div>
todo
</div>
<h3>[method:todo stop]()</h3>
<div>
todo
</div>
<h3>[method:todo update]([page:todo deltaTimeMS])</h3>
<div>
deltaTimeMS -- todo
</div>
<div>
todo
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,133 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">todo</div>
<h2>Constructor</h2>
<h3>[name]([page:todo root], [page:todo data], [page:todo JITCompile])</h3>
<div>
root -- todo <br />
data -- todo <br />
JITCompile -- todo
</div>
<div>
todo
</div>
<h2>Properties</h2>
<h3>[property:todo root]</h3>
<div>
todo
</div>
<h3>[property:todo data]</h3>
<div>
todo
</div>
<h3>[property:todo hierarchy]</h3>
<div>
todo
</div>
<h3>[property:number currentTime]</h3>
<div>
todo
</div>
<h3>[property:number timeScale]</h3>
<div>
todo
</div>
<h3>[property:boolean isPlaying]</h3>
<div>
todo
</div>
<h3>[property:boolean isPaused]</h3>
<div>
todo
</div>
<h3>[property:boolean loop]</h3>
<div>
todo
</div>
<h3>[property:boolean JITCompile]</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>[method:todo play]()</h3>
<div>
todo
</div>
<h3>[method:todo pause]()</h3>
<div>
todo
</div>
<h3>[method:todo stop]()</h3>
<div>
todo
</div>
<h3>[method:todo update]([page:todo deltaTimeMS])</h3>
<div>
deltaTimeMS -- todo
</div>
<div>
todo
</div>
<h3>[method:todo interpolateCatmullRom]([page:todo points], [page:todo scale])</h3>
<div>
points -- todo <br />
scale -- todo
</div>
<div>
todo
</div>
<h3>[method:todo getNextKeyWith]([page:todo sid], [page:todo h], [page:todo key])</h3>
<div>
sid -- todo <br />
h -- todo <br />
key -- todo
</div>
<div>
todo
</div>
<h3>[method:todo getPrevKeyWith]([page:todo sid], [page:todo h], [page:todo key])</h3>
<div>
sid -- todo <br />
h -- todo <br />
key -- todo
</div>
<div>
todo
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,64 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
<h1>[name]</h1>
<div class="desc">An extensible curve object which contains methods for interpolation.</div>
<h2>Examples</h2>
<h3>[example:webgl_geometry_extrude_splines geometry / extrude / splines ]
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
This constructor creates a new [name].
</div>
<h2>Methods</h2>
<h3>[method:Vector getPoint]( t )</h3>
<div>Returns a vector for point t of the curve where t is between 0 and 1</div>
<h3>[method:Vector getPointAt]( u )</h3>
<div>Returns a vector for point at relative position in curve according to arc length</div>
<h3>[method:Array getPoints]( divisions )</h3>
<div>Get sequence of points using getPoint( t ) </div>
<h3>[method:Array getSpacedPoints]( divisions )</h3>
<div>Get sequence of equi-spaced points using getPointAt( u )</div>
<h3>[method:Float getLength]()</h3>
<div>Get total curve arc length</div>
<h3>[method:Array getLengths]( divisions )</h3>
<div>Get list of cumulative segment lengths</div>
<h3>[method:null updateArcLengths]()</h3>
<div>Update the cumlative segment distance cache</div>
<h3>[method:Float getUtoTmapping]( u, distance )</h3>
<div>Given u ( 0 .. 1 ), get a t to find p. This gives you points which are equidistant</div>
<h3>[method:Vector getTangent]( t )</h3>
<div>Returns a unit vector tangent at t. If the subclassed curve do not implement its tangent derivation, 2 points a small delta apart will be used to find its gradient which seems to give a reasonable approximation</div>
<h3>[method:Vector getTangentAt]( u )</h3>
<div>Returns tangent at equidistant point u on the curve</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,138 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">todo</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
todo
</div>
<h2>Properties</h2>
<h3>[property:array curves]</h3>
<div>
todo
</div>
<h3>[property:array bends]</h3>
<div>
todo
</div>
<h3>[property:boolean autoClose]</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>[method:todo getWrapPoints]([page:todo oldPts], [page:todo path])</h3>
<div>
oldPts -- todo <br />
path -- todo
</div>
<div>
todo
</div>
<h3>[method:todo createPointsGeometry]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
todo
</div>
<h3>[method:todo addWrapPath]([page:todo bendpath])</h3>
<div>
bendpath -- todo
</div>
<div>
todo
</div>
<h3>[method:todo createGeometry]([page:todo points])</h3>
<div>
points -- todo
</div>
<div>
todo
</div>
<h3>[method:todo add]([page:todo curve])</h3>
<div>
curve -- todo
</div>
<div>
todo
</div>
<h3>[method:todo getTransformedSpacedPoints]([page:todo segments], [page:todo bends])</h3>
<div>
segments -- todo <br />
bends -- todo
</div>
<div>
todo
</div>
<h3>[method:todo createSpacedPointsGeometry]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
todo
</div>
<h3>[method:todo closePath]()</h3>
<div>
todo
</div>
<h3>[method:todo getBoundingBox]()</h3>
<div>
todo
</div>
<h3>[method:todo getCurveLengths]()</h3>
<div>
todo
</div>
<h3>[method:todo getTransformedPoints]([page:todo segments], [page:todo bends])</h3>
<div>
segments -- todo <br />
bends -- todo
</div>
<div>
todo
</div>
<h3>[method:todo checkConnection]()</h3>
<div>
todo
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,36 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Object3D] &rarr;
<h1>[name]</h1>
<div class="desc">todo</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
todo
</div>
<h2>Properties</h2>
<h2>Methods</h2>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,79 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:CurvePath] &rarr;
<h1>[name]</h1>
<div class="desc">A 2d path representation, comprising of points, lines, and cubes, similar to the html5 2d canvas api. It extends CurvePath.</div>
<h2>Constructor</h2>
<h3>[name]([page:todo points])</h3>
<div>
points -- array of Vector2
</div>
<div>
Creates a Path from the points. The first vector defines the offset. After that the lines get defined.
</div>
<h2>Properties</h2>
<h3>[property:array actions]</h3>
<div>
The possible actions that define the path.
</div>
<h2>Methods</h2>
<h3>[method:todo fromPoints]( vectors )</h3>
<div>
Adds to the Path from the points. The first vector defines the offset. After that the lines get defined.
</div>
<h3>[method:todo moveTo]( x, y )</h3>
<div>This moves the offset to x and y</div>
<h3>[method:todo lineTo]( x, y )</h3>
<div>This creates a line from the offset to X and Y and updates the offset to X and Y.</div>
<h3>[method:todo quadraticCurveTo]( aCPx, aCPy, aX, aY )</h3>
<div>This creates a quadratic curve from the offset to aX and aY with aCPx and aCPy as control point and updates the offset to aX and aY.</div>
<h3>[method:todo bezierCurveTo]( aCP1x, aCP1y, aCP2x, aCP2y, aX, aY )</h3>
<div>This creates a bezier curve from the offset to aX and aY with aCP1x, aCP1y and aCP1x, aCP1y as control points and updates the offset to aX and aY.</div>
<h3>.splineThru ( pts /*Array of Vector*/ ) </h3>
<div>todo</div>
<h3>[method:todo arc]( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise )</h3>
<div>todo</div>
<h3>[method:todo absarc]( aX, aY, aRadius, aStartAngle, aEndAngle, aClockwise )</h3>
<div>todo</div>
<h3>[method:todo ellipse]( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise )</h3>
<div>todo</div>
<h3>[method:todo absellipse]( aX, aY, xRadius, yRadius, aStartAngle, aEndAngle, aClockwise )</h3>
<div>todo</div>
<h3>[method:todo toShapes]()</h3>
<div>todo</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,97 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Path] &rarr;
<h1>[name]</h1>
<div class="desc">Defines a 2d shape plane using paths.</div>
<h2>Constructor</h2>
<h3>[name]()</h3>
<div>
todo
</div>
<h2>Properties</h2>
<h3>[property:array holes]</h3>
<div>
todo
</div>
<h2>Methods</h2>
<h3>[method:todo makeGeometry]([page:todo options])</h3>
<div>
options -- The options passed as the second argument to [page:ShapeGeometry ShapeGeometry]
</div>
<div>
Convenience method to return ShapeGeometry
</div>
<h3>[method:todo extractAllPoints]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
Get points of shape and holes (keypoints based on segments parameter)
</div>
<h3>[method:todo extrude]([page:todo options])</h3>
<div>
options -- The options passed as the second argument to [page:ExtrudeGeometry ExtrudeGeometry]
</div>
<div>
Convenience method to return ExtrudeGeometry
</div>
<h3>[method:todo extractPoints]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
todo
</div>
<h3>[method:todo extractAllSpacedPoints]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
todo
</div>
<h3>[method:todo getPointsHoles]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
Get points of holes
</div>
<h3>[method:todo getSpacedPointsHoles]([page:todo divisions])</h3>
<div>
divisions -- todo
</div>
<div>
Get points of holes (spaced by regular distance)
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,20 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:EllipseCurve] &rarr;
<h1>[name]</h1>
<div class="desc">Alias for [page:EllipseCurve]</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,54 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">Create a smooth 3d spline curve from a series of points that loops back onto itself</div>
<h2>Example</h2>
<code>
//Create a closed wavey loop
var curve = new THREE.ClosedSplineCurve3( [
new THREE.Vector3( -10, 0, 10 ),
new THREE.Vector3( -5, 5, 5 ),
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 5, -5, 5 ),
new THREE.Vector3( 10, 0, 10 )
] );
var geometry = new THREE.Geometry();
geometry.vertices = curve.getPoints( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
</code>
<h3>[example:webgl_geometry_extrude_splines geometry / extrude / splines] (choose SampleClosedSpline)</h3>
<h2>Constructor</h2>
<h3>[name]( [page:Array points] )</h3>
<div>points An array of [page:Vector3] points</div>
<h2>Properties</h2>
<h3>[property:Array points]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">
Create a smooth 2d <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:Bezier_curve.svg" target="_blank">cubic bezier curve</a>.
</div>
<h2>Example</h2>
<code>
var curve = new THREE.CubicBezierCurve(
new THREE.Vector3( -10, 0, 0 ),
new THREE.Vector3( -5, 15, 0 ),
new THREE.Vector3( 20, 15, 0 ),
new THREE.Vector3( 10, 0, 0 )
);
var path = new THREE.Path( curve.getPoints( 50 ) );
var geometry = path.createPointsGeometry( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final Object3d to add to the scene
var curveObject = new THREE.Line( geometry, material );
</code>
<h2>Constructor</h2>
<h3>[name] ( [page:Vector2 v0], [page:Vector2 v1], [page:Vector2 v2], [page:Vector2 v3] )</h3>
<div>
[page:Vector2 v0] The starting point<br/>
[page:Vector2 v1] The first control point<br/>
[page:Vector2 v2] The second control point<br/>
[page:Vector2 v3] The ending point<br/>
</div>
<h2>Properties</h2>
<h3>[property:Vector2 v0]</h3>
<h3>[property:Vector2 v1]</h3>
<h3>[property:Vector2 v2]</h3>
<h3>[property:Vector2 v3]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,67 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">
Create a smooth 3d <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:Bezier_curve.svg" target="_blank">cubic bezier curve</a>.
</div>
<h2>Example</h2>
<code>
var curve = new THREE.CubicBezierCurve3(
new THREE.Vector3( -10, 0, 0 ),
new THREE.Vector3( -5, 15, 0 ),
new THREE.Vector3( 20, 15, 0 ),
new THREE.Vector3( 10, 0, 0 )
);
var geometry = new THREE.Geometry();
geometry.vertices = curve.getPoints( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final Object3d to add to the scene
var curveObject = new THREE.Line( geometry, material );
</code>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 v0], [page:Vector3 v1], [page:Vector3 v2], [page:Vector3 v3] )</h3>
<div>
[page:Vector3 v0] The starting point<br/>
[page:Vector3 v1] The first control point<br/>
[page:Vector3 v2] The second control point<br/>
[page:Vector3 v3] The ending point<br/>
</div>
<h2>Properties</h2>
<h3>[property:Vector3 v0]</h3>
<h3>[property:Vector3 v1]</h3>
<h3>[property:Vector3 v2]</h3>
<h3>[property:Vector3 v3]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,69 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">Creates a 2d curve in the shape of an ellipse.</div>
<h2>Example</h2>
<code>
var curve = new THREE.EllipseCurve(
0, 0, // ax, aY
10, 10, // xRadius, yRadius
0, 2 * Math.PI, // aStartAngle, aEndAngle
false // aClockwise
);
var path = new THREE.Path( curve.getPoints( 50 ) );
var geometry = path.createPointsGeometry( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final Object3d to add to the scene
var ellipse = new THREE.Line( geometry, material );
</code>
<h2>Constructor</h2>
<h3>[name]( [page:Float aX], [page:Float aY], [page:Float xRadius], [page:Float yRadius], [page:Radians aStartAngle], [page:Radians aEndAngle], [page:Boolean aClockwise] )</h3>
<div>
aX The X center of the ellipse<br/>
aY The Y center of the ellipse<br/>
xRadius The radius of the ellipse in the x direction<br/>
yRadius The radius of the ellipse in the y direction<br/>
aStartAngle The start angle of the curve in radians starting from the middle right side<br/>
aEndAngle The end angle of the curve in radians starting from the middle right side<br/>
aClockwise Whether the ellipse is clockwise<br/><br/>
<strong>Note:</strong> When going clockwise it's best to set the start angle to (Math.PI * 2) and then work towards lower numbers.
</div>
<h2>Properties</h2>
<h3>[property:Float aX]</h3>
<h3>[property:Float aY]</h3>
<h3>[property:Radians xRadius]</h3>
<h3>[property:Radians yRadius]</h3>
<h3>[property:Float aStartAngle]</h3>
<h3>[property:Float aEndAngle]</h3>
<h3>[property:Boolean aClockwise]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,41 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">A curve representing a 2d line segment</div>
<h2>Constructor</h2>
<h3>[name]( [page:Vector2 v1], [page:Vector2 v2] )</h3>
<div>
v1 The start point<br/>
v2 - The end point
</div>
<h2>Properties</h2>
<h3>[property:Vector2 v1]</h3>
<h3>[property:Vector2 v2]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,40 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">A curve representing a 3d line segment</div>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 v1], [page:Vector3 v2] )</h3>
<div>
v1 The start point<br/>
v2 - The end point
</div>
<h2>Properties</h2>
<h3>[property:Vector3 v1]</h3>
<h3>[property:Vector3 v2]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">
Create a smooth 2d <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:B%C3%A9zier_2_big.gif" target="_blank">quadratic bezier curve</a>.
</div>
<h2>Example</h2>
<code>
var curve = new THREE.QuadraticBezierCurve(
new THREE.Vector3( -10, 0, 0 ),
new THREE.Vector3( 20, 15, 0 ),
new THREE.Vector3( 10, 0, 0 )
);
var path = new THREE.Path( curve.getPoints( 50 ) );
var geometry = path.createPointsGeometry( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
//Create the final Object3d to add to the scene
var curveObject = new THREE.Line( geometry, material );
</code>
<h2>Constructor</h2>
<h3>[name]( [page:Vector2 v0], [page:Vector2 v1], [page:Vector2 v2] )</h3>
<div>
[page:Vector2 v0] The starting point<br/>
[page:Vector2 v1] The middle control point<br/>
[page:Vector2 v2] The ending point<br/>
</div>
<h2>Properties</h2>
<h3>[property:Vector2 v0]</h3>
<h3>[property:Vector2 v1]</h3>
<h3>[property:Vector2 v2]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,66 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">
Create a smooth 3d <a href="http://en.wikipedia.org/wiki/B%C3%A9zier_curve#mediaviewer/File:B%C3%A9zier_2_big.gif" target="_blank">quadratic bezier curve</a>.
</div>
<h2>Example</h2>
<code>
var curve = new THREE.QuadraticBezierCurve3(
new THREE.Vector3( -10, 0, 0 ),
new THREE.Vector3( 20, 15, 0 ),
new THREE.Vector3( 10, 0, 0 )
);
var geometry = new THREE.Geometry();
geometry.vertices = curve.getPoints( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final Object3d to add to the scene
var curveObject = new THREE.Line( geometry, material );
</code>
<h2>Constructor</h2>
<h3>[name]( [page:Vector3 v0], [page:Vector3 v1], [page:Vector3 v2] )</h3>
<div>
[page:Vector3 v0] The starting point<br/>
[page:Vector3 v1] The middle control point<br/>
[page:Vector3 v2] The ending point<br/>
</div>
<h2>Properties</h2>
<h3>[property:Vector3 v0]</h3>
<h3>[property:Vector3 v1]</h3>
<h3>[property:Vector3 v2]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,56 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">Create a smooth 2d spline curve from a series of points</div>
<h2>Example</h2>
<code>
// Create a sine-like wave
var curve = new THREE.SplineCurve( [
new THREE.Vector2( -10, 0 ),
new THREE.Vector2( -5, 5 ),
new THREE.Vector2( 0, 0 ),
new THREE.Vector2( 5, -5 ),
new THREE.Vector2( 10, 0 )
] );
var path = new THREE.Path( curve.getPoints( 50 ) );
var geometry = path.createPointsGeometry( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
// Create the final Object3d to add to the scene
var splineObject = new THREE.Line( geometry, material );
</code>
<h2>Constructor</h2>
<h3>[name]( [page:Array points] )</h3>
<div>points An array of [page:Vector2] points</div>
<h2>Properties</h2>
<h3>[property:Array points]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,57 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Curve] &rarr;
<h1>[name]</h1>
<div class="desc">Create a smooth 3d spline curve from a series of points</div>
<h2>Example</h2>
<code>
//Create a closed bent a sine-like wave
var curve = new THREE.SplineCurve3( [
new THREE.Vector3( -10, 0, 10 ),
new THREE.Vector3( -5, 5, 5 ),
new THREE.Vector3( 0, 0, 0 ),
new THREE.Vector3( 5, -5, 5 ),
new THREE.Vector3( 10, 0, 10 )
] );
var geometry = new THREE.Geometry();
geometry.vertices = curve.getPoints( 50 );
var material = new THREE.LineBasicMaterial( { color : 0xff0000 } );
//Create the final Object3d to add to the scene
var splineObject = new THREE.Line( geometry, material );
</code>
<h3>[example:webgl_geometry_extrude_splines geometry / extrude / splines ] (choose PipeSpline)</h3>
<h2>Constructor</h2>
<h3>[name]( [page:Array points] )</h3>
<div>points An array of [page:Vector3] points</div>
<h2>Properties</h2>
<h3>[property:Array points]</h3>
<h2>Methods</h2>
<h3>See [page:Curve] for inherited methods</h3>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,48 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">BoxGeometry is the quadrilateral primitive geometry class. It is typically used for creating a cube or irregular quadrilateral of the dimensions provided with the 'width', 'height', and 'depth' constructor arguments.</div>
<h2>Example</h2>
<code>var geometry = new THREE.BoxGeometry( 1, 1, 1 );
var material = new THREE.MeshBasicMaterial( {color: 0x00ff00} );
var cube = new THREE.Mesh( geometry, material );
scene.add( cube );
</code>
<h2>Constructor</h2>
<h3>[name]([page:Float width], [page:Float height], [page:Float depth], [page:Integer widthSegments], [page:Integer heightSegments], [page:Integer depthSegments])</h3>
<div>
width — Width of the sides on the X axis.<br />
height — Height of the sides on the Y axis.<br />
depth — Depth of the sides on the Z axis.<br />
widthSegments — Optional. Number of segmented faces along the width of the sides. Default is 1.<br />
heightSegments — Optional. Number of segmented faces along the height of the sides. Default is 1.<br />
depthSegments — Optional. Number of segmented faces along the depth of the sides. Default is 1.
</div>
<h2>Properties</h2>
<div>
Each of the constructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,47 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">CircleGeometry is a simple shape of Euclidean geometry. It is contructed from a number of triangular segments that are oriented around a central point and extend as far out as a given radius. It is built counter-clockwise from a start angle and a given central angle. It can also be used to create regular polygons, where the number of segments determines the number of sides.
</div>
<h2>Example</h2>
<code>var material = new THREE.MeshBasicMaterial({
color: 0x0000ff
});
var radius = 5;
var segments = 32;
var circleGeometry = new THREE.CircleGeometry( radius, segments );
var circle = new THREE.Mesh( circleGeometry, material );
scene.add( circle );
</code>
<h2>Constructor</h2>
<h3>[name]([page:Float radius], [page:Integer segments], [page:Float thetaStart], [page:Float thetaLength])</h3>
<div>
radius — Radius of the circle, default = 50.<br />
segments — Number of segments (triangles), minimum = 3, default = 8.<br />
thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete circle.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,19 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">Renamed CubeGeometry to BoxGeometry. see [page:BoxGeometry].</div>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,53 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">A class for generating cylinder geometries</div>
<h2>Example</h2>
<code>var geometry = new THREE.CylinderGeometry( 5, 5, 20, 32 );
var material = new THREE.MeshBasicMaterial( {color: 0xffff00} );
var cylinder = new THREE.Mesh( geometry, material );
scene.add( cylinder );
</code>
<h2>Constructor</h2>
<h3>[name]([page:Float radiusTop], [page:Float radiusBottom], [page:Float height], [page:Integer radiusSegments], [page:Integer heightSegments], [page:Boolean openEnded], [page:Float thetaStart], [page:Float thetaLength])</h3>
<div>
radiusTop — Radius of the cylinder at the top. Default is 20.<br />
radiusBottom — Radius of the cylinder at the bottom. Default is 20.<br />
height — Height of the cylinder. Default is 100.<br />
radiusSegments — Number of segmented faces around the circumference of the cylinder. Default is 8<br />
heightSegments — Number of rows of faces along the height of the cylinder. Default is 1.<br />
openEnded — A Boolean indicating whether the ends of the cylinder are open or capped. Default is false, meaning capped.<br />
thetaStart — Start angle for first segment, default = 0 (three o'clock position).<br />
thetaLength — The central angle, often called theta, of the circular sector. The default is 2*Pi, which makes for a complete cylinder.
</div>
<h2>Properties</h2>
<div>
Each of the constructor parameters is accessible as a property of the same name. Any modification of these properties after instantiation does not change the geometry.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,39 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:PolyhedronGeometry] &rarr;
<h1>[name]</h1>
<div class="desc">A class for generating a dodecahedron geometries.</div>
<h2>Constructor</h2>
<h3>[name]([page:Float radius], [page:Integer detail])</h3>
<div>
radius — Radius of the dodecahedron. Default is 1.<br />
detail — Default is 0. Setting this to a value greater than 0 adds vertices making it no longer a dodecahedron.
</div>
<h2>Properties</h2>
<h3>[property:Object parameters]</h3>
<div>
An object with all of the parameters that were used to generate the geometry.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,98 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">Creates extruded geometry from a path shape</div>
<h2>Constructor</h2>
<h3>[name]([page:Array shapes], [page:Object options])</h3>
<div>
shapes — Shape or an array of shapes. <br />
options — Object that can contain the following parameters.
<ul>
<li>curveSegments — int. number of points on the curves</li>
<li>steps — int. number of points used for subdividing segements of extrude spline</li>
<li>amount — int. Depth to extrude the shape</li>
<li>bevelEnabled — bool. turn on bevel</li>
<li>bevelThickness — float. how deep into the original shape bevel goes</li>
<li>bevelSize — float. how far from shape outline is bevel</li>
<li>bevelSegments — int. number of bevel layers</li>
<li>extrudePath — THREE.CurvePath. 3d spline path to extrude shape along. (creates Frames if (frames aren't defined)</li>
<li>frames — THREE.TubeGeometry.FrenetFrames. containing arrays of tangents, normals, binormals</li>
<li>material — int. material index for front and back faces</li>
<li>extrudeMaterial — int. material index for extrusion and beveled faces</li>
<li>uvGenerator — Object. object that provides UV generator functions</li>
</ul>
</div>
<div>
This object extrudes an 2D shape to an 3D geometry.
</div>
<h2>Properties</h2>
<h2>Methods</h2>
<h3>[method:null addShapeList]([page:Array shapes], [page:Object options])</h3>
<div>
shapes — An Array of shapes to add. <br />
options — Object that can contain the following parameters.
<ul>
<li>curveSegments — int. number of points on the curves</li>
<li>steps — int. number of points used for subdividing segements of extrude spline</li>
<li>amount — int. Depth to extrude the shape</li>
<li>bevelEnabled — bool. turn on bevel</li>
<li>bevelThickness — float. how deep into the original shape bevel goes</li>
<li>bevelSize — float. how far from shape outline is bevel</li>
<li>bevelSegments — int. number of bevel layers</li>
<li>extrudePath — THREE.CurvePath. 3d spline path to extrude shape along. (creates Frames if (frames aren't defined)</li>
<li>frames — THREE.TubeGeometry.FrenetFrames. containing arrays of tangents, normals, binormals</li>
<li>material — int. material index for front and back faces</li>
<li>extrudeMaterial — int. material index for extrusion and beveled faces</li>
<li>uvGenerator — Object. object that provides UV generator functions</li>
</ul>
</div>
<div>Adds the shapes to the list to extrude.</div>
<h3>[method:null addShape]([page:Shape shape], [page:Object options])</h3>
<div>
shape — A shape to add. <br />
options — Object that can contain the following parameters.
<ul>
<li>curveSegments — int. number of points on the curves</li>
<li>steps — int. number of points used for subdividing segements of extrude spline</li>
<li>amount — int. Depth to extrude the shape</li>
<li>bevelEnabled — bool. turn on bevel</li>
<li>bevelThickness — float. how deep into the original shape bevel goes</li>
<li>bevelSize — float. how far from shape outline is bevel</li>
<li>bevelSegments — int. number of bevel layers</li>
<li>extrudePath — THREE.CurvePath. 3d spline path to extrude shape along. (creates Frames if (frames aren't defined)</li>
<li>frames — THREE.TubeGeometry.FrenetFrames. containing arrays of tangents, normals, binormals</li>
<li>material — int. material index for front and back faces</li>
<li>extrudeMaterial — int. material index for extrusion and beveled faces</li>
<li>uvGenerator — Object. object that provides UV generator functions</li>
</ul>
</div>
<div>Add the shape to the list to extrude.</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,38 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:PolyhedronGeometry] &rarr;
<h1>[name]</h1>
<div class="desc">A class for generating an icosahedron geometry.</div>
<h2>Constructor</h2>
<h3>[name]([page:Float radius], [page:Integer detail])</h3>
<div>
radius — Default is 1. <br />
detail — Default is 0. Setting this to a value greater than 0 adds more vertices making it no longer an icosahedron. When detail is greater than 1, it's effectively a sphere.
</div>
<h2>Properties</h2>
<h3>[property:Object parameters]</h3>
<div>
An object with all of the parameters that were used to generate the geometry.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

View File

@ -1,50 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<script src="../../../list.js"></script>
<script src="../../../page.js"></script>
<link type="text/css" rel="stylesheet" href="../../../page.css" />
</head>
<body>
[page:Geometry] &rarr;
<h1>[name]</h1>
<div class="desc">Class for generating meshes with axial symmetry. Possible uses include donuts, pipes, vases etc. The lathe rotate around the Z axis.</div>
<h2>Example</h2>
<code>
var points = [];
for ( var i = 0; i < 10; i ++ ) {
points.push( new THREE.Vector3( Math.sin( i * 0.2 ) * 15 + 50, 0, ( i - 5 ) * 2 ) );
}
var geometry = new THREE.LatheGeometry( points );
var material = new THREE.MeshBasicMaterial( { color: 0xffff00 } );
var lathe = new THREE.Mesh( geometry, material );
scene.add( lathe );
</code>
<h2>Constructor</h2>
<h3>[name]([page:Array points], [page:Integer segments], [page:Float phiStart], [page:Float phiLength])</h3>
<div>
points — Array of Vector3s. Since this rotates around Z axis, the y-values can be set to 0<br />
segments — the number of circumference segments to generate. Default is 12.<br />
phiStart — the starting angle in radians. Default is 0.<br />
phiLength — the radian (0 to 2*PI) range of the lathed section 2*PI is a closed lathe, less than 2PI is a portion. Default is 2*PI
</div>
<div>
This creates a LatheGeometry based on the parameters.
</div>
<h2>Source</h2>
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More