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

Add support for uniforms array #140

Open
dmnsgn opened this issue Jun 10, 2024 · 0 comments
Open

Add support for uniforms array #140

dmnsgn opened this issue Jun 10, 2024 · 0 comments
Labels
type/feat A new feature

Comments

@dmnsgn
Copy link
Member

dmnsgn commented Jun 10, 2024

// Instead of
for (let i = 0; i < directionalLights.length; i++) {
  sharedUniforms[`uDirectionalLights[${i}].intensity`] = directionalLights[i].intensity;
  sharedUniforms[`uDirectionalLights[${i}].color`] = lightColorToSrgb(directionalLights[i]);
}


const uniforms = {
  uDirectionalLights: directionalLights.map((light) => {
    intensity: light.intensity,
    color: lightColorToSrgb(light),
  })
}

ctx.submit({ uniforms })

Will require checking uniforms value Array.isArray of objects.

@dmnsgn dmnsgn added the type/feat A new feature label Jun 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feat A new feature
Projects
None yet
Development

No branches or pull requests

1 participant