Skip to content

Commit 69cbe87

Browse files
committed
move remaining two public extras classes to H3DU namespaces; generate links in short descriptions in docs; etc.
1 parent 34068b2 commit 69cbe87

27 files changed

+451
-625
lines changed

build/publish.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,9 +448,11 @@ exports.publish = function(input, o, t) {
448448
var docCollection = new DocCollection();
449449
docCollection.tutorials = t;
450450
docCollection.readme = o.readme;
451-
docCollection.descriptions = descriptions(inputget);
452451
docCollection.typeNames = typeNames(inputget);
452+
// registerLinks depends on typeNames being filled
453453
registerLinks(docCollection, inputget);
454+
// for best results, descriptions depends on registerLinks
455+
docCollection.descriptions = descriptions(inputget);
454456
fillCollection(docCollection, inputget);
455457
docCollection.write();
456458
};

demos/demoutil.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* global H3DU, MeshJSON, alert, shapeGroup */
1+
/* global H3DU, alert, shapeGroup */
22
/* exported formulaEditorHelp */
33
function formulaEditorHelp() {
44
"use strict";
@@ -120,7 +120,7 @@ function updateShape(func, allsettings) {
120120
a.id = "settings-link";
121121
a.innerHTML = "Save this model (JSON)";
122122
a.addEventListener("click", function() {
123-
var json = MeshJSON.toJSON(func(allsettings));
123+
var json = H3DU.MeshJSON.toJSON(func(allsettings));
124124
saveString(json, "application/json", "model.json");
125125
});
126126
div.appendChild(a);

demos/obj.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
Spot, a public domain model from Keenan Clark<br>
1919
</div>
2020
<script id="demo">
21-
/* global H3DU, ObjData, addLink */
21+
/* global H3DU, addLink */
2222
// <!--
2323
/*
2424
Written by Peter O. in 2015.
@@ -41,7 +41,7 @@
4141
var shape = null;
4242
addLink("Toboggan", startfunc = function() {
4343
"use strict";
44-
ObjData.loadObjFromUrlWithTextures("toboggan.obj", loader)
44+
H3DU.ObjData.loadObjFromUrlWithTextures("toboggan.obj", loader)
4545
.then(function(mesh) {
4646
sub.removeShape(shape);
4747
sub.addShape(shape = mesh.toShape());
@@ -51,7 +51,7 @@
5151
addLink("Spot", function() {
5252
"use strict";
5353
H3DU.getPromiseResultsAll([
54-
ObjData.loadObjFromUrl("spot_quadrangulated.obj"),
54+
H3DU.ObjData.loadObjFromUrl("spot_quadrangulated.obj"),
5555
loader.loadTexture("spot_texture.png")
5656
]).then(function(results) {
5757
sub.removeShape(shape);

doc/Camera.md

Lines changed: 3 additions & 280 deletions
Original file line numberDiff line numberDiff line change
@@ -2,285 +2,8 @@
22

33
[Back to documentation index.](index.md)
44

5-
### Camera(batch, fov, nearZ, farZ, [canvas]) <a id='Camera'></a>
5+
### Camera() <a id='Camera'></a>
66

7-
A class for controlling the projection and
8-
view of a 3D scene, in the nature of an abstract "camera".
9-
This class uses the concept of a "camera's position", or where
10-
the camera is located in world space, as well
11-
as a "reference point", or the point in world space that the camera
12-
is looking at.
7+
<b>Deprecated: Use <a href="H3DU.Camera.md">H3DU.Camera</a> instead.</b>
138

14-
This class is considered a supplementary class to the
15-
Public Domain HTML 3D Library and is not considered part of that
16-
library.
17-
18-
To use this class, you must include the script "extras/camera.js"; the
19-
class is not included in the "h3du_min.js" file which makes up
20-
the HTML 3D Library. Example:
21-
22-
<script type="text/javascript" src="extras/camera.js"></script>
23-
24-
#### Parameters
25-
26-
* `batch` (Type: <a href="H3DU.Batch3D.md">H3DU.Batch3D</a>)<br>
27-
A 3D scene to associate with this camera object.
28-
* `fov` (Type: Number)<br>
29-
Vertical field of view, in degrees. Should be less than 180 degrees. (The smaller this number, the bigger close objects appear to be.) See <a href="H3DU.Math.md#H3DU.Math.mat4perspective">H3DU.Math.mat4perspective</a>.
30-
* `nearZ` (Type: Number)<br>
31-
The distance from the camera to the near clipping plane. See <a href="H3DU.Math.md#H3DU.Math.mat4perspective">H3DU.Math.mat4perspective</a>. seen. This should be slightly greater than 0.
32-
* `farZ` (Type: Number)<br>
33-
The distance from the camera to the far clipping plane. Objects beyond this distance will be too far to be seen. See <a href="H3DU.Math.md#H3DU.Math.mat4perspective">H3DU.Math.mat4perspective</a>.
34-
* `canvas` (Type: HTMLCanvasElement) (optional)<br>
35-
A canvas to associate with this camera object. <i>This argument is deprecated.</i>
36-
37-
### Methods
38-
39-
* [getDistance](#Camera_Camera_getDistance)
40-
* [getPosition](#Camera_Camera_getPosition)
41-
* [getVectorFromCenter](#Camera_Camera_getVectorFromCenter)
42-
* [moveAngleHorizontal](#Camera_Camera_moveAngleHorizontal)
43-
* [moveAngleVertical](#Camera_Camera_moveAngleVertical)
44-
* [moveCenterHorizontal](#Camera_Camera_moveCenterHorizontal)
45-
* [moveCenterVertical](#Camera_Camera_moveCenterVertical)
46-
* [moveClose](#Camera_Camera_moveClose)
47-
* [moveForward](#Camera_Camera_moveForward)
48-
* [moveHorizontal](#Camera_Camera_moveHorizontal)
49-
* [movePosition](#Camera_Camera_movePosition)
50-
* [moveVertical](#Camera_Camera_moveVertical)
51-
* [setDistance](#Camera_Camera_setDistance)
52-
* [setPosition](#Camera_Camera_setPosition)
53-
* [turnHorizontal](#Camera_Camera_turnHorizontal)
54-
* [turnVertical](#Camera_Camera_turnVertical)
55-
* [update](#Camera_Camera_update)
56-
57-
### Camera#getDistance() <a id='Camera_Camera_getDistance'></a>
58-
59-
Finds the distance from the camera's position to the reference point.
60-
61-
#### Return Value
62-
63-
Return value. (Type: Number)
64-
65-
### Camera#getPosition() <a id='Camera_Camera_getPosition'></a>
66-
67-
Gets the position of the camera.
68-
69-
#### Return Value
70-
71-
An array of three numbers giving
72-
the X, Y, and Z coordinates of the camera's position, respectively. (Type: Array.&lt;Number>)
73-
74-
### Camera#getVectorFromCenter() <a id='Camera_Camera_getVectorFromCenter'></a>
75-
76-
Gets the 3-element vector that points from the reference
77-
point to the camera's position.
78-
79-
#### Return Value
80-
81-
The return value as a unit
82-
vector (a <a href="H3DU.Math.md#H3DU.Math.vec3norm">"normalized" vector</a> with a length of 1).
83-
Returns (0,0,0) if the reference point is the same as the camera's position. (Type: Array.&lt;Number>)
84-
85-
### Camera#moveAngleHorizontal(angleDegrees) <a id='Camera_Camera_moveAngleHorizontal'></a>
86-
87-
Moves the camera to the left or right so that it faces
88-
the same reference point at the same distance.
89-
90-
#### Parameters
91-
92-
* `angleDegrees` (Type: Number)<br>
93-
The angle to rotate the camera, in degrees. If the coordinate-system is right-handed, positive values rotate the camera leftward, and negative values rightward. If the coordinate-system is left-handed, vice versa.
94-
95-
#### Return Value
96-
97-
This object. (Type: <a href="Camera.md">Camera</a>)
98-
99-
### Camera#moveAngleVertical(angleDegrees) <a id='Camera_Camera_moveAngleVertical'></a>
100-
101-
Moves the camera upward or downward so that it faces
102-
the same reference point at the same distance.
103-
104-
#### Parameters
105-
106-
* `angleDegrees` (Type: Number)<br>
107-
The angle to rotate the camera, in degrees. If the coordinate-system is right-handed, positive values rotate the camera upward, and negative values downward. If the coordinate-system is left-handed, vice versa.
108-
109-
#### Return Value
110-
111-
This object. (Type: <a href="Camera.md">Camera</a>)
112-
113-
### Camera#moveCenterHorizontal(dist) <a id='Camera_Camera_moveCenterHorizontal'></a>
114-
115-
<b>Deprecated: Use "moveHorizontal" instead.</b>
116-
117-
Moves the camera horizontally relative to the camera's up vector.
118-
119-
#### Parameters
120-
121-
* `dist` (Type: Number)<br>
122-
Distance to move the camera.
123-
124-
#### Return Value
125-
126-
This object. (Type: <a href="Camera.md">Camera</a>)
127-
128-
### Camera#moveCenterVertical(dist) <a id='Camera_Camera_moveCenterVertical'></a>
129-
130-
<b>Deprecated: Use "moveVertical" instead.</b>
131-
132-
Moves the camera toward or away from the camera's up vector.
133-
134-
#### Parameters
135-
136-
* `dist` (Type: Number)<br>
137-
Distance to move the camera.
138-
139-
#### Return Value
140-
141-
This object. (Type: <a href="Camera.md">Camera</a>)
142-
143-
### Camera#moveClose(dist) <a id='Camera_Camera_moveClose'></a>
144-
145-
Moves the camera the given distance, but not too close
146-
to the reference point.
147-
148-
#### Parameters
149-
150-
* `dist` (Type: Number)<br>
151-
The distance to move. Positive values mean forward, and negative distances mean back.
152-
153-
#### Return Value
154-
155-
This object. (Type: <a href="Camera.md">Camera</a>)
156-
157-
### Camera#moveForward(dist) <a id='Camera_Camera_moveForward'></a>
158-
159-
Moves the camera forward the given distance.
160-
161-
#### Parameters
162-
163-
* `dist` (Type: Number)<br>
164-
The distance to move. Positive values mean forward, and negative distances mean back.
165-
166-
#### Return Value
167-
168-
This object. (Type: <a href="Camera.md">Camera</a>)
169-
170-
### Camera#moveHorizontal(dist) <a id='Camera_Camera_moveHorizontal'></a>
171-
172-
Moves the camera horizontally relative to the camera's up vector.
173-
174-
#### Parameters
175-
176-
* `dist` (Type: Number)<br>
177-
Distance to move the camera.
178-
179-
#### Return Value
180-
181-
This object. (Type: <a href="Camera.md">Camera</a>)
182-
183-
### Camera#movePosition(cx, cy, cz) <a id='Camera_Camera_movePosition'></a>
184-
185-
<b>Deprecated: Renamed to "setPosition".</b>
186-
187-
Sets the position of the camera.
188-
189-
#### Parameters
190-
191-
* `cx` (Type: Number)<br>
192-
The camera's new X-coordinate.
193-
* `cy` (Type: Number)<br>
194-
The camera's new Y-coordinate.
195-
* `cz` (Type: Number)<br>
196-
The camera's new Z-coordinate.
197-
198-
#### Return Value
199-
200-
This object. (Type: <a href="Camera.md">Camera</a>)
201-
202-
### Camera#moveVertical(dist) <a id='Camera_Camera_moveVertical'></a>
203-
204-
Moves the camera toward or away from the camera's up vector.
205-
206-
#### Parameters
207-
208-
* `dist` (Type: Number)<br>
209-
Distance to move the camera.
210-
211-
#### Return Value
212-
213-
This object. (Type: <a href="Camera.md">Camera</a>)
214-
215-
### Camera#setDistance(dist) <a id='Camera_Camera_setDistance'></a>
216-
217-
Moves the camera a given distance from the reference
218-
point without changing its orientation.
219-
220-
#### Parameters
221-
222-
* `dist` (Type: Number)<br>
223-
Positive number giving the distance. If this is less than the near plane distance, the distance will be equal to the near plane distance. Does nothing if the distance is 0 or less.
224-
225-
#### Return Value
226-
227-
This object. (Type: <a href="Camera.md">Camera</a>)
228-
229-
### Camera#setPosition(cx, [cy], [cz]) <a id='Camera_Camera_setPosition'></a>
230-
231-
Sets the position of the camera.
232-
233-
#### Parameters
234-
235-
* `cx` (Type: Number)<br>
236-
The camera's new X-coordinate, or a 3-element vector containing the X, Y, and Z coordinates. In the latter case, "cy" and "cz" can be omitted.
237-
* `cy` (Type: Number) (optional)<br>
238-
The camera's new Y-coordinate.
239-
* `cz` (Type: Number) (optional)<br>
240-
The camera's new Z-coordinate.
241-
242-
#### Return Value
243-
244-
This object. (Type: <a href="Camera.md">Camera</a>)
245-
246-
### Camera#turnHorizontal(angleDegrees) <a id='Camera_Camera_turnHorizontal'></a>
247-
248-
Turns the camera to the left or right so that it faces
249-
the same distance from a reference point.
250-
251-
#### Parameters
252-
253-
* `angleDegrees` (Type: Number)<br>
254-
The angle to rotate the camera, in degrees. If the coordinate-system is right-handed, positive values rotate the camera rightward, and negative values leftward. If the coordinate-system is left-handed, vice versa.
255-
256-
#### Return Value
257-
258-
This object. (Type: <a href="Camera.md">Camera</a>)
259-
260-
### Camera#turnVertical(angleDegrees) <a id='Camera_Camera_turnVertical'></a>
261-
262-
Turns the camera upward or downward so that it faces
263-
the same distance from a reference point.
264-
265-
#### Parameters
266-
267-
* `angleDegrees` (Type: Number)<br>
268-
The angle to rotate the camera, in degrees. If the coordinate-system is right-handed, positive values rotate the camera upward, and negative values downward. If the coordinate-system is left-handed, vice versa.
269-
270-
#### Return Value
271-
272-
This object. (Type: <a href="Camera.md">Camera</a>)
273-
274-
### Camera#update([input]) <a id='Camera_Camera_update'></a>
275-
276-
Updates information about this camera based
277-
on the state of an input tracker.
278-
279-
#### Parameters
280-
281-
* `input` (Type: <a href="H3DU.InputTracker.md">H3DU.InputTracker</a>) (optional)<br>
282-
An input tracker. This method should be called right after the tracker's 'update' method was called. <i>Note that future versions may require this parameter.</i>
283-
284-
#### Return Value
285-
286-
Return value. (Type: Object)
9+
Alias for the <a href="H3DU.Camera.md">H3DU.Camera</a> class.

doc/FrameCounter.md

Lines changed: 2 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -4,38 +4,6 @@
44

55
### FrameCounter() <a id='FrameCounter'></a>
66

7-
A class for finding the frame rate of an HTML rendering.
7+
<b>Deprecated: Use <a href="H3DU.FrameCounter.md">H3DU.FrameCounter</a> instead.</b>
88

9-
This class is considered a supplementary class to the
10-
Public Domain HTML 3D Library and is not considered part of that
11-
library.
12-
13-
To use this class, you must include the script "extras/frame.js"; the
14-
class is not included in the "h3du_min.js" file which makes up
15-
the HTML 3D Library. Example:
16-
17-
<script type="text/javascript" src="extras/frame.js"></script>
18-
19-
### Methods
20-
21-
* [getFPS](#FrameCounter_FrameCounter_getFPS)<br>Gets the calculated frames per second, based
22-
on how often the update method was called.
23-
* [update](#FrameCounter_FrameCounter_update)<br>Updates the state for determining the frame count.
24-
25-
### FrameCounter#getFPS() <a id='FrameCounter_FrameCounter_getFPS'></a>
26-
27-
Gets the calculated frames per second, based
28-
on how often the update method was called.
29-
30-
#### Return Value
31-
32-
Return value. (Type: Object)
33-
34-
### FrameCounter#update() <a id='FrameCounter_FrameCounter_update'></a>
35-
36-
Updates the state for determining the frame count.
37-
This method should be called once per frame.
38-
39-
#### Return Value
40-
41-
Return value. (Type: Object)
9+
Alias for the <a href="H3DU.FrameCounter.md">H3DU.FrameCounter</a> class.

0 commit comments

Comments
 (0)