summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--o3d/samples/o3d-webgl-samples/pool.html14
-rw-r--r--o3d/samples/o3d-webgl/bounding_box.js7
-rw-r--r--o3d/samples/o3d-webgl/param_object.js20
-rw-r--r--o3d/samples/o3d-webgl/primitive.js7
4 files changed, 29 insertions, 19 deletions
diff --git a/o3d/samples/o3d-webgl-samples/pool.html b/o3d/samples/o3d-webgl-samples/pool.html
index e161a44..cabe6d0 100644
--- a/o3d/samples/o3d-webgl-samples/pool.html
+++ b/o3d/samples/o3d-webgl-samples/pool.html
@@ -43,22 +43,22 @@ single image file and then split up using Bitmaps.
html, body {
border: 0;
margin: 0;
- height: 100%;
+ width: 100%;
height: 100%;
}
div#container {
- position:relative; /* needed for footer positioning*/
- margin:0 auto; /* center, not in IE5 */
+ position:relative; /* Needed for footer positioning. */
+ margin:0 auto; /* Center, not in IE5. */
- height:auto !important; /* real browsers */
- height:100%; /* IE6: treaded as min-height*/
+ height:auto !important; /* For browsers other than IE. */
+ min-height:100%;
- min-height:100%; /* real browsers */
+ height:100%; /* For IE6. */
}
div#footer {
position:absolute;
width:100%;
- bottom:0; /* stick to bottom */
+ bottom:0; /* Stick to bottom. */
background: #111111;
}
</style>
diff --git a/o3d/samples/o3d-webgl/bounding_box.js b/o3d/samples/o3d-webgl/bounding_box.js
index b585c31..ebd7d09 100644
--- a/o3d/samples/o3d-webgl/bounding_box.js
+++ b/o3d/samples/o3d-webgl/bounding_box.js
@@ -154,7 +154,6 @@ o3d.BoundingBox.prototype.add =
/**
* Checks if a ray defined in same coordinate system as this box intersects
* this bounding box.
- * TODO(petersont): this can also take six coordinates as input.
* @param {!o3d.math.Point3} start position of start of ray in local space.
* @param {!o3d.math.Point3} end position of end of ray in local space.
* @return {!o3d.RayIntersectionInfo} RayIntersectionInfo. If result.value
@@ -165,6 +164,12 @@ o3d.BoundingBox.prototype.add =
*/
o3d.BoundingBox.prototype.intersectRay =
function(start, end) {
+ // If there are six arguments, assume they are the coordinates of two points.
+ if (arguments.length == 6) {
+ start = [arguments[0], arguments[1], arguments[2]];
+ end = [arguments[3], arguments[4], arguments[5]];
+ }
+
var result = new RayIntersectionInfo;
if (this.valid) {
diff --git a/o3d/samples/o3d-webgl/param_object.js b/o3d/samples/o3d-webgl/param_object.js
index 27b567e..51e8688d 100644
--- a/o3d/samples/o3d-webgl/param_object.js
+++ b/o3d/samples/o3d-webgl/param_object.js
@@ -46,7 +46,7 @@ o3d.ParamObject.O3D_PREFIX_ = 'o3d.';
/**
* Creates a Param with the given name and type on the ParamObject.
* Will fail if a param with the same name already exists.
- *
+ *
* @param {string} param_name The name of the Param to be created.
* @param {string} param_type_name The type of Param to create.
* Valid types are
@@ -116,7 +116,7 @@ o3d.ParamObject.prototype.createParam =
/**
* Searches by name for a Param defined in the object.
- *
+ *
* @param {string} param_name Name to search for.
* @return {!o3d.Param} The Param with the given name, or null otherwise.
*/
@@ -153,30 +153,30 @@ o3d.ParamObject.prototype.getParam =
/**
* Removes a Param from a ParamObject.
- *
+ *
* This function will fail if the param does not exist on this ParamObject
* or if the param is unremovable.
- *
+ *
* @param {!o3d.Param} param param to remove.
* @return {boolean} True if the param was removed.
*/
o3d.ParamObject.prototype.removeParam =
function(param) {
- o3d.notImplemented();
+ o3d.removeFromArray(param, this.params_);
};
/**
* Gets all the param on this param object.
- *
+ *
* Each access to this field gets the entire list, so it is best to get it
* just once. For example:
- *
+ *
* var params = paramObject.params;
* for (var i = 0; i < params.length; i++) {
* var param = params[i];
* }
- *
+ *
* Note that modifications to this array [e.g. push()] will not affect
* the underlying ParamObject, while modifications to the array's members
* will affect them.
@@ -193,7 +193,9 @@ o3d.ParamObject.prototype.params_ = {};
*/
o3d.ParamObject.prototype.copyParams =
function(source_param_object) {
- o3d.notImplemented();
+ for (param in source_param_object.params_) {
+ this.createParam(param.name, param.className);
+ }
};
diff --git a/o3d/samples/o3d-webgl/primitive.js b/o3d/samples/o3d-webgl/primitive.js
index fe31ecb..904abf8 100644
--- a/o3d/samples/o3d-webgl/primitive.js
+++ b/o3d/samples/o3d-webgl/primitive.js
@@ -130,10 +130,13 @@ o3d.Primitive.prototype.render = function() {
this.gl.enableVertexAttribArray(gl_index);
enabled_attribs.push(gl_index);
- // TODO(petersont): Change that hard-coded 4 down there.
+ // TODO(petersont): When the constant WebGLFloatArray.BYTES_PER_ELEMENT
+ // becomes available in implementations, use that here instead of this
+ // hard-coded 4.
+ var kFloatSize = 4;
this.gl.vertexAttribPointer(
gl_index, field.numComponents, this.gl.FLOAT, false,
- buffer.totalComponents * 4, field.offset_ * 4);
+ buffer.totalComponents * kFloatSize, field.offset_ * kFloatSize);
}
}
}