Advertisement
NanoBob

mapping shader setup

Feb 21st, 2016
129
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.62 KB | None | 0 0
  1. local shaders={
  2. ["images/barsign.png"]={"des_probesign",},
  3. ["images/wall.png"]={"stoneclad1",},
  4. }
  5. function setupShaders()
  6.     for fileName,textures in pairs(shaders) do
  7.         local shader = dxCreateShader ("shader.fx",1,100)
  8.         local texture = dxCreateTexture (fileName)
  9.         dxSetShaderValue (shader,"CUSTOMTEX0", texture )
  10.         shaders[fileName].shader==shader
  11.     end
  12. end
  13. setupShaders()
  14.  
  15. -- code for object creation loop (assuming object is identified as "object"
  16. for _,data in pairs(shaders) do
  17.     local shader=data.shader
  18.     for _,texure in pairs(data.textures) do
  19.         engineApplyShaderToWorldTexture(shader,texture,object)
  20.     end
  21. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement