ONSPPropagationMaterial.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616
  1. /************************************************************************************
  2. Filename : ONSPPropagationMaterial.cs
  3. Content : Propagation material class
  4. Attach to geometry to define material properties
  5. Copyright : Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
  6. Licensed under the Oculus SDK Version 3.5 (the "License");
  7. you may not use the Oculus SDK except in compliance with the License,
  8. which is provided at the time of installation or download, or which
  9. otherwise accompanies this software in either electronic or hard copy form.
  10. You may obtain a copy of the License at
  11. https://developer.oculus.com/licenses/sdk-3.5/
  12. Unless required by applicable law or agreed to in writing, the Oculus SDK
  13. distributed under the License is distributed on an "AS IS" BASIS,
  14. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. See the License for the specific language governing permissions and
  16. limitations under the License.
  17. ************************************************************************************/
  18. using System;
  19. using System.Linq;
  20. using System.Collections.Generic;
  21. using UnityEngine;
  22. using Oculus.Spatializer.Propagation;
  23. public sealed class ONSPPropagationMaterial : MonoBehaviour
  24. {
  25. public enum Preset
  26. {
  27. Custom,
  28. AcousticTile,
  29. Brick,
  30. BrickPainted,
  31. Carpet,
  32. CarpetHeavy,
  33. CarpetHeavyPadded,
  34. CeramicTile,
  35. Concrete,
  36. ConcreteRough,
  37. ConcreteBlock,
  38. ConcreteBlockPainted,
  39. Curtain,
  40. Foliage,
  41. Glass,
  42. GlassHeavy,
  43. Grass,
  44. Gravel,
  45. GypsumBoard,
  46. PlasterOnBrick,
  47. PlasterOnConcreteBlock,
  48. Soil,
  49. SoundProof,
  50. Snow,
  51. Steel,
  52. Water,
  53. WoodThin,
  54. WoodThick,
  55. WoodFloor,
  56. WoodOnConcrete
  57. }
  58. [Serializable]
  59. public sealed class Point
  60. {
  61. public float frequency;
  62. public float data;
  63. public Point( float frequency = 0, float data = 0 )
  64. {
  65. this.frequency = frequency;
  66. this.data = data;
  67. }
  68. public static implicit operator Point(Vector2 v)
  69. {
  70. return new Point(v.x, v.y);
  71. }
  72. public static implicit operator Vector2(Point point)
  73. {
  74. return new Vector2(point.frequency, point.data);
  75. }
  76. }
  77. [Serializable]
  78. public sealed class Spectrum
  79. {
  80. public int selection = int.MaxValue;
  81. public List<Point> points = new List<Point>();
  82. public float this[float f]
  83. {
  84. get
  85. {
  86. if (points.Count > 0)
  87. {
  88. Point lower = new Point(float.MinValue);
  89. Point upper = new Point(float.MaxValue);
  90. foreach (Point point in points)
  91. {
  92. if (point.frequency < f)
  93. {
  94. if (point.frequency > lower.frequency)
  95. lower = point;
  96. }
  97. else
  98. {
  99. if (point.frequency < upper.frequency)
  100. upper = point;
  101. }
  102. }
  103. if (lower.frequency == float.MinValue)
  104. lower.data = points.OrderBy(p => p.frequency).First().data;
  105. if (upper.frequency == float.MaxValue)
  106. upper.data = points.OrderBy(p => p.frequency).Last().data;
  107. return lower.data + (f - lower.frequency) *
  108. (upper.data - lower.data) / (upper.frequency - lower.frequency);
  109. }
  110. return 0f;
  111. }
  112. }
  113. }
  114. //***********************************************************************
  115. // Private Fields
  116. public IntPtr materialHandle = IntPtr.Zero;
  117. //***********************************************************************
  118. // Public Fields
  119. [Tooltip("Absorption")]
  120. public Spectrum absorption = new Spectrum();
  121. [Tooltip("Transmission")]
  122. public Spectrum transmission = new Spectrum();
  123. [Tooltip("Scattering")]
  124. public Spectrum scattering = new Spectrum();
  125. [SerializeField]
  126. private Preset preset_ = Preset.Custom;
  127. public Preset preset
  128. {
  129. get { return preset_; }
  130. set
  131. {
  132. this.SetPreset( value );
  133. preset_ = value;
  134. }
  135. }
  136. //***********************************************************************
  137. // Start / Destroy
  138. /// Initialize the audio material. This is called after Awake() and before the first Update().
  139. void Start()
  140. {
  141. StartInternal();
  142. }
  143. public void StartInternal()
  144. {
  145. // Ensure that the material is not initialized twice.
  146. if ( materialHandle != IntPtr.Zero )
  147. return;
  148. // Create the internal material.
  149. if (ONSPPropagation.Interface.CreateAudioMaterial( out materialHandle ) != ONSPPropagationGeometry.OSPSuccess)
  150. throw new Exception("Unable to create internal audio material");
  151. // Run the updates to initialize the material.
  152. UploadMaterial();
  153. }
  154. /// Destroy the audio scene. This is called when the scene is deleted.
  155. void OnDestroy()
  156. {
  157. DestroyInternal();
  158. }
  159. public void DestroyInternal()
  160. {
  161. if ( materialHandle != IntPtr.Zero )
  162. {
  163. // Destroy the material.
  164. ONSPPropagation.Interface.DestroyAudioMaterial(materialHandle);
  165. materialHandle = IntPtr.Zero;
  166. }
  167. }
  168. //***********************************************************************
  169. // Upload
  170. public void UploadMaterial()
  171. {
  172. if ( materialHandle == IntPtr.Zero )
  173. return;
  174. // Absorption
  175. ONSPPropagation.Interface.AudioMaterialReset(materialHandle, MaterialProperty.ABSORPTION);
  176. foreach ( Point p in absorption.points )
  177. ONSPPropagation.Interface.AudioMaterialSetFrequency(materialHandle, MaterialProperty.ABSORPTION,
  178. p.frequency, p.data );
  179. // Transmission
  180. ONSPPropagation.Interface.AudioMaterialReset(materialHandle, MaterialProperty.TRANSMISSION);
  181. foreach (Point p in transmission.points)
  182. ONSPPropagation.Interface.AudioMaterialSetFrequency(materialHandle, MaterialProperty.TRANSMISSION,
  183. p.frequency, p.data);
  184. // Scattering
  185. ONSPPropagation.Interface.AudioMaterialReset(materialHandle, MaterialProperty.SCATTERING);
  186. foreach (Point p in scattering.points)
  187. ONSPPropagation.Interface.AudioMaterialSetFrequency(materialHandle, MaterialProperty.SCATTERING,
  188. p.frequency, p.data);
  189. }
  190. //***********************************************************************
  191. public void SetPreset(Preset preset )
  192. {
  193. ONSPPropagationMaterial material = this;
  194. switch ( preset )
  195. {
  196. case Preset.AcousticTile: AcousticTile(ref material); break;
  197. case Preset.Brick: Brick(ref material); break;
  198. case Preset.BrickPainted: BrickPainted(ref material); break;
  199. case Preset.Carpet: Carpet(ref material); break;
  200. case Preset.CarpetHeavy: CarpetHeavy(ref material); break;
  201. case Preset.CarpetHeavyPadded: CarpetHeavyPadded(ref material); break;
  202. case Preset.CeramicTile: CeramicTile(ref material); break;
  203. case Preset.Concrete: Concrete(ref material); break;
  204. case Preset.ConcreteRough: ConcreteRough(ref material); break;
  205. case Preset.ConcreteBlock: ConcreteBlock(ref material); break;
  206. case Preset.ConcreteBlockPainted: ConcreteBlockPainted(ref material); break;
  207. case Preset.Curtain: Curtain(ref material); break;
  208. case Preset.Foliage: Foliage(ref material); break;
  209. case Preset.Glass: Glass(ref material); break;
  210. case Preset.GlassHeavy: GlassHeavy(ref material); break;
  211. case Preset.Grass: Grass(ref material); break;
  212. case Preset.Gravel: Gravel(ref material); break;
  213. case Preset.GypsumBoard: GypsumBoard(ref material); break;
  214. case Preset.PlasterOnBrick: PlasterOnBrick(ref material); break;
  215. case Preset.PlasterOnConcreteBlock: PlasterOnConcreteBlock(ref material); break;
  216. case Preset.Soil: Soil(ref material); break;
  217. case Preset.SoundProof: SoundProof(ref material); break;
  218. case Preset.Snow: Snow(ref material); break;
  219. case Preset.Steel: Steel(ref material); break;
  220. case Preset.Water: Water(ref material); break;
  221. case Preset.WoodThin: WoodThin(ref material); break;
  222. case Preset.WoodThick: WoodThick(ref material); break;
  223. case Preset.WoodFloor: WoodFloor(ref material); break;
  224. case Preset.WoodOnConcrete: WoodOnConcrete(ref material); break;
  225. case Preset.Custom:
  226. break;
  227. default:
  228. break;
  229. }
  230. }
  231. //***********************************************************************
  232. private static void AcousticTile(ref ONSPPropagationMaterial material)
  233. {
  234. material.absorption.points = new List<Point>{
  235. new Point(125f, .50f), new Point(250f, .70f), new Point(500f, .60f), new Point(1000f, .70f), new Point(2000f, .70f), new Point(4000f, .50f) };
  236. material.scattering.points = new List<Point>{
  237. new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .20f), new Point(2000f, .25f), new Point(4000f, .30f) };
  238. material.transmission.points = new List<Point>(){
  239. new Point(125f, .05f), new Point(250f, .04f), new Point(500f, .03f), new Point(1000f, .02f), new Point(2000f, .005f), new Point(4000f, .002f) };
  240. }
  241. private static void Brick(ref ONSPPropagationMaterial material)
  242. {
  243. material.absorption.points = new List<Point>{
  244. new Point(125f, .02f), new Point(250f, .02f), new Point(500f, .03f), new Point(1000f, .04f), new Point(2000f, .05f), new Point(4000f, .07f) };
  245. material.scattering.points = new List<Point>{
  246. new Point(125f, .20f), new Point(250f, .25f), new Point(500f, .30f), new Point(1000f, .35f), new Point(2000f, .40f), new Point(4000f, .45f) };
  247. material.transmission.points = new List<Point>(){
  248. new Point(125f, .025f), new Point(250f, .019f), new Point(500f, .01f), new Point(1000f, .0045f), new Point(2000f, .0018f), new Point(4000f, .00089f) };
  249. }
  250. private static void BrickPainted(ref ONSPPropagationMaterial material)
  251. {
  252. material.absorption.points = new List<Point>{
  253. new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .02f), new Point(1000f, .02f), new Point(2000f, .02f), new Point(4000f, .03f) };
  254. material.scattering.points = new List<Point>{
  255. new Point(125f, .15f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .20f), new Point(2000f, .20f), new Point(4000f, .25f) };
  256. material.transmission.points = new List<Point>(){
  257. new Point(125f, .025f), new Point(250f, .019f), new Point(500f, .01f), new Point(1000f, .0045f), new Point(2000f, .0018f), new Point(4000f, .00089f) };
  258. }
  259. private static void Carpet(ref ONSPPropagationMaterial material)
  260. {
  261. material.absorption.points = new List<Point>{
  262. new Point(125f, .01f), new Point(250f, .05f), new Point(500f, .10f), new Point(1000f, .20f), new Point(2000f, .45f), new Point(4000f, .65f) };
  263. material.scattering.points = new List<Point>{
  264. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .15f), new Point(1000f, .20f), new Point(2000f, .30f), new Point(4000f, .45f) };
  265. material.transmission.points = new List<Point>(){
  266. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  267. }
  268. private static void CarpetHeavy(ref ONSPPropagationMaterial material)
  269. {
  270. material.absorption.points = new List<Point>{
  271. new Point(125f, .02f), new Point(250f, .06f), new Point(500f, .14f), new Point(1000f, .37f), new Point(2000f, .48f), new Point(4000f, .63f) };
  272. material.scattering.points = new List<Point>{
  273. new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .25f), new Point(2000f, .35f), new Point(4000f, .50f) };
  274. material.transmission.points = new List<Point>(){
  275. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  276. }
  277. private static void CarpetHeavyPadded(ref ONSPPropagationMaterial material)
  278. {
  279. material.absorption.points = new List<Point>{
  280. new Point(125f, .08f), new Point(250f, .24f), new Point(500f, .57f), new Point(1000f, .69f), new Point(2000f, .71f), new Point(4000f, .73f) };
  281. material.scattering.points = new List<Point>{
  282. new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .20f), new Point(1000f, .25f), new Point(2000f, .35f), new Point(4000f, .50f) };
  283. material.transmission.points = new List<Point>(){
  284. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  285. }
  286. private static void CeramicTile(ref ONSPPropagationMaterial material)
  287. {
  288. material.absorption.points = new List<Point>{
  289. new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .01f), new Point(1000f, .01f), new Point(2000f, .02f), new Point(4000f, .02f) };
  290. material.scattering.points = new List<Point>{
  291. new Point(125f, .10f), new Point(250f, .12f), new Point(500f, .14f), new Point(1000f, .16f), new Point(2000f, .18f), new Point(4000f, .20f) };
  292. material.transmission.points = new List<Point>(){
  293. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  294. }
  295. private static void Concrete(ref ONSPPropagationMaterial material)
  296. {
  297. material.absorption.points = new List<Point>{
  298. new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .02f), new Point(1000f, .02f), new Point(2000f, .02f), new Point(4000f, .02f) };
  299. material.scattering.points = new List<Point>{
  300. new Point(125f, .10f), new Point(250f, .11f), new Point(500f, .12f), new Point(1000f, .13f), new Point(2000f, .14f), new Point(4000f, .15f) };
  301. material.transmission.points = new List<Point>(){
  302. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  303. }
  304. private static void ConcreteRough(ref ONSPPropagationMaterial material)
  305. {
  306. material.absorption.points = new List<Point>{
  307. new Point(125f, .01f), new Point(250f, .02f), new Point(500f, .04f), new Point(1000f, .06f), new Point(2000f, .08f), new Point(4000f, .10f) };
  308. material.scattering.points = new List<Point>{
  309. new Point(125f, .10f), new Point(250f, .12f), new Point(500f, .15f), new Point(1000f, .20f), new Point(2000f, .25f), new Point(4000f, .30f) };
  310. material.transmission.points = new List<Point>(){
  311. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  312. }
  313. private static void ConcreteBlock(ref ONSPPropagationMaterial material)
  314. {
  315. material.absorption.points = new List<Point>{
  316. new Point(125f, .36f), new Point(250f, .44f), new Point(500f, .31f), new Point(1000f, .29f), new Point(2000f, .39f), new Point(4000f, .21f) };
  317. material.scattering.points = new List<Point>{
  318. new Point(125f, .10f), new Point(250f, .12f), new Point(500f, .15f), new Point(1000f, .20f), new Point(2000f, .30f), new Point(4000f, .40f) };
  319. material.transmission.points = new List<Point>(){
  320. new Point(125f, .02f), new Point(250f, .01f), new Point(500f, .0063f), new Point(1000f, .0035f), new Point(2000f, .00011f), new Point(4000f, .00063f) };
  321. }
  322. private static void ConcreteBlockPainted(ref ONSPPropagationMaterial material)
  323. {
  324. material.absorption.points = new List<Point>{
  325. new Point(125f, .10f), new Point(250f, .05f), new Point(500f, .06f), new Point(1000f, .07f), new Point(2000f, .09f), new Point(4000f, .08f) };
  326. material.scattering.points = new List<Point>{
  327. new Point(125f, .10f), new Point(250f, .11f), new Point(500f, .13f), new Point(1000f, .15f), new Point(2000f, .16f), new Point(4000f, .20f) };
  328. material.transmission.points = new List<Point>(){
  329. new Point(125f, .02f), new Point(250f, .01f), new Point(500f, .0063f), new Point(1000f, .0035f), new Point(2000f, .00011f), new Point(4000f, .00063f) };
  330. }
  331. private static void Curtain(ref ONSPPropagationMaterial material)
  332. {
  333. material.absorption.points = new List<Point>{
  334. new Point(125f, .07f), new Point(250f, .31f), new Point(500f, .49f), new Point(1000f, .75f), new Point(2000f, .70f), new Point(4000f, .60f) };
  335. material.scattering.points = new List<Point>{
  336. new Point(125f, .10f), new Point(250f, .15f), new Point(500f, .2f), new Point(1000f, .3f), new Point(2000f, .4f), new Point(4000f, .5f) };
  337. material.transmission.points = new List<Point>(){
  338. new Point(125f, .42f), new Point(250f, .39f), new Point(500f, .21f), new Point(1000f, .14f), new Point(2000f, .079f), new Point(4000f, .045f) };
  339. }
  340. private static void Foliage(ref ONSPPropagationMaterial material)
  341. {
  342. material.absorption.points = new List<Point>{
  343. new Point(125f, .03f), new Point(250f, .06f), new Point(500f, .11f), new Point(1000f, .17f), new Point(2000f, .27f), new Point(4000f, .31f) };
  344. material.scattering.points = new List<Point>{
  345. new Point(125f, .20f), new Point(250f, .3f), new Point(500f, .4f), new Point(1000f, .5f), new Point(2000f, .7f), new Point(4000f, .8f) };
  346. material.transmission.points = new List<Point>(){
  347. new Point(125f, .9f), new Point(250f, .9f), new Point(500f, .9f), new Point(1000f, .8f), new Point(2000f, .5f), new Point(4000f, .3f) };
  348. }
  349. private static void Glass(ref ONSPPropagationMaterial material)
  350. {
  351. material.absorption.points = new List<Point>{
  352. new Point(125f, .35f), new Point(250f, .25f), new Point(500f, .18f), new Point(1000f, .12f), new Point(2000f, .07f), new Point(4000f, .05f) };
  353. material.scattering.points = new List<Point>{
  354. new Point(125f, .05f), new Point(250f, .05f), new Point(500f, .05f), new Point(1000f, .05f), new Point(2000f, .05f), new Point(4000f, .05f) };
  355. material.transmission.points = new List<Point>(){
  356. new Point(125f, .125f), new Point(250f, .089f), new Point(500f, .05f), new Point(1000f, .028f), new Point(2000f, .022f), new Point(4000f, .079f) };
  357. }
  358. private static void GlassHeavy(ref ONSPPropagationMaterial material)
  359. {
  360. material.absorption.points = new List<Point>{
  361. new Point(125f, .18f), new Point(250f, .06f), new Point(500f, .04f), new Point(1000f, .03f), new Point(2000f, .02f), new Point(4000f, .02f) };
  362. material.scattering.points = new List<Point>{
  363. new Point(125f, .05f), new Point(250f, .05f), new Point(500f, .05f), new Point(1000f, .05f), new Point(2000f, .05f), new Point(4000f, .05f) };
  364. material.transmission.points = new List<Point>(){
  365. new Point(125f, .056f), new Point(250f, .039f), new Point(500f, .028f), new Point(1000f, .02f), new Point(2000f, .032f), new Point(4000f, .014f) };
  366. }
  367. private static void Grass(ref ONSPPropagationMaterial material)
  368. {
  369. material.absorption.points = new List<Point>{
  370. new Point(125f, .11f), new Point(250f, .26f), new Point(500f, .60f), new Point(1000f, .69f), new Point(2000f, .92f), new Point(4000f, .99f) };
  371. material.scattering.points = new List<Point>{
  372. new Point(125f, .30f), new Point(250f, .30f), new Point(500f, .40f), new Point(1000f, .50f), new Point(2000f, .60f), new Point(4000f, .70f) };
  373. material.transmission.points = new List<Point>();
  374. }
  375. private static void Gravel(ref ONSPPropagationMaterial material)
  376. {
  377. material.absorption.points = new List<Point>{
  378. new Point(125f, .25f), new Point(250f, .60f), new Point(500f, .65f), new Point(1000f, .70f), new Point(2000f, .75f), new Point(4000f, .80f) };
  379. material.scattering.points = new List<Point>{
  380. new Point(125f, .20f), new Point(250f, .30f), new Point(500f, .40f), new Point(1000f, .50f), new Point(2000f, .60f), new Point(4000f, .70f) };
  381. material.transmission.points = new List<Point>();
  382. }
  383. private static void GypsumBoard(ref ONSPPropagationMaterial material)
  384. {
  385. material.absorption.points = new List<Point>{
  386. new Point(125f, .29f), new Point(250f, .10f), new Point(500f, .05f), new Point(1000f, .04f), new Point(2000f, .07f), new Point(4000f, .09f) };
  387. material.scattering.points = new List<Point>{
  388. new Point(125f, .10f), new Point(250f, .11f), new Point(500f, .12f), new Point(1000f, .13f), new Point(2000f, .14f), new Point(4000f, .15f) };
  389. material.transmission.points = new List<Point>(){
  390. new Point(125f, .035f), new Point(250f, .0125f), new Point(500f, .0056f), new Point(1000f, .0025f), new Point(2000f, .0013f), new Point(4000f, .0032f) };
  391. }
  392. private static void PlasterOnBrick(ref ONSPPropagationMaterial material)
  393. {
  394. material.absorption.points = new List<Point>{
  395. new Point(125f, .01f), new Point(250f, .02f), new Point(500f, .02f), new Point(1000f, .03f), new Point(2000f, .04f), new Point(4000f, .05f) };
  396. material.scattering.points = new List<Point>{
  397. new Point(125f, .20f), new Point(250f, .25f), new Point(500f, .30f), new Point(1000f, .35f), new Point(2000f, .40f), new Point(4000f, .45f) };
  398. material.transmission.points = new List<Point>(){
  399. new Point(125f, .025f), new Point(250f, .019f), new Point(500f, .01f), new Point(1000f, .0045f), new Point(2000f, .0018f), new Point(4000f, .00089f) };
  400. }
  401. private static void PlasterOnConcreteBlock(ref ONSPPropagationMaterial material)
  402. {
  403. material.absorption.points = new List<Point>{
  404. new Point(125f, .12f), new Point(250f, .09f), new Point(500f, .07f), new Point(1000f, .05f), new Point(2000f, .05f), new Point(4000f, .04f) };
  405. material.scattering.points = new List<Point>{
  406. new Point(125f, .20f), new Point(250f, .25f), new Point(500f, .30f), new Point(1000f, .35f), new Point(2000f, .40f), new Point(4000f, .45f) };
  407. material.transmission.points = new List<Point>(){
  408. new Point(125f, .02f), new Point(250f, .01f), new Point(500f, .0063f), new Point(1000f, .0035f), new Point(2000f, .00011f), new Point(4000f, .00063f) };
  409. }
  410. private static void Soil(ref ONSPPropagationMaterial material)
  411. {
  412. material.absorption.points = new List<Point>{
  413. new Point(125f, .15f), new Point(250f, .25f), new Point(500f, .40f), new Point(1000f, .55f), new Point(2000f, .60f), new Point(4000f, .60f) };
  414. material.scattering.points = new List<Point>{
  415. new Point(125f, .10f), new Point(250f, .20f), new Point(500f, .25f), new Point(1000f, .40f), new Point(2000f, .55f), new Point(4000f, .70f) };
  416. material.transmission.points = new List<Point>();
  417. }
  418. private static void SoundProof(ref ONSPPropagationMaterial material)
  419. {
  420. material.absorption.points = new List<Point>{ new Point(1000f, 1.0f) };
  421. material.scattering.points = new List<Point>{ new Point(1000f, 0.0f) };
  422. material.transmission.points = new List<Point>();
  423. }
  424. private static void Snow(ref ONSPPropagationMaterial material)
  425. {
  426. material.absorption.points = new List<Point>{
  427. new Point(125f, .45f), new Point(250f, .75f), new Point(500f, .90f), new Point(1000f, .95f), new Point(2000f, .95f), new Point(4000f, .95f) };
  428. material.scattering.points = new List<Point>{
  429. new Point(125f, .20f), new Point(250f, .30f), new Point(500f, .40f), new Point(1000f, .50f), new Point(2000f, .60f), new Point(4000f, .75f) };
  430. material.transmission.points = new List<Point>();
  431. }
  432. private static void Steel(ref ONSPPropagationMaterial material)
  433. {
  434. material.absorption.points = new List<Point>{
  435. new Point(125f, .05f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .07f), new Point(4000f, .02f) };
  436. material.scattering.points = new List<Point>{
  437. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .10f) };
  438. material.transmission.points = new List<Point>(){
  439. new Point(125f, .25f), new Point(250f, .2f), new Point(500f, .17f), new Point(1000f, .089f), new Point(2000f, .089f), new Point(4000f, .0056f) };
  440. }
  441. private static void Water(ref ONSPPropagationMaterial material)
  442. {
  443. material.absorption.points = new List<Point>{
  444. new Point(125f, .01f), new Point(250f, .01f), new Point(500f, .01f), new Point(1000f, .02f), new Point(2000f, .02f), new Point(4000f, .03f) };
  445. material.scattering.points = new List<Point>{
  446. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .07f), new Point(2000f, .05f), new Point(4000f, .05f) };
  447. material.transmission.points = new List<Point>(){
  448. new Point(125f, .03f), new Point(250f, .03f), new Point(500f, .03f), new Point(1000f, .02f), new Point(2000f, .015f), new Point(4000f, .01f) };
  449. }
  450. private static void WoodThin(ref ONSPPropagationMaterial material)
  451. {
  452. material.absorption.points = new List<Point>{
  453. new Point(125f, .42f), new Point(250f, .21f), new Point(500f, .10f), new Point(1000f, .08f), new Point(2000f, .06f), new Point(4000f, .06f) };
  454. material.scattering.points = new List<Point>{
  455. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) };
  456. material.transmission.points = new List<Point>(){
  457. new Point(125f, .2f), new Point(250f, .125f), new Point(500f, .079f), new Point(1000f, .1f), new Point(2000f, .089f), new Point(4000f, .05f) };
  458. }
  459. private static void WoodThick(ref ONSPPropagationMaterial material)
  460. {
  461. material.absorption.points = new List<Point>{
  462. new Point(125f, .19f), new Point(250f, .14f), new Point(500f, .09f), new Point(1000f, .06f), new Point(2000f, .06f), new Point(4000f, .05f) };
  463. material.scattering.points = new List<Point>{
  464. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) };
  465. material.transmission.points = new List<Point>(){
  466. new Point(125f, .035f), new Point(250f, .028f), new Point(500f, .028f), new Point(1000f, .028f), new Point(2000f, .011f), new Point(4000f, .0071f) };
  467. }
  468. private static void WoodFloor(ref ONSPPropagationMaterial material)
  469. {
  470. material.absorption.points = new List<Point>{
  471. new Point(125f, .15f), new Point(250f, .11f), new Point(500f, .10f), new Point(1000f, .07f), new Point(2000f, .06f), new Point(4000f, .07f) };
  472. material.scattering.points = new List<Point>{
  473. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) };
  474. material.transmission.points = new List<Point>(){
  475. new Point(125f, .071f), new Point(250f, .025f), new Point(500f, .0158f), new Point(1000f, .0056f), new Point(2000f, .0035f), new Point(4000f, .0016f) };
  476. }
  477. private static void WoodOnConcrete(ref ONSPPropagationMaterial material)
  478. {
  479. material.absorption.points = new List<Point>{
  480. new Point(125f, .04f), new Point(250f, .04f), new Point(500f, .07f), new Point(1000f, .06f), new Point(2000f, .06f), new Point(4000f, .07f) };
  481. material.scattering.points = new List<Point>{
  482. new Point(125f, .10f), new Point(250f, .10f), new Point(500f, .10f), new Point(1000f, .10f), new Point(2000f, .10f), new Point(4000f, .15f) };
  483. material.transmission.points = new List<Point>(){
  484. new Point(125f, .004f), new Point(250f, .0079f), new Point(500f, .0056f), new Point(1000f, .0016f), new Point(2000f, .0014f), new Point(4000f, .0005f) };
  485. }
  486. }