diff options
author | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 21:41:31 +0000 |
---|---|---|
committer | gman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-24 21:41:31 +0000 |
commit | 28b4f9bc980da2e69c3edcee374948bae0c5f8ac (patch) | |
tree | aa761d14dc32d90bc3ced831ccef11bfef0cf22e | |
parent | 6f324234680499d621c1277dec1abb08fde3cc0a (diff) | |
download | chromium_src-28b4f9bc980da2e69c3edcee374948bae0c5f8ac.zip chromium_src-28b4f9bc980da2e69c3edcee374948bae0c5f8ac.tar.gz chromium_src-28b4f9bc980da2e69c3edcee374948bae0c5f8ac.tar.bz2 |
This change fixes the issue that if you use
o3djs.util.setMainEngine(...V8) in any sample
and you use scripts that you don't want run in V8,
for example Adsense, Google Analyitics, Wave,
Google WebElements then the o3djs would attempt
to pull in that javascript and execute it in V8.
Specifically this refers to inline <script> tags
instead HTML. Not <script src="url"> tags.
The solution is we add an id to the tags we want
o3djs to pull in. Any script with an id that starts
with "o3d" will get pulled in.
This CL changes our samples to have that id on their
script tags.
Review URL: http://codereview.chromium.org/159339
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@21585 0039d316-1c4b-4281-b951-d872f2087c98
98 files changed, 194 insertions, 168 deletions
diff --git a/o3d/command_buffer/samples/bubble/bubble.html b/o3d/command_buffer/samples/bubble/bubble.html index 5ccc8ef..e9d086f 100644 --- a/o3d/command_buffer/samples/bubble/bubble.html +++ b/o3d/command_buffer/samples/bubble/bubble.html @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <HEAD> <TITLE>Native Client + Command buffer bubble test</TITLE> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> var client; var server; diff --git a/o3d/samples/2d.html b/o3d/samples/2d.html index 1e9224e..e39bde6 100644 --- a/o3d/samples/2d.html +++ b/o3d/samples/2d.html @@ -99,7 +99,7 @@ Things to notice: <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step01ex.html b/o3d/samples/GoogleIO-2009/step01ex.html index d105a59..a10b961 100644 --- a/o3d/samples/GoogleIO-2009/step01ex.html +++ b/o3d/samples/GoogleIO-2009/step01ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step02ex.html b/o3d/samples/GoogleIO-2009/step02ex.html index 74f3b0f..4d6770b 100644 --- a/o3d/samples/GoogleIO-2009/step02ex.html +++ b/o3d/samples/GoogleIO-2009/step02ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step03ex.html b/o3d/samples/GoogleIO-2009/step03ex.html index 8f6aaa9..5a24793 100644 --- a/o3d/samples/GoogleIO-2009/step03ex.html +++ b/o3d/samples/GoogleIO-2009/step03ex.html @@ -46,7 +46,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step04ex.html b/o3d/samples/GoogleIO-2009/step04ex.html index 93bd8ed..6dc7e60 100644 --- a/o3d/samples/GoogleIO-2009/step04ex.html +++ b/o3d/samples/GoogleIO-2009/step04ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step05ex.html b/o3d/samples/GoogleIO-2009/step05ex.html index 2c79086..2013aee 100644 --- a/o3d/samples/GoogleIO-2009/step05ex.html +++ b/o3d/samples/GoogleIO-2009/step05ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step06ex.html b/o3d/samples/GoogleIO-2009/step06ex.html index 131ff43..e5e3969f 100644 --- a/o3d/samples/GoogleIO-2009/step06ex.html +++ b/o3d/samples/GoogleIO-2009/step06ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step07ex.html b/o3d/samples/GoogleIO-2009/step07ex.html index 4c61f93..8528d56 100644 --- a/o3d/samples/GoogleIO-2009/step07ex.html +++ b/o3d/samples/GoogleIO-2009/step07ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step08ex.html b/o3d/samples/GoogleIO-2009/step08ex.html index dc3084c..e57ae9b 100644 --- a/o3d/samples/GoogleIO-2009/step08ex.html +++ b/o3d/samples/GoogleIO-2009/step08ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step09ex.html b/o3d/samples/GoogleIO-2009/step09ex.html index ce931be..63a4b45 100644 --- a/o3d/samples/GoogleIO-2009/step09ex.html +++ b/o3d/samples/GoogleIO-2009/step09ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step10ex.html b/o3d/samples/GoogleIO-2009/step10ex.html index 965ef7c..44967c2 100644 --- a/o3d/samples/GoogleIO-2009/step10ex.html +++ b/o3d/samples/GoogleIO-2009/step10ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step11ex.html b/o3d/samples/GoogleIO-2009/step11ex.html index 1db5557..0376012 100644 --- a/o3d/samples/GoogleIO-2009/step11ex.html +++ b/o3d/samples/GoogleIO-2009/step11ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step12ex.html b/o3d/samples/GoogleIO-2009/step12ex.html index cb07ce7..c7fe250 100644 --- a/o3d/samples/GoogleIO-2009/step12ex.html +++ b/o3d/samples/GoogleIO-2009/step12ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step13ex.html b/o3d/samples/GoogleIO-2009/step13ex.html index a995627..0b0bcc9 100644 --- a/o3d/samples/GoogleIO-2009/step13ex.html +++ b/o3d/samples/GoogleIO-2009/step13ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/GoogleIO-2009/step14ex.html b/o3d/samples/GoogleIO-2009/step14ex.html index 031f858..8c05081 100644 --- a/o3d/samples/GoogleIO-2009/step14ex.html +++ b/o3d/samples/GoogleIO-2009/step14ex.html @@ -54,7 +54,7 @@ Google I/O O3D Sample <script type="text/javascript" src="../o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/animated-scene.html b/o3d/samples/animated-scene.html index 7d6fc96..07cc80d 100644 --- a/o3d/samples/animated-scene.html +++ b/o3d/samples/animated-scene.html @@ -49,7 +49,7 @@ Animated Scene. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/animation.html b/o3d/samples/animation.html index d0af19d..96c0422 100644 --- a/o3d/samples/animation.html +++ b/o3d/samples/animation.html @@ -46,7 +46,7 @@ Animation. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.effect'); diff --git a/o3d/samples/archive-textures.html b/o3d/samples/archive-textures.html index 00ca148..cd771aa 100644 --- a/o3d/samples/archive-textures.html +++ b/o3d/samples/archive-textures.html @@ -42,7 +42,7 @@ In this tutorial, we show how to progressively load in textures from a tar.gz ar Progressive Texture Loading </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.io'); diff --git a/o3d/samples/billboards.html b/o3d/samples/billboards.html index 38b00dd..41fc281 100644 --- a/o3d/samples/billboards.html +++ b/o3d/samples/billboards.html @@ -44,7 +44,7 @@ Billboard Example <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); @@ -118,18 +118,18 @@ function initStep2(clientElements) { } function loadTexture(loader, filename) { - loader.loadTexture(g_pack, - o3djs.util.getAbsoluteURI('assets/' + filename), + loader.loadTexture(g_pack, + o3djs.util.getAbsoluteURI('assets/' + filename), rememberTexture); function rememberTexture(texture, exception) { if (exception) { alert(exception); } else { - g_textures[filename] = texture; + g_textures[filename] = texture; } } -} +} function initStep3() { var redMaterial = o3djs.material.createBasicMaterial( @@ -137,7 +137,7 @@ function initStep3() { g_viewInfo, [0.2, 1, 0.2, 1]); // green - var checkerMaterial = o3djs.material.createCheckerMaterial(g_pack, + var checkerMaterial = o3djs.material.createCheckerMaterial(g_pack, g_viewInfo); var billboardMaterial = o3djs.material.createMaterialFromFile( @@ -147,7 +147,7 @@ function initStep3() { g_pack, 'shaders/imposter.shader', g_viewInfo.zOrderedDrawList); // Set the textures. - // We don't need to create the params or the samplers because + // We don't need to create the params or the samplers because // createMaterialFromFile has already handled that for us. var sampler = billboardMaterial.getParam('texSampler0').value; sampler.texture = g_textures['purple-flower.png']; @@ -246,7 +246,7 @@ function unload() { <body> <h1>Billboards</h1> <div> -Flowers always face the camera.<br/> +Flowers always face the camera.<br/> Pillars rotate around Y toward the camera. </div> <div id="o3d" style="width: 800px; height: 600px;"></div> diff --git a/o3d/samples/bitmap-draw-image.html b/o3d/samples/bitmap-draw-image.html index 038cd32..710ba22 100644 --- a/o3d/samples/bitmap-draw-image.html +++ b/o3d/samples/bitmap-draw-image.html @@ -1,11 +1,11 @@ <!--
Copyright 2009, Google Inc.
All rights reserved.
-
+
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
-
+
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
@@ -15,7 +15,7 @@ distribution. * Neither the name of Google Inc. nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
-
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
@@ -27,33 +27,33 @@ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--->
-
-<!--
-In this tutorial, we show how to create bitmap and how to draw
-image on both bitmap and texture.
--->
+-->
+
+<!--
+In this tutorial, we show how to create bitmap and how to draw
+image on both bitmap and texture.
+-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html>
-<head>
-<meta http-equiv="content-type" content="text/html; charset=UTF-8">
-<title>
+ "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="content-type" content="text/html; charset=UTF-8">
+<title>
Bitmap Draw Image Demo
-</title>
-<script type="text/javascript" src="o3djs/base.js"></script>
-<script type="text/javascript">
+</title>
+<script type="text/javascript" src="o3djs/base.js"></script>
+<script type="text/javascript" id="o3d">
o3djs.require('o3djs.util');
o3djs.require('o3djs.math');
o3djs.require('o3djs.io');
o3djs.require('o3djs.rendergraph');
o3djs.require('o3djs.primitives');
o3djs.require('o3djs.effect');
-
+
// Events
// Run the init() once the page has finished loading.
window.onload = init;
-
+
// global variables
var g_o3d;
var g_math;
@@ -64,20 +64,20 @@ var g_finished = false; // for selenium testing var g_eye;
var g_target;
var g_up;
-
+
function makeShape(texture, effect) {
// Create a Material for the effect.
var myMaterial = g_pack.createObject('Material');
-
+
// Set the material's drawList for opaque objects.
myMaterial.drawList = g_viewInfo.performanceDrawList;
-
+
// Apply our effect to this material.
myMaterial.effect = effect;
// Create the parameters the effect needs on the material.
effect.createUniformParameters(myMaterial);
-
+
// Creates a quad.
var myShape = o3djs.primitives.createPlane(g_pack,
myMaterial,
@@ -85,15 +85,15 @@ function makeShape(texture, effect) { 3, // height
1, // quads across
1); // quads down
-
+
// Get the material's sampler parameter and put a sampler on it.
var sampler_param = myMaterial.getParam('texSampler0');
var sampler = g_pack.createObject('Sampler');
sampler_param.value = sampler;
-
+
// Set the texture to use.
sampler.texture = texture;
-
+
// adjust the scale of our transform to match the aspect ratio of
// the texture. Of course we could also have waited until now to build
// our plane and set its width and height to match instead of scaling
@@ -110,10 +110,10 @@ function makeShape(texture, effect) { // We now attach our quad to the root of the transform graph.
// We do this after the texture has loaded, otherwise we'd be attempting
// to display something invalid.
-
+
// Make a transform for each quad.
var transform = g_pack.createObject('Transform');
-
+
transform.translate(0, 0, 0);
transform.scale(hScale, 1, vScale);
transform.addShape(myShape);
@@ -121,7 +121,7 @@ function makeShape(texture, effect) { g_finished = true;
return myShape;
}
-
+
/**
* Creates the client area.
*/
@@ -140,16 +140,16 @@ function initStep2(clientElements) { g_o3d = o3dElement.o3d;
g_math = o3djs.math;
g_client = o3dElement.client;
-
+
// Create a pack to manage our resources/assets
g_pack = g_client.createPack();
-
+
// Create the render graph for a view.
g_viewInfo = o3djs.rendergraph.createBasicView(
g_pack,
g_client.root,
g_client.renderGraphRoot);
-
+
// Set up an orthographic projection.
var proj_matrix = g_math.matrix4.perspective(
g_math.degToRad(45),
@@ -165,7 +165,7 @@ function initStep2(clientElements) { g_viewInfo.drawContext.view = view_matrix;
g_viewInfo.drawContext.projection = proj_matrix;
-
+
// Create and load the effect.
var effect = g_pack.createObject('Effect');
o3djs.effect.loadEffect(effect, 'shaders/texture-only.shader');
@@ -218,17 +218,17 @@ function scrollMe(e) { g_eye = g_math.mulScalarVector((e.deltaY < 0 ? 11 : 13) / 12, g_eye);
g_viewInfo.drawContext.view = g_math.matrix4.lookAt(g_eye, g_target, g_up);
}
-</script>
-</head>
-<body>
-<h1>Bitmap Draw Image Demo</h1>
+</script>
+</head>
+<body>
+<h1>Bitmap Draw Image Demo</h1>
This tutorial shows how to create bitmap and how to draw image
on both bitmap and texture mipmap.
-<br/>
+<br/>
Scroll wheel to see different mipmaps.
<br/>
-<!-- Start of O3D plugin -->
-<div id="o3d" style="width: 600px; height: 600px"></div>
-<!-- End of O3D plugin -->
-</body>
-</html>
\ No newline at end of file +<!-- Start of O3D plugin -->
+<div id="o3d" style="width: 600px; height: 600px"></div>
+<!-- End of O3D plugin -->
+</body>
+</html>
\ No newline at end of file diff --git a/o3d/samples/canvas-fonts.html b/o3d/samples/canvas-fonts.html index 7a284ab..b89fb0a 100644 --- a/o3d/samples/canvas-fonts.html +++ b/o3d/samples/canvas-fonts.html @@ -46,7 +46,7 @@ O3D Canvas <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.primitives'); @@ -124,7 +124,7 @@ function init(clientElements) { var drawTextBox = false; var typefaceArray = [ 'Arial', 'Arial Black', 'Comic Sans MS', 'Courier New', - 'Georgia', 'Impact', 'Palatino', 'Verdana', + 'Georgia', 'Impact', 'Palatino', 'Verdana', 'Webdings' ]; var verticalPosition = 10; diff --git a/o3d/samples/canvas-texturedraw.html b/o3d/samples/canvas-texturedraw.html index efdf804..5ec6e57 100644 --- a/o3d/samples/canvas-texturedraw.html +++ b/o3d/samples/canvas-texturedraw.html @@ -45,7 +45,7 @@ O3D Canvas <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.io'); o3djs.require('o3djs.math'); diff --git a/o3d/samples/canvas.html b/o3d/samples/canvas.html index e76fc9a..0b55323 100644 --- a/o3d/samples/canvas.html +++ b/o3d/samples/canvas.html @@ -45,7 +45,7 @@ O3D Canvas <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.primitives'); @@ -271,7 +271,7 @@ function createSceneContents() { var metrics = paint.fontMetrics; var ascent = metrics.ascent; var stringDimensions = paint.measureText('Hello O3D'); - + paint.textStyle = g_o3d.CanvasPaint.BOLD; paint.textAlign = g_o3d.CanvasPaint.LEFT; diff --git a/o3d/samples/convolution.html b/o3d/samples/convolution.html index 2a21024..249cf4b 100644 --- a/o3d/samples/convolution.html +++ b/o3d/samples/convolution.html @@ -44,7 +44,7 @@ O3D: Convolution Shader Sample </title> <!-- Include sample javascript library functions--> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.camera'); diff --git a/o3d/samples/culling.html b/o3d/samples/culling.html index f1d3566..b7eba7e 100644 --- a/o3d/samples/culling.html +++ b/o3d/samples/culling.html @@ -50,7 +50,7 @@ Culling. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/customcamera.html b/o3d/samples/customcamera.html index 83b0df62..4c38ad9 100644 --- a/o3d/samples/customcamera.html +++ b/o3d/samples/customcamera.html @@ -59,7 +59,7 @@ Tutorial B4: Cameras and events </style> <!-- Our javascript code --> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/debugging.html b/o3d/samples/debugging.html index bc96bff..31506e5 100644 --- a/o3d/samples/debugging.html +++ b/o3d/samples/debugging.html @@ -44,7 +44,7 @@ Debugging. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/displayfps.html b/o3d/samples/displayfps.html index fb96f89..6a7891c 100644 --- a/o3d/samples/displayfps.html +++ b/o3d/samples/displayfps.html @@ -49,7 +49,7 @@ Compute and Display FPS. </style> <!-- Our javascript code --> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/error-texture.html b/o3d/samples/error-texture.html index e71d742..9650d68 100644 --- a/o3d/samples/error-texture.html +++ b/o3d/samples/error-texture.html @@ -37,7 +37,7 @@ how turning it off will generate helpful error information. <head> <title>Error Texture</title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/fullscreen.html b/o3d/samples/fullscreen.html index 0383ca2..1bf7563 100644 --- a/o3d/samples/fullscreen.html +++ b/o3d/samples/fullscreen.html @@ -46,7 +46,7 @@ Full-Screen Mode Example <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); @@ -109,7 +109,7 @@ function createBannerSurfaceAndClickableRegion(clientHeight, viewInfo) { [0, 0, 1, 0], [0,-1, 0, 0], [0, 0, 0, 1]]); - + // Load our banner. var url = o3djs.util.getCurrentURI() + 'assets/fullscreen.png'; o3djs.io.loadTexture(g_pack, url, function(texture, exception) { diff --git a/o3d/samples/generate-texture.html b/o3d/samples/generate-texture.html index b910af3..951f81b 100644 --- a/o3d/samples/generate-texture.html +++ b/o3d/samples/generate-texture.html @@ -41,7 +41,7 @@ How to generate a texture. Generate Texture. </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/hellocube-colors.html b/o3d/samples/hellocube-colors.html index 6e49825..c784206a 100644 --- a/o3d/samples/hellocube-colors.html +++ b/o3d/samples/hellocube-colors.html @@ -44,7 +44,7 @@ to change the values of uniform parameters used by shaders. Hello Square Colors: Getting started with O3D, take 2. </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/hellocube-textures.html b/o3d/samples/hellocube-textures.html index 16522b2..b320f3b 100644 --- a/o3d/samples/hellocube-textures.html +++ b/o3d/samples/hellocube-textures.html @@ -43,7 +43,7 @@ This sample is a simple demonstration of texture usage in O3D. Hello Square Textures: Getting started with O3D, take 3. </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/hellocube.html b/o3d/samples/hellocube.html index 4ad4eb4..7b09abc 100644 --- a/o3d/samples/hellocube.html +++ b/o3d/samples/hellocube.html @@ -42,7 +42,7 @@ This sample shows how to place an O3D area in a page and draw simple Hello Cube: Getting started with O3D </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/helloworld.html b/o3d/samples/helloworld.html index f5ed748..b34b8d5 100644 --- a/o3d/samples/helloworld.html +++ b/o3d/samples/helloworld.html @@ -46,7 +46,7 @@ Tutorial A1: Loading a scene <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/home-configurators/homedesigner.html b/o3d/samples/home-configurators/homedesigner.html index ce7e2bf..241fad3 100644 --- a/o3d/samples/home-configurators/homedesigner.html +++ b/o3d/samples/home-configurators/homedesigner.html @@ -89,7 +89,7 @@ BODY { <script type="text/javascript" src="zoomtool.js"></script> <script type="text/javascript" src="deletetool.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> /** * A structure to store our list of catalog items that can be dragged in. * If the url doesn't start with 'http:' then we assume it's a local diff --git a/o3d/samples/hud-2d-overlay.html b/o3d/samples/hud-2d-overlay.html index 0b86b34..d9782d9 100644 --- a/o3d/samples/hud-2d-overlay.html +++ b/o3d/samples/hud-2d-overlay.html @@ -46,7 +46,7 @@ HUD 2D Overlay. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/instance-override.html b/o3d/samples/instance-override.html index 10e53a4..0a1f750 100644 --- a/o3d/samples/instance-override.html +++ b/o3d/samples/instance-override.html @@ -47,7 +47,7 @@ Instancing with Overrides. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/instancing.html b/o3d/samples/instancing.html index 344a385..8525944 100644 --- a/o3d/samples/instancing.html +++ b/o3d/samples/instancing.html @@ -46,7 +46,7 @@ Instancing. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/juggler.html b/o3d/samples/juggler.html index 066b84b..233e958 100644 --- a/o3d/samples/juggler.html +++ b/o3d/samples/juggler.html @@ -43,7 +43,7 @@ O3D Juggler <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); @@ -348,7 +348,7 @@ float4 drawAirborneBalls(in float pi, in float hand_swing_radius, in float2 Z, in float threshold) { - float value = + float value = // balls going right to left (drawBallsInArc(pi, offset, right_hand, left_hand, height_factor, baseline, ball_radius_2, hand_swing_radius, Z, threshold) + @@ -397,7 +397,7 @@ float4 pixelShaderMain(PixelShaderInput input) : COLOR { // smaller than they would otherwise be. That's the opposite of what we do // for the balls, just because it happens to be cheaper here to do smaller and // cheaper in drawBallsInArc to do larger. - result += + result += clamp((hand_radius_2 - length_2(Z - r_h)) / threshold, 0, 1) * (Z.y < r_h.y) * right_hand_color + clamp((hand_radius_2 - length_2(Z - l_h)) / threshold, 0, 1) * @@ -416,7 +416,7 @@ float4 pixelShaderMain(PixelShaderInput input) : COLOR { // subtraction in the "1 - clamp..." below], but inverting it in // drawBallsInArc would be more expensive, and they have to match so that the // balls are all the same size. - result += (1 - result.a) * + result += (1 - result.a) * (1 - clamp((length_2(Z - hand) - ball_radius_2) / threshold, 0, 1)); // Draw airborne balls. diff --git a/o3d/samples/julia.html b/o3d/samples/julia.html index 6162db4..c301f2f 100644 --- a/o3d/samples/julia.html +++ b/o3d/samples/julia.html @@ -46,7 +46,7 @@ Julia Set Pixel Shader <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/multiple-clients.html b/o3d/samples/multiple-clients.html index 331adc0..650794b 100644 --- a/o3d/samples/multiple-clients.html +++ b/o3d/samples/multiple-clients.html @@ -43,7 +43,7 @@ Multiple Clients </title> <!-- Our javascript code --> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.io'); diff --git a/o3d/samples/multiple-views.html b/o3d/samples/multiple-views.html index b5694c9..b2d493b 100644 --- a/o3d/samples/multiple-views.html +++ b/o3d/samples/multiple-views.html @@ -44,7 +44,7 @@ Multiple Views <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/o3djs/util.js b/o3d/samples/o3djs/util.js index 16c0360..8a696c9 100644 --- a/o3d/samples/o3djs/util.js +++ b/o3d/samples/o3djs/util.js @@ -667,6 +667,17 @@ o3djs.util.isScriptUri = function(uri) { }; /** + * Returns whether or not this is a script tag we want. Currently that is + * only script tags with an id that starts with "o3d". + * @private + * @param {!Element} scriptElement The script element to check. + * @return {boolean} True if we want this script tag. + */ +o3djs.util.isWantedScriptTag_ = function(scriptElement) { + return scriptElement.id && scriptElement.id.match(/^o3d/); +}; + +/** * Concatenate the text of all the script tags in the document and invokes * the callback when complete. This function is asynchronous if any of the * script tags reference JavaScript through a URI. @@ -680,7 +691,8 @@ o3djs.util.getScriptTagText_ = function() { var scriptElement = scriptElements[i]; if (scriptElement.type === '' || scriptElement.type === 'text/javascript') { - if ('text' in scriptElement && scriptElement.text) { + if ('text' in scriptElement && scriptElement.text && + o3djs.util.isWantedScriptTag_(scriptElement)) { scriptTagText += scriptElement.text; } if ('src' in scriptElement && scriptElement.src && diff --git a/o3d/samples/old-school-shadows.html b/o3d/samples/old-school-shadows.html index 580f057..2162387 100644 --- a/o3d/samples/old-school-shadows.html +++ b/o3d/samples/old-school-shadows.html @@ -44,7 +44,7 @@ Old School Shadows. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/particles.html b/o3d/samples/particles.html index 244b621..d50345c 100644 --- a/o3d/samples/particles.html +++ b/o3d/samples/particles.html @@ -46,7 +46,7 @@ Particles. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.quaternions'); diff --git a/o3d/samples/phongshading.html b/o3d/samples/phongshading.html index 479cdf6..534ef32 100644 --- a/o3d/samples/phongshading.html +++ b/o3d/samples/phongshading.html @@ -55,7 +55,7 @@ Tutorial B5: Phong Shading </title> <!-- Our javascript code --> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/pingpong/o3dPingPong.html b/o3d/samples/pingpong/o3dPingPong.html index a487166..edeffe9 100644 --- a/o3d/samples/pingpong/o3dPingPong.html +++ b/o3d/samples/pingpong/o3dPingPong.html @@ -32,7 +32,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. <title>o3dPingPong</title> <script type="text/javascript" src="../o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/primitives.html b/o3d/samples/primitives.html index 1dbee40..849d83c 100644 --- a/o3d/samples/primitives.html +++ b/o3d/samples/primitives.html @@ -44,7 +44,7 @@ to make various shapes. Primitives </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/procedural-texture.html b/o3d/samples/procedural-texture.html index b160f1a..9bba357 100644 --- a/o3d/samples/procedural-texture.html +++ b/o3d/samples/procedural-texture.html @@ -47,7 +47,7 @@ Applying a Procedural Texture to a scene <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); o3djs.require('o3djs.pack'); diff --git a/o3d/samples/render-mode.html b/o3d/samples/render-mode.html index 19736204..7e2bdf5 100644 --- a/o3d/samples/render-mode.html +++ b/o3d/samples/render-mode.html @@ -47,7 +47,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. </head> <body onload="init();" onunload="uninit();"> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.quaternions'); diff --git a/o3d/samples/render-targets.html b/o3d/samples/render-targets.html index 75d78b7..28c706e 100644 --- a/o3d/samples/render-targets.html +++ b/o3d/samples/render-targets.html @@ -43,7 +43,7 @@ O3D: Render-Target Sample </title> <!-- Include sample javascript library functions--> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/rotatemodel.html b/o3d/samples/rotatemodel.html index eb9c2da..d129fbf 100644 --- a/o3d/samples/rotatemodel.html +++ b/o3d/samples/rotatemodel.html @@ -46,7 +46,7 @@ Tutorial A2: Transformations <!-- Include sample javascript library functions--> <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.camera'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/scatter-chart.html b/o3d/samples/scatter-chart.html index d6d72527d..c7a3dfb 100644 --- a/o3d/samples/scatter-chart.html +++ b/o3d/samples/scatter-chart.html @@ -45,7 +45,7 @@ This sample demonstrates how to plot a 3d scatter chart and how to rotate and zo <script type="text/javascript" src="o3djs/base.js"></script> <script type="text/javascript" src="assets/teapot_vertices.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.quaternions'); diff --git a/o3d/samples/shader-test.html b/o3d/samples/shader-test.html index 3e231f3..eb4e4ed 100644 --- a/o3d/samples/shader-test.html +++ b/o3d/samples/shader-test.html @@ -54,7 +54,7 @@ Shader Test <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); o3djs.require('o3djs.pack'); diff --git a/o3d/samples/shadow-map.html b/o3d/samples/shadow-map.html index b8f4ba6..47230f1 100755 --- a/o3d/samples/shadow-map.html +++ b/o3d/samples/shadow-map.html @@ -48,7 +48,7 @@ render pass samples it to determine which points in the scene are in shaodow. Shadow Mapping </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); @@ -364,7 +364,7 @@ function createShapes() { function createLightShape() { var inverseMatrix = g_math.matrix4.inverse(g_lightViewProjection); - // Scale and translate a cube of side length 2 to get a box + // Scale and translate a cube of side length 2 to get a box // that extends from [-1, -1, 0] to [1, 1, 1]. var shape = o3djs.debug.createLineCube( g_pack, @@ -448,7 +448,7 @@ function keyPressed(event) { case 'o': moveLight([0, 0, -delta]); break; - + case ' ': toggleView(); break; diff --git a/o3d/samples/simple.html b/o3d/samples/simple.html index 846a3b1..90d5280 100644 --- a/o3d/samples/simple.html +++ b/o3d/samples/simple.html @@ -45,7 +45,7 @@ Simple <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.simple'); // Events diff --git a/o3d/samples/simpletexture.html b/o3d/samples/simpletexture.html index 6e1c688..fff5772 100644 --- a/o3d/samples/simpletexture.html +++ b/o3d/samples/simpletexture.html @@ -43,7 +43,7 @@ In this tutorial, we show how to use textures in o3d. Tutorial B3: Textures </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/simpleviewer/simpleviewer.html b/o3d/samples/simpleviewer/simpleviewer.html index 88b24aa..da2d3d4 100644 --- a/o3d/samples/simpleviewer/simpleviewer.html +++ b/o3d/samples/simpleviewer/simpleviewer.html @@ -47,7 +47,7 @@ html, body { </head> <body onload="init();" onunload="uninit();"> <script type="text/javascript" src="../o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.quaternions'); diff --git a/o3d/samples/siteswap/siteswap.html b/o3d/samples/siteswap/siteswap.html index 83ea42d..22bc094 100644 --- a/o3d/samples/siteswap/siteswap.html +++ b/o3d/samples/siteswap/siteswap.html @@ -26,7 +26,7 @@ Author: Eric Uhrhane (ericu@google.com) <script type="text/javascript" src="siteswap.js"></script>
<script type="text/javascript" src="math.js"></script>
<script type="text/javascript" src="animation.js"></script>
-<script type="text/javascript">
+<script type="text/javascript" id="o3d">
o3djs.require('o3djs.util');
diff --git a/o3d/samples/skinning.html b/o3d/samples/skinning.html index 67d3281..5534fd2 100644 --- a/o3d/samples/skinning.html +++ b/o3d/samples/skinning.html @@ -46,7 +46,7 @@ Skinning. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/sobel.html b/o3d/samples/sobel.html index f325c48..3443654 100644 --- a/o3d/samples/sobel.html +++ b/o3d/samples/sobel.html @@ -43,7 +43,7 @@ O3D: Sobel Shader Sample </title> <!-- Include sample javascript library functions--> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/stencil_example.html b/o3d/samples/stencil_example.html index 824f76a..3277918 100644 --- a/o3d/samples/stencil_example.html +++ b/o3d/samples/stencil_example.html @@ -56,7 +56,7 @@ Stencil Example <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/texturesamplers.html b/o3d/samples/texturesamplers.html index b7f0da4..23e6533 100644 --- a/o3d/samples/texturesamplers.html +++ b/o3d/samples/texturesamplers.html @@ -44,7 +44,7 @@ Demonstrates how to create samplers and set their various states. Texture Samplers </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/trends/trends.html b/o3d/samples/trends/trends.html index d7ca2b2..bf2d67c 100644 --- a/o3d/samples/trends/trends.html +++ b/o3d/samples/trends/trends.html @@ -58,7 +58,7 @@ Google Trends Visualizer </head> <body onload="init();" onunload="uninit();"> <script type="text/javascript" src="../o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.quaternions'); diff --git a/o3d/samples/tutorial-primitive.html b/o3d/samples/tutorial-primitive.html index ef41aeb..501ec25 100644 --- a/o3d/samples/tutorial-primitive.html +++ b/o3d/samples/tutorial-primitive.html @@ -43,7 +43,7 @@ Tutorial: Primitive. </title> <!-- Include sample javascript library functions--> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); o3djs.require('o3djs.primitives'); diff --git a/o3d/samples/vertex-shader-animation.html b/o3d/samples/vertex-shader-animation.html index b0e5c7c..ab6c752 100644 --- a/o3d/samples/vertex-shader-animation.html +++ b/o3d/samples/vertex-shader-animation.html @@ -54,7 +54,7 @@ Vertex Shader Animation } </style> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/vertex-shader.html b/o3d/samples/vertex-shader.html index 42edf73..c0df47c 100644 --- a/o3d/samples/vertex-shader.html +++ b/o3d/samples/vertex-shader.html @@ -45,7 +45,7 @@ through the vertices in javascript. Vertex Shader </title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/yuv2rgb.html b/o3d/samples/yuv2rgb.html index d69d288..7f48aad 100644 --- a/o3d/samples/yuv2rgb.html +++ b/o3d/samples/yuv2rgb.html @@ -43,7 +43,7 @@ RGB texture using a shader to do the conversion on the video hardware. <meta http-equiv="content-type" content="text/html; charset=UTF-8"> <title>YUV to RGB Conversion in a shader.</title> <script type="text/javascript" src="o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/samples/zsorting.html b/o3d/samples/zsorting.html index 1a0a942..c136e41 100644 --- a/o3d/samples/zsorting.html +++ b/o3d/samples/zsorting.html @@ -44,7 +44,7 @@ ZSorting. <script type="text/javascript" src="o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/sample_list.txt b/o3d/tests/selenium/sample_list.txt index 67e77f1..3d77f54 100644 --- a/o3d/tests/selenium/sample_list.txt +++ b/o3d/tests/selenium/sample_list.txt @@ -60,7 +60,7 @@ # noticeable at the lower resolution. Be careful with using this parameter # as it may mask other problems. # -# pdiff_edge_ignore_off : Turn off edge detection function in pdiff. +# pdiff_edge_ignore_off : Turn off edge detection function in pdiff. # By default, it's on with a default edge detect threshold 5. # # pdiff_edge_threshold(0 to 7) : Set edge detect threshold in pdiff. @@ -103,7 +103,7 @@ medium procedural-texture screenshot pdiff_threshold(200) medium render-targets screenshot pdiff_threshold(200) medium scatter-chart screenshot pdiff_threshold(200) pdiff_threshold_mac(10600) medium simple screenshot client(g_simple.client) -medium simpletexture screenshot pdiff_threshold(200) +medium simpletexture screenshot pdiff_threshold(300) medium skinning screenshot pdiff_threshold(200) medium sobel screenshot pdiff_threshold(1400) medium stencil_example screenshot(0) screenshot(100) screenshot(7777) pdiff_threshold(200) pdiff_threshold_win(200) @@ -125,7 +125,7 @@ large GoogleIO-2009/step14ex screenshot pdiff_threshold(200) timeou # pdiff_threshold options have any meaning small TestSampleErrorTextureSmall pdiff_threshold(200) -small TestSampleHelloCube_TexturesSmall pdiff_threshold(300) +small TestSampleHelloCube_TexturesSmall pdiff_threshold(350) small TestSampleRefreshPageLoad_Small medium TestSampleCustomCamera pdiff_threshold(200) pdiff_threshold_win(200) medium TestSamplePicking diff --git a/o3d/tests/selenium/selenium_utilities.py b/o3d/tests/selenium/selenium_utilities.py index a5d5b3d..8f8ccc0 100644 --- a/o3d/tests/selenium/selenium_utilities.py +++ b/o3d/tests/selenium/selenium_utilities.py @@ -137,21 +137,35 @@ def TakeScreenShotAtPath(session, session.window_focus() # Resize window, and client area if needed. - resize_script = ["window.resizeTo(%d, %d)" % - (selenium_constants.RESIZE_WIDTH, - selenium_constants.RESIZE_HEIGHT)] - width_specification = session.get_eval( - "window.document.getElementById('o3d').style.width") - need_client_resize = width_specification.find("%") >= 0 - if need_client_resize: - resize_script += [ - "window.document.getElementById('o3d').style.width = '800px';", - "window.document.getElementById('o3d').style.height = '600px';"] - session.run_script("\n".join(resize_script)) + session.run_script( + "(function() {\n" + " var needResize = false;\n" + " var divs = window.document.getElementsByTagName('div');\n" + " for (var ii = 0; ii < divs.length; ++ii) {\n" + " var div = divs[ii];\n" + " if (div.id && div.id == 'o3d') {\n" + " var widthSpec = div.style.width;\n" + " if (widthSpec.indexOf('%') >= 0) {\n" + " div.style.width = '800px';\n" + " div.style.height = '600px';\n" + " needResize = true;\n" + " break;\n" + " }\n" + " }\n" + " }\n" + " window.o3d_seleniumNeedResize = needResize;\n" + "} ());\n") + + need_client_resize = ( + session.get_eval("window.o3d_seleniumNeedResize") == "true") if need_client_resize: session.wait_for_condition( "window.%s.width == 800 && window.%s.height == 600" % (client, client), 20000) + else: + session.run_script("window.resizeTo(%d, %d)" % + (selenium_constants.RESIZE_WIDTH, + selenium_constants.RESIZE_HEIGHT)) # Execute screenshot capture code diff --git a/o3d/tests/selenium/tests/base-test.html b/o3d/tests/selenium/tests/base-test.html index 80169ed..0cefe47 100644 --- a/o3d/tests/selenium/tests/base-test.html +++ b/o3d/tests/selenium/tests/base-test.html @@ -49,7 +49,7 @@ This tests base.js. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.test'); o3djs.require('o3djs.util'); diff --git a/o3d/tests/selenium/tests/culling-zsort-test.html b/o3d/tests/selenium/tests/culling-zsort-test.html index 097b30d..44b6c20 100644 --- a/o3d/tests/selenium/tests/culling-zsort-test.html +++ b/o3d/tests/selenium/tests/culling-zsort-test.html @@ -46,7 +46,7 @@ Culling and ZSorting Test. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/drawshapes.html b/o3d/tests/selenium/tests/drawshapes.html index c25901b..3901194 100644 --- a/o3d/tests/selenium/tests/drawshapes.html +++ b/o3d/tests/selenium/tests/drawshapes.html @@ -45,7 +45,7 @@ The color is set randomly. Drawshape stress test for O3D </title> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/effect-import-test.html b/o3d/tests/selenium/tests/effect-import-test.html index 6a2515f..fec01dc 100644 --- a/o3d/tests/selenium/tests/effect-import-test.html +++ b/o3d/tests/selenium/tests/effect-import-test.html @@ -44,7 +44,7 @@ Effect Import Test <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); o3djs.require('o3djs.camera'); diff --git a/o3d/tests/selenium/tests/event-test.html b/o3d/tests/selenium/tests/event-test.html index 57c160c..5b463fd 100644 --- a/o3d/tests/selenium/tests/event-test.html +++ b/o3d/tests/selenium/tests/event-test.html @@ -44,7 +44,7 @@ This tests the event-handler functions in the event.js library. <br/> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.event'); o3djs.require('o3djs.test'); diff --git a/o3d/tests/selenium/tests/features-test.html b/o3d/tests/selenium/tests/features-test.html index 3520d33..d42c2f9 100644 --- a/o3d/tests/selenium/tests/features-test.html +++ b/o3d/tests/selenium/tests/features-test.html @@ -47,7 +47,7 @@ Features Test. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/init-status-test.html b/o3d/tests/selenium/tests/init-status-test.html index 08b9eb2..c17e74f 100644 --- a/o3d/tests/selenium/tests/init-status-test.html +++ b/o3d/tests/selenium/tests/init-status-test.html @@ -46,7 +46,7 @@ Init Status Test. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/math-test.html b/o3d/tests/selenium/tests/math-test.html index 399e432..c96b11d 100644 --- a/o3d/tests/selenium/tests/math-test.html +++ b/o3d/tests/selenium/tests/math-test.html @@ -44,7 +44,7 @@ This tests the math utility library. <br/> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.math'); o3djs.require('o3djs.test'); @@ -71,7 +71,7 @@ g_suite.testPseudoRandom = function() { g_math.resetPseudoRandom(); for (var ii = 0; ii < values.length; ++ii) { value = g_math.pseudoRandom(); - g_test.assertEquals(value, values[ii]); + g_test.assertEquals(value, values[ii]); } }; diff --git a/o3d/tests/selenium/tests/no-rendergraph.html b/o3d/tests/selenium/tests/no-rendergraph.html index e35e648..bf07950 100644 --- a/o3d/tests/selenium/tests/no-rendergraph.html +++ b/o3d/tests/selenium/tests/no-rendergraph.html @@ -44,7 +44,7 @@ No Rendergraph. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); // Events diff --git a/o3d/tests/selenium/tests/non-cachable-params.html b/o3d/tests/selenium/tests/non-cachable-params.html index f506304..74d2007 100644 --- a/o3d/tests/selenium/tests/non-cachable-params.html +++ b/o3d/tests/selenium/tests/non-cachable-params.html @@ -44,7 +44,7 @@ Non Cachable Params <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/offscreen-test.html b/o3d/tests/selenium/tests/offscreen-test.html index 033e0fa..dcdb78d 100644 --- a/o3d/tests/selenium/tests/offscreen-test.html +++ b/o3d/tests/selenium/tests/offscreen-test.html @@ -47,7 +47,7 @@ Offscreen Test. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/ownership-test.html b/o3d/tests/selenium/tests/ownership-test.html index fea74f0..8caeb91 100644 --- a/o3d/tests/selenium/tests/ownership-test.html +++ b/o3d/tests/selenium/tests/ownership-test.html @@ -42,7 +42,7 @@ Ownership Test </title> <!-- Our javascript code --> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); window.onload = init; diff --git a/o3d/tests/selenium/tests/param-array-test.html b/o3d/tests/selenium/tests/param-array-test.html index aca7d0f..3b753a2 100644 --- a/o3d/tests/selenium/tests/param-array-test.html +++ b/o3d/tests/selenium/tests/param-array-test.html @@ -41,7 +41,7 @@ Param Array Test Param Array Test. </title> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/pixel-perfection.html b/o3d/tests/selenium/tests/pixel-perfection.html index 60e7b1c..cbb19c2 100644 --- a/o3d/tests/selenium/tests/pixel-perfection.html +++ b/o3d/tests/selenium/tests/pixel-perfection.html @@ -52,7 +52,7 @@ we have a way to do that. Pixel Perfection </title> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.effect'); o3djs.require('o3djs.material'); o3djs.require('o3djs.math'); diff --git a/o3d/tests/selenium/tests/quaternion-test.html b/o3d/tests/selenium/tests/quaternion-test.html index 1d37182..142fb65 100644 --- a/o3d/tests/selenium/tests/quaternion-test.html +++ b/o3d/tests/selenium/tests/quaternion-test.html @@ -44,7 +44,7 @@ This tests the quaternion utility library. <br/> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.math'); o3djs.require('o3djs.quaternions'); diff --git a/o3d/tests/selenium/tests/render-test.html b/o3d/tests/selenium/tests/render-test.html index 3b4e26a..d1a2000 100644 --- a/o3d/tests/selenium/tests/render-test.html +++ b/o3d/tests/selenium/tests/render-test.html @@ -51,7 +51,7 @@ Render Test. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/serialization-test.html b/o3d/tests/selenium/tests/serialization-test.html index a59b0cb..6c5c186 100644 --- a/o3d/tests/selenium/tests/serialization-test.html +++ b/o3d/tests/selenium/tests/serialization-test.html @@ -48,7 +48,7 @@ This tests deserialization of packs from JSON. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.io'); o3djs.require('o3djs.serialization'); diff --git a/o3d/tests/selenium/tests/test-test.html b/o3d/tests/selenium/tests/test-test.html index 06d6a0d..faa815a 100644 --- a/o3d/tests/selenium/tests/test-test.html +++ b/o3d/tests/selenium/tests/test-test.html @@ -44,7 +44,7 @@ This tests the operation of the unit testing library. <br/> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.test'); diff --git a/o3d/tests/selenium/tests/texture-set-test.html b/o3d/tests/selenium/tests/texture-set-test.html index a421e5f..8bbc3fe 100644 --- a/o3d/tests/selenium/tests/texture-set-test.html +++ b/o3d/tests/selenium/tests/texture-set-test.html @@ -41,7 +41,7 @@ Texture set test. Texture Set Test. </title> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/type-test.html b/o3d/tests/selenium/tests/type-test.html index fe88c72..06edcb3 100644 --- a/o3d/tests/selenium/tests/type-test.html +++ b/o3d/tests/selenium/tests/type-test.html @@ -43,7 +43,7 @@ Type Test <!-- Our javascript code --> <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.math'); diff --git a/o3d/tests/selenium/tests/util-test.html b/o3d/tests/selenium/tests/util-test.html index 9785ed3..1504fd3 100644 --- a/o3d/tests/selenium/tests/util-test.html +++ b/o3d/tests/selenium/tests/util-test.html @@ -49,7 +49,7 @@ This tests util.js. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.test'); o3djs.require('o3djs.util'); diff --git a/o3d/tests/selenium/tests/v8-test.html b/o3d/tests/selenium/tests/v8-test.html index 6dd96d1..167c8309 100644 --- a/o3d/tests/selenium/tests/v8-test.html +++ b/o3d/tests/selenium/tests/v8-test.html @@ -49,7 +49,7 @@ This tests V8/NPAPI interoperation and the ActiveX bridge. <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.test'); o3djs.require('o3djs.util'); diff --git a/o3d/tests/selenium/tests/version-check-test.html b/o3d/tests/selenium/tests/version-check-test.html index b16d878..ddeef25 100644 --- a/o3d/tests/selenium/tests/version-check-test.html +++ b/o3d/tests/selenium/tests/version-check-test.html @@ -46,7 +46,7 @@ Version Check src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); // Events diff --git a/o3d/tests/selenium/tests/window-overlap-test.html b/o3d/tests/selenium/tests/window-overlap-test.html index 8ce4e16..4b3f9c0 100644 --- a/o3d/tests/selenium/tests/window-overlap-test.html +++ b/o3d/tests/selenium/tests/window-overlap-test.html @@ -47,7 +47,7 @@ Window Overlap Test <script type="text/javascript" src="../../../samples/o3djs/base.js"></script> <!-- Our javascript code --> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> o3djs.require('o3djs.util'); o3djs.require('o3djs.rendergraph'); diff --git a/o3d/tests/selenium/tests/window-overlap-top.html b/o3d/tests/selenium/tests/window-overlap-top.html index 250addc..3c5cc2d 100644 --- a/o3d/tests/selenium/tests/window-overlap-top.html +++ b/o3d/tests/selenium/tests/window-overlap-top.html @@ -42,7 +42,7 @@ See window-overlap-test.html <title> Window Overlap Test Top Window </title> -<script type="text/javascript"> +<script type="text/javascript" id="o3d"> // Events // init() once the page has finished loading. window.onload = init; |