Skip to content

Commit be1d181

Browse files
committed
edit docs
1 parent d2734d2 commit be1d181

File tree

3 files changed

+39
-7
lines changed

3 files changed

+39
-7
lines changed

objmtl.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ function MtlData(){
2323
}
2424
/**
2525
* Creates one or more 3D shapes from the data
26-
* in this OBJ file.
26+
* in this OBJ file.<p>
27+
* To use this class, you must include the script "objmtl.js"; the
28+
* class is not included in the "glutil_min.js" file which makes up
29+
* the HTML 3D Library. Example:<pre>
30+
* &lt;script type="text/javascript" src="glutil_min.js">&lt;/script></pre>
2731
* @param {Scene3D} scene 3D scene to load the shape with.
2832
* @return {glutil.ShapeGroup} Group of shapes.
2933
*/

stl.js

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,26 @@ http://creativecommons.org/publicdomain/zero/1.0/
66
If you like this, you should donate to Peter O.
77
at: http://upokecenter.dreamhosters.com/articles/donate-now-2/
88
*/
9+
10+
if(!GLUtil){
11+
GLUtil={};
12+
}
13+
(function(GLUtil){
14+
var StlData={};
915
/**
10-
Loads a .STL file asynchronously.
16+
* Loads a .STL file asynchronously.
17+
* To use this class, you must include the script "stl.js"; the
18+
* class is not included in the "glutil_min.js" file which makes up
19+
* the HTML 3D Library. Example:<pre>
20+
* &lt;script type="text/javascript" src="stl.js">&lt;/script></pre>
21+
@alias glutil.GLUtil.loadStlFromUrl
1122
@param {string} url The URL to load.
1223
@return {Promise} A promise that:
1324
- Resolves when:
1425
The .STL file is loaded successfully. The result is a Mesh object.
1526
- Is rejected when:
1627
An error occurs when loading the .STL file.
1728
*/
18-
if(!GLUtil){
19-
GLUtil={};
20-
}
21-
(function(GLUtil){
22-
var StlData={};
2329
GLUtil.loadStlFromUrl=function(url){
2430
return GLUtil.loadFileFromUrl(url).then(
2531
function(e){

tutorials/camera.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## The "Camera" and the Projection and View Transforms
2+
3+
The `Scene3D` class has a concept of a "projection transform" and a "view transform". If we use the concept of a "camera", the projection is like setting the camera's focus and lens, and the view transform is like setting its position and orientation. `Scene3D` has methods for setting all these attributes of this abstract "camera". Two of them are `setPerspective()` and `setLookAt(), which are shown in the example below.
4+
5+
// Set the perspective view. Camera has a 45-degree field of view
6+
// and will see objects from 0.1 to 100 units away.
7+
scene.setPerspective(45,scene.getAspect(),0.1,100);
8+
// Move the camera back 40 units.
9+
scene.setLookAt([0,0,40]);
10+
// Move the camera back 30 units instead, and turn it so it
11+
// points at (0, 2, 0), that is, up 2 units.
12+
scene.setLookAt([0,0,30], [0,2,0]);
13+
14+
In 3D graphics, the two most commonly used projections are the perspective projection and the orthographic projection. Both are described in detail below.
15+
16+
### Perspective Projection
17+
18+
A perspective projection gives the 3D scene a sense of depth. In this projection, closer objects look bigger than more distant objects with the same size. The `Scene3D` class's `setPerspective()` method defines a perspective projection.
19+
20+
### Orthographic Projection
21+
22+
In an orthographic projection, objects with the same size don't vary in size with their depth. The `Scene3D` class's `setOrtho()` and `setOrthoAspect()` methods define an orthographic projection.

0 commit comments

Comments
 (0)