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

Side by Side Diff: samples/o3d-webgl/shape.js

Issue 1092003: Fixed a lot of bugs with render surfaces and bitmaps. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/o3d/
Patch Set: '' Created 10 years, 9 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 | « samples/o3d-webgl/render_surface_set.js ('k') | samples/o3d-webgl/state.js » ('j') | 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 2010, Google Inc. 2 * Copyright 2010, 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 o3d.Shape.prototype.addElement = function(element) { 87 o3d.Shape.prototype.addElement = function(element) {
88 this.elements.push(element); 88 this.elements.push(element);
89 }; 89 };
90 90
91 91
92 /** 92 /**
93 * Removes and element to the list of elements for this shape. 93 * Removes and element to the list of elements for this shape.
94 * @param {o3d.Element} element The element to add. 94 * @param {o3d.Element} element The element to add.
95 */ 95 */
96 o3d.Shape.prototype.removeElement = function(element) { 96 o3d.Shape.prototype.removeElement = function(element) {
97 97 o3d.removeFromArray(this.elements, element);
98 }; 98 };
99 99
100 100
101 /** 101 /**
102 * Called when the tree traversal finds this shape in the transform tree. 102 * Called when the tree traversal finds this shape in the transform tree.
103 * Adds objects to the given drawlists if the drawlist of the material matches. 103 * Adds objects to the given drawlists if the drawlist of the material matches.
104 * @param {Array.<Object>} drawListInfos A list of objects containing 104 * @param {Array.<Object>} drawListInfos A list of objects containing
105 * drawlists and matrix info. 105 * drawlists and matrix info.
106 * @param {o3d.math.Matrix4} world The world matrix. 106 * @param {o3d.math.Matrix4} world The world matrix.
107 */ 107 */
108 o3d.Shape.prototype.writeToDrawLists = 108 o3d.Shape.prototype.writeToDrawLists =
109 function(drawListInfos, world, transform) { 109 function(drawListInfos, world, transform) {
110 var elements = this.elements; 110 var elements = this.elements;
111
112 // Iterate through elements of this shape.
111 for (var i = 0; i < elements.length; ++i) { 113 for (var i = 0; i < elements.length; ++i) {
112 var element = elements[i]; 114 var element = elements[i];
115
116 // For each element look at the DrawElements for that element.
113 for (var j = 0; j < element.drawElements.length; ++j) { 117 for (var j = 0; j < element.drawElements.length; ++j) {
114 var drawElement = element.drawElements[j]; 118 var drawElement = element.drawElements[j];
115 var materialDrawList = drawElement.material.drawList; 119 var material = drawElement.material || drawElement.owner.material;
120 var materialDrawList = material.drawList;
121
122 // Iterate through the drawlists we might write to.
116 for (var k = 0; k < drawListInfos.length; ++k) { 123 for (var k = 0; k < drawListInfos.length; ++k) {
117 var drawListInfo = drawListInfos[k]; 124 var drawListInfo = drawListInfos[k];
118 var list = drawListInfo.list; 125 var list = drawListInfo.list;
119 var context = drawListInfo.context; 126 var context = drawListInfo.context;
127
128 // If any of those drawlists matches the material on the drawElement,
129 // add the drawElement to the list.
120 if (materialDrawList == list) { 130 if (materialDrawList == list) {
121 list.list_.push({ 131 list.list_.push({
122 view: context.view, 132 view: context.view,
123 projection: context.projection, 133 projection: context.projection,
124 world: world, 134 world: world,
125 transform: transform, 135 transform: transform,
126 drawElement: drawElement 136 drawElement: drawElement
127 }); 137 });
128 } 138 }
129 } 139 }
130 } 140 }
131 } 141 }
132 }; 142 };
143
144
OLDNEW
« no previous file with comments | « samples/o3d-webgl/render_surface_set.js ('k') | samples/o3d-webgl/state.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698