Code archives/3D Graphics - Misc/Independant texture scale per entity
This code has been declared by its author to be Public Domain code.
Download source code
| |||||
Useful for editors and situations where you need to optimise your game. The idea is to scale the uv coordinates instead of the texture. This allows you to refine the appearance and use the same texture over and over again. You could use a similar approach for rotated textures and so on. | |||||
Function ScaleUV#(entity,scalex#=1,scaley#=1) If entity=0 Then Return 0 For i=1 To CountSurfaces(entity) s=GetSurface(entity,i) For j=0 To CountVertices(s)-1 u#=VertexU(s,j,0) v#=VertexV(s,j,0) VertexTexCoords s,j,u*scalex,v*scaley,0,1 Next Next End Function |
Comments
None.
Code Archives Forum