About Store Forum Documentation Contact



Post Reply 
Change material parameters through material pointers
Author Message
thiezar Offline
Member

Post: #1
Change material parameters through material pointers
I have this simple code:
Code:
MaterialPtr ground_mtrl = Materials.ptrRequire("./data/mtrl/Ground/0.mtrl");
Mesh ground_mesh;
ground_mesh.parts.New().base.create(Box(10, 1, 10), VTX_TEX0|VTX_NRM|VTX_TAN);
ground_mesh.setMaterial(ground_mtrl).setRender().setBox();

What if I want to change texture scale before assigning material to the mesh?
(This post was last modified: 12-21-2012 04:52 PM by thiezar.)
12-21-2012 04:52 PM
Find all posts by this user Quote this message in a reply
thiezar Offline
Member

Post: #2
RE: Change material parameters through material pointers
No answers, yet? :-(
Please, if someone could help me with this I will be able to solve other problems I have with Esenthel pointer classes.
Esenthel classes often pointer classes like MeshPtr.
This require that resources are located on the disk and this is good. But what if I want to pick resources from the disk and edit them using not MeshPtr methods, but Mesh methods? Maybe adding a part to the mesh like a box dinamically created.
I hope I've been clear on my problem :-p
12-25-2012 10:04 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #3
RE: Change material parameters through material pointers
Hi,

You can change tex scale in 2 ways:
mtrl->tex_scale*=2;
mtrl->validate();

or

mesh.texScale(2);
mesh.setRender(); // this line may not be needed in case texScale already processes GPU mesh
12-29-2012 12:54 PM
Find all posts by this user Quote this message in a reply
thiezar Offline
Member

Post: #4
RE: Change material parameters through material pointers
Thank you for your answer, Esenthel. It helped me a lot.
My error was considering tex_scale as a method and not an attribute so I wrote
mtrl->tex_scale(2);
I think I have a lot to learn :-p
12-30-2012 09:44 PM
Find all posts by this user Quote this message in a reply
Post Reply