Perlin.js 652 B

1234567891011121314151617181920212223242526272829
  1. function Perlin(octaves,freq,amp,seed) {
  2. if(arguments[0] != "__skip_ptr__") {
  3. this.__ptr = Polycode.Perlin(octaves,freq,amp,seed)
  4. }
  5. }
  6. Duktape.fin(Perlin.prototype, function (x) {
  7. if (x === Perlin.prototype) {
  8. return;
  9. }
  10. Polycode.Perlin__delete(x.__ptr)
  11. })
  12. Perlin.prototype.Get2DTiledX = function(x,y,t) {
  13. return Polycode.Perlin_Get2DTiledX(this.__ptr, x, y, t)
  14. }
  15. Perlin.prototype.Get = function(x,y) {
  16. return Polycode.Perlin_Get(this.__ptr, x, y)
  17. }
  18. Perlin.prototype.Get2D = function(x,y) {
  19. return Polycode.Perlin_Get2D(this.__ptr, x, y)
  20. }
  21. Perlin.prototype.Get3D = function(x,y,z) {
  22. return Polycode.Perlin_Get3D(this.__ptr, x, y, z)
  23. }