Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(923)

Side by Side Diff: samples/o3djs/canvas.js

Issue 150131: Some minor JS fixes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/o3d/
Patch Set: Created 11 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009, Google Inc. 2 * Copyright 2009, Google Inc.
3 * All rights reserved. 3 * All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 278
279 /** 279 /**
280 * A scale transform for this quad. 280 * A scale transform for this quad.
281 * You can change the scale the quad without effecting its positon using 281 * You can change the scale the quad without effecting its positon using
282 * this transform. 282 * this transform.
283 * @type {!o3d.Transform} 283 * @type {!o3d.Transform}
284 */ 284 */
285 this.scaleTransform = canvasInfo.pack.createObject('Transform'); 285 this.scaleTransform = canvasInfo.pack.createObject('Transform');
286 this.scaleTransform.parent = this.transform; 286 this.scaleTransform.parent = this.transform;
287 287
288 // create the texture the canvas will draw on. 288 /**
289 this.texture = canvasInfo.pack.createTexture2D( 289 * The texture the canvas will draw on.
290 * @type {!o3d.Texture2D}
291 */
292 this.texture = /** @type {!o3d.Texture2D} */ (canvasInfo.pack.createTexture2D(
290 width, 293 width,
291 height, 294 height,
292 o3djs.base.o3d.Texture.ARGB8, 295 o3djs.base.o3d.Texture.ARGB8,
293 1, // mipmap levels 296 1, // mipmap levels
294 false); 297 false));
295 298
296 // Create a Canvas object to go with the quad. 299 // Create a Canvas object to go with the quad.
297 300
298 /** 301 /**
299 * The Canvas object used to draw on this quad. 302 * The Canvas object used to draw on this quad.
300 * @type {!o3d.Canvas} 303 * @type {!o3d.Canvas}
301 */ 304 */
302 this.canvas = canvasInfo.pack.createObject('Canvas'); 305 this.canvas = canvasInfo.pack.createObject('Canvas');
303 this.canvas.setSize(width, height); 306 this.canvas.setSize(width, height);
304 307
305 // setup the sampler for the texture 308 /**
309 * The sampler for the texture.
310 * @type {!o3d.Sampler}
311 */
306 this.sampler = canvasInfo.pack.createObject('Sampler'); 312 this.sampler = canvasInfo.pack.createObject('Sampler');
307 this.sampler.addressModeU = o3djs.base.o3d.Sampler.CLAMP; 313 this.sampler.addressModeU = o3djs.base.o3d.Sampler.CLAMP;
308 this.sampler.addressModeV = o3djs.base.o3d.Sampler.CLAMP; 314 this.sampler.addressModeV = o3djs.base.o3d.Sampler.CLAMP;
309 this.paramSampler = this.scaleTransform.createParam('texSampler0', 315
310 'ParamSampler'); 316 /**
311 this.paramSampler.value = this.sampler; 317 * The param sampler for this transform.
318 * @private
319 * @type {!o3d.ParamSampler}
320 */
321 this.paramSampler_ = this.scaleTransform.createParam('texSampler0',
322 'ParamSampler');
323 this.paramSampler_.value = this.sampler;
312 324
313 this.sampler.texture = this.texture; 325 this.sampler.texture = this.texture;
314 if (transparent) { 326 if (transparent) {
315 this.scaleTransform.addShape(canvasInfo.transparentQuadShape); 327 this.scaleTransform.addShape(canvasInfo.transparentQuadShape);
316 } else { 328 } else {
317 this.scaleTransform.addShape(canvasInfo.opaqueQuadShape); 329 this.scaleTransform.addShape(canvasInfo.opaqueQuadShape);
318 } 330 }
319 this.scaleTransform.translate(width / 2, height / 2, 0); 331 this.scaleTransform.translate(width / 2, height / 2, 0);
320 this.scaleTransform.scale(width, -height, 1); 332 this.scaleTransform.scale(width, -height, 1);
321 }; 333 };
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 o3djs.canvas.CanvasInfo.prototype.createQuad = function(width, 390 o3djs.canvas.CanvasInfo.prototype.createQuad = function(width,
379 height, 391 height,
380 transparent, 392 transparent,
381 opt_parent) { 393 opt_parent) {
382 return new o3djs.canvas.CanvasQuad(this, 394 return new o3djs.canvas.CanvasQuad(this,
383 width, 395 width,
384 height, 396 height,
385 transparent, 397 transparent,
386 opt_parent); 398 opt_parent);
387 }; 399 };
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698