Home Reference Source
import {Utils} from 'bimsurfer3/viewer/utils.js'
public class | source

Utils

Generic utils

Static Method Summary

Static Public Methods
public static

calculateBytesUsed(settings: *, nrVertices: *, nrColors: *, nrIndices: *, nrLineIndices: *, nrNormals: *): *

public static

createBuffer(gl: *, data: *, numElements: *, bufferType: *, components: *, srcStart: *, attribType: *, js_type: *): *

Create a new GPU buffer, keep in mind that some extra attributes are being set on the returned GLBuffer object

public static

createEmptyBuffer(gl: *, numElements: *, bufferType: *, components: *, attribType: *, js_type: *): *

Create a new GPU empty buffer, keep in mind that some extra attributes are being set on the returned GLBuffer object.

public static

createIndexBuffer(gl: *, data: *, n: *): *

public static

createLineIndexBuffer(gl: *, data: *, n: *): *

public static

emptyAabb(): *

public static

getLargestEdge(width: *, height: *, depth: *): *

public static

getLargestFaceArea(width: *, height: *, depth: *): *

public static

glTypeToTypedArray(glType: *): *

public static

growAabb(aabb: *, pnt: *)

public static

hash(input: *): *

public static

isEmptyAabb(aabb: *): *

public static
public static

request(options: *): *

public static

sortMapKeys(inputMap: *): *

public static

toArray(input: *): *

Converts the given mat/vec to an array

public static

transformBounds(inputBounds: *, translation: *): *

public static

typedArrayToGlType(typedArrayType: *): *

public static

unionAabb(a: *, b: *): *

public static

updateBuffer(gl: *, targetGlBuffer: *, data: *, pos: *, numElements: *)

Update a GPU buffer

Static Public Methods

public static calculateBytesUsed(settings: *, nrVertices: *, nrColors: *, nrIndices: *, nrLineIndices: *, nrNormals: *): * source

Params:

NameTypeAttributeDescription
settings *
nrVertices *
nrColors *
nrIndices *
nrLineIndices *
nrNormals *

Return:

*

public static createBuffer(gl: *, data: *, numElements: *, bufferType: *, components: *, srcStart: *, attribType: *, js_type: *): * source

Create a new GPU buffer, keep in mind that some extra attributes are being set on the returned GLBuffer object

Params:

NameTypeAttributeDescription
gl *
data *
numElements *
bufferType *
components *
srcStart *
attribType *
js_type *

Return:

*

public static createEmptyBuffer(gl: *, numElements: *, bufferType: *, components: *, attribType: *, js_type: *): * source

Create a new GPU empty buffer, keep in mind that some extra attributes are being set on the returned GLBuffer object. This method is usually used in order to create buffers that will be later be filled by calls to bufferSubData (via Utils.updateBuffer)

Params:

NameTypeAttributeDescription
gl *
numElements *
bufferType *
components *
attribType *
js_type *

Return:

*

public static createIndexBuffer(gl: *, data: *, n: *): * source

Params:

NameTypeAttributeDescription
gl *
data *
n *

Return:

*

public static createLineIndexBuffer(gl: *, data: *, n: *): * source

Params:

NameTypeAttributeDescription
gl *
data *
n *

Return:

*

public static emptyAabb(): * source

Return:

*

public static getLargestEdge(width: *, height: *, depth: *): * source

Params:

NameTypeAttributeDescription
width *
height *
depth *

Return:

*

public static getLargestFaceArea(width: *, height: *, depth: *): * source

Params:

NameTypeAttributeDescription
width *
height *
depth *

Return:

*

public static glTypeToTypedArray(glType: *): * source

Params:

NameTypeAttributeDescription
glType *

Return:

*

public static growAabb(aabb: *, pnt: *) source

Params:

NameTypeAttributeDescription
aabb *
pnt *

public static hash(input: *): * source

Params:

NameTypeAttributeDescription
input *

Return:

*

public static isEmptyAabb(aabb: *): * source

Params:

NameTypeAttributeDescription
aabb *

Return:

*

public static octDecodeVec2(oct: *): undefined[] source

Params:

NameTypeAttributeDescription
oct *

Return:

undefined[]

public static request(options: *): * source

Params:

NameTypeAttributeDescription
options *

Return:

*

public static sortMapKeys(inputMap: *): * source

Params:

NameTypeAttributeDescription
inputMap *

Return:

*

public static toArray(input: *): * source

Converts the given mat/vec to an array

Params:

NameTypeAttributeDescription
input *

Return:

*

public static transformBounds(inputBounds: *, translation: *): * source

Params:

NameTypeAttributeDescription
inputBounds *
translation *

Return:

*

public static typedArrayToGlType(typedArrayType: *): * source

Params:

NameTypeAttributeDescription
typedArrayType *

Return:

*

public static unionAabb(a: *, b: *): * source

Params:

NameTypeAttributeDescription
a *
b *

Return:

*

public static updateBuffer(gl: *, targetGlBuffer: *, data: *, pos: *, numElements: *) source

Update a GPU buffer

Params:

NameTypeAttributeDescription
gl *
targetGlBuffer *
data *
pos *
numElements *