| OLD | NEW |
| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 * @type {number} | 53 * @type {number} |
| 54 */ | 54 */ |
| 55 o3d.DrawList.SortMethod = goog.typedef; | 55 o3d.DrawList.SortMethod = goog.typedef; |
| 56 | 56 |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * SortMethod, | 59 * SortMethod, |
| 60 * BY_PERFORMANCE | 60 * BY_PERFORMANCE |
| 61 * BY_Z_ORDER | 61 * BY_Z_ORDER |
| 62 * BY_PRIORITY | 62 * BY_PRIORITY |
| 63 * | 63 * |
| 64 * Method to sort DrawList by. | 64 * Method to sort DrawList by. |
| 65 */ | 65 */ |
| 66 o3d.DrawList.BY_PERFORMANCE = 0; | 66 o3d.DrawList.BY_PERFORMANCE = 0; |
| 67 o3d.DrawList.BY_Z_ORDER = 1; | 67 o3d.DrawList.BY_Z_ORDER = 1; |
| 68 o3d.DrawList.BY_PRIORITY = 2; | 68 o3d.DrawList.BY_PRIORITY = 2; |
| 69 | 69 |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Renders the draw list. | 72 * Renders the draw list. |
| 73 */ | 73 */ |
| 74 o3d.DrawList.prototype.render = function() { | 74 o3d.DrawList.prototype.render = function() { |
| 75 // TODO(petersont): Add sort. | 75 // TODO(petersont): Add sort. |
| 76 for (var i = 0; i < this.list_.length; ++i) { | 76 for (var i = 0; i < this.list_.length; ++i) { |
| 77 var drawElementInfo = this.list_[i]; | 77 var drawElementInfo = this.list_[i]; |
| 78 var world = drawElementInfo.world; | 78 var world = drawElementInfo.world; |
| 79 var view = drawElementInfo.view; | 79 var view = drawElementInfo.view; |
| 80 var viewProjection = drawElementInfo.viewProjection; |
| 81 var worldViewProjection = drawElementInfo.worldViewProjection; |
| 80 var projection = drawElementInfo.projection; | 82 var projection = drawElementInfo.projection; |
| 81 var transform = drawElementInfo.transform; | 83 var transform = drawElementInfo.transform; |
| 82 var drawElement = drawElementInfo.drawElement; | 84 var drawElement = drawElementInfo.drawElement; |
| 83 var element = drawElementInfo.drawElement.owner; | 85 var element = drawElementInfo.drawElement.owner; |
| 84 var material = drawElementInfo.drawElement.material || | 86 var material = drawElementInfo.drawElement.material || |
| 85 drawElementInfo.drawElement.owner.material; | 87 drawElementInfo.drawElement.owner.material; |
| 86 var effect = material.effect; | 88 var effect = material.effect; |
| 87 | 89 |
| 88 o3d.Param.SAS.setWorld(world); | 90 o3d.Param.SAS.setWorld(world); |
| 89 o3d.Param.SAS.setView(view); | 91 o3d.Param.SAS.setView(view); |
| 90 o3d.Param.SAS.setProjection(projection); | 92 o3d.Param.SAS.setProjection(projection); |
| 93 o3d.Param.SAS.setViewProjection(viewProjection); |
| 94 o3d.Param.SAS.setWorldViewProjection(worldViewProjection); |
| 91 | 95 |
| 92 var paramObjects = [ | 96 var paramObjects = [ |
| 93 transform, | 97 transform, |
| 94 drawElement, | 98 drawElement, |
| 95 element, | 99 element, |
| 96 material, | 100 material, |
| 97 effect, | 101 effect, |
| 98 o3d.Param.SAS | 102 o3d.Param.SAS |
| 99 ]; | 103 ]; |
| 100 | 104 |
| 101 effect.searchForParams_(paramObjects); | 105 effect.searchForParams_(paramObjects); |
| 102 element.render(); | 106 element.render(); |
| 103 } | 107 } |
| 104 }; | 108 }; |
| 105 | 109 |
| 106 | 110 |
| OLD | NEW |