-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1074 from abwood/issue93
Scale billboards based on distance (Issue #93)
- Loading branch information
Showing
13 changed files
with
639 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
/*global define*/ | ||
define([ | ||
'./defaultValue', | ||
'./defined', | ||
'./DeveloperError' | ||
], function( | ||
defaultValue, | ||
defined, | ||
DeveloperError) { | ||
"use strict"; | ||
|
||
/** | ||
* Represents a scalar value's lower and upper bound at a near distance and far distance in eye space. | ||
* @alias NearFarScalar | ||
* @constructor | ||
* | ||
* @param {Number} [near=0.0] The lower bound of the camera range. | ||
* @param {Number} [nearValue=0.0] The value at the lower bound of the camera range. | ||
* @param {Number} [far=1.0] The upper bound of the camera range. | ||
* @param {Number} [farValue=0.0] The value at the upper bound of the camera range. | ||
*/ | ||
var NearFarScalar = function(near, nearValue, far, farValue) { | ||
/** | ||
* The lower bound of the camera range. | ||
* @type {Number} | ||
* @default 0.0 | ||
*/ | ||
this.near = defaultValue(near, 0.0); | ||
/** | ||
* The value at the lower bound of the camera range. | ||
* @type {Number} | ||
* @default 0.0 | ||
*/ | ||
this.nearValue = defaultValue(nearValue, 0.0); | ||
/** | ||
* The upper bound of the camera range. | ||
* @type {Number} | ||
* @default 1.0 | ||
*/ | ||
this.far = defaultValue(far, 1.0); | ||
/** | ||
* The value at the upper bound of the camera range. | ||
* @type {Number} | ||
* @default 0.0 | ||
*/ | ||
this.farValue = defaultValue(farValue, 0.0); | ||
}; | ||
|
||
/** | ||
* Duplicates a NearFarScalar instance. | ||
* @memberof NearFarScalar | ||
* | ||
* @param {NearFarScalar} nearFarScalar The NearFarScalar to duplicate. | ||
* @param {NearFarScalar} [result] The object onto which to store the result. | ||
* @returns {NearFarScalar} The modified result parameter or a new NearFarScalar instance if one was not provided. (Returns undefined if nearFarScalar is undefined) | ||
*/ | ||
NearFarScalar.clone = function(nearFarScalar, result) { | ||
if (!defined(nearFarScalar)) { | ||
return undefined; | ||
} | ||
|
||
if (!defined(result)) { | ||
return new NearFarScalar(nearFarScalar.near, | ||
nearFarScalar.nearValue, | ||
nearFarScalar.far, | ||
nearFarScalar.farValue); | ||
} | ||
|
||
result.near = nearFarScalar.near; | ||
result.nearValue = nearFarScalar.nearValue; | ||
result.far = nearFarScalar.far; | ||
result.farValue = nearFarScalar.farValue; | ||
return result; | ||
}; | ||
|
||
/** | ||
* Compares the provided NearFarScalar and returns <code>true</code> if they are equal, | ||
* <code>false</code> otherwise. | ||
* @memberof NearFarScalar | ||
* | ||
* @param {NearFarScalar} [left] The first NearFarScalar. | ||
* @param {NearFarScalar} [right] The second NearFarScalar. | ||
* | ||
* @returns {Boolean} <code>true</code> if left and right are equal; otherwise <code>false</code>. | ||
*/ | ||
NearFarScalar.equals = function(left, right) { | ||
return (left === right) || | ||
((defined(left)) && | ||
(defined(right)) && | ||
(left.near === right.near) && | ||
(left.nearValue === right.nearValue) && | ||
(left.far === right.far) && | ||
(left.farValue === right.farValue)); | ||
}; | ||
|
||
return NearFarScalar; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.