Dinkelborg Posted January 26, 2015 Share Posted January 26, 2015 OpenGL ES declares the following types as valid within the GLSL language:voidboolintfloatvec2,vec3,vec4bvec2,bvec3,bvec4ivec2,ivec3,ivec4mat2,mat3,mat4sampler2DsamplerCubewhy does the BABYLON.ShaderMaterial class only have set-functions for TextureFloat, FloatsColor3,Color4Vector2,Vector3andMatrixI need a boolean uniform in my shader, is there any way I can still set a value for it or could you please add the missing set-functions? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 26, 2015 Share Posted January 26, 2015 you can use int for bool as well Quote Link to comment Share on other sites More sharing options...
Dinkelborg Posted January 27, 2015 Author Share Posted January 27, 2015 There is also no setInt function Quote Link to comment Share on other sites More sharing options...
RaananW Posted January 27, 2015 Share Posted January 27, 2015 Both the engine and the Effect class have setBool function, you could use them, no? btw - Javascript has no "integer" class. only number. So everything is a float :-) I guess you could cast the float in your shader after setting it. But I am no shader expert, can't really say how well this will work. Quote Link to comment Share on other sites More sharing options...
Dinkelborg Posted January 28, 2015 Author Share Posted January 28, 2015 It's not like I cannot use a float, in fact I did just create a float and made its value 1.0 or 0.0 so that I can check in the shader for it, but that just isn't what floats are made for really... and I think a boolean is cheaper than a float, so if one day anyone wants to create a huge shader that needs - I don't know - 300 booleans it might make a difference if there is 300 float variables instead ... I don't exactly understand how the engine's or effect-class' setBool function would help me set a boolean value in my shaderMaterial... ?All I'm saying is, that GLSL knows more variable types as there are set-functions in the shaderMaterial-class, if the shaderMaterial class wants to make it easier for the user to set a value for a shader-uniform by automatically finding the uniform-index and handing the value to the shader, then it should do so for all available variable (or uniform) types. Otherwise there is a shortcut for like 5 variable types and if one wants to use one of the other 7 or so that don't have this shortcut, he has to go the long way anyways, so why even bother getting to know the shortcut? Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted January 28, 2015 Share Posted January 28, 2015 You can use the effect directly (even if using float is the same actually): mat.getEffect().setBool Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.