| 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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 * inTangent[0], inTangent[1], outTangent[0], outTangent[1]). | 577 * inTangent[0], inTangent[1], outTangent[0], outTangent[1]). |
| 578 * Length must be a multiple of 6. | 578 * Length must be a multiple of 6. |
| 579 */ | 579 */ |
| 580 o3d.Curve.prototype.addBezierKeys = function(values) { | 580 o3d.Curve.prototype.addBezierKeys = function(values) { |
| 581 var kNumBezierKeyValues = 6; | 581 var kNumBezierKeyValues = 6; |
| 582 if (values.length % kNumBezierKeyValues != 0) { | 582 if (values.length % kNumBezierKeyValues != 0) { |
| 583 this.gl.client.error_callback( | 583 this.gl.client.error_callback( |
| 584 "addBezierKeys: expected multiple of 6 values got "+values.size()); | 584 "addBezierKeys: expected multiple of 6 values got "+values.size()); |
| 585 return; | 585 return; |
| 586 } | 586 } |
| 587 for (var ii = 0; ii < values.length; ii += kNumBezierKeyValues) { | 587 for (var i = 0; i < values.length; i += kNumBezierKeyValues) { |
| 588 var newKey = this.createKey("BezierCurveKey"); | 588 var newKey = this.createKey("BezierCurveKey"); |
| 589 newKey.input = values[i]; | 589 newKey.input = values[i]; |
| 590 newKey.output = values[i+1]; | 590 newKey.output = values[i+1]; |
| 591 newKey.inTangent[0] = values[i+2]; | 591 newKey.inTangent[0] = values[i+2]; |
| 592 newKey.inTangent[1] = values[i+3]; | 592 newKey.inTangent[1] = values[i+3]; |
| 593 newKey.outTangent[0] = values[i+4]; | 593 newKey.outTangent[0] = values[i+4]; |
| 594 newKey.outTangent[1] = values[i+5]; | 594 newKey.outTangent[1] = values[i+5]; |
| 595 } | 595 } |
| 596 this.sorted_ = false; | 596 this.sorted_ = false; |
| 597 }; | 597 }; |
| (...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 // interpolate end_input to anything past it. | 903 // interpolate end_input to anything past it. |
| 904 if (input >= end_input) { | 904 if (input >= end_input) { |
| 905 return end_output + output_offset; | 905 return end_output + output_offset; |
| 906 } | 906 } |
| 907 | 907 |
| 908 // TODO(pathorn): Implement curve cache in javascript. | 908 // TODO(pathorn): Implement curve cache in javascript. |
| 909 // See 'void Curve::CreateCache' in o3d/core/cross/curve.cc | 909 // See 'void Curve::CreateCache' in o3d/core/cross/curve.cc |
| 910 | 910 |
| 911 return this.getOutputInSpan_(input, context) + output_offset; | 911 return this.getOutputInSpan_(input, context) + output_offset; |
| 912 }; | 912 }; |
| OLD | NEW |