UNPKG

awayjs-display

Version:
46 lines 2 kB
"use strict"; var __extends = (this && this.__extends) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; var DirectionalShadowMapper_1 = require("../../materials/shadowmappers/DirectionalShadowMapper"); var NearDirectionalShadowMapper = (function (_super) { __extends(NearDirectionalShadowMapper, _super); function NearDirectionalShadowMapper(coverageRatio) { if (coverageRatio === void 0) { coverageRatio = .5; } _super.call(this); this.coverageRatio = coverageRatio; } Object.defineProperty(NearDirectionalShadowMapper.prototype, "coverageRatio", { /** * A value between 0 and 1 to indicate the ratio of the view frustum that needs to be covered by the shadow map. */ get: function () { return this._coverageRatio; }, set: function (value) { if (value > 1) value = 1; else if (value < 0) value = 0; this._coverageRatio = value; }, enumerable: true, configurable: true }); NearDirectionalShadowMapper.prototype.pUpdateDepthProjection = function (camera) { var corners = camera.projection.frustumCorners; for (var i = 0; i < 12; ++i) { var v = corners[i]; this._pLocalFrustum[i] = v; this._pLocalFrustum[i + 12] = v + (corners[i + 12] - v) * this._coverageRatio; } this.pUpdateProjectionFromFrustumCorners(camera, this._pLocalFrustum, this._pMatrix); this._pOverallDepthProjection.matrix = this._pMatrix; }; return NearDirectionalShadowMapper; }(DirectionalShadowMapper_1.default)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = NearDirectionalShadowMapper; //# sourceMappingURL=NearDirectionalShadowMapper.js.map