jared-hughes / DesThree

Desmos bindings for three.js
3 stars 0 forks source link

Allow styling geometries with different materials #61

Open jared-hughes opened 3 years ago

jared-hughes commented 3 years ago

This would be a variation on the Mesh function that supports styling a single geometry with a list of materials instead of broadcasting over the material argument.

It appears that https://threejs.org/docs/#api/en/core/BufferGeometry.addGroup exposes this natively.

Since all other geometries (box, sphere, etc.) are subclasses of BufferGeometry, this could apply to all geometries in DesThree.

Sample use case: styling a corner of a Rubik's cube with four different colors and using a BoxGeometry for it.

jared-hughes commented 3 years ago

This should happen after a material selector in edit list mode. A list of colors spread along the horizontal axis like |||| would correspond to the existing broadcasting (same as how Desmos does lists of colors). A list of colors spread along the vertical axis like ≡ would correspond to broadcasting a material over faces as proposed here.