Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataTexture support. #245

Open
NikitaDudin opened this issue Jul 23, 2024 · 0 comments
Open

DataTexture support. #245

NikitaDudin opened this issue Jul 23, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@NikitaDudin
Copy link

NikitaDudin commented Jul 23, 2024

It would be a good to have a possibility to create a textureSource directly from raw data, width and height.

const textureWidth = 1024;
const textureHeight = 1024;
const textureData = new Uint8Array(textureWidth * textureHeight * 4);
for (let i = 0; i < textureWidth * textureHeight * 4; i += 4) {
  textureData[i] = 255; // r
  textureData[i+1] = 0; // g
  textureData[i+2] = 0; // b
  textureData[i+3] = 255; // a
}
...
const textureSource = createBufferFromRawData(textureData, textureWidth, textureHeight, ...otherOptions);
...
<Model ...>
<EntitySelector byName="Tip" textureMap={{ materialName, textureSource }} />
</Model>
@hannojg hannojg added the enhancement New feature or request label Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants