@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 2.53 kB
JavaScript
/*
All material copyright ESRI, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.33/esri/copyright.txt for details.
*/
import{_ as e}from"../../../../chunks/tslib.es6.js";import t from"../../../../core/Accessor.js";import"../../../../core/has.js";import{property as r}from"../../../../core/accessorSupport/decorators/property.js";import"../../../../core/Logger.js";import"../../../../core/RandomLCG.js";import{subclass as o}from"../../../../core/accessorSupport/decorators/subclass.js";import{create as s}from"../../../../core/libs/gl-matrix-2/factories/mat4f64.js";import{a as i}from"../../../../chunks/sphere.js";import{GridLocalOriginFactory as a}from"../lib/GridLocalOriginFactory.js";import n from"../lib/ModelDirtySet.js";import{RenderGeometry as d}from"../lib/RenderGeometry.js";import{assert as c}from"../lib/Util.js";let l=class extends t{constructor(){super(...arguments),this.dirtySet=new n({model:this}),this._originFactory=new a(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;c(!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&&(c(!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&&(c(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;c(!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 d(t,{castShadow:e.castShadow,objectShaderTransformation:e.shaderTransformation}),o=t.localOrigin;return r.transformation=e.getCombinedStaticTransformation(t,u),r.localOrigin=o??this._originFactory.getOrigin(i(r.boundingSphere)),r}updateRenderGeometryTransformation(e,t,r){if(null==e)return!1;r.transformation=e.getCombinedStaticTransformation(t,u);const o=this._originFactory.getOrigin(i(r.boundingSphere));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 u=s();export{l as Model};