Setting Textures

Mar 29, 2009 at 1:20 PM
Hi Bryan,

I'm currently trying to find the best way to set textures for models in the ox framework.
I have the main component and use seperate components for drawing, etc
However, there doesn't seem to be a proper way to set the texture if it's not included in the model file (e.g. when using different texture maps for the same model).

I'm currently doing it like this in the main component constructor;

Texture2D texture = Engine.Load<Texture2D>(strTextureAsset, DomainName);
        foreach (Effect effect in m_ModelComponent.Effects.Values)
                ((ShadowReceiverEffect)effect).DiffuseTexture = texture;

Is that the best way or is there another better method?

Incidently, I sent some changes I made to my copy of the framework to your yahoo account, did you get them or did the email get lost in spam filters?

Mar 29, 2009 at 2:29 PM
Hi hi!

I never got the code you sent. Maybe you can send it from another e-mail account? :)

That seems to be the only way to do what you're wanting. I think I can come up with a much better way, though. Give me a day to investigate :)
Apr 6, 2009 at 5:58 PM
Hi Bryan,

Thanks for getting back to me so quickly, sorry for not replying sooner.

Ok, I'll try resending that email and give you the nod when I do.

Ok thanks, at least I know there wasn't a blindingly obvious method that I was completely missing ;-)

Apr 7, 2009 at 1:49 PM
Hi again!

I've thought about it a lot and I can't justify making this possible via a method or property. The reason is that texture swapping is not something that the current components are intended to do. What you want seems to fall in the realm of a custom scene component.

Thank you for your suggestion! I will keep thinking about it too :)