@arcgis/core
Version:
ArcGIS Maps SDK for JavaScript: A complete 2D and 3D mapping and data visualization API
6 lines (5 loc) • 3.02 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{PixelFormat as R,SizedPixelFormat as T,TextureWrapMode as E,TextureSamplingMode as N,PixelType as A,SizedDepthStencilFormat as M,SizedDepthFormat as O,UnsizedDepthFormat as n}from"../../../webgl/enums.js";import{TextureDescriptor as e}from"../../../webgl/TextureDescriptor.js";import{isSizedDepthFormat as t}from"../../../webgl/textureUtils.js";var o,_;!function(R){R[R.R8UNORM=0]="R8UNORM",R[R.R8UINT=1]="R8UINT",R[R.RG8UNORM=2]="RG8UNORM",R[R.RG8UINT=3]="RG8UINT",R[R.RGBA4UNORM=4]="RGBA4UNORM",R[R.RGBA8UNORM=5]="RGBA8UNORM",R[R.RGBA8UNORM_MIPMAP=6]="RGBA8UNORM_MIPMAP",R[R.R16FLOAT=7]="R16FLOAT",R[R.RGBA16FLOAT=8]="RGBA16FLOAT",R[R.R32FLOAT=9]="R32FLOAT",R[R.COUNT=10]="COUNT"}(o||(o={})),function(R){R[R.DEPTH16=10]="DEPTH16",R[R.DEPTH24_STENCIL8=11]="DEPTH24_STENCIL8"}(_||(_={}));const a={[o.R8UNORM]:"R8",[o.R8UINT]:"R8UI",[o.R16FLOAT]:"R16F",[o.R32FLOAT]:"R32F",[o.RG8UNORM]:"RG8",[o.RG8UINT]:"RG8UI",[o.RGBA8UNORM]:"RGBA8",[o.RGBA4UNORM]:"RGBA4",[o.RGBA8UNORM_MIPMAP]:"RGBA8_MM",[o.RGBA16FLOAT]:"RGBA16F",[_.DEPTH16]:"D16",[_.DEPTH24_STENCIL8]:"D24S8"};function G(R){return R>=o.COUNT}const r=new e;r.pixelFormat=R.RED,r.internalFormat=T.R8,r.wrapMode=E.CLAMP_TO_EDGE;const F=new e;F.pixelFormat=R.RED_INTEGER,F.internalFormat=T.R8UI,F.wrapMode=E.CLAMP_TO_EDGE,F.samplingMode=N.NEAREST;const U=new e;U.pixelFormat=R.RG,U.internalFormat=T.RG8,U.wrapMode=E.CLAMP_TO_EDGE;const P=new e;P.pixelFormat=R.RG_INTEGER,P.internalFormat=T.RG8UI,P.wrapMode=E.CLAMP_TO_EDGE,P.samplingMode=N.NEAREST;const D=new e;D.internalFormat=T.RGBA4,D.dataType=A.UNSIGNED_SHORT_4_4_4_4,D.wrapMode=E.CLAMP_TO_EDGE;const I=new e;I.wrapMode=E.CLAMP_TO_EDGE;const L=new e;L.wrapMode=E.CLAMP_TO_EDGE,L.samplingMode=N.LINEAR_MIPMAP_LINEAR,L.hasMipmap=!0,L.maxAnisotropy=8;const p=new e;p.pixelFormat=R.RED,p.dataType=A.HALF_FLOAT,p.internalFormat=T.R16F,p.samplingMode=N.NEAREST;const i=new e;i.dataType=A.HALF_FLOAT,i.internalFormat=T.RGBA16F,i.wrapMode=E.CLAMP_TO_EDGE;const m=new e;m.pixelFormat=R.RED,m.dataType=A.FLOAT,m.internalFormat=T.R32F,m.samplingMode=N.NEAREST;const l={[o.R8UNORM]:r,[o.R8UINT]:F,[o.RG8UNORM]:U,[o.RG8UINT]:P,[o.RGBA4UNORM]:D,[o.RGBA8UNORM]:I,[o.RGBA8UNORM_MIPMAP]:L,[o.R16FLOAT]:p,[o.RGBA16FLOAT]:i,[o.R32FLOAT]:m,[o.COUNT]:null},s={[O.DEPTH_COMPONENT16]:A.UNSIGNED_SHORT,[O.DEPTH_COMPONENT24]:A.UNSIGNED_INT,[O.DEPTH_COMPONENT32F]:A.FLOAT,[M.DEPTH24_STENCIL8]:A.UNSIGNED_INT_24_8,[M.DEPTH32F_STENCIL8]:A.FLOAT_32_UNSIGNED_INT_24_8_REV},C={[_.DEPTH24_STENCIL8]:w(M.DEPTH24_STENCIL8),[_.DEPTH16]:w(O.DEPTH_COMPONENT16)};function w(R){const T=new e;return T.pixelFormat=t(R)?n.DEPTH_COMPONENT:n.DEPTH_STENCIL,T.dataType=s[R],T.samplingMode=N.NEAREST,T.wrapMode=E.CLAMP_TO_EDGE,T.internalFormat=R,T.hasMipmap=!1,T.isImmutable=!0,T}export{o as ColorFormat,l as ColorFormats,_ as DepthFormat,C as DepthTextureFormats,a as format2String,G as isDepthFormat};