com.warwlock.mtree 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (290) hide show
  1. package/.github/workflows/npm.yml +19 -0
  2. package/CHANGELOG.md +17 -0
  3. package/CHANGELOG.md.meta +7 -0
  4. package/Documentation~/Documentation.md +3 -0
  5. package/Editor/BranchEditor.cs +545 -0
  6. package/Editor/BranchEditor.cs.meta +16 -0
  7. package/Editor/EditorCallbacks.cs +69 -0
  8. package/Editor/EditorCallbacks.cs.meta +11 -0
  9. package/Editor/MTree.Editor.asmdef +18 -0
  10. package/Editor/MTree.Editor.asmdef.meta +7 -0
  11. package/Editor/MenuItem.cs +31 -0
  12. package/Editor/MenuItem.cs.meta +11 -0
  13. package/Editor/MtreeBezierInspector.cs +161 -0
  14. package/Editor/MtreeBezierInspector.cs.meta +11 -0
  15. package/Editor/MtreeEditor.cs +434 -0
  16. package/Editor/MtreeEditor.cs.meta +11 -0
  17. package/Editor/TemplateInspector.cs +66 -0
  18. package/Editor/TemplateInspector.cs.meta +12 -0
  19. package/Editor/ValuesEditor.cs +18 -0
  20. package/Editor/ValuesEditor.cs.meta +11 -0
  21. package/Editor/VertexColorAdjustmentEditor.cs +169 -0
  22. package/Editor/VertexColorAdjustmentEditor.cs.meta +11 -0
  23. package/Editor.meta +8 -0
  24. package/LICENSE +21 -0
  25. package/LICENSE.meta +7 -0
  26. package/README.md +68 -0
  27. package/README.md.meta +7 -0
  28. package/Resources/Mtree/MtreeBillboardCamera.prefab +204 -0
  29. package/Resources/Mtree/MtreeBillboardCamera.prefab.meta +8 -0
  30. package/Resources/Mtree/Sprites/DeleteCrossSprite.png +0 -0
  31. package/Resources/Mtree/Sprites/DeleteCrossSprite.png.meta +116 -0
  32. package/Resources/Mtree/Sprites/TreeFunctionSprite.png +0 -0
  33. package/Resources/Mtree/Sprites/TreeFunctionSprite.png.meta +116 -0
  34. package/Resources/Mtree/Sprites/TreeFunctionSpriteSelected.psd +0 -0
  35. package/Resources/Mtree/Sprites/TreeFunctionSpriteSelected.psd.meta +116 -0
  36. package/Resources/Mtree/Sprites.meta +8 -0
  37. package/Resources/Mtree/Vertex Color Editor/Mtree Vertex Color GameObject.prefab +104 -0
  38. package/Resources/Mtree/Vertex Color Editor/Mtree Vertex Color GameObject.prefab.meta +7 -0
  39. package/Resources/Mtree/Vertex Color Editor.meta +8 -0
  40. package/Resources/Mtree/branches.fbx +0 -0
  41. package/Resources/Mtree/branches.fbx.meta +137 -0
  42. package/Resources/Mtree.meta +8 -0
  43. package/Resources.meta +8 -0
  44. package/Runtime/AO/DensityAO.cs +203 -0
  45. package/Runtime/AO/DensityAO.cs.meta +11 -0
  46. package/Runtime/AO/KDTree.cs +169 -0
  47. package/Runtime/AO/KDTree.cs.meta +11 -0
  48. package/Runtime/AO/WeightedRandom.cs +74 -0
  49. package/Runtime/AO/WeightedRandom.cs.meta +11 -0
  50. package/Runtime/AO.meta +8 -0
  51. package/Runtime/Bezier/Bezier.cs +69 -0
  52. package/Runtime/Bezier/Bezier.cs.meta +11 -0
  53. package/Runtime/Bezier/MtreeBezier.cs +185 -0
  54. package/Runtime/Bezier/MtreeBezier.cs.meta +11 -0
  55. package/Runtime/Bezier.meta +8 -0
  56. package/Runtime/ExampleSceneManager.cs +165 -0
  57. package/Runtime/ExampleSceneManager.cs.meta +11 -0
  58. package/Runtime/LODValues.cs +44 -0
  59. package/Runtime/LODValues.cs.meta +11 -0
  60. package/Runtime/LeafPoint.cs +135 -0
  61. package/Runtime/LeafPoint.cs.meta +11 -0
  62. package/Runtime/MTree.Runtime.asmdef +3 -0
  63. package/Runtime/MTree.Runtime.asmdef.meta +7 -0
  64. package/Runtime/MTree.cs +569 -0
  65. package/Runtime/MTree.cs.meta +11 -0
  66. package/Runtime/MtreeComponent.cs +482 -0
  67. package/Runtime/MtreeComponent.cs.meta +11 -0
  68. package/Runtime/MtreeVariables.cs +11 -0
  69. package/Runtime/MtreeVariables.cs.meta +11 -0
  70. package/Runtime/MtreeWind.cs +94 -0
  71. package/Runtime/MtreeWind.cs.meta +11 -0
  72. package/Runtime/Node.cs +331 -0
  73. package/Runtime/Node.cs.meta +11 -0
  74. package/Runtime/SimplexNoise.cs +166 -0
  75. package/Runtime/SimplexNoise.cs.meta +11 -0
  76. package/Runtime/Splines.cs +379 -0
  77. package/Runtime/Splines.cs.meta +11 -0
  78. package/Runtime/TreeBilboard.cs +290 -0
  79. package/Runtime/TreeBilboard.cs.meta +11 -0
  80. package/Runtime/TreeFunctions/BranchFunction.cs +92 -0
  81. package/Runtime/TreeFunctions/BranchFunction.cs.meta +11 -0
  82. package/Runtime/TreeFunctions/GrowFunction.cs +81 -0
  83. package/Runtime/TreeFunctions/GrowFunction.cs.meta +11 -0
  84. package/Runtime/TreeFunctions/LeafFunction.cs +111 -0
  85. package/Runtime/TreeFunctions/LeafFunction.cs.meta +11 -0
  86. package/Runtime/TreeFunctions/RootsFunction.cs +77 -0
  87. package/Runtime/TreeFunctions/RootsFunction.cs.meta +11 -0
  88. package/Runtime/TreeFunctions/SplitFunction.cs +50 -0
  89. package/Runtime/TreeFunctions/SplitFunction.cs.meta +11 -0
  90. package/Runtime/TreeFunctions/TreeFunctionAsset.cs +105 -0
  91. package/Runtime/TreeFunctions/TreeFunctionAsset.cs.meta +11 -0
  92. package/Runtime/TreeFunctions/TrunkFunction.cs +88 -0
  93. package/Runtime/TreeFunctions/TrunkFunction.cs.meta +11 -0
  94. package/Runtime/TreeFunctions.meta +8 -0
  95. package/Runtime/TreePoint.cs +27 -0
  96. package/Runtime/TreePoint.cs.meta +11 -0
  97. package/Runtime/TreeTemplate.cs +50 -0
  98. package/Runtime/TreeTemplate.cs.meta +12 -0
  99. package/Runtime/Utils.cs +268 -0
  100. package/Runtime/Utils.cs.meta +11 -0
  101. package/Runtime/VSProIntegration.cs +132 -0
  102. package/Runtime/VSProIntegration.cs.meta +11 -0
  103. package/Runtime.meta +8 -0
  104. package/Samples~/ExampleTemplates/Examples/Birch.asset +364 -0
  105. package/Samples~/ExampleTemplates/Examples/Birch.asset.meta +8 -0
  106. package/Samples~/ExampleTemplates/Examples/Bush.asset +385 -0
  107. package/Samples~/ExampleTemplates/Examples/Bush.asset.meta +8 -0
  108. package/Samples~/ExampleTemplates/Examples/Eastern Pine.asset +482 -0
  109. package/Samples~/ExampleTemplates/Examples/Eastern Pine.asset.meta +8 -0
  110. package/Samples~/ExampleTemplates/Examples/FantasyTree.asset +406 -0
  111. package/Samples~/ExampleTemplates/Examples/FantasyTree.asset.meta +8 -0
  112. package/Samples~/ExampleTemplates/Examples/Fern.asset +291 -0
  113. package/Samples~/ExampleTemplates/Examples/Fern.asset.meta +8 -0
  114. package/Samples~/ExampleTemplates/Examples/High Poly.asset +300 -0
  115. package/Samples~/ExampleTemplates/Examples/High Poly.asset.meta +8 -0
  116. package/Samples~/ExampleTemplates/Examples/LightingData.asset +0 -0
  117. package/Samples~/ExampleTemplates/Examples/LightingData.asset.meta +8 -0
  118. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Birch Outline.mat +196 -0
  119. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Birch Outline.mat.meta +8 -0
  120. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Birch.mat +196 -0
  121. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Birch.mat.meta +8 -0
  122. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Fern.mat +181 -0
  123. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Fern.mat.meta +8 -0
  124. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark HighPoly.mat +201 -0
  125. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark HighPoly.mat.meta +8 -0
  126. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Oak.mat +208 -0
  127. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Oak.mat.meta +8 -0
  128. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Palm.mat +180 -0
  129. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Palm.mat.meta +8 -0
  130. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Pine.mat +206 -0
  131. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Pine.mat.meta +8 -0
  132. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Ponderossa.mat +206 -0
  133. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Ponderossa.mat.meta +8 -0
  134. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Poplar.mat +172 -0
  135. package/Samples~/ExampleTemplates/Examples/Materials/Bark/Bark Poplar.mat.meta +8 -0
  136. package/Samples~/ExampleTemplates/Examples/Materials/Bark.meta +8 -0
  137. package/Samples~/ExampleTemplates/Examples/Materials/Example Scene/Floor.mat +392 -0
  138. package/Samples~/ExampleTemplates/Examples/Materials/Example Scene/Floor.mat.meta +8 -0
  139. package/Samples~/ExampleTemplates/Examples/Materials/Example Scene.meta +8 -0
  140. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Fern.mat +202 -0
  141. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Fern.mat.meta +8 -0
  142. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs HighPoly.mat +265 -0
  143. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs HighPoly.mat.meta +8 -0
  144. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Needles.mat +267 -0
  145. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Needles.mat.meta +8 -0
  146. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Palm.mat +232 -0
  147. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Palm.mat.meta +8 -0
  148. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Palmate.mat +250 -0
  149. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Palmate.mat.meta +8 -0
  150. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Pine.mat +247 -0
  151. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Pine.mat.meta +8 -0
  152. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Poplar.mat +223 -0
  153. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Poplar.mat.meta +8 -0
  154. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Serrate Outline.mat +262 -0
  155. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Serrate Outline.mat.meta +8 -0
  156. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Serrate.mat +281 -0
  157. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Serrate.mat.meta +8 -0
  158. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Stone Pine.mat +267 -0
  159. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Stone Pine.mat.meta +8 -0
  160. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Willow.mat +236 -0
  161. package/Samples~/ExampleTemplates/Examples/Materials/Leafs/Leafs Willow.mat.meta +8 -0
  162. package/Samples~/ExampleTemplates/Examples/Materials/Leafs.meta +8 -0
  163. package/Samples~/ExampleTemplates/Examples/Materials.meta +8 -0
  164. package/Samples~/ExampleTemplates/Examples/Oak.asset +364 -0
  165. package/Samples~/ExampleTemplates/Examples/Oak.asset.meta +8 -0
  166. package/Samples~/ExampleTemplates/Examples/Old Oak.asset +364 -0
  167. package/Samples~/ExampleTemplates/Examples/Old Oak.asset.meta +8 -0
  168. package/Samples~/ExampleTemplates/Examples/Palm.asset +500 -0
  169. package/Samples~/ExampleTemplates/Examples/Palm.asset.meta +8 -0
  170. package/Samples~/ExampleTemplates/Examples/Pine 2.asset +387 -0
  171. package/Samples~/ExampleTemplates/Examples/Pine 2.asset.meta +8 -0
  172. package/Samples~/ExampleTemplates/Examples/Pine.asset +405 -0
  173. package/Samples~/ExampleTemplates/Examples/Pine.asset.meta +8 -0
  174. package/Samples~/ExampleTemplates/Examples/Ponderossa Pine.asset +478 -0
  175. package/Samples~/ExampleTemplates/Examples/Ponderossa Pine.asset.meta +8 -0
  176. package/Samples~/ExampleTemplates/Examples/Poplar.asset +309 -0
  177. package/Samples~/ExampleTemplates/Examples/Poplar.asset.meta +8 -0
  178. package/Samples~/ExampleTemplates/Examples/ReflectionProbe-0.exr +0 -0
  179. package/Samples~/ExampleTemplates/Examples/ReflectionProbe-0.exr.meta +117 -0
  180. package/Samples~/ExampleTemplates/Examples/Small Pine.asset +273 -0
  181. package/Samples~/ExampleTemplates/Examples/Small Pine.asset.meta +8 -0
  182. package/Samples~/ExampleTemplates/Examples/Small Tree.asset +364 -0
  183. package/Samples~/ExampleTemplates/Examples/Small Tree.asset.meta +8 -0
  184. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Birch_C.png +0 -0
  185. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Birch_C.png.meta +74 -0
  186. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Birch_N.png +0 -0
  187. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Birch_N.png.meta +96 -0
  188. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Damaged_C.png +0 -0
  189. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Damaged_C.png.meta +116 -0
  190. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Damaged_N.png +0 -0
  191. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Damaged_N.png.meta +116 -0
  192. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_1_C.png +0 -0
  193. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_1_C.png.meta +132 -0
  194. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_1_N.png +0 -0
  195. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_1_N.png.meta +116 -0
  196. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_2_C.png +0 -0
  197. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_2_C.png.meta +132 -0
  198. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_3_C.png +0 -0
  199. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_3_C.png.meta +132 -0
  200. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_3_N.png +0 -0
  201. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_3_N.png.meta +116 -0
  202. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_4_C.png +0 -0
  203. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_4_C.png.meta +132 -0
  204. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_4_N.png +0 -0
  205. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Decidious_4_N.png.meta +116 -0
  206. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Oak_C.png +0 -0
  207. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Oak_C.png.meta +74 -0
  208. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Oak_N.png +0 -0
  209. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Oak_N.png.meta +96 -0
  210. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Palm_C.png +0 -0
  211. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Palm_C.png.meta +74 -0
  212. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Palm_N.bmp +0 -0
  213. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Palm_N.bmp.meta +96 -0
  214. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Pine_C.png +0 -0
  215. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Pine_C.png.meta +74 -0
  216. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Pine_N.png +0 -0
  217. package/Samples~/ExampleTemplates/Examples/Textures/Bark/Bark_Pine_N.png.meta +96 -0
  218. package/Samples~/ExampleTemplates/Examples/Textures/Bark.meta +8 -0
  219. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch Serrate_C.png +0 -0
  220. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch Serrate_C.png.meta +96 -0
  221. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch Serrate_N.png +0 -0
  222. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch Serrate_N.png.meta +96 -0
  223. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Needles_C.png +0 -0
  224. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Needles_C.png.meta +99 -0
  225. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Needles_N.png +0 -0
  226. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Needles_N.png.meta +96 -0
  227. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Palmate_C.png +0 -0
  228. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Palmate_C.png.meta +99 -0
  229. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Palmate_N.png +0 -0
  230. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Palmate_N.png.meta +96 -0
  231. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_1_C.png +0 -0
  232. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_1_C.png.meta +88 -0
  233. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_1_N.png +0 -0
  234. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_1_N.png.meta +96 -0
  235. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_2_C.png +0 -0
  236. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_2_C.png.meta +96 -0
  237. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_2_N.png +0 -0
  238. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Pine_2_N.png.meta +96 -0
  239. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Poplar_C.png +0 -0
  240. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Poplar_C.png.meta +96 -0
  241. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Poplar_N.png +0 -0
  242. package/Samples~/ExampleTemplates/Examples/Textures/Branch/Branch_Poplar_N.png.meta +96 -0
  243. package/Samples~/ExampleTemplates/Examples/Textures/Branch.meta +8 -0
  244. package/Samples~/ExampleTemplates/Examples/Textures/Color Ramp/Ramp_PSD.psd +0 -0
  245. package/Samples~/ExampleTemplates/Examples/Textures/Color Ramp/Ramp_PSD.psd.meta +76 -0
  246. package/Samples~/ExampleTemplates/Examples/Textures/Color Ramp/Ramp_Toon.png +0 -0
  247. package/Samples~/ExampleTemplates/Examples/Textures/Color Ramp/Ramp_Toon.png.meta +76 -0
  248. package/Samples~/ExampleTemplates/Examples/Textures/Color Ramp.meta +8 -0
  249. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Fern_C.png +0 -0
  250. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Fern_C.png.meta +99 -0
  251. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Fern_N.png +0 -0
  252. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Fern_N.png.meta +88 -0
  253. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Palm_C.png +0 -0
  254. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Palm_C.png.meta +88 -0
  255. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Palm_N.png +0 -0
  256. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Palm_N.png.meta +88 -0
  257. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Willow_C.png +0 -0
  258. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Willow_C.png.meta +99 -0
  259. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Willow_N.png +0 -0
  260. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Leaf_Willow_N.png.meta +88 -0
  261. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Single_Serrated_C.png +0 -0
  262. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Single_Serrated_C.png.meta +96 -0
  263. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Single_Serrated_N.png +0 -0
  264. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs/Single_Serrated_N.png.meta +96 -0
  265. package/Samples~/ExampleTemplates/Examples/Textures/Single Leafs.meta +8 -0
  266. package/Samples~/ExampleTemplates/Examples/Textures.meta +8 -0
  267. package/Samples~/ExampleTemplates/Examples/Willow.asset +364 -0
  268. package/Samples~/ExampleTemplates/Examples/Willow.asset.meta +8 -0
  269. package/Samples~/ExampleTemplates/Examples.meta +8 -0
  270. package/Samples~/ExampleTemplates/Examples.unity +12660 -0
  271. package/Samples~/ExampleTemplates/Examples.unity.meta +7 -0
  272. package/Samples~/ExampleTemplates.meta +8 -0
  273. package/Shaders/BarkShader.shadergraph +17215 -0
  274. package/Shaders/BarkShader.shadergraph.meta +10 -0
  275. package/Shaders/Editor/BarkEditor.cs +100 -0
  276. package/Shaders/Editor/BarkEditor.cs.meta +11 -0
  277. package/Shaders/Editor/LeafEditor.cs +173 -0
  278. package/Shaders/Editor/LeafEditor.cs.meta +11 -0
  279. package/Shaders/Editor.meta +8 -0
  280. package/Shaders/LeafShader.shadergraph +34803 -0
  281. package/Shaders/LeafShader.shadergraph.meta +10 -0
  282. package/Shaders/MTree.Shaders.asmdef +3 -0
  283. package/Shaders/MTree.Shaders.asmdef.meta +7 -0
  284. package/Shaders/leafFunctions.hlsl +201 -0
  285. package/Shaders/leafFunctions.hlsl.meta +7 -0
  286. package/Shaders/vertexFunc.hlsl +55 -0
  287. package/Shaders/vertexFunc.hlsl.meta +7 -0
  288. package/Shaders.meta +8 -0
  289. package/package.json +36 -0
  290. package/package.json.meta +7 -0
@@ -0,0 +1,88 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ #if UNITY_EDITOR
5
+ using UnityEditor;
6
+ #endif
7
+
8
+ namespace Mtree
9
+ {
10
+ public class TrunkFunction : TreeFunctionAsset
11
+ {
12
+ public float radiusMultiplier = .3f;
13
+ public AnimationCurve radius;
14
+ public float length = 15;
15
+ public int number = 1;
16
+ public float randomness = .1f;
17
+ public float originAttraction = .1f;
18
+ public float resolution = 1.5f;
19
+ public AnimationCurve rootShape;
20
+ public float rootRadius = .25f;
21
+ public float rootInnerRadius = .2f;
22
+ public float rootHeight = 1f;
23
+ public float rootResolution = 3f;
24
+ public int flareNumber = 5;
25
+ public float spinAmount = .1f;
26
+ public float displacementStrength = 1f;
27
+ public float displacementSize = 2.5f;
28
+ public float heightOffset = .5f;
29
+
30
+ public override void Init(TreeFunctionAsset parent, bool preserveSettings = false)
31
+ {
32
+ base.Init(parent);
33
+ name = "Trunk";
34
+ if (!preserveSettings)
35
+ {
36
+ Keyframe[] keys = new Keyframe[2] { new Keyframe(0f, 1f, 0f, 0f), new Keyframe(1f, 0f, -1f, -1f) };
37
+ radius = new AnimationCurve(keys);
38
+ Keyframe[] rootKeys = new Keyframe[2] { new Keyframe(0f, 1f, -2f, -2f), new Keyframe(1f, 0f, 0f, 0f) };
39
+ rootShape = new AnimationCurve(rootKeys);
40
+ }
41
+
42
+ }
43
+
44
+ public override void DrawProperties()
45
+ {
46
+ #if UNITY_EDITOR
47
+
48
+ SerializedObject obj = new SerializedObject(this);
49
+
50
+ EditorGUILayout.PropertyField(obj.FindProperty("seed"), new GUIContent("Seed"));
51
+ Utils.BoundedFloatProperty(obj.FindProperty("length"), "Length", 0.01f);
52
+ Utils.BoundedFloatProperty(obj.FindProperty("radiusMultiplier"), "Radius", 0.01f);
53
+ Utils.BoundedFloatProperty(obj.FindProperty("resolution"), new GUIContent("Resolution", "Number of segments per unit of length"), 0.01f);
54
+ EditorGUILayout.Slider(obj.FindProperty("originAttraction"), 0, 1, new GUIContent("Axis attraction", "How much the tree is drawn to its original axis"));
55
+ EditorGUILayout.PropertyField(obj.FindProperty("radius"), new GUIContent("Shape"));
56
+ EditorGUILayout.Slider(obj.FindProperty("randomness"), 0, .5f, new GUIContent("Randomness", "How irregular the trunk looks"));
57
+ EditorGUILayout.PropertyField(obj.FindProperty("displacementStrength"), new GUIContent("Displacement strength", "Strength of the the noise affecting the geometry of the trunk"));
58
+ EditorGUILayout.PropertyField(obj.FindProperty("displacementSize"), new GUIContent("Displacement size", "Size of the noise affecting the geometry of the trunk"));
59
+ EditorGUILayout.PropertyField(obj.FindProperty("spinAmount"), new GUIContent("Spin amount", "How much the trunk is twisted"));
60
+ EditorGUILayout.PropertyField(obj.FindProperty("heightOffset"), new GUIContent("Height Offset", "How much the trunk goes inside the ground. Helps when a tree is placed on an uneven ground"));
61
+
62
+ EditorGUILayout.BeginVertical(EditorStyles.helpBox);
63
+ EditorGUILayout.LabelField("Flares");
64
+
65
+ EditorGUILayout.PropertyField(obj.FindProperty("rootShape"), new GUIContent("Shape"));
66
+ Utils.BoundedFloatProperty(obj.FindProperty("rootHeight"), "Start Height", 0.01f);
67
+ EditorGUILayout.Slider(obj.FindProperty("rootRadius"), 0, 2, new GUIContent("Outer Radius"));
68
+ EditorGUILayout.Slider(obj.FindProperty("rootInnerRadius"), 0, 1, new GUIContent("Inner Radius"));
69
+ Utils.BoundedFloatProperty(obj.FindProperty("rootResolution"), new GUIContent("Additional Resolution"), 1);
70
+ EditorGUILayout.IntSlider(obj.FindProperty("flareNumber"), 0, 10, new GUIContent("Number"));
71
+
72
+ EditorGUILayout.EndVertical();
73
+ obj.ApplyModifiedProperties();
74
+
75
+ #endif
76
+ }
77
+
78
+ public override void Execute(MTree tree)
79
+ {
80
+ base.Execute(tree);
81
+
82
+ Random.InitState(seed);
83
+
84
+ tree.AddTrunk(Vector3.down * heightOffset, Vector3.up, length, radius, radiusMultiplier, resolution, randomness
85
+ , id, rootShape, rootRadius, rootHeight, rootResolution, originAttraction);
86
+ }
87
+ }
88
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 156ba2a5f4fc7bf47b493b7cbf9c7f19
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: c4943d4fb904f614e8b0cf526a389706
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
@@ -0,0 +1,27 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+
5
+ namespace Mtree
6
+ {
7
+ public struct TreePoint
8
+ {
9
+ public Vector3 position, direction;
10
+ public float radius;
11
+ public NodeType type;
12
+ public Vector3 parentDirection;
13
+ public float parentRadius;
14
+ public float distanceFromOrigin;
15
+
16
+ public TreePoint(Vector3 pos, Vector3 dir, float rad, NodeType type, Vector3 parentDirection, float distanceFromOrigin, float parentRadius)
17
+ {
18
+ position = pos;
19
+ direction = dir;
20
+ radius = rad;
21
+ this.type = type;
22
+ this.parentDirection = parentDirection;
23
+ this.distanceFromOrigin = distanceFromOrigin;
24
+ this.parentRadius = parentRadius;
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: e4841eb714eb8a2408ec035f30ff5a29
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,50 @@
1
+ 
2
+ using System.Collections;
3
+ using System.Collections.Generic;
4
+ #if UNITY_EDITOR
5
+ using UnityEditor;
6
+ #endif
7
+ using UnityEngine;
8
+
9
+ namespace Mtree
10
+ {
11
+ public class TreeTemplate : ScriptableObject
12
+ {
13
+ #if UNITY_EDITOR
14
+ public List<TreeFunctionAsset> treeFunctions;
15
+
16
+ public static TreeTemplate CreateFromFunctions(List<TreeFunctionAsset> functionsToCopy, string path)
17
+ {
18
+ List<TreeFunctionAsset> treeFunctions = new List<TreeFunctionAsset>();
19
+
20
+ for (int i = 0; i < functionsToCopy.Count; i++)
21
+ {
22
+ TreeFunctionAsset function = Instantiate(functionsToCopy[i]);
23
+ treeFunctions.Add(function);
24
+ }
25
+
26
+ for (int i = 0; i < functionsToCopy.Count; i++)
27
+ {
28
+ int parentIndex = functionsToCopy.IndexOf(functionsToCopy[i].parent);
29
+ TreeFunctionAsset parent = parentIndex == -1 ? null : treeFunctions[parentIndex];
30
+ treeFunctions[i].Init(parent, true);
31
+ }
32
+
33
+ TreeTemplate template = ScriptableObject.CreateInstance<TreeTemplate>();
34
+ template.treeFunctions = treeFunctions;
35
+
36
+ AssetDatabase.CreateAsset(template, path);
37
+
38
+ template = AssetDatabase.LoadAssetAtPath<TreeTemplate>(path);
39
+
40
+ for (int i = 0; i < treeFunctions.Count; i++)
41
+ AssetDatabase.AddObjectToAsset(treeFunctions[i], template);
42
+
43
+ AssetDatabase.SaveAssets();
44
+ AssetDatabase.Refresh();
45
+
46
+ return template;
47
+ }
48
+ #endif
49
+ }
50
+ }
@@ -0,0 +1,12 @@
1
+ fileFormatVersion: 2
2
+ guid: 58c179839cc7e1e4bb7fdb33c0866483
3
+ timeCreated: 1572911718
4
+ licenseType: Store
5
+ MonoImporter:
6
+ serializedVersion: 2
7
+ defaultReferences: []
8
+ executionOrder: 0
9
+ icon: {instanceID: 0}
10
+ userData:
11
+ assetBundleName:
12
+ assetBundleVariant:
@@ -0,0 +1,268 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using UnityEngine.Rendering;
5
+
6
+
7
+
8
+ #if UNITY_EDITOR
9
+ using UnityEditor;
10
+ #endif
11
+
12
+ namespace Mtree
13
+ {
14
+ public class Utils
15
+ {
16
+ public static string GetCurrentPipeline()
17
+ {
18
+ var ActivePipeline = "legacy";
19
+ if (GraphicsSettings.defaultRenderPipeline != null)
20
+ {
21
+ if (GraphicsSettings.defaultRenderPipeline.GetType().ToString().Contains("LightweightRenderPipelineAsset"))
22
+ ActivePipeline = "lwrp";
23
+ if (GraphicsSettings.defaultRenderPipeline.GetType().ToString().Contains("UniversalRenderPipelineAsset"))
24
+ ActivePipeline = "urp";
25
+ if (GraphicsSettings.defaultRenderPipeline.GetType().ToString().Contains("HDRenderPipelineAsset"))
26
+ ActivePipeline = "hdrp";
27
+ }
28
+ else
29
+ {
30
+ ActivePipeline = "legacy";
31
+ }
32
+ return ActivePipeline;
33
+ }
34
+
35
+ public static Shader GetBarkShader()
36
+ {
37
+ Shader shader = null;
38
+
39
+ switch(GetCurrentPipeline())
40
+ {
41
+ case "legacy":
42
+ shader = Shader.Find("Mtree/Bark");
43
+ break;
44
+
45
+ case "lwrp":
46
+ shader = Shader.Find("Mtree/SRP/Bark LWRP");
47
+ break;
48
+
49
+ case "hdrp":
50
+ shader = Shader.Find("Mtree/SRP/Bark HDRP");
51
+ break;
52
+
53
+ case "urp":
54
+ shader = Shader.Find("Mtree/SRP/Bark URP");
55
+ break;
56
+ }
57
+ return shader;
58
+ }
59
+
60
+ public static Shader GetLeafShader()
61
+ {
62
+ Shader shader = null;
63
+
64
+ switch(GetCurrentPipeline()){
65
+ case "legacy":
66
+ shader = Shader.Find("Mtree/Leafs");
67
+ break;
68
+
69
+ case "lwrp":
70
+ shader = Shader.Find("Mtree/SRP/Leafs LWRP");
71
+ break;
72
+
73
+ case "hdrp":
74
+ shader = Shader.Find("Mtree/SRP/Leafs HDRP");
75
+ break;
76
+
77
+ case "urp":
78
+ shader = Shader.Find("Mtree/SRP/Leafs URP");
79
+ break;
80
+ }
81
+ return shader;
82
+ }
83
+
84
+ public static Shader GetBillboardShader()
85
+ {
86
+ Shader shader = null;
87
+
88
+ switch(GetCurrentPipeline()){
89
+ case "legacy":
90
+ shader = Shader.Find("Mtree/Billboard");
91
+ break;
92
+
93
+ case "lwrp":
94
+ shader = Shader.Find("Mtree/SRP/Billboard LWRP");
95
+ break;
96
+
97
+ case "hdrp":
98
+ shader = Shader.Find("Mtree/SRP/Billboard HDRP");
99
+ break;
100
+
101
+ case "urp":
102
+ shader = Shader.Find("Universal Render Pipeline/Lit");
103
+ break;
104
+ }
105
+ return shader;
106
+ }
107
+ public static Shader GetVertexColorShader()
108
+ {
109
+ Shader shader = null;
110
+
111
+ switch(GetCurrentPipeline()){
112
+ case "legacy":
113
+ shader = Shader.Find("Hidden/Mtree/VertexColorShader");
114
+ break;
115
+
116
+ case "lwrp":
117
+ shader = Shader.Find("Hidden/Mtree/SRP/VertexColorShader LWRP");
118
+ break;
119
+
120
+ case "hdrp":
121
+ shader = Shader.Find("Hidden/Mtree/SRP/VertexColorShader HDRP");
122
+ break;
123
+
124
+ case "urp":
125
+ shader = Shader.Find("Hidden/Mtree/SRP/VertexColorShader URP");
126
+ break;
127
+ }
128
+ return shader;
129
+ }
130
+
131
+ public static T[] SampleArray<T>(T[] array, int number)
132
+ {
133
+ number = Mathf.Max(0, Mathf.Min(array.Length, number));
134
+ T[] result = new T[number];
135
+ for (int i = 0; i < number; i++)
136
+ {
137
+ int index = Random.Range(i, array.Length - 1);
138
+ result[i] = array[index];
139
+ array[index] = array[i];
140
+ }
141
+
142
+ return result;
143
+ }
144
+
145
+ public static void DilateTexture(Texture2D texture, int iterations )//, bool removeBackground = false)
146
+ {
147
+ Color[] cols = texture.GetPixels();
148
+
149
+ // [Removed dueto HDRP]
150
+ // if (removeBackground)
151
+ // RemoveBackground(ref cols);
152
+
153
+ Color[] copyCols = new Color[cols.Length];
154
+ System.Array.Copy(cols, copyCols, cols.Length);
155
+ HashSet<int> borderIndices = new HashSet<int>();
156
+ HashSet<int> indexBuffer = new HashSet<int>();
157
+ int w = texture.width;
158
+ int h = texture.height;
159
+ for (int i = 0; i < cols.Length; i++)
160
+ {
161
+ if (cols[i].a < 0.5f)
162
+ {
163
+ for (int x = -1; x < 2; x++)
164
+ {
165
+ for (int y = -1; y < 2; y++)
166
+ {
167
+ int index = i + y * w + x;
168
+ if (index >= 0 && index < cols.Length && cols[index].a > 0.5f) // if a non transparent pixel is near the transparent one, add the transparent pixel index to border indices
169
+ {
170
+ borderIndices.Add(i);
171
+ goto End;
172
+ }
173
+ }
174
+ }
175
+ End:;
176
+ }
177
+ }
178
+
179
+ for (int iteration = 0; iteration < iterations; iteration++)
180
+ {
181
+ foreach (int i in borderIndices)
182
+ {
183
+ Color meanCol = Color.black;
184
+ int opaqueNeighbours = 0;
185
+ for (int x = -1; x < 2; x++)
186
+ {
187
+ for (int y = -1; y < 2; y++)
188
+ {
189
+ int index = i + y * w + x;
190
+ if (index >= 0 && index < cols.Length && index != i)
191
+ {
192
+ if (cols[index].a > 0.5f)
193
+ {
194
+ cols[index].a = 1;
195
+ meanCol += cols[index];
196
+ opaqueNeighbours++;
197
+ }
198
+ else
199
+ {
200
+ indexBuffer.Add(index);
201
+ }
202
+ }
203
+ }
204
+ }
205
+ cols[i] = meanCol / opaqueNeighbours;
206
+ }
207
+
208
+ indexBuffer.ExceptWith(borderIndices);
209
+
210
+ borderIndices = indexBuffer;
211
+ indexBuffer = new HashSet<int>();
212
+ }
213
+ for (int i = 0; i < cols.Length; i++)
214
+ cols[i].a = copyCols[i].a;
215
+ texture.SetPixels(cols);
216
+ }
217
+
218
+ // [Removed dueto HDRP]
219
+
220
+ // private static void RemoveBackground(ref Color[] colors)
221
+ // {
222
+ // Debug.Log("Removing");
223
+ // Color backgroundColor = new Color(0.173f, 0.294f, 0.471f);
224
+ // for (int i = 0; i < colors.Length; i++)
225
+ // {
226
+ // Color c = colors[i];
227
+ // if (Mathf.Abs(c.r - backgroundColor.r) + Mathf.Abs(c.g - backgroundColor.g) + Mathf.Abs(c.b - backgroundColor.b) < .05)
228
+ // colors[i] = new Color(0, 0, 0, 0);
229
+ // }
230
+ // }
231
+
232
+ public static void AddTriangle(Queue<int> triangles ,int i1, int i2, int i3)
233
+ {
234
+ triangles.Enqueue(i1); triangles.Enqueue(i2); triangles.Enqueue(i3);
235
+ }
236
+
237
+ #if UNITY_EDITOR
238
+
239
+ public static void BoundedFloatProperty(SerializedProperty prop, string label = "", float minValue = Mathf.NegativeInfinity, float maxValue = Mathf.Infinity)
240
+ {
241
+ GUIContent labelGui = label == "" ? null : new GUIContent(label);
242
+ BoundedFloatProperty(prop, labelGui, minValue, maxValue);
243
+ }
244
+
245
+ public static void BoundedFloatProperty(SerializedProperty prop, GUIContent label = null, float minValue = Mathf.NegativeInfinity, float maxValue = Mathf.Infinity)
246
+ {
247
+ Rect position = EditorGUILayout.GetControlRect(label != null);
248
+
249
+ EditorGUI.BeginProperty(position, label, prop);
250
+ EditorGUI.PropertyField(position, prop, label);
251
+ prop.floatValue = Mathf.Clamp(prop.floatValue, minValue, maxValue);
252
+ EditorGUI.EndProperty();
253
+
254
+ }
255
+
256
+ public static void BoundedIntProperty(SerializedProperty prop, GUIContent label = null, int minValue = int.MinValue, int maxValue = int.MaxValue)
257
+ {
258
+ Rect position = EditorGUILayout.GetControlRect(label != null);
259
+
260
+ EditorGUI.BeginProperty(position, label, prop);
261
+ EditorGUI.PropertyField(position, prop, label);
262
+ prop.intValue = Mathf.Clamp(prop.intValue, minValue, maxValue);
263
+ EditorGUI.EndProperty();
264
+ }
265
+ #endif
266
+ }
267
+
268
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: fb81739195aebd645ab25e26f8110db6
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,132 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+
4
+ #if VEGETATION_STUDIO_PRO
5
+ using AwesomeTechnologies.VegetationSystem;
6
+ using UnityEngine;
7
+
8
+ namespace AwesomeTechnologies.Shaders
9
+ {
10
+ public class MtreeShaderController : IShaderController
11
+ {
12
+ public bool MatchShader(string shaderName)
13
+ {
14
+ return (shaderName == "Mtree/Bark" || shaderName == "Mtree/Leafs");
15
+ }
16
+
17
+ public bool MatchBillboardShader(Material[] materials)
18
+ {
19
+ return false;
20
+ }
21
+
22
+ public ShaderControllerSettings Settings { get; set; }
23
+ bool CustomLightSource;
24
+
25
+ public void CreateDefaultSettings(Material[] materials)
26
+ {
27
+ Settings = new ShaderControllerSettings
28
+ {
29
+ Heading = "Mtree settings",
30
+ Description = "",
31
+ LODFadePercentage = true,
32
+ LODFadeCrossfade = true,
33
+ SampleWind = true,
34
+ };
35
+
36
+ Settings.AddLabelProperty("Foliage settings");
37
+ Settings.AddColorProperty("BarkTintColor", "Bark Color", "", GetColor(materials, "_Color","Bark"));
38
+ Settings.AddColorProperty("FoliageTintColor", "Leaf Color", "", GetColor(materials,"_Color","Leafs"));
39
+ Settings.AddFloatProperty("MtreeCutoff","Alpha Cutoff","",GetFloatValue(materials,"_Cutoff","Leafs"),0,1);
40
+
41
+
42
+ Settings.AddLabelProperty("Translucency Settings");
43
+ Settings.AddFloatProperty("TranslucentStrength","Srength", "", GetFloatValue(materials, "_Translucency", "Leafs"), 0, 50);
44
+ Settings.AddFloatProperty("TransNormalDistortion", "Normal Distortion", "", GetFloatValue(materials, "_TransNormalDistortion", "Leafs"), 0, 1);
45
+ Settings.AddFloatProperty("TransScattering", "Scattering Falloff", "", GetFloatValue(materials, "_TransScattering", "Leafs"), 1, 50);
46
+ Settings.AddColorProperty("TranslucentColor","Translucent Color","Only Works if Translucent Light Mode set to Custom!",GetColor(materials, "_TranslucencyTint", "Leafs"));
47
+
48
+ Settings.AddLabelProperty("Other Settings");
49
+ Settings.AddFloatProperty("AmbientOcclusion", "AO Strength", "", GetGlobalFloatValue(materials, "_OcclusionStrength"), 0, 1);
50
+ Settings.AddFloatProperty("MtreeGlobalWindInfluence", "Global Wind Influence","",GetGlobalFloatValue(materials,"_GlobalWindInfluence"),0,1);
51
+ Settings.AddFloatProperty("MtreeGlobalWindTurbulence", "Global Wind Turbulence Influence","",GetFloatValue(materials,"_GlobalTurbulenceInfluence","Leafs"),0,1);
52
+
53
+ }
54
+
55
+ public void UpdateMaterial(Material material, EnvironmentSettings environmentSettings)
56
+ {
57
+ if (Settings == null) return;
58
+ float GlobalWindInfluence = Settings.GetFloatPropertyValue("MtreeGlobalWindInfluence");
59
+ material.SetFloat("_GlobalWindInfluence", GlobalWindInfluence);
60
+ float aoStrength = Settings.GetFloatPropertyValue("AmbientOcclusion");
61
+ material.SetFloat("_OcclusionStrength", aoStrength);
62
+
63
+ if (material.shader.name == "Mtree/Bark")
64
+ {
65
+ Color barkTintColor = Settings.GetColorPropertyValue("BarkTintColor");
66
+ material.SetColor("_Color", barkTintColor);
67
+ }
68
+ if (material.shader.name == "Mtree/Leafs")
69
+ {
70
+ Color foliageTintColor = Settings.GetColorPropertyValue("FoliageTintColor");
71
+ material.SetColor("_Color", foliageTintColor);
72
+
73
+ float foliageCutoff = Settings.GetFloatPropertyValue("MtreeCutoff");
74
+ material.SetFloat("_Cutoff", foliageCutoff);
75
+
76
+ float translucentStrength = Settings.GetFloatPropertyValue("TranslucentStrength");
77
+ material.SetFloat("_Translucency", translucentStrength);
78
+
79
+ float TransNormalDistortion = Settings.GetFloatPropertyValue("TransnormalDistortion");
80
+ material.SetFloat("_TransNormalDistortion", TransNormalDistortion);
81
+
82
+ float TransScattering = Settings.GetFloatPropertyValue("TransScattering");
83
+ material.SetFloat("_TransScattering", TransScattering);
84
+
85
+ Color translucentColor = Settings.GetColorPropertyValue("TranslucentColor");
86
+ material.SetColor("_TranslucencyTint",translucentColor);
87
+
88
+ float GlobalWindTurbulence = Settings.GetFloatPropertyValue("MtreeGlobalWindTurbulence");
89
+ material.SetFloat("_GlobalTurbulenceInfluence",GlobalWindTurbulence);
90
+ }
91
+
92
+
93
+
94
+
95
+
96
+
97
+ }
98
+
99
+ Color GetColor(Material[] materials, string property,string shadertype)
100
+ {
101
+ foreach (Material mat in materials)
102
+ {
103
+ if (mat.shader.name == "Mtree/"+shadertype)
104
+ return mat.GetColor(property);
105
+ }
106
+ return Color.black;
107
+ }
108
+ float GetFloatValue(Material[] materials,string property, string shadertype)
109
+ {
110
+ foreach(Material mat in materials)
111
+ if (mat.shader.name == "Mtree/" + shadertype)
112
+ return mat.GetFloat(property);
113
+ return 0.1f;
114
+ }
115
+ float GetGlobalFloatValue(Material[] materials, string property)
116
+ {
117
+ foreach (Material mat in materials)
118
+ if (mat.shader.name == "Mtree/Bark" || mat.shader.name == "Mtree/Leafs")
119
+ return mat.GetFloat(property);
120
+ return 0.1f;
121
+ }
122
+
123
+
124
+
125
+
126
+
127
+ public void UpdateWind(Material material, WindSettings windSettings)
128
+ {
129
+ }
130
+ }
131
+ }
132
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 97bec76d39579e74a81aea716489775f
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
package/Runtime.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: 9d53a12ff04e6024ea6dad5f192295dd
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant: