Closed stigmergic closed 3 years ago
OK, here's a fairly easy (I think!) approach. Each draw checks the requested shape,size,color (the viewFcn(turtle)) with the existing one. If any differ, simply delete the existing mesh and create an entirely new one. Would that solve the issue?
Yes I expect it would. I think it is important that turtles be able to change color. I also understand that it could have an impact on performance. But I tend toward first being able to do it, and later if necessary worrying about speeding it up.
OK, I've made it possible to modify the shape, color, size of an existing mesh. BUT it requires colors to be typed colors.
Basically the problem is that the ctor does a lot of preprocessing of the drawOptions, so simply changing the drawOptions can bypass that preprocessing.
The best solution would be to add a method for changing the entire drawOptions object but I think this may do for now.
seeing it run a little slowly. Here are my drawOptions
turtlesShape: (t) => (isCamera(t) ? 'Dart' : 'Sphere'),
turtlesColor: (t) =>
t.el < 0
? 'black'
: isPlanet(t)
? planetColor(t.data.name)
: isStar(t)
? 'yellow'
: 'red',
turtlesSize: (t) =>
isPlanet(t) ? (t.data.name == 'Sun' ? 3 : 1.5) : isStar(t) ? 0.3 : 4,
}```
@stigmergic I think this is fixed now. I'll close it for now and hope it's fixed :)
Just checked: In ThreeMeshes.js:
I suspect that's what you're using, a shape that is real 3D.
Let me check on just how easy that would be to add color changes for the mesh-per-turtle