summaryrefslogtreecommitdiffstats
path: root/o3d
diff options
context:
space:
mode:
authorgman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 18:01:05 +0000
committergman@google.com <gman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-08-21 18:01:05 +0000
commit435e5ff915fafe4aa95195688e4443d6d98c1984 (patch)
treed1c3eb1e178abb6ef02b45853caca70ca30c2bed /o3d
parent167f8adb2e665acb24a5dd4d8fec87a5ac861dc2 (diff)
downloadchromium_src-435e5ff915fafe4aa95195688e4443d6d98c1984.zip
chromium_src-435e5ff915fafe4aa95195688e4443d6d98c1984.tar.gz
chromium_src-435e5ff915fafe4aa95195688e4443d6d98c1984.tar.bz2
Updates the bitmap and skinning samples and gets the
latest reference images. Review URL: http://codereview.chromium.org/173183 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23977 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'o3d')
-rw-r--r--o3d/DEPS2
-rw-r--r--o3d/DEPS_gyp2
-rw-r--r--o3d/samples/MANIFEST4
-rw-r--r--o3d/samples/assets/four_pixel.pngbin0 -> 169 bytes
-rw-r--r--o3d/samples/assets/hi.jpgbin0 -> 1745 bytes
-rw-r--r--o3d/samples/assets/shaving_cream_300x300.jpg (renamed from o3d/samples/assets/bmp_mip.o3dtgz)bin105972 -> 107306 bytes
-rw-r--r--o3d/samples/bitmap-draw-image.html100
-rw-r--r--o3d/samples/skinning.html2
-rw-r--r--o3d/tests/selenium/sample_list.txt2
9 files changed, 64 insertions, 48 deletions
diff --git a/o3d/DEPS b/o3d/DEPS
index 28994a3..6961164 100644
--- a/o3d/DEPS
+++ b/o3d/DEPS
@@ -2,7 +2,7 @@ vars = {
"chromium_trunk":
"http://src.chromium.org/svn/trunk",
"nixysa_rev": "29",
- "o3d_code_rev": "120",
+ "o3d_code_rev": "122",
"skia_rev": "279",
"gyp_rev": "553",
"gtest_rev": "267",
diff --git a/o3d/DEPS_gyp b/o3d/DEPS_gyp
index 2a2423d..3c646ec 100644
--- a/o3d/DEPS_gyp
+++ b/o3d/DEPS_gyp
@@ -2,7 +2,7 @@ vars = {
"chromium_trunk": "http://src.chromium.org/svn/trunk",
"nixysa_rev": "29",
"chromium_rev": "22547",
- "o3d_code_rev": "120",
+ "o3d_code_rev": "122",
"skia_rev": "279",
"gyp_rev": "601",
"gtest_rev": "267",
diff --git a/o3d/samples/MANIFEST b/o3d/samples/MANIFEST
index b17fd66..c331fcc 100644
--- a/o3d/samples/MANIFEST
+++ b/o3d/samples/MANIFEST
@@ -2,18 +2,19 @@ archive-textures.html
assets/android.png
assets/archive_textures.o3dtgz
assets/block.png
-assets/bmp_mip.o3dtgz
assets/brush.png
assets/dome1.o3dtgz
assets/dome2.o3dtgz
assets/dome3.o3dtgz
assets/dome4.o3dtgz
assets/egg.png
+assets/four_pixel.png
assets/fullscreen.png
assets/gauge.png
assets/gaugeback.png
assets/gears_init.js
assets/google-square.png
+assets/hi.jpg
assets/iconback.png
assets/kitty_151_idle_stand05_cff1.o3dtgz
assets/normalmap.dds
@@ -33,6 +34,7 @@ assets/rock_texture.jpg
assets/seven_shapes.o3dtgz
assets/shaving_cream.jpg
assets/shaving_cream.png
+assets/shaving_cream_300x300.jpg
assets/square.png
assets/stencil_frame.o3dtgz
assets/teapot.o3dtgz
diff --git a/o3d/samples/assets/four_pixel.png b/o3d/samples/assets/four_pixel.png
new file mode 100644
index 0000000..02e84a3
--- /dev/null
+++ b/o3d/samples/assets/four_pixel.png
Binary files differ
diff --git a/o3d/samples/assets/hi.jpg b/o3d/samples/assets/hi.jpg
new file mode 100644
index 0000000..d65cdcc
--- /dev/null
+++ b/o3d/samples/assets/hi.jpg
Binary files differ
diff --git a/o3d/samples/assets/bmp_mip.o3dtgz b/o3d/samples/assets/shaving_cream_300x300.jpg
index b7a0c52..7e288ed 100644
--- a/o3d/samples/assets/bmp_mip.o3dtgz
+++ b/o3d/samples/assets/shaving_cream_300x300.jpg
Binary files differ
diff --git a/o3d/samples/bitmap-draw-image.html b/o3d/samples/bitmap-draw-image.html
index e4a5208..30d2835 100644
--- a/o3d/samples/bitmap-draw-image.html
+++ b/o3d/samples/bitmap-draw-image.html
@@ -30,8 +30,8 @@ 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 bitmaps and how to draw
+images on both bitmaps and textures.
-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
@@ -45,7 +45,7 @@ Bitmap Draw Image Demo
<script type="text/javascript" id="o3dscript">
o3djs.require('o3djs.util');
o3djs.require('o3djs.math');
-o3djs.require('o3djs.io');
+o3djs.require('o3djs.loader');
o3djs.require('o3djs.rendergraph');
o3djs.require('o3djs.primitives');
o3djs.require('o3djs.effect');
@@ -64,6 +64,7 @@ var g_finished = false; // for selenium testing
var g_eye;
var g_target;
var g_up;
+var g_bitmaps = []; // bitmaps by URL.
function makeShape(texture, effect) {
// Create a Material for the effect.
@@ -120,11 +121,24 @@ function makeShape(texture, effect) {
return myShape;
}
+function loadBitmap(loader, url) {
+ loader.loadBitmaps(g_pack, o3djs.util.getAbsoluteURI('assets/' + url),
+ function(bitmaps, exception) {
+ if (!exception) {
+ // We know we are only loading 2D images so there will only be 1 bitmap.
+ g_bitmaps[url] = bitmaps[0];
+ } else {
+ alert(exception);
+ }
+ });
+
+}
+
/**
* Creates the client area.
*/
function init() {
- o3djs.util.makeClients(initStep2);
+ o3djs.util.makeClients(initStep2, 'NotAntiAliased');
}
/**
@@ -168,45 +182,45 @@ function initStep2(clientElements) {
var effect = g_pack.createObject('Effect');
o3djs.effect.loadEffect(effect, 'shaders/texture-only.shader');
+ var loader = o3djs.loader.createLoader(callback);
+ loadBitmap(loader, 'shaving_cream_300x300.jpg');
+ loadBitmap(loader, 'four_pixel.png');
+ loadBitmap(loader, 'hi.jpg');
+ loader.finish();
+
// Start a request for loading the tar.gz archive containing a bunch of
// image files. We'll then make textures from each one...
- var loadInfo = o3djs.io.loadArchive(
- g_pack,
- './assets/bmp_mip.o3dtgz',
- callback);
- function callback(archiveInfo, exception) {
- if (!exception) {
- var rawdata1 = archiveInfo.getFileByURI('shaving_cream_300x300.jpg', true);
- var bitmap1 = g_pack.createBitmapsFromRawData(rawdata1)[0];
- bitmap1.flipVertically();
- var rawdata2 = archiveInfo.getFileByURI('four_pixel.png', true);
- var bitmap2 = g_pack.createBitmapsFromRawData(rawdata2)[0];
- bitmap2.flipVertically();
- var rawdata_hi = archiveInfo.getFileByURI('hi.jpg', true);
- var bitmapHi = g_pack.createBitmapsFromRawData(rawdata_hi)[0];
- bitmapHi.flipVertically();
- var texture = g_pack.createTexture2D(300, 300, g_o3d.Texture.XRGB8, 0,
- false);
- // draw image on bitmap.
- // scale down on top left corner.
- texture.drawImage(bitmap1, 0, 0, 0, 300, 300, 0, 0, 0, 150, 150);
- // scale up on top right corner.
- texture.drawImage(bitmap1, 0, 0, 156, 100, 100, 0, 150, 0, 150, 150);
- // flip and draw part of the img on bottom left.
- texture.drawImage(
- bitmap1, 0, 150, 100, 150, 150, 0, 149, 299, -150, -150);
- // draw out of boundary.
- texture.drawImage(bitmap1, 0, 0, 135, 300, 300, 0, 150, 150, 300, 300);
- // draw o3d.
- texture.drawImage(bitmapHi, 0, 0, 0, 100, 50, 0, 100, 125, 100, 50);
-
- // draw image on different mip-maps.
- texture.drawImage(bitmap1, 0, 0, 0, 300, 300, 1, 0, 0, 150, 150);
- texture.drawImage(bitmap2, 0, 0, 0, 2, 2, 2, 0, 0, 75, 75);
- texture.setRect(0, 0, 0, 1, [1, 0, 0]);
-
- makeShape(texture, effect);
- }
+ function callback() {
+ var bitmap1 = g_bitmaps['shaving_cream_300x300.jpg'];
+ bitmap1.flipVertically();
+ var bitmap2 = g_bitmaps['four_pixel.png'];
+ bitmap2.flipVertically();
+ var bitmapHi = g_bitmaps['hi.jpg'];
+ bitmapHi.flipVertically();
+
+ var texture = g_pack.createTexture2D(300, 300, g_o3d.Texture.XRGB8, 0,
+ false);
+ // draw image on bitmap.
+ // scale down on top left corner.
+ texture.drawImage(bitmap1, 0, 0, 0, 300, 300, 0, 0, 0, 150, 150);
+
+ // scale up on top right corner.
+ texture.drawImage(bitmap1, 0, 0, 156, 100, 100, 0, 150, 0, 150, 150);
+
+ // flip and draw part of the img on bottom left.
+ texture.drawImage(bitmap1, 0, 150, 100, 150, 150, 0, 149, 299, -150, -150);
+
+ // draw out of boundary.
+ texture.drawImage(bitmap1, 0, 0, 135, 300, 300, 0, 150, 150, 300, 300);
+
+ // draw o3d.
+ texture.drawImage(bitmapHi, 0, 0, 0, 100, 50, 0, 100, 125, 100, 50);
+
+ // draw image on different mip-maps.
+ texture.drawImage(bitmap1, 0, 0, 0, 300, 300, 1, 0, 0, 150, 150);
+ texture.drawImage(bitmap2, 0, 0, 0, 2, 2, 2, 0, 0, 75, 75);
+
+ makeShape(texture, effect);
}
o3djs.event.addEventListener(o3dElement, 'wheel', scrollMe);
}
@@ -219,8 +233,8 @@ function scrollMe(e) {
</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.
+This tutorial shows how to create bitmaps and how to draw images
+on both bitmaps and texture mipmaps.
<br/>
Scroll wheel to see different mipmaps.
<br/>
diff --git a/o3d/samples/skinning.html b/o3d/samples/skinning.html
index c329623..79d1cdc 100644
--- a/o3d/samples/skinning.html
+++ b/o3d/samples/skinning.html
@@ -220,7 +220,7 @@ function initStep2(clientElements) {
// to the SkinEval so the SkinEval will fill them in each frame.
var streamBank = shape.elements[0].streamBank;
streamBank.bindStream(skinEval, g_o3d.Stream.POSITION, 0);
- streamBank.bindStream(skinEval, g_o3d.Stream.POSITION, 0);
+ streamBank.bindStream(skinEval, g_o3d.Stream.NORMAL, 0);
// Setup an onrender callback for animation.
g_client.setRenderCallback(onrender);
diff --git a/o3d/tests/selenium/sample_list.txt b/o3d/tests/selenium/sample_list.txt
index e9f50ba..3d77f54 100644
--- a/o3d/tests/selenium/sample_list.txt
+++ b/o3d/tests/selenium/sample_list.txt
@@ -77,7 +77,7 @@ medium animation
large animated-scene screenshot timeout(45000) pdiff_threshold(200)
large beachdemo/beachdemo screenshot timeout(120000) pdiff_threshold(200) pdiff_threshold_mac(2100) downsample(1) except(*iexplore, *googlechrome)
medium billboards screenshot pdiff_threshold(200)
-#medium bitmap-draw-image screenshot pdiff_threshold(200)
+medium bitmap-draw-image screenshot pdiff_threshold(200)
medium canvas screenshot pdiff_threshold(200) pdiff_threshold_mac(14600)
medium canvas-fonts screenshot pdiff_threshold(200) pdiff_threshold_mac(21900)
medium canvas-texturedraw