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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 */ | 405 */ |
406 o3d.SkinEval.getMaxNumBones = function(obj) { | 406 o3d.SkinEval.getMaxNumBones = function(obj) { |
407 // Quote from spec: | 407 // Quote from spec: |
408 // GL_MAX_VERTEX_UNIFORM_VECTORS | 408 // GL_MAX_VERTEX_UNIFORM_VECTORS |
409 // params returns one value, the maximum number of four-element | 409 // params returns one value, the maximum number of four-element |
410 // floating-point, integer, or boolean vectors that can be held in | 410 // floating-point, integer, or boolean vectors that can be held in |
411 // uniform variable storage for a vertex shader. | 411 // uniform variable storage for a vertex shader. |
412 // The value must be at least 128. See glUniform. | 412 // The value must be at least 128. See glUniform. |
413 var gl = obj.gl; | 413 var gl = obj.gl; |
414 var maxVertexUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS); | 414 var maxVertexUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS); |
| 415 if (!maxVertexUniformVectors) { |
| 416 maxVertexUniformVectors = 128; |
| 417 } |
415 return Math.floor((maxVertexUniformVectors - 32) / 3); | 418 return Math.floor((maxVertexUniformVectors - 32) / 3); |
416 }; | 419 }; |
417 | 420 |
418 /** | 421 /** |
419 * Someone bound a stream to this SkinEval. Enable the shader on the primitive, | 422 * Someone bound a stream to this SkinEval. Enable the shader on the primitive, |
420 * and bind any additional weights or indices streams if necessary. | 423 * and bind any additional weights or indices streams if necessary. |
421 * | 424 * |
422 * @param {o3d.VertexSource} dest VertexSource that bound to this VertexSource. | 425 * @param {o3d.VertexSource} dest VertexSource that bound to this VertexSource. |
423 * @param {o3d.ParamVertexBufferStream} dest_param Other param which was bound. | 426 * @param {o3d.ParamVertexBufferStream} dest_param Other param which was bound. |
424 * @override | 427 * @override |
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
919 */ | 922 */ |
920 o3d.SkinEval.StreamInfo.prototype.copyFloat4 = function(source) { | 923 o3d.SkinEval.StreamInfo.prototype.copyFloat4 = function(source) { |
921 var ii = this.index_; | 924 var ii = this.index_; |
922 this.values_[ii] = source.result_[0]; | 925 this.values_[ii] = source.result_[0]; |
923 this.values_[ii+1] = source.result_[1]; | 926 this.values_[ii+1] = source.result_[1]; |
924 this.values_[ii+2] = source.result_[2]; | 927 this.values_[ii+2] = source.result_[2]; |
925 this.values_[ii+3] = source.result_[3]; | 928 this.values_[ii+3] = source.result_[3]; |
926 this.index_ = ii + this.stride_; | 929 this.index_ = ii + this.stride_; |
927 }; | 930 }; |
928 | 931 |
OLD | NEW |