123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- import Cartesian2 from "../Core/Cartesian2.js";
- import Color from "../Core/Color.js";
- import defaultValue from "../Core/defaultValue.js";
- import defined from "../Core/defined.js";
- import Event from "../Core/Event.js";
- import createPropertyDescriptor from "./createPropertyDescriptor.js";
- import Property from "./Property.js";
- var defaultEvenColor = Color.WHITE;
- var defaultOddColor = Color.BLACK;
- var defaultRepeat = new Cartesian2(2.0, 2.0);
- function CheckerboardMaterialProperty(options) {
- options = defaultValue(options, defaultValue.EMPTY_OBJECT);
- this._definitionChanged = new Event();
- this._evenColor = undefined;
- this._evenColorSubscription = undefined;
- this._oddColor = undefined;
- this._oddColorSubscription = undefined;
- this._repeat = undefined;
- this._repeatSubscription = undefined;
- this.evenColor = options.evenColor;
- this.oddColor = options.oddColor;
- this.repeat = options.repeat;
- }
- Object.defineProperties(CheckerboardMaterialProperty.prototype, {
-
- isConstant: {
- get: function () {
- return (
- Property.isConstant(this._evenColor) &&
- Property.isConstant(this._oddColor) &&
- Property.isConstant(this._repeat)
- );
- },
- },
-
- definitionChanged: {
- get: function () {
- return this._definitionChanged;
- },
- },
-
- evenColor: createPropertyDescriptor("evenColor"),
-
- oddColor: createPropertyDescriptor("oddColor"),
-
- repeat: createPropertyDescriptor("repeat"),
- });
- CheckerboardMaterialProperty.prototype.getType = function (time) {
- return "Checkerboard";
- };
- CheckerboardMaterialProperty.prototype.getValue = function (time, result) {
- if (!defined(result)) {
- result = {};
- }
- result.lightColor = Property.getValueOrClonedDefault(
- this._evenColor,
- time,
- defaultEvenColor,
- result.lightColor
- );
- result.darkColor = Property.getValueOrClonedDefault(
- this._oddColor,
- time,
- defaultOddColor,
- result.darkColor
- );
- result.repeat = Property.getValueOrDefault(this._repeat, time, defaultRepeat);
- return result;
- };
- CheckerboardMaterialProperty.prototype.equals = function (other) {
- return (
- this === other ||
- (other instanceof CheckerboardMaterialProperty &&
- Property.equals(this._evenColor, other._evenColor) &&
- Property.equals(this._oddColor, other._oddColor) &&
- Property.equals(this._repeat, other._repeat))
- );
- };
- export default CheckerboardMaterialProperty;
|