Page 1 of 1

Material script use a custom texture?

Posted: Thu Oct 03, 2013 8:37 pm
by Samuel
When using a material script. I know that you can use EntityCustomParameter() to change the parameters that have been set with custom.
Like this one for example.

Code: Select all

param_named_auto Depth custom 1
But to me it looks like this isn't possible for a texture. At least not with that command.
Similar to how EntityCustomParameter() works. I'm hoping for a way to set the texture in Purebasic and then send that info to the material script.
Which will then update with the new information. Is this possible or can you only predefine the texture in the material script?

I can go into greater detail if needed. Thanks!

Re: Material script use a custom texture?

Posted: Fri Oct 04, 2013 7:29 am
by Bananenfreak
Hmm, I think it is the only Chance to define a few materialscripts and Change materialscripts.

Re: Material script use a custom texture?

Posted: Fri Oct 04, 2013 10:10 pm
by Samuel
Creating a few material scripts would solve the issue if it was just a couple textures, but in my case there will be hundreds of texture options.
I was hoping for a solution that would allow me to have one script, but allow me to change the textures simply by adjusting a custom parameter in PB.
So, far I haven't found anything in OGRE or Purebasic. So, I think I'm about to give up on this. At least for the time being.
If someone does find a solution or has a thought on this please let me know.

Re: Material script use a custom texture?

Posted: Fri Oct 04, 2013 10:40 pm
by Comtois
look at ReloadMaterial.pb example. It's not the faster solution, but may be this can help ? You can change a materialScript, save it, and reload it.

Re: Material script use a custom texture?

Posted: Sat Oct 05, 2013 12:09 am
by Samuel
Comtois wrote:look at ReloadMaterial.pb example. It's not the faster solution, but may be this can help ? You can change a materialScript, save it, and reload it.
Thank you Comtois,

I think that will work. I need to test it a little to make sure, but that example looks very promising.

Alexi wrote: Yes, we can change it, but not create new Scripts at runtime. :D
I can already create scripts at runtime. Just by using the standard file creation. The problem was creating a script after the archives were already parsed.
If I understood this correctly we can create a script using the file commands. Then with ReloadMaterial() we can reload the newly created script even after the scripts
were already parsed.