GLSLShaderModule.lua 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. class "GLSLShaderModule"
  2. function GLSLShaderModule:GLSLShaderModule(...)
  3. for k,v in pairs(arg) do
  4. if type(v) == "table" then
  5. if v.__ptr ~= nil then
  6. arg[k] = v.__ptr
  7. end
  8. end
  9. end
  10. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  11. self.__ptr = Polycore.GLSLShaderModule(unpack(arg))
  12. Polycore.__ptr_lookup[self.__ptr] = self
  13. end
  14. end
  15. function GLSLShaderModule:acceptsExtension(extension)
  16. local retVal = Polycore.GLSLShaderModule_acceptsExtension(self.__ptr, extension)
  17. return retVal
  18. end
  19. function GLSLShaderModule:createProgramFromFile(extension, fullPath)
  20. local retVal = Polycore.GLSLShaderModule_createProgramFromFile(self.__ptr, extension, fullPath)
  21. if Polycore.__ptr_lookup[retVal] ~= nil then
  22. return Polycore.__ptr_lookup[retVal]
  23. else
  24. Polycore.__ptr_lookup[retVal] = Resource("__skip_ptr__")
  25. Polycore.__ptr_lookup[retVal].__ptr = retVal
  26. return Polycore.__ptr_lookup[retVal]
  27. end
  28. end
  29. function GLSLShaderModule:reloadPrograms()
  30. local retVal = Polycore.GLSLShaderModule_reloadPrograms(self.__ptr)
  31. end
  32. function GLSLShaderModule:getShaderType()
  33. local retVal = Polycore.GLSLShaderModule_getShaderType(self.__ptr)
  34. return retVal
  35. end
  36. function GLSLShaderModule:createShader(node)
  37. local retVal = Polycore.GLSLShaderModule_createShader(self.__ptr, node.__ptr)
  38. if Polycore.__ptr_lookup[retVal] ~= nil then
  39. return Polycore.__ptr_lookup[retVal]
  40. else
  41. Polycore.__ptr_lookup[retVal] = Shader("__skip_ptr__")
  42. Polycore.__ptr_lookup[retVal].__ptr = retVal
  43. return Polycore.__ptr_lookup[retVal]
  44. end
  45. end
  46. function GLSLShaderModule:applyShaderMaterial(r_enderer, material, localOptions, shaderIndex)
  47. local retVal = Polycore.GLSLShaderModule_applyShaderMaterial(self.__ptr, r_enderer.__ptr, material.__ptr, localOptions.__ptr, shaderIndex)
  48. return retVal
  49. end
  50. function GLSLShaderModule:clearShader()
  51. local retVal = Polycore.GLSLShaderModule_clearShader(self.__ptr)
  52. end
  53. function GLSLShaderModule:__delete()
  54. Polycore.__ptr_lookup[self.__ptr] = nil
  55. Polycore.delete_GLSLShaderModule(self.__ptr)
  56. end