Jump to content

Question about the function "_mustRebind"


heyzxz
 Share

Recommended Posts

Hi there,

I have some questions about this function: _mustRebind( ... ), (which was executed inside the 'bindForSubMesh(...)' for both StandardMaterial and PBRMaterial, and was defined in the 'PushMaterial' class  )

1. I don't understand  the purpose of using this function because it always returns true. Please prove me if I'm wrong: it finally execute a comparison like: 'scene._cachedVisibility !== mesh.visibility' , which is always true, because the scene._cachedVisibility has never been used and would always be null...  right? is this a mistake? 

2. The '_mustRebind' directly returns the 'scene.isCachedMaterialValid', look into the latter function, I guess it actually did a kind of 'Invalid' check, isn't it ? If so, is it better naming it as "isCachedMaterialInvalid"?

Screen Shot 2017-08-17 at 5.30.14 PM.png

599562bf16a6f_ScreenShot2017-08-17at5_31_16PM.thumb.png.7e9c938cc93626158b82b724236d2e00.png

Thank you!

 

Link to comment
Share on other sites

Hi @Deltakosh,

I've seen your changes on git,  thank you :)

But there is still one thing not very clear to me: see the StandardMaterial class (and also happens in PBRMaterial):  the  '_mustRebind' had been called twice in the 'bindForSubMesh'. The 1st call is now make sense to me,  but the 2nd call is still always true I think, because it only passed the first 2 parameters, leaving the 3rd parameter 'visibility' as the default 0, which may mostly not equal to the scene._cachedVisibility (it is 1) . 

59964a60e4795_ScreenShot2017-08-18at9_44_18AM.thumb.png.1a62527cd5332355e84812d0a5109c58.png

59964a8f0e1d5_ScreenShot2017-08-18at10_01_21AM.thumb.png.57dec8e404c5270288866a0de8b5534e.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...