Perlin.lua 533 B

123456789101112131415161718192021222324252627282930313233
  1. class "Perlin"
  2. function Perlin:Perlin(...)
  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.Perlin(unpack(arg))
  12. Polycore.__ptr_lookup[self.__ptr] = self
  13. end
  14. end
  15. function Perlin:Get(x, y)
  16. local retVal = Polycore.Perlin_Get(self.__ptr, x, y)
  17. return retVal
  18. end
  19. function Perlin:__delete()
  20. Polycore.__ptr_lookup[self.__ptr] = nil
  21. Polycore.delete_Perlin(self.__ptr)
  22. end