Tuesday, 1 February 2011
Developer Journal 48
I just saw some footage of another version of Polyworld. It looks really good. Kind of bums me out. I've been working on my simulation for so long!
The video is foodotrope-hill-flying-pill-session.mpg by toomalf. I recommend you visit toomalf's channel for more great videos.
I just spent a few hours trying to figure out how to scale textures with code.
I managed to get a pointer to my material by going from class Entity to class SubEntity to class MaterialPtr to class Material.
I through the way to change scale was to use Material::setParameter().
The problem was Material::getParameter().size() was 0.
After a lot of searching on the forums I found.
How i can change scale textures programmatically?
Thanks to makiolo and madmarx I now know how to do it.
You start at class Material then class Technique then class Pass then class TextureUnitPass.
Then you can use TextureUnitPass::setTextureScale( float uScale, float vScale )
I tried setting a texture to be 1 unit. Took me a while to figure out, textures automatically scale to the size of your object. If you want a texture to be 1 unit by 1 unit on a ground that is 100 units by 100 units, you need to scale your texture by dividing its u scale and v scale by 100.
Grr. I rotated a cube by 45 degrees and it looked like the cube rotated and then rotated back. Nope. The cube was rotating.
I then rotated they cube by 90 degrees and 180 degrees the cube looked like it didn't move. Nope. It did move.
Grr. Must make the front of the cube look different.
Labels: developer journal