Making different sized textured walls
Blitz3D Forums/Blitz3D Programming/Making different sized textured walls
| ||
I'm nearing completion of my online tanks game, and at the moment, the walls within the game are not textured. When a level loads, I do a CopyEntity of a master wall, then scale it to the size it's supposed to be. However, if I texture the master wall, any scaling does not alter the uv co-ords, so the texture will appear too stretched. How easy life would be if there was a parameter for ScaleEntity when, if set to true, would also scale the uv co-ords so that any texture applied would also get scaled up. Of course, I can't just alter the texture, since this would affect every wall, no matter its size. The only way around this I can think of is to create a mesh for each wall, and programmatically set its uv co-ords depending on its size. A bit more of a hassle than copying primitives, but it should work. Is this the only way? Or am I missing a simple solution to this? |
| ||
[edit] oops Use copymesh and manually amend the uv's of the new wall. For example ... Say you want the wall to be 3 x the xscale and therefore the texture to be repeated 3 times MESHuv( WALLmesh , 3, 1 ) Should work providing you don't use the clamp U & V flags when loading the texture. Stevie Function MESHuv( mesh , scaleu#, scalev# ) s = getsurface( mesh , 1 ) for v = 0 to countvertices(s)-1 vertextexcoords s, v, vertexu( s, v ) * ScaleU , vertexv( s, v ) * ScaleV next end function Stevie |