I’ve read about this, but it should be casted to float I believe and it’s performance penalty, as I read, but perftest will show the results! Many thanks for both suggestions!
EDIT: Did you notice we are talking about shader code?
Bad luck - switch and the second solution runs at the same speed (approx.) as the if’s.
EDIT: I think, we could see some different result using different approaches on mobile GPUs, what I’ve learned from reading articles about GPU optimizations.
The easiest (and fastest) way would be to have a single colorMode property in the material plugin and use a define to set the value in the shader, something like:
I didn’t use it because I could imagine a situation where the user wants to implement mouse over highlighting of the line just by changing the colorMode to SET from other modes and as you said previously recompilation of the shader is a heavy task. What’s your opinion?
Indeed, in this case, passing the colorMode as a uniform variable and testing all 3 values is the best solution. Branching when the condition involves only uniform variables is normally not very expensive.
Thanks man! I am already past the worst part, still coughing though but I couldn’t resist to smoke and I am just having one I am convincing myself that the 70% oxygen I receive will balance it out
Guys, @RaananW,
how can I ensure that my tree shakeable single functions from Misc/greasedLineTools.ts are put not directly under the BABYLON namespace, but under BABYLON.GreasedLineTools?
EDIT: I’ve tried namespacing the functions or export * as GreasedLineTools from “./greasedLine” in index.ts but I could get it working in Playground. Actually it was OK, just the intellisense didn’t work
EDIT: If i don’t use class methods I don’t get intellisens at all:
Guys,
I think I am ready for the first PR. However the intellisense issue is still a thing. Should I refactor to static class methods?
Thanks!
EDIT: I need to be hospitalized for a few days. I started to feel better, but today suddenly I started to feel much worse, I was at the doctors in the morning and just got a call from the doc that I’ve a bacterial infection of the respiratory system and that sucker seems to ATB resistent + I was COVID possitive… So… Fuck me dead… I’ll hopefully get back alive on Tuesday Just to be sure, current sources:
to ge tthe typing in UMD you will need to export your class and functions from a referenced index.ts. To allow tree-shaking in es6 you just need to be sure to not reference those functions from any other class.
But i’ll really need to see some code (if possible) to recommend the best way to go here.