-
-
Notifications
You must be signed in to change notification settings - Fork 35.5k
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
Dirty refactoring? #697
Comments
I like the |
i kind of like geometry.needUpdateVertices();
geometry.needUpdateElements();
geometry.needUpdateMorphTargets();
geometry.needUpdateUvs();
geometry.needUpdateNormals();
geometry.needUpdateColors();
geometry.needUpdateTangents(); |
Uhm... I like this other one instead: geometry.verticesNeedUpdate = true;
geometry.elementsNeedUpdate = true;
geometry.morphTargetsNeedUpdate = true;
geometry.uvsNeedUpdate = true;
geometry.normalsNeedUpdate = true;
geometry.colorsNeedUpdate = true;
geometry.tangentsNeedUpdate = true; I think it's better for the API having the properties sorted by object type than by actions. We already have some properties following this pattern: object.matrixAutoUpdate
object.matrixWorldNeedUpdate
object.rotationAutoUpdate
... For instance, I just realised shadows don't follow the pattern: object.castShadow
object.receiveShadow isn't it cleaner (and easier to scan when debugging) to have it like this instead? object.shadowCast
object.shadowReceive |
There is also computeTangents, computeFaceNormals, etc. Is the style actionProperty for methods and groupSetting for values? (I think *NeedUpdate is fine). @zz85 I don't think function calls should be used here for a few reasons. First, the stickler in me says they waste a few bytes of memory and a few processor cycles only to set one value. Second, chaining them would look funny imo. object.verticesNeedUpdate().normalsNeedUpdate(); vs object.verticesNeedUpdate = object.normalsNeedUpdate = true. Last, the __dirty* values are specific to the WebGLRenderer and making them methods would most likely mean adding them to the Geometry object itself, regardless of renderer used. |
So it seems! Kind of works for me :) |
@chandlerprall true, true (no pun intended :), these are valid points i didn't think of. |
waking this issue up, I began doing such modifications in #1623, just for the __dirtyVertices property. I can do the same for other properties, too. What do you think? |
hmm... looking at this again, I think I would still prefer the Let's say if I have dynamic geometry, I would think that my mind would have a chain of thought that place Its like how many would prefix their variables like If we look at the affected code in would be nicer with
vs
|
If you focus on sibling action properties it makes sense the way you're saying. geometry.vertices = [];
geometry.verticesNeedUpdate = false;
mesh.matrix = [];
mesh.matrixNeedsUpdate = false; vs geometry.vertices = [];
geometry.needsUpdateVertices = false;
mesh.matrix = [];
mesh.needsUpdateMatrix = false; |
6 months later, the change has been done :P |
https://github.com/mrdoob/three.js/wiki/Updates needs update :D |
Haha :) |
I think
__dirtyXXX
properties definitely proved to be useful and it's time to finally graduate them from hackily exposing WebGLRenderer's internals into something looking more like API.We could make them lose underscores:
Or they could be more in line with textures and custom attributes:
A bit different variant:
What do you think?
The text was updated successfully, but these errors were encountered: