@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
3 lines (2 loc) • 2.23 kB
JavaScript
/* COPYRIGHT Esri - https://js.arcgis.com/5.0.8/LICENSE.txt */
import{__decorate as e}from"tslib";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as r,subclass as o}from"../../../../core/accessorSupport/decorators.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{GridLocalOriginFactory as i}from"../lib/GridLocalOriginFactory.js";import a from"../lib/ModelDirtySet.js";import{RenderGeometry as n}from"../lib/RenderGeometry.js";import{assert as d}from"../lib/Util.js";let l=class extends t{constructor(){super(...arguments),this.dirtySet=new a({model:this}),this._originFactory=new i(null),this._textures=new Map,this._layers=new Map}hasTexture(e){return this._textures.has(e.id)}getTexture(e){return null==e?null:this._textures.get(e)}addTexture(e){const t=e.id;d(!this._textures.has(t),"Model/Stage already contains texture to be added"),this._textures.set(t,e)}removeTexture(e){return this._textures.delete(e.id)}addTextures(e){for(const t of e)t&&(d(!this._textures.has(t.id),"Model/Stage already contains object to be added"),this._textures.set(t.id,t))}removeTextures(e){for(const t of e)t&&(d(this._textures.has(t.id),"Model/Stage doesn't contain object to be removed"),this._textures.delete(t.id))}forEachTexture(e){this._textures.forEach(t=>e(t))}hasLayer(e){return this._layers.has(e.id)}getLayer(e){return null==e?null:this._layers.get(e)}addLayer(e){const t=e.id;d(!this._layers.has(t),"Model/Stage already contains layer to be added"),this._layers.set(t,e)}removeLayer(e){return this._layers.delete(e.id)}getRenderGeometry(e,t){const r=new n(t,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation}),o=t.localOrigin;return r.transformation=e.getCombinedStaticTransformation(t,c),r.localOrigin=o??this._originFactory.getOrigin(r.boundingSphere.center),r}updateRenderGeometryTransformation(e,t,r){if(null==e)return!1;r.transformation=e.getCombinedStaticTransformation(t,c);const o=this._originFactory.getOrigin(r.boundingSphere.center);return r.localOrigin!==o}get test(){}};e([r({constructOnly:!0})],l.prototype,"dirtySet",void 0),l=e([o("esri.views.3d.webgl-engine.parts.Model")],l);const c=s();export{l as Model};