Open AntonSynytsia opened 4 years ago
This is somewhat of a limitation of the graphic pipeline. Even internally we bulk up polygons of same material and draw them with separate calls.
Though, I guess it could be allowed as a utility abstraction...
Or maybe we provide a utility example that will perform the same thing. Might be more flexible to adapt for specific usage.
It would be convenient to have a way to apply multiple textures to the triplets/polygons with a single call to
view.draw
. The{ :textures => Array}
option would suffice the request.The
textures
array option is better than a single:texture
option, which would limit to applying a single texture to the entire geometry of the mesh. With a single:texture
option, in order to apply multiple textures, a user would have to break down the mesh into clusters and callview.draw
for each cluster. So, a single:texture
option would make it inconvenient and unnecessarily performance affecting.A way to do this is to allow the user to pass an array of textures, through the
:textures
option, with each texture index mapping to the corresponding triplet/polygon passed. For example, if the user intends to call GL_TRIANGLES, they would pass the following:In the above snippet,
t1
maps to thept1, pt2, pt3
triplet;t2
maps to thept4, pt5, pt6
triplet.Now, if the user does not desire a texture for a triplet, they can simply pass
-1
,0
, ornil
for the triplet index - up to the implementer.The
:textures
option should be considered whenopenglenum
argument forview.draw
indicates triplets/polygons.This feature would enhance the usability of
view.draw
.