123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239 |
- import Check from "../Core/Check.js";
- import defined from "../Core/defined.js";
- import DeveloperError from "../Core/DeveloperError.js";
- import NearFarScalar from "../Core/NearFarScalar.js";
- import Rectangle from "../Core/Rectangle.js";
- function GlobeTranslucency() {
- this._enabled = false;
- this._frontFaceAlpha = 1.0;
- this._frontFaceAlphaByDistance = undefined;
- this._backFaceAlpha = 1.0;
- this._backFaceAlphaByDistance = undefined;
- this._rectangle = Rectangle.clone(Rectangle.MAX_VALUE);
- }
- Object.defineProperties(GlobeTranslucency.prototype, {
-
- enabled: {
- get: function () {
- return this._enabled;
- },
- set: function (value) {
-
- Check.typeOf.bool("enabled", value);
-
- this._enabled = value;
- },
- },
-
- frontFaceAlpha: {
- get: function () {
- return this._frontFaceAlpha;
- },
- set: function (value) {
-
- Check.typeOf.number.greaterThanOrEquals("frontFaceAlpha", value, 0.0);
- Check.typeOf.number.lessThanOrEquals("frontFaceAlpha", value, 1.0);
-
- this._frontFaceAlpha = value;
- },
- },
-
- frontFaceAlphaByDistance: {
- get: function () {
- return this._frontFaceAlphaByDistance;
- },
- set: function (value) {
-
- if (defined(value) && value.far < value.near) {
- throw new DeveloperError(
- "far distance must be greater than near distance."
- );
- }
-
- this._frontFaceAlphaByDistance = NearFarScalar.clone(
- value,
- this._frontFaceAlphaByDistance
- );
- },
- },
-
- backFaceAlpha: {
- get: function () {
- return this._backFaceAlpha;
- },
- set: function (value) {
-
- Check.typeOf.number.greaterThanOrEquals("backFaceAlpha", value, 0.0);
- Check.typeOf.number.lessThanOrEquals("backFaceAlpha", value, 1.0);
-
- this._backFaceAlpha = value;
- },
- },
-
- backFaceAlphaByDistance: {
- get: function () {
- return this._backFaceAlphaByDistance;
- },
- set: function (value) {
-
- if (defined(value) && value.far < value.near) {
- throw new DeveloperError(
- "far distance must be greater than near distance."
- );
- }
-
- this._backFaceAlphaByDistance = NearFarScalar.clone(
- value,
- this._backFaceAlphaByDistance
- );
- },
- },
-
- rectangle: {
- get: function () {
- return this._rectangle;
- },
- set: function (value) {
- if (!defined(value)) {
- value = Rectangle.clone(Rectangle.MAX_VALUE);
- }
- Rectangle.clone(value, this._rectangle);
- },
- },
- });
- export default GlobeTranslucency;
|