@doegis/core
Version:
DOE GIS API
3 lines (1 loc) • 1.52 kB
JavaScript
import{Default3D as e}from"./DefaultVertexAttributeLocations.js";import{Pos2 as t,Pos2Tex as r}from"./DefaultVertexBufferLayouts.js";import{VertexArrayObject as o}from"./VertexArrayObject.js";import{BufferObject as n}from"../../../webgl/BufferObject.js";import{Usage as a,TextureType as i,PixelFormat as m,PixelType as T,TextureSamplingMode as l}from"../../../webgl/enums.js";import{Texture as u}from"../../../webgl/Texture.js";function f(i,m=t,T=e,l=-1,u=1){let f=null;if(m===r)f=new Float32Array([l,l,0,0,u,l,1,0,l,u,0,1,u,u,1,1]);else f=new Float32Array([l,l,u,l,l,u,u,u]);return new o(i,T,{geometry:m},{geometry:n.createVertex(i,a.STATIC_DRAW,f)})}function E(r,i=t,m=e){const T=new Float32Array([-1,-1,3,-1,-1,3]);return new o(r,m,{geometry:i},{geometry:n.createVertex(r,a.STATIC_DRAW,T)})}const g=4;function s(e,t=g){return new u(e,{target:i.TEXTURE_2D,pixelFormat:m.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:l.NEAREST,width:t,height:t})}function A(e,t,r=g){const o=new Uint8Array(r*r*4);for(let n=0;n<o.length;n+=4)o[n+0]=255*t[0],o[n+1]=255*t[1],o[n+2]=255*t[2],o[n+3]=255*t[3];return new u(e,{target:i.TEXTURE_2D,pixelFormat:m.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:l.NEAREST,width:r,height:r},o)}function p(e){return new u(e,{target:i.TEXTURE_2D,pixelFormat:m.RGBA,dataType:T.UNSIGNED_BYTE,samplingMode:l.NEAREST,width:1,height:1},new Uint8Array([255,255,255,255]))}export{A as createColorTexture,p as createEmptyDepthTexture,s as createEmptyTexture,f as createQuadVAO,E as createScreenSizeTriangleVAO};