import { VertexBuffer } from "../VertexBuffer" ; namespace Private { export let quad ; export let centeredQuad ; export let uiQuad ; export let skyBox ; quad = new VertexBuffer ( { attributes : { position : [ 0 , 0 , 0 , 1 , 0 , 0 , 1 , 1 , 0 , 0 , 0 , 0 , 1 , 1 , 0 , 0 , 1 , 0 , ] , uv : [ 0 , 0 , 1 , 0 , 1 , 1 , 0 , 0 , 1 , 1 , 0 , 1 , ] , normal : [ 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 1 , 0 , 0 , 1 ] } , primitiveType : "TRIANGLES" } ) ; centeredQuad = new VertexBuffer ( { attributes : { position : [ - 1 , - 1 , 0.0 , 1 , - 1 , 0.0 , 1 , 1 , 0.0 , - 1 , - 1 , 0.0 , 1 , 1 , 0.0 , - 1 , 1 , 0.0 , ] , uv : quad . attributes . uv as number [ ] , normal : quad . attributes . normal as number [ ] } , primitiveType : "TRIANGLES" } ) ; uiQuad = new VertexBuffer ( { attributes : { position : [ 0 , 0 , 0.0 , 0 , 1 , 0.0 , 1 , 0 , 0.0 , 0 , 1 , 0.0 , 1 , 1 , 0.0 , 1 , 0 , 0.0 ] , uv : [ 0 , 1 , 0 , 0 , 1 , 1 , 0 , 0 , 1 , 0 , 1 , 1 ] } , primitiveType : "TRIANGLES" } ) ; } export class GeometryProvider { static get quad ( ) { return Private . quad ; } static get centeredQuad ( ) { return Private . centeredQuad ; } static get uiQuad ( ) { return Private . uiQuad ; } static get skyBox ( ) { if ( ! Private . skyBox ) { const size = 1 ; const skyBox = new VertexBuffer ( { attributes : { position : [ - size , size , - size , - size , - size , - size , size , - size , - size , size , - size , - size , size , size , - size , - size , size , - size , - size , - size , size , - size , - size , - size , - size , size , - size , - size , size , - size , - size , size , size , - size , - size , size , size , - size , - size , size , - size , size , size , size , size , size , size , size , size , size , - size , size , - size , - size , - size , - size , size , - size , size , size , size , size , size , size , size , size , size , - size , size , - size , - size , size , - size , size , - size , size , size , - size , size , size , size , size , size , size , - size , size , size , - size , size , - size , - size , - size , - size , - size , - size , size , size , - size , - size , size , - size , - size , - size , - size , size , size , - size , size ] } , primitiveType : "TRIANGLES" } ) ; Private . skyBox = skyBox ; } return Private . skyBox ; } static unload ( ) { Private . centeredQuad . unload ( ) ; Private . quad . unload ( ) ; Private . uiQuad . unload ( ) ; if ( Private . skyBox ) { Private . skyBox . unload ( ) ; } } }