OpenSimplexNoise.xml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <class name="OpenSimplexNoise" inherits="Resource" category="Core" version="3.1">
  3. <brief_description>
  4. Noise generator based on Open Simplex.
  5. </brief_description>
  6. <description>
  7. This resource allows you to configure and sample a fractal noise space. Here is a brief usage example that configures an OpenSimplexNoise and gets samples at various positions and dimensions:
  8. [codeblock]
  9. var noise = OpenSimplexNoise.new()
  10. # Configure
  11. noise.seed = randi()
  12. noise.octaves = 4
  13. noise.period = 20.0
  14. noise.persistence = 0.8
  15. # Sample
  16. print("Values:")
  17. print(noise.get_noise_2d(1.0, 1.0))
  18. print(noise.get_noise_3d(0.5, 3.0, 15.0))
  19. print(noise.get_noise_4d(0.5, 1.9, 4.7, 0.0))
  20. [/codeblock]
  21. </description>
  22. <tutorials>
  23. </tutorials>
  24. <demos>
  25. </demos>
  26. <methods>
  27. <method name="get_image">
  28. <return type="Image">
  29. </return>
  30. <argument index="0" name="width" type="int">
  31. </argument>
  32. <argument index="1" name="height" type="int">
  33. </argument>
  34. <description>
  35. Generate a noise image with the requested [code]width[/code] and [code]height[/code], based on the current noise parameters.
  36. </description>
  37. </method>
  38. <method name="get_noise_2d">
  39. <return type="float">
  40. </return>
  41. <argument index="0" name="x" type="float">
  42. </argument>
  43. <argument index="1" name="y" type="float">
  44. </argument>
  45. <description>
  46. Returns the 2D noise value [code][-1,1][/code] at the given position.
  47. </description>
  48. </method>
  49. <method name="get_noise_2dv">
  50. <return type="float">
  51. </return>
  52. <argument index="0" name="pos" type="Vector2">
  53. </argument>
  54. <description>
  55. Returns the 2D noise value [code][-1,1][/code] at the given position.
  56. </description>
  57. </method>
  58. <method name="get_noise_3d">
  59. <return type="float">
  60. </return>
  61. <argument index="0" name="x" type="float">
  62. </argument>
  63. <argument index="1" name="y" type="float">
  64. </argument>
  65. <argument index="2" name="z" type="float">
  66. </argument>
  67. <description>
  68. Returns the 3D noise value [code][-1,1][/code] at the given position.
  69. </description>
  70. </method>
  71. <method name="get_noise_3dv">
  72. <return type="float">
  73. </return>
  74. <argument index="0" name="pos" type="Vector3">
  75. </argument>
  76. <description>
  77. Returns the 3D noise value [code][-1,1][/code] at the given position.
  78. </description>
  79. </method>
  80. <method name="get_noise_4d">
  81. <return type="float">
  82. </return>
  83. <argument index="0" name="x" type="float">
  84. </argument>
  85. <argument index="1" name="y" type="float">
  86. </argument>
  87. <argument index="2" name="z" type="float">
  88. </argument>
  89. <argument index="3" name="w" type="float">
  90. </argument>
  91. <description>
  92. Returns the 4D noise value [code][-1,1][/code] at the given position.
  93. </description>
  94. </method>
  95. <method name="get_seamless_image">
  96. <return type="Image">
  97. </return>
  98. <argument index="0" name="size" type="int">
  99. </argument>
  100. <description>
  101. Generate a tileable noise image, based on the current noise parameters. Generated seamless images are always square ([code]size[/code] x [code]size[/code]).
  102. </description>
  103. </method>
  104. </methods>
  105. <members>
  106. <member name="lacunarity" type="float" setter="set_lacunarity" getter="get_lacunarity">
  107. Difference in period between [member octaves].
  108. </member>
  109. <member name="octaves" type="int" setter="set_octaves" getter="get_octaves">
  110. Number of OpenSimplex noise layers that are sampled to get the fractal noise.
  111. </member>
  112. <member name="period" type="float" setter="set_period" getter="get_period">
  113. Period of the base octave. A lower period results in a higher-frequency noise (more value changes across the same distance).
  114. </member>
  115. <member name="persistence" type="float" setter="set_persistence" getter="get_persistence">
  116. Contribution factor of the different octaves. A [code]persistence[/code] value of 1 means all the octaves have the same contribution, a value of 0.5 means each octave contributes half as much as the previous one.
  117. </member>
  118. <member name="seed" type="int" setter="set_seed" getter="get_seed">
  119. Seed used to generate random values, different seeds will generate different noise maps.
  120. </member>
  121. </members>
  122. <constants>
  123. </constants>
  124. </class>