Icare Posted July 14, 2010 Share Posted July 14, 2010 Hi, Is it possible to retreive or set the properties of an material on runtime without read or write on the .mat file ? I would like to retreive or set : * Depthmask * colormask * alphatest * etc ... Similarly we can load or create a material, but if we want to save it we must write The function to do it? thank Nicolaas Quote Link to comment Share on other sites More sharing options...
Joh Posted August 4, 2010 Share Posted August 4, 2010 I don't think it is. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Pixel Perfect Posted August 4, 2010 Share Posted August 4, 2010 Hi, Is it possible to retreive or set the properties of an material on runtime without read or write on the .mat file ? I would like to retreive or set : * Depthmask * colormask * alphatest * etc ... I think you can still use GetMaterialKey and SetMaterialKey for this but I know in the past that SetMaterialKey didn't work for all standard properties in the material file. For instance 'castshadows' couldn't be set programatically. Both Masterxilo and myself requested the full set be implemented on separtate occations but I'm not sure this ever got implemented ... I just gave up asking in the end! Quote Intel Core i5 2.66 GHz, Asus P7P55D, 8Gb DDR3 RAM, GTX460 1Gb DDR5, Windows 7 (x64), LE Editor, GMax, 3DWS, UU3D Pro, Texture Maker Pro, Shader Map Pro. Development language: C/C++ Link to comment Share on other sites More sharing options...
Paul Thomas Posted August 5, 2010 Share Posted August 5, 2010 Been a while since I've done much with LE, but I remember this part: Local myMaterial:tmaterial = LoadMaterial(FILE) SetShaderVec3(myMaterial.reference.shader, "ShaderVariableName", vec3(0,0,0)) ' SetShaderVec4 ' SetShaderFloat Not sure if that's what you meant exactly, but there you go. Quote Link to comment Share on other sites More sharing options...
Joh Posted August 5, 2010 Share Posted August 5, 2010 I think he mean add the "other" parameter (cullface, blend, etc..), in this case i don't think it's possible. Quote Intel Corei7-6700, NVIDIA GeForce GTX 980, 32GB DDR4, W-10. Link to comment Share on other sites More sharing options...
Masterxilo Posted August 5, 2010 Share Posted August 5, 2010 As Pixel Perfect said you can modify some material keys at runtime using GetMaterialKey and SetMaterialKey. This doesn't work for all keys however. So you'd be better off writing a class that creates a temp material file, loads and deletes it to create materials at runtime. That's what I did anyway. Similarly we can load or create a material, but if we want to save it we must write The function to do it? Yes. Quote Hurricane-Eye Entertainment - Site, blog. Link to comment Share on other sites More sharing options...
Paul Thomas Posted August 5, 2010 Share Posted August 5, 2010 Oh yeah, I remember that was a feature request for a long time, since the last forum. Too bad that hasn't been added yet. Quote Link to comment Share on other sites More sharing options...
Icare Posted August 6, 2010 Author Share Posted August 6, 2010 I found my happiness ... There is reference member in blitzmax object that gives access to everything... global material=creatematerial() WriteLine file, "color=" + 1.0 / 255.0 * r + "," + 1.0 / 255.0 * g + "," + 1.0 / 255.0 * b + "," + a WriteLine File, "blend=" + material.reference.blendmode WriteLine file, "depthmask=" + material.reference.depthmask WriteLine File, "depthtest=" + material.reference.depthtest WriteLine File, "alphatest=" + material.reference.alphatest WriteLine File, "overlay=" + material.reference.overlay WriteLine file, "zsort=" + material.reference.zsort WriteLine file, "cullface=" + material.reference.cullface WriteLine file, "castshadows=" + material.reference.castshadows WriteLine file, "specular=" + material.reference.specular WriteLine file, "bumpscale=" + material.reference.bumpscale 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.