2
0

ImportOptions.cs 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. using BansheeEngine;
  6. namespace BansheeEditor
  7. {
  8. /** @addtogroup Library
  9. * @{
  10. */
  11. /// <summary>
  12. /// Base class for all import options. Allows control over how is a specific resource type imported.
  13. /// </summary>
  14. public class ImportOptions : ScriptObject
  15. {
  16. }
  17. /// <summary>
  18. /// Determines the type of the source image for generating cubemaps.
  19. /// </summary>
  20. public enum CubemapSourceType
  21. {
  22. /// <summary>
  23. /// Source is a single image that will be replicated on all cubemap faces.
  24. /// </summary>
  25. Single,
  26. /// <summary>
  27. /// Source is a list of 6 images, either sequentially next to each other or in a cross format. The system will
  28. /// automatically guess the layout and orientation based on the aspect ratio.
  29. /// </summary>
  30. Faces,
  31. /// <summary>
  32. /// Source is a single spherical panoramic image.
  33. /// </summary>
  34. Spherical,
  35. /// <summary>
  36. /// Source is a single cylindrical panoramic image.
  37. /// </summary>
  38. Cylindrical
  39. };
  40. /// <summary>
  41. /// Provides options for controlling how is a texture resource imported.
  42. /// </summary>
  43. public class TextureImportOptions : ImportOptions
  44. {
  45. /// <summary>
  46. /// Creates new texture import options with default values.
  47. /// </summary>
  48. public TextureImportOptions()
  49. {
  50. Internal_CreateInstance(this);
  51. }
  52. /// <summary>
  53. /// Pixel format to import as.
  54. /// </summary>
  55. public PixelFormat Format
  56. {
  57. get { return Internal_GetPixelFormat(mCachedPtr); }
  58. set { Internal_SetPixelFormat(mCachedPtr, value); }
  59. }
  60. /// <summary>
  61. /// Determines whether the imported texture will have mipmaps generated.
  62. /// </summary>
  63. public bool GenerateMipmaps
  64. {
  65. get { return Internal_GetGenerateMipmaps(mCachedPtr); }
  66. set { Internal_SetGenerateMipmaps(mCachedPtr, value); }
  67. }
  68. /// <summary>
  69. /// Maximum mipmap level to generate, if mipmap generation is enabled.
  70. /// </summary>
  71. public int MaxMipmapLevel
  72. {
  73. get { return Internal_GetMaxMipmapLevel(mCachedPtr); }
  74. set { Internal_SetMaxMipmapLevel(mCachedPtr, value); }
  75. }
  76. /// <summary>
  77. /// Determines whether the texture data is also stored in main memory, available for fast CPU access.
  78. /// </summary>
  79. public bool CPUCached
  80. {
  81. get { return Internal_GetCPUCached(mCachedPtr); }
  82. set { Internal_SetCPUCached(mCachedPtr, value); }
  83. }
  84. /// <summary>
  85. /// Determines should the texture data be treated as if its in sRGB (gamma) space. Such texture will be converted by
  86. /// hardware to linear space before use on the GPU.
  87. /// </summary>
  88. public bool IsSRGB
  89. {
  90. get { return Internal_GetIsSRGB(mCachedPtr); }
  91. set { Internal_SetIsSRGB(mCachedPtr, value); }
  92. }
  93. /// <summary>
  94. /// Determines should the texture be imported as a cubemap. See <see cref="CubemapSourceType"/> to choose how will
  95. /// the source texture be converted to a cubemap.
  96. /// </summary>
  97. public bool IsCubemap
  98. {
  99. get { return Internal_GetIsCubemap(mCachedPtr); }
  100. set { Internal_SetIsCubemap(mCachedPtr, value); }
  101. }
  102. /// <summary>
  103. /// Sets a value that determines how should the source texture be interpreted when generating a cubemap. Only
  104. /// relevant when <see cref="IsCubemap"/> is set to true.
  105. /// </summary>
  106. public CubemapSourceType CubemapSourceType
  107. {
  108. get { return Internal_GetCubemapSourceType(mCachedPtr); }
  109. set { Internal_SetCubemapSourceType(mCachedPtr, value); }
  110. }
  111. [MethodImpl(MethodImplOptions.InternalCall)]
  112. private static extern void Internal_CreateInstance(TextureImportOptions instance);
  113. [MethodImpl(MethodImplOptions.InternalCall)]
  114. private static extern PixelFormat Internal_GetPixelFormat(IntPtr thisPtr);
  115. [MethodImpl(MethodImplOptions.InternalCall)]
  116. private static extern void Internal_SetPixelFormat(IntPtr thisPtr, PixelFormat value);
  117. [MethodImpl(MethodImplOptions.InternalCall)]
  118. private static extern bool Internal_GetGenerateMipmaps(IntPtr thisPtr);
  119. [MethodImpl(MethodImplOptions.InternalCall)]
  120. private static extern void Internal_SetGenerateMipmaps(IntPtr thisPtr, bool value);
  121. [MethodImpl(MethodImplOptions.InternalCall)]
  122. private static extern int Internal_GetMaxMipmapLevel(IntPtr thisPtr);
  123. [MethodImpl(MethodImplOptions.InternalCall)]
  124. private static extern void Internal_SetMaxMipmapLevel(IntPtr thisPtr, int value);
  125. [MethodImpl(MethodImplOptions.InternalCall)]
  126. private static extern bool Internal_GetCPUCached(IntPtr thisPtr);
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern void Internal_SetCPUCached(IntPtr thisPtr, bool value);
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern bool Internal_GetIsSRGB(IntPtr thisPtr);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern void Internal_SetIsSRGB(IntPtr thisPtr, bool value);
  133. [MethodImpl(MethodImplOptions.InternalCall)]
  134. private static extern bool Internal_GetIsCubemap(IntPtr thisPtr);
  135. [MethodImpl(MethodImplOptions.InternalCall)]
  136. private static extern void Internal_SetIsCubemap(IntPtr thisPtr, bool value);
  137. [MethodImpl(MethodImplOptions.InternalCall)]
  138. private static extern CubemapSourceType Internal_GetCubemapSourceType(IntPtr thisPtr);
  139. [MethodImpl(MethodImplOptions.InternalCall)]
  140. private static extern void Internal_SetCubemapSourceType(IntPtr thisPtr, CubemapSourceType value);
  141. }
  142. /// <summary>
  143. /// Information about how to split an AnimationClip into multiple separate clips.
  144. /// </summary>
  145. public class AnimationSplitInfo
  146. {
  147. public AnimationSplitInfo() { }
  148. public AnimationSplitInfo(string name, int startFrame, int endFrame, bool isAdditive)
  149. {
  150. this.name = name;
  151. this.startFrame = startFrame;
  152. this.endFrame = endFrame;
  153. this.isAdditive = isAdditive;
  154. }
  155. public string name;
  156. public int startFrame = 0;
  157. public int endFrame = 0;
  158. public bool isAdditive = false;
  159. }
  160. /// <summary>
  161. /// A set of animation events that will be added to an animation clip during animation import.
  162. /// </summary>
  163. public class ImportedAnimationEvents
  164. {
  165. public string name;
  166. public AnimationEvent[] events;
  167. }
  168. /// <summary>
  169. /// Provides options for controlling how is a mesh resource imported.
  170. /// </summary>
  171. public class MeshImportOptions : ImportOptions
  172. {
  173. /// <summary>
  174. /// Creates new mesh import options with default values.
  175. /// </summary>
  176. public MeshImportOptions()
  177. {
  178. Internal_CreateInstance(this);
  179. }
  180. /// <summary>
  181. /// Determines whether the mesh data is also stored in main memory, available for fast CPU access.
  182. /// </summary>
  183. public bool CPUCached
  184. {
  185. get { return Internal_GetCPUCached(mCachedPtr); }
  186. set { Internal_SetCPUCached(mCachedPtr, value); }
  187. }
  188. /// <summary>
  189. /// Controls should mesh normals be imported if available.
  190. /// </summary>
  191. public bool ImportNormals
  192. {
  193. get { return Internal_GetImportNormals(mCachedPtr); }
  194. set { Internal_SetImportNormals(mCachedPtr, value); }
  195. }
  196. /// <summary>
  197. /// Controls should mesh tangents/bitangents be imported if available.
  198. /// </summary>
  199. public bool ImportTangents
  200. {
  201. get { return Internal_GetImportTangents(mCachedPtr); }
  202. set { Internal_SetImportTangents(mCachedPtr, value); }
  203. }
  204. /// <summary>
  205. /// Controls should mesh skin data like bone weights, indices and bind poses be imported if available.
  206. /// </summary>
  207. public bool ImportSkin
  208. {
  209. get { return Internal_GetImportSkin(mCachedPtr); }
  210. set { Internal_SetImportSkin(mCachedPtr, value); }
  211. }
  212. /// <summary>
  213. /// Controls should animation clips be imported if available.
  214. /// </summary>
  215. public bool ImportAnimation
  216. {
  217. get { return Internal_GetImportAnimation(mCachedPtr); }
  218. set { Internal_SetImportAnimation(mCachedPtr, value); }
  219. }
  220. /// <summary>
  221. /// Controls should mesh blend shapes be imported if available.
  222. /// </summary>
  223. public bool ImportBlendShapes
  224. {
  225. get { return Internal_GetImportBlendShapes(mCachedPtr); }
  226. set { Internal_SetImportBlendShapes(mCachedPtr, value); }
  227. }
  228. /// <summary>
  229. /// Uniformly scales the imported mesh by the specified value.
  230. /// </summary>
  231. public float Scale
  232. {
  233. get { return Internal_GetScale(mCachedPtr); }
  234. set { Internal_SetScale(mCachedPtr, value); }
  235. }
  236. /// <summary>
  237. /// Determines if keyframe reduction is enabled. Keyframe reduction will reduce the number of key-frames in an
  238. /// animation clip by removing identical keyframes, and therefore reducing the size of the clip.
  239. /// </summary>
  240. public bool KeyframeReduction
  241. {
  242. get { return Internal_GetKeyFrameReduction(mCachedPtr); }
  243. set { Internal_SetKeyFrameReduction(mCachedPtr, value); }
  244. }
  245. /// <summary>
  246. /// Determines if import of root motion curves is enabled. When enabled, any animation curves in imported animations
  247. /// affecting the root bone will be available through a set of separate curves in AnimationClip, and they won't be
  248. /// evaluated through normal animation process. Instead it is expected that the user evaluates the curves manually
  249. /// and applies them as required.
  250. /// </summary>
  251. public bool ImportRootMotion
  252. {
  253. get { return Internal_GetRootMotion(mCachedPtr); }
  254. set { Internal_SetRootMotion(mCachedPtr, value); }
  255. }
  256. /// <summary>
  257. /// Controls what type (if any) of collision mesh should be imported.
  258. /// </summary>
  259. public CollisionMeshType CollisionMeshType
  260. {
  261. get { return (CollisionMeshType)Internal_GetCollisionMeshType(mCachedPtr); }
  262. set { Internal_SetCollisionMeshType(mCachedPtr, (int)value); }
  263. }
  264. /// <summary>
  265. /// Split information that allows you to split the animation clip contained in the mesh file into multiple separate
  266. /// clips. The split always applies to the first clip in the file (if the file contains multiple), other clips are
  267. /// imported as is.
  268. /// </summary>
  269. public AnimationSplitInfo[] AnimationClipSplits
  270. {
  271. get { return Internal_GetAnimationClipSplits(mCachedPtr); }
  272. set { Internal_SetAnimationClipSplits(mCachedPtr, value); }
  273. }
  274. /// <summary>
  275. /// A set of events that will be added to the animation clip, if animation import is enabled.
  276. /// </summary>
  277. public ImportedAnimationEvents[] AnimationEvents
  278. {
  279. get { return Internal_GetAnimationEvents(mCachedPtr); }
  280. set { Internal_SetAnimationEvents(mCachedPtr, value); }
  281. }
  282. [MethodImpl(MethodImplOptions.InternalCall)]
  283. private static extern void Internal_CreateInstance(MeshImportOptions instance);
  284. [MethodImpl(MethodImplOptions.InternalCall)]
  285. private static extern bool Internal_GetCPUCached(IntPtr thisPtr);
  286. [MethodImpl(MethodImplOptions.InternalCall)]
  287. private static extern void Internal_SetCPUCached(IntPtr thisPtr, bool value);
  288. [MethodImpl(MethodImplOptions.InternalCall)]
  289. private static extern bool Internal_GetImportNormals(IntPtr thisPtr);
  290. [MethodImpl(MethodImplOptions.InternalCall)]
  291. private static extern void Internal_SetImportNormals(IntPtr thisPtr, bool value);
  292. [MethodImpl(MethodImplOptions.InternalCall)]
  293. private static extern bool Internal_GetImportTangents(IntPtr thisPtr);
  294. [MethodImpl(MethodImplOptions.InternalCall)]
  295. private static extern void Internal_SetImportTangents(IntPtr thisPtr, bool value);
  296. [MethodImpl(MethodImplOptions.InternalCall)]
  297. private static extern bool Internal_GetImportSkin(IntPtr thisPtr);
  298. [MethodImpl(MethodImplOptions.InternalCall)]
  299. private static extern void Internal_SetImportSkin(IntPtr thisPtr, bool value);
  300. [MethodImpl(MethodImplOptions.InternalCall)]
  301. private static extern bool Internal_GetImportAnimation(IntPtr thisPtr);
  302. [MethodImpl(MethodImplOptions.InternalCall)]
  303. private static extern void Internal_SetImportAnimation(IntPtr thisPtr, bool value);
  304. [MethodImpl(MethodImplOptions.InternalCall)]
  305. private static extern bool Internal_GetImportBlendShapes(IntPtr thisPtr);
  306. [MethodImpl(MethodImplOptions.InternalCall)]
  307. private static extern void Internal_SetImportBlendShapes(IntPtr thisPtr, bool value);
  308. [MethodImpl(MethodImplOptions.InternalCall)]
  309. private static extern bool Internal_GetKeyFrameReduction(IntPtr thisPtr);
  310. [MethodImpl(MethodImplOptions.InternalCall)]
  311. private static extern void Internal_SetKeyFrameReduction(IntPtr thisPtr, bool value);
  312. [MethodImpl(MethodImplOptions.InternalCall)]
  313. private static extern bool Internal_GetRootMotion(IntPtr thisPtr);
  314. [MethodImpl(MethodImplOptions.InternalCall)]
  315. private static extern void Internal_SetRootMotion(IntPtr thisPtr, bool value);
  316. [MethodImpl(MethodImplOptions.InternalCall)]
  317. private static extern AnimationSplitInfo[] Internal_GetAnimationClipSplits(IntPtr thisPtr);
  318. [MethodImpl(MethodImplOptions.InternalCall)]
  319. private static extern void Internal_SetAnimationClipSplits(IntPtr thisPtr, AnimationSplitInfo[] value);
  320. [MethodImpl(MethodImplOptions.InternalCall)]
  321. private static extern ImportedAnimationEvents[] Internal_GetAnimationEvents(IntPtr thisPtr);
  322. [MethodImpl(MethodImplOptions.InternalCall)]
  323. private static extern void Internal_SetAnimationEvents(IntPtr thisPtr, ImportedAnimationEvents[] value);
  324. [MethodImpl(MethodImplOptions.InternalCall)]
  325. private static extern float Internal_GetScale(IntPtr thisPtr);
  326. [MethodImpl(MethodImplOptions.InternalCall)]
  327. private static extern void Internal_SetScale(IntPtr thisPtr, float value);
  328. [MethodImpl(MethodImplOptions.InternalCall)]
  329. private static extern int Internal_GetCollisionMeshType(IntPtr thisPtr);
  330. [MethodImpl(MethodImplOptions.InternalCall)]
  331. private static extern void Internal_SetCollisionMeshType(IntPtr thisPtr, int value);
  332. }
  333. /// <summary>
  334. /// Controls what type of collision mesh should be imported during mesh import.
  335. /// </summary>
  336. public enum CollisionMeshType // Note: Must match C++ enum CollisionMeshImport
  337. {
  338. /// <summary>
  339. /// No collision mesh will be imported.
  340. /// </summary>
  341. None,
  342. /// <summary>
  343. /// Normal triangle mesh will be imported.
  344. /// </summary>
  345. Normal,
  346. /// <summary>
  347. /// A convex hull will be generated from the source mesh.
  348. /// </summary>
  349. Convex
  350. }
  351. /// <summary>
  352. /// Import options that provide various options for controlling how is a font resource imported.
  353. /// </summary>
  354. public class FontImportOptions : ImportOptions
  355. {
  356. /// <summary>
  357. /// Creates new font import options with default values.
  358. /// </summary>
  359. public FontImportOptions()
  360. {
  361. Internal_CreateInstance(this);
  362. }
  363. /// <summary>
  364. /// Font sizes in points that are to be imported.
  365. /// </summary>
  366. public int[] FontSizes
  367. {
  368. get { return Internal_GetFontSizes(mCachedPtr); }
  369. set { Internal_SetFontSizes(mCachedPtr, value); }
  370. }
  371. /// <summary>
  372. /// Dots per inch resolution to use when rendering the characters into the texture.
  373. /// </summary>
  374. public int DPI
  375. {
  376. get { return Internal_GetDPI(mCachedPtr); }
  377. set { Internal_SetDPI(mCachedPtr, value); }
  378. }
  379. /// <summary>
  380. /// Determines rendering mode used when rendering the characters into the bitmap.
  381. /// </summary>
  382. public FontRenderMode RenderMode
  383. {
  384. get { return Internal_GetRenderMode(mCachedPtr); }
  385. set { Internal_SetRenderMode(mCachedPtr, value); }
  386. }
  387. /// <summary>
  388. /// Determines should the characters be rendered in bold style.
  389. /// </summary>
  390. public bool Bold
  391. {
  392. get { return Internal_GetBold(mCachedPtr); }
  393. set { Internal_SetBold(mCachedPtr, value); }
  394. }
  395. /// <summary>
  396. /// Determines should the characters be rendered in italic style.
  397. /// </summary>
  398. public bool Italic
  399. {
  400. get { return Internal_GetItalic(mCachedPtr); }
  401. set { Internal_SetItalic(mCachedPtr, value); }
  402. }
  403. /// <summary>
  404. /// Determines character ranges to import from the font. Ranges are defined as unicode numbers.
  405. /// </summary>
  406. public CharRange[] CharRanges
  407. {
  408. get { return Internal_GetCharRanges(mCachedPtr); }
  409. set { Internal_SetCharRanges(mCachedPtr, value); }
  410. }
  411. [MethodImpl(MethodImplOptions.InternalCall)]
  412. private static extern void Internal_CreateInstance(FontImportOptions instance);
  413. [MethodImpl(MethodImplOptions.InternalCall)]
  414. private static extern int[] Internal_GetFontSizes(IntPtr thisPtr);
  415. [MethodImpl(MethodImplOptions.InternalCall)]
  416. private static extern void Internal_SetFontSizes(IntPtr thisPtr, int[] value);
  417. [MethodImpl(MethodImplOptions.InternalCall)]
  418. private static extern int Internal_GetDPI(IntPtr thisPtr);
  419. [MethodImpl(MethodImplOptions.InternalCall)]
  420. private static extern void Internal_SetDPI(IntPtr thisPtr, int value);
  421. [MethodImpl(MethodImplOptions.InternalCall)]
  422. private static extern FontRenderMode Internal_GetRenderMode(IntPtr thisPtr);
  423. [MethodImpl(MethodImplOptions.InternalCall)]
  424. private static extern void Internal_SetRenderMode(IntPtr thisPtr, FontRenderMode value);
  425. [MethodImpl(MethodImplOptions.InternalCall)]
  426. private static extern bool Internal_GetBold(IntPtr thisPtr);
  427. [MethodImpl(MethodImplOptions.InternalCall)]
  428. private static extern void Internal_SetBold(IntPtr thisPtr, bool value);
  429. [MethodImpl(MethodImplOptions.InternalCall)]
  430. private static extern bool Internal_GetItalic(IntPtr thisPtr);
  431. [MethodImpl(MethodImplOptions.InternalCall)]
  432. private static extern void Internal_SetItalic(IntPtr thisPtr, bool value);
  433. [MethodImpl(MethodImplOptions.InternalCall)]
  434. private static extern CharRange[] Internal_GetCharRanges(IntPtr thisPtr);
  435. [MethodImpl(MethodImplOptions.InternalCall)]
  436. private static extern void Internal_SetCharRanges(IntPtr thisPtr, CharRange[] value);
  437. }
  438. /// <summary>
  439. /// Provides various options for controlling how is a script file imported.
  440. /// </summary>
  441. public class ScriptCodeImportOptions : ImportOptions
  442. {
  443. /// <summary>
  444. /// Creates new script import options with default values.
  445. /// </summary>
  446. public ScriptCodeImportOptions()
  447. {
  448. Internal_CreateInstance(this);
  449. }
  450. /// <summary>
  451. /// Determines whether the script is editor-only or a normal game script. Editor scripts are compiled in a separate
  452. /// assembly and may reference editor specific functionality, but are not available in the final game code.
  453. /// </summary>
  454. public bool EditorScript
  455. {
  456. get { return Internal_IsEditorScript(mCachedPtr); }
  457. set { Internal_SetEditorScript(mCachedPtr, value); }
  458. }
  459. [MethodImpl(MethodImplOptions.InternalCall)]
  460. private static extern void Internal_CreateInstance(ScriptCodeImportOptions instance);
  461. [MethodImpl(MethodImplOptions.InternalCall)]
  462. private static extern bool Internal_IsEditorScript(IntPtr thisPtr);
  463. [MethodImpl(MethodImplOptions.InternalCall)]
  464. private static extern void Internal_SetEditorScript(IntPtr thisPtr, bool value);
  465. }
  466. /// <summary>
  467. /// Determines how is a font rendered into the bitmap texture.
  468. /// </summary>
  469. public enum FontRenderMode // Note: Must match C++ enum FontRenderMode
  470. {
  471. /// <summary>Render antialiased fonts without hinting (slightly more blurry).</summary>
  472. Smooth,
  473. /// <summary>Render non-antialiased fonts without hinting (slightly more blurry).</summary>
  474. Raster,
  475. /// <summary>Render antialiased fonts with hinting.</summary>
  476. HintedSmooth,
  477. /// <summary>Render non-antialiased fonts with hinting.</summary>
  478. HintedRaster
  479. }
  480. /// <summary>
  481. /// Provides various options for controlling how is an audio clip file imported.
  482. /// </summary>
  483. public class AudioClipImportOptions : ImportOptions
  484. {
  485. /// <summary>
  486. /// Creates new audio clip import options with default values.
  487. /// </summary>
  488. public AudioClipImportOptions()
  489. {
  490. Internal_CreateInstance(this);
  491. }
  492. /// <summary>
  493. /// Format to import the audio clip as.
  494. /// </summary>
  495. public AudioFormat Format
  496. {
  497. get { return Internal_GetFormat(mCachedPtr); }
  498. set { Internal_SetFormat(mCachedPtr, value); }
  499. }
  500. /// <summary>
  501. /// Determines how is audio data loaded into memory.
  502. /// </summary>
  503. public AudioReadMode ReadMode
  504. {
  505. get { return Internal_GetReadMode(mCachedPtr); }
  506. set { Internal_SetReadMode(mCachedPtr, value); }
  507. }
  508. /// <summary>
  509. /// Determines will the clip be played as spatial (3D) audio or as normal audio.
  510. /// </summary>
  511. public bool Is3D
  512. {
  513. get { return Internal_GetIs3D(mCachedPtr); }
  514. set { Internal_SetIs3D(mCachedPtr, value); }
  515. }
  516. /// <summary>
  517. /// Size of a single sample in bits.
  518. /// </summary>
  519. public AudioBitDepth BitDepth
  520. {
  521. get
  522. {
  523. int bits = Internal_GetBitDepth(mCachedPtr);
  524. switch (bits)
  525. {
  526. case 8:
  527. return AudioBitDepth.Bits8;
  528. case 16:
  529. return AudioBitDepth.Bits16;
  530. case 24:
  531. return AudioBitDepth.Bits24;
  532. case 32:
  533. return AudioBitDepth.Bits32;
  534. }
  535. return AudioBitDepth.Bits16;
  536. }
  537. set { Internal_SetBitDepth(mCachedPtr, (int)value); }
  538. }
  539. [MethodImpl(MethodImplOptions.InternalCall)]
  540. private static extern void Internal_CreateInstance(AudioClipImportOptions instance);
  541. [MethodImpl(MethodImplOptions.InternalCall)]
  542. private static extern AudioFormat Internal_GetFormat(IntPtr thisPtr);
  543. [MethodImpl(MethodImplOptions.InternalCall)]
  544. private static extern void Internal_SetFormat(IntPtr thisPtr, AudioFormat format);
  545. [MethodImpl(MethodImplOptions.InternalCall)]
  546. private static extern AudioReadMode Internal_GetReadMode(IntPtr thisPtr);
  547. [MethodImpl(MethodImplOptions.InternalCall)]
  548. private static extern void Internal_SetReadMode(IntPtr thisPtr, AudioReadMode readMode);
  549. [MethodImpl(MethodImplOptions.InternalCall)]
  550. private static extern bool Internal_GetIs3D(IntPtr thisPtr);
  551. [MethodImpl(MethodImplOptions.InternalCall)]
  552. private static extern void Internal_SetIs3D(IntPtr thisPtr, bool is3d);
  553. [MethodImpl(MethodImplOptions.InternalCall)]
  554. private static extern int Internal_GetBitDepth(IntPtr thisPtr);
  555. [MethodImpl(MethodImplOptions.InternalCall)]
  556. private static extern void Internal_SetBitDepth(IntPtr thisPtr, int bitDepth);
  557. }
  558. /** @} */
  559. }