Three.js: Question: Why use this value in constants.js

Created on 22 May 2020  Â·  5Comments  Â·  Source: mrdoob/three.js

I am sorry to bother you, why is it designed this way, may be this question is very simple, just for unique id like UUID?

export var StaticDrawUsage = 35044; // equal 0b‭100010001110_0100‬
export var DynamicDrawUsage = 35048;// equal‭ 0b100010001110_1000‬
export var StreamDrawUsage = 35040; // equal 0b‭100010001110_0000‬
export var StaticReadUsage = 35045; // equal 0b‭100010001110_0101‬
export var DynamicReadUsage = 35049;// equal 0b100010001110_1001
export var StreamReadUsage = 35041; // equal 0b‭100010001110_0001‬
export var StaticCopyUsage = 35046; // equal 0b‭100010001110_0110‬
export var DynamicCopyUsage = 35050;// equal 0b‭100010001110_1010‬
export var StreamCopyUsage = 35042; // equal 0b‭100010001110_0010‬
Question

Most helpful comment

All 5 comments

These are the actual WebGL constants that are passed to the API command bufferData():

https://github.com/mrdoob/three.js/blob/e5cd04511cbdbf588b33dad2795ba2b4e5accada/src/renderers/webgl/WebGLAttributes.js#L19

See: https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Buffers

How about this.

// src/constant.d.ts

/**
 *  @see {@link https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/Constants#Buffers|WebGL API Constant}
 */
// usage types
export enum Usage {}
export const StaticDrawUsage: Usage;

I'm not sure what you referring to. Can you please explain in more detail why you share TS code?

I'm not sure what you referring to. Can you please explain in more detail why you share TS code?

see: https://github.com/mrdoob/three.js/pull/19431

Was this page helpful?
0 / 5 - 0 ratings