| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 * @constructor | 204 * @constructor |
| 205 * @extends {o3d.StreamBank} | 205 * @extends {o3d.StreamBank} |
| 206 */ | 206 */ |
| 207 o3d.SkinEval = function() { | 207 o3d.SkinEval = function() { |
| 208 o3d.StreamBank.call(this); | 208 o3d.StreamBank.call(this); |
| 209 | 209 |
| 210 /** | 210 /** |
| 211 * The base matrix to subtract from the matrices before skinning. | 211 * The base matrix to subtract from the matrices before skinning. |
| 212 * @type {!Array<!Array<number>>} | 212 * @type {!Array<!Array<number>>} |
| 213 */ | 213 */ |
| 214 this.base = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]; | 214 this.base = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]; |
| 215 | 215 |
| 216 /** | 216 /** |
| 217 * Temporary storage for matrix ops. | 217 * Temporary storage for matrix ops. |
| 218 * @type {!Array<!Array<number>>} | 218 * @type {!Array<!Array<number>>} |
| 219 * @private | 219 * @private |
| 220 */ | 220 */ |
| 221 this.temp_matrix_ = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]; | 221 this.temp_matrix_ = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]; |
| 222 | 222 |
| 223 /** | 223 /** |
| 224 * Array of matrices representing each bone. | 224 * Array of matrices representing each bone. |
| 225 * @type {!Array<!Array<!Array<number>>>} | 225 * @type {!Array<!Array<!Array<number>>>} |
| 226 * @private | 226 * @private |
| 227 */ | 227 */ |
| 228 this.bones_ = []; | 228 this.bones_ = []; |
| 229 | 229 |
| 230 /** | 230 /** |
| 231 * Cache of StreamInfo objects for input values. Saved to avoid reallocating. | 231 * Cache of StreamInfo objects for input values. Saved to avoid reallocating. |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 | 480 |
| 481 for (var ii = 0; ii < param_array.length; ++ii) { | 481 for (var ii = 0; ii < param_array.length; ++ii) { |
| 482 var param = param_array.getParam(ii); // ParamMatrix4 | 482 var param = param_array.getParam(ii); // ParamMatrix4 |
| 483 if (!param) { | 483 if (!param) { |
| 484 this.gl.client.error_callback("SkinEval.updateBones_: " | 484 this.gl.client.error_callback("SkinEval.updateBones_: " |
| 485 + "In SkinEval '" + this.name + "' param at index " + ii | 485 + "In SkinEval '" + this.name + "' param at index " + ii |
| 486 + " in ParamArray '" + param_array.name | 486 + " in ParamArray '" + param_array.name |
| 487 + " is not a ParamMatrix4"); | 487 + " is not a ParamMatrix4"); |
| 488 return; | 488 return; |
| 489 } | 489 } |
| 490 this.bones_[ii] = [[1,0,0,0],[0,1,0,0],[0,0,1,0],[0,0,0,1]]; | 490 this.bones_[ii] = [[1, 0, 0, 0], [0, 1, 0, 0], [0, 0, 1, 0], [0, 0, 0, 1]]; |
| 491 o3d.Transform.compose(param.value, inverse_bind_pose_array[ii], | 491 o3d.Transform.compose(param.value, inverse_bind_pose_array[ii], |
| 492 this.bones_[ii]); | 492 this.bones_[ii]); |
| 493 o3d.Transform.compose(inverse_base, this.bones_[ii], this.bones_[ii]); | 493 o3d.Transform.compose(inverse_base, this.bones_[ii], this.bones_[ii]); |
| 494 } | 494 } |
| 495 }; | 495 }; |
| 496 | 496 |
| 497 /** | 497 /** |
| 498 * Updates the VertexBuffers bound to streams on this VertexSource. | 498 * Updates the VertexBuffers bound to streams on this VertexSource. |
| 499 */ | 499 */ |
| 500 o3d.SkinEval.prototype.updateStreams = function() { | 500 o3d.SkinEval.prototype.updateStreams = function() { |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 */ | 657 */ |
| 658 o3d.SkinEval.StreamInfo.prototype.copyFloat4 = function(source) { | 658 o3d.SkinEval.StreamInfo.prototype.copyFloat4 = function(source) { |
| 659 var ii = this.index_; | 659 var ii = this.index_; |
| 660 this.values_[ii] = source.result_[0]; | 660 this.values_[ii] = source.result_[0]; |
| 661 this.values_[ii+1] = source.result_[1]; | 661 this.values_[ii+1] = source.result_[1]; |
| 662 this.values_[ii+2] = source.result_[2]; | 662 this.values_[ii+2] = source.result_[2]; |
| 663 this.values_[ii+3] = source.result_[3]; | 663 this.values_[ii+3] = source.result_[3]; |
| 664 this.index_ = ii + this.stride_; | 664 this.index_ = ii + this.stride_; |
| 665 }; | 665 }; |
| 666 | 666 |
| OLD | NEW |