2
0

Perlin.lua 814 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. class "Perlin"
  2. function Perlin:Perlin(...)
  3. local arg = {...}
  4. for k,v in pairs(arg) do
  5. if type(v) == "table" then
  6. if v.__ptr ~= nil then
  7. arg[k] = v.__ptr
  8. end
  9. end
  10. end
  11. if self.__ptr == nil and arg[1] ~= "__skip_ptr__" then
  12. self.__ptr = Polycode.Perlin(unpack(arg))
  13. end
  14. end
  15. function Perlin:Get2DTiledX(x, y, t)
  16. local retVal = Polycode.Perlin_Get2DTiledX(self.__ptr, x, y, t)
  17. return retVal
  18. end
  19. function Perlin:Get(x, y)
  20. local retVal = Polycode.Perlin_Get(self.__ptr, x, y)
  21. return retVal
  22. end
  23. function Perlin:Get2D(x, y)
  24. local retVal = Polycode.Perlin_Get2D(self.__ptr, x, y)
  25. return retVal
  26. end
  27. function Perlin:Get3D(x, y, z)
  28. local retVal = Polycode.Perlin_Get3D(self.__ptr, x, y, z)
  29. return retVal
  30. end
  31. function Perlin:__delete()
  32. if self then Polycode.delete_Perlin(self.__ptr) end
  33. end