What is setUsage on BufferAttribute?

My console is screaming at me that some method has been deprecated and renamed.

The documentation says:

.setUsage ( value : Usage ) : BufferAttribute

Set usage to value.

While it’s clear setUsage( value ) sets usage to value, it’s not clear what the value should be?

1 Like

it’s to do with static and dynamic draw. This was a replacement for .dynamic property.

Here’s an example:

newAttribute.setUsage(DynamicDrawUsage);
3 Likes

I assume the other one is StaticDrawUsage, are there others?

3 Likes

My confusion came from not understanding that there is .usage property when reading about setUsage doc.

@Mugen87

The issue is closed so i don’t know if you get pings. I’ve looked at the docs to try to address this, but there is no section dedicated to constants in general, because they’re mostly for textures i assume, which have their own page.

The only other thing that comes to mind off the top of my head is the renderer, but it also refers to texture constants (encoding).

I wonder if these could be refactored a bit. If encoding could be filed under “color conversion” or something like that, it would warrant having a generic constants page, or one for each family.

It’s not immediately obvious that these options from your snippet are available. The webgl ones that the link leads to are uppercase and snake.