ImportOptions.cs 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692
  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. /// <summary>
  112. /// If true makrs the cubemap as a reflection cubemap and perform special filtering on the cubemap mip-maps. Only
  113. /// relevant when texture is imported as a cubemap.This will override texture size and mip levels to match the
  114. /// requirements needed for reflection cubemaps.
  115. /// </summary>
  116. public bool IsCubemapReflection
  117. {
  118. get { return Internal_GetIsCubemapReflection(mCachedPtr); }
  119. set { Internal_SetIsCubemapReflection(mCachedPtr, value); }
  120. }
  121. [MethodImpl(MethodImplOptions.InternalCall)]
  122. private static extern void Internal_CreateInstance(TextureImportOptions instance);
  123. [MethodImpl(MethodImplOptions.InternalCall)]
  124. private static extern PixelFormat Internal_GetPixelFormat(IntPtr thisPtr);
  125. [MethodImpl(MethodImplOptions.InternalCall)]
  126. private static extern void Internal_SetPixelFormat(IntPtr thisPtr, PixelFormat value);
  127. [MethodImpl(MethodImplOptions.InternalCall)]
  128. private static extern bool Internal_GetGenerateMipmaps(IntPtr thisPtr);
  129. [MethodImpl(MethodImplOptions.InternalCall)]
  130. private static extern void Internal_SetGenerateMipmaps(IntPtr thisPtr, bool value);
  131. [MethodImpl(MethodImplOptions.InternalCall)]
  132. private static extern int Internal_GetMaxMipmapLevel(IntPtr thisPtr);
  133. [MethodImpl(MethodImplOptions.InternalCall)]
  134. private static extern void Internal_SetMaxMipmapLevel(IntPtr thisPtr, int value);
  135. [MethodImpl(MethodImplOptions.InternalCall)]
  136. private static extern bool Internal_GetCPUCached(IntPtr thisPtr);
  137. [MethodImpl(MethodImplOptions.InternalCall)]
  138. private static extern void Internal_SetCPUCached(IntPtr thisPtr, bool value);
  139. [MethodImpl(MethodImplOptions.InternalCall)]
  140. private static extern bool Internal_GetIsSRGB(IntPtr thisPtr);
  141. [MethodImpl(MethodImplOptions.InternalCall)]
  142. private static extern void Internal_SetIsSRGB(IntPtr thisPtr, bool value);
  143. [MethodImpl(MethodImplOptions.InternalCall)]
  144. private static extern bool Internal_GetIsCubemap(IntPtr thisPtr);
  145. [MethodImpl(MethodImplOptions.InternalCall)]
  146. private static extern void Internal_SetIsCubemap(IntPtr thisPtr, bool value);
  147. [MethodImpl(MethodImplOptions.InternalCall)]
  148. private static extern CubemapSourceType Internal_GetCubemapSourceType(IntPtr thisPtr);
  149. [MethodImpl(MethodImplOptions.InternalCall)]
  150. private static extern void Internal_SetCubemapSourceType(IntPtr thisPtr, CubemapSourceType value);
  151. [MethodImpl(MethodImplOptions.InternalCall)]
  152. private static extern bool Internal_GetIsCubemapReflection(IntPtr thisPtr);
  153. [MethodImpl(MethodImplOptions.InternalCall)]
  154. private static extern void Internal_SetIsCubemapReflection(IntPtr thisPtr, bool value);
  155. }
  156. /// <summary>
  157. /// Information about how to split an AnimationClip into multiple separate clips.
  158. /// </summary>
  159. public class AnimationSplitInfo
  160. {
  161. public AnimationSplitInfo() { }
  162. public AnimationSplitInfo(string name, int startFrame, int endFrame, bool isAdditive)
  163. {
  164. this.name = name;
  165. this.startFrame = startFrame;
  166. this.endFrame = endFrame;
  167. this.isAdditive = isAdditive;
  168. }
  169. public string name;
  170. public int startFrame = 0;
  171. public int endFrame = 0;
  172. public bool isAdditive = false;
  173. }
  174. /// <summary>
  175. /// A set of animation events that will be added to an animation clip during animation import.
  176. /// </summary>
  177. public class ImportedAnimationEvents
  178. {
  179. public string name;
  180. public AnimationEvent[] events;
  181. }
  182. /// <summary>
  183. /// Provides options for controlling how is a mesh resource imported.
  184. /// </summary>
  185. public class MeshImportOptions : ImportOptions
  186. {
  187. /// <summary>
  188. /// Creates new mesh import options with default values.
  189. /// </summary>
  190. public MeshImportOptions()
  191. {
  192. Internal_CreateInstance(this);
  193. }
  194. /// <summary>
  195. /// Determines whether the mesh data is also stored in main memory, available for fast CPU access.
  196. /// </summary>
  197. public bool CPUCached
  198. {
  199. get { return Internal_GetCPUCached(mCachedPtr); }
  200. set { Internal_SetCPUCached(mCachedPtr, value); }
  201. }
  202. /// <summary>
  203. /// Controls should mesh normals be imported if available.
  204. /// </summary>
  205. public bool ImportNormals
  206. {
  207. get { return Internal_GetImportNormals(mCachedPtr); }
  208. set { Internal_SetImportNormals(mCachedPtr, value); }
  209. }
  210. /// <summary>
  211. /// Controls should mesh tangents/bitangents be imported if available.
  212. /// </summary>
  213. public bool ImportTangents
  214. {
  215. get { return Internal_GetImportTangents(mCachedPtr); }
  216. set { Internal_SetImportTangents(mCachedPtr, value); }
  217. }
  218. /// <summary>
  219. /// Controls should mesh skin data like bone weights, indices and bind poses be imported if available.
  220. /// </summary>
  221. public bool ImportSkin
  222. {
  223. get { return Internal_GetImportSkin(mCachedPtr); }
  224. set { Internal_SetImportSkin(mCachedPtr, value); }
  225. }
  226. /// <summary>
  227. /// Controls should animation clips be imported if available.
  228. /// </summary>
  229. public bool ImportAnimation
  230. {
  231. get { return Internal_GetImportAnimation(mCachedPtr); }
  232. set { Internal_SetImportAnimation(mCachedPtr, value); }
  233. }
  234. /// <summary>
  235. /// Controls should mesh blend shapes be imported if available.
  236. /// </summary>
  237. public bool ImportBlendShapes
  238. {
  239. get { return Internal_GetImportBlendShapes(mCachedPtr); }
  240. set { Internal_SetImportBlendShapes(mCachedPtr, value); }
  241. }
  242. /// <summary>
  243. /// Uniformly scales the imported mesh by the specified value.
  244. /// </summary>
  245. public float Scale
  246. {
  247. get { return Internal_GetScale(mCachedPtr); }
  248. set { Internal_SetScale(mCachedPtr, value); }
  249. }
  250. /// <summary>
  251. /// Determines if keyframe reduction is enabled. Keyframe reduction will reduce the number of key-frames in an
  252. /// animation clip by removing identical keyframes, and therefore reducing the size of the clip.
  253. /// </summary>
  254. public bool KeyframeReduction
  255. {
  256. get { return Internal_GetKeyFrameReduction(mCachedPtr); }
  257. set { Internal_SetKeyFrameReduction(mCachedPtr, value); }
  258. }
  259. /// <summary>
  260. /// Determines if import of root motion curves is enabled. When enabled, any animation curves in imported animations
  261. /// affecting the root bone will be available through a set of separate curves in AnimationClip, and they won't be
  262. /// evaluated through normal animation process. Instead it is expected that the user evaluates the curves manually
  263. /// and applies them as required.
  264. /// </summary>
  265. public bool ImportRootMotion
  266. {
  267. get { return Internal_GetRootMotion(mCachedPtr); }
  268. set { Internal_SetRootMotion(mCachedPtr, value); }
  269. }
  270. /// <summary>
  271. /// Controls what type (if any) of collision mesh should be imported.
  272. /// </summary>
  273. public CollisionMeshType CollisionMeshType
  274. {
  275. get { return (CollisionMeshType)Internal_GetCollisionMeshType(mCachedPtr); }
  276. set { Internal_SetCollisionMeshType(mCachedPtr, (int)value); }
  277. }
  278. /// <summary>
  279. /// Split information that allows you to split the animation clip contained in the mesh file into multiple separate
  280. /// clips. The split always applies to the first clip in the file (if the file contains multiple), other clips are
  281. /// imported as is.
  282. /// </summary>
  283. public AnimationSplitInfo[] AnimationClipSplits
  284. {
  285. get { return Internal_GetAnimationClipSplits(mCachedPtr); }
  286. set { Internal_SetAnimationClipSplits(mCachedPtr, value); }
  287. }
  288. /// <summary>
  289. /// A set of events that will be added to the animation clip, if animation import is enabled.
  290. /// </summary>
  291. public ImportedAnimationEvents[] AnimationEvents
  292. {
  293. get { return Internal_GetAnimationEvents(mCachedPtr); }
  294. set { Internal_SetAnimationEvents(mCachedPtr, value); }
  295. }
  296. [MethodImpl(MethodImplOptions.InternalCall)]
  297. private static extern void Internal_CreateInstance(MeshImportOptions instance);
  298. [MethodImpl(MethodImplOptions.InternalCall)]
  299. private static extern bool Internal_GetCPUCached(IntPtr thisPtr);
  300. [MethodImpl(MethodImplOptions.InternalCall)]
  301. private static extern void Internal_SetCPUCached(IntPtr thisPtr, bool value);
  302. [MethodImpl(MethodImplOptions.InternalCall)]
  303. private static extern bool Internal_GetImportNormals(IntPtr thisPtr);
  304. [MethodImpl(MethodImplOptions.InternalCall)]
  305. private static extern void Internal_SetImportNormals(IntPtr thisPtr, bool value);
  306. [MethodImpl(MethodImplOptions.InternalCall)]
  307. private static extern bool Internal_GetImportTangents(IntPtr thisPtr);
  308. [MethodImpl(MethodImplOptions.InternalCall)]
  309. private static extern void Internal_SetImportTangents(IntPtr thisPtr, bool value);
  310. [MethodImpl(MethodImplOptions.InternalCall)]
  311. private static extern bool Internal_GetImportSkin(IntPtr thisPtr);
  312. [MethodImpl(MethodImplOptions.InternalCall)]
  313. private static extern void Internal_SetImportSkin(IntPtr thisPtr, bool value);
  314. [MethodImpl(MethodImplOptions.InternalCall)]
  315. private static extern bool Internal_GetImportAnimation(IntPtr thisPtr);
  316. [MethodImpl(MethodImplOptions.InternalCall)]
  317. private static extern void Internal_SetImportAnimation(IntPtr thisPtr, bool value);
  318. [MethodImpl(MethodImplOptions.InternalCall)]
  319. private static extern bool Internal_GetImportBlendShapes(IntPtr thisPtr);
  320. [MethodImpl(MethodImplOptions.InternalCall)]
  321. private static extern void Internal_SetImportBlendShapes(IntPtr thisPtr, bool value);
  322. [MethodImpl(MethodImplOptions.InternalCall)]
  323. private static extern bool Internal_GetKeyFrameReduction(IntPtr thisPtr);
  324. [MethodImpl(MethodImplOptions.InternalCall)]
  325. private static extern void Internal_SetKeyFrameReduction(IntPtr thisPtr, bool value);
  326. [MethodImpl(MethodImplOptions.InternalCall)]
  327. private static extern bool Internal_GetRootMotion(IntPtr thisPtr);
  328. [MethodImpl(MethodImplOptions.InternalCall)]
  329. private static extern void Internal_SetRootMotion(IntPtr thisPtr, bool value);
  330. [MethodImpl(MethodImplOptions.InternalCall)]
  331. private static extern AnimationSplitInfo[] Internal_GetAnimationClipSplits(IntPtr thisPtr);
  332. [MethodImpl(MethodImplOptions.InternalCall)]
  333. private static extern void Internal_SetAnimationClipSplits(IntPtr thisPtr, AnimationSplitInfo[] value);
  334. [MethodImpl(MethodImplOptions.InternalCall)]
  335. private static extern ImportedAnimationEvents[] Internal_GetAnimationEvents(IntPtr thisPtr);
  336. [MethodImpl(MethodImplOptions.InternalCall)]
  337. private static extern void Internal_SetAnimationEvents(IntPtr thisPtr, ImportedAnimationEvents[] value);
  338. [MethodImpl(MethodImplOptions.InternalCall)]
  339. private static extern float Internal_GetScale(IntPtr thisPtr);
  340. [MethodImpl(MethodImplOptions.InternalCall)]
  341. private static extern void Internal_SetScale(IntPtr thisPtr, float value);
  342. [MethodImpl(MethodImplOptions.InternalCall)]
  343. private static extern int Internal_GetCollisionMeshType(IntPtr thisPtr);
  344. [MethodImpl(MethodImplOptions.InternalCall)]
  345. private static extern void Internal_SetCollisionMeshType(IntPtr thisPtr, int value);
  346. }
  347. /// <summary>
  348. /// Controls what type of collision mesh should be imported during mesh import.
  349. /// </summary>
  350. public enum CollisionMeshType // Note: Must match C++ enum CollisionMeshImport
  351. {
  352. /// <summary>
  353. /// No collision mesh will be imported.
  354. /// </summary>
  355. None,
  356. /// <summary>
  357. /// Normal triangle mesh will be imported.
  358. /// </summary>
  359. Normal,
  360. /// <summary>
  361. /// A convex hull will be generated from the source mesh.
  362. /// </summary>
  363. Convex
  364. }
  365. /// <summary>
  366. /// Import options that provide various options for controlling how is a font resource imported.
  367. /// </summary>
  368. public class FontImportOptions : ImportOptions
  369. {
  370. /// <summary>
  371. /// Creates new font import options with default values.
  372. /// </summary>
  373. public FontImportOptions()
  374. {
  375. Internal_CreateInstance(this);
  376. }
  377. /// <summary>
  378. /// Font sizes in points that are to be imported.
  379. /// </summary>
  380. public int[] FontSizes
  381. {
  382. get { return Internal_GetFontSizes(mCachedPtr); }
  383. set { Internal_SetFontSizes(mCachedPtr, value); }
  384. }
  385. /// <summary>
  386. /// Dots per inch resolution to use when rendering the characters into the texture.
  387. /// </summary>
  388. public int DPI
  389. {
  390. get { return Internal_GetDPI(mCachedPtr); }
  391. set { Internal_SetDPI(mCachedPtr, value); }
  392. }
  393. /// <summary>
  394. /// Determines rendering mode used when rendering the characters into the bitmap.
  395. /// </summary>
  396. public FontRenderMode RenderMode
  397. {
  398. get { return Internal_GetRenderMode(mCachedPtr); }
  399. set { Internal_SetRenderMode(mCachedPtr, value); }
  400. }
  401. /// <summary>
  402. /// Determines should the characters be rendered in bold style.
  403. /// </summary>
  404. public bool Bold
  405. {
  406. get { return Internal_GetBold(mCachedPtr); }
  407. set { Internal_SetBold(mCachedPtr, value); }
  408. }
  409. /// <summary>
  410. /// Determines should the characters be rendered in italic style.
  411. /// </summary>
  412. public bool Italic
  413. {
  414. get { return Internal_GetItalic(mCachedPtr); }
  415. set { Internal_SetItalic(mCachedPtr, value); }
  416. }
  417. /// <summary>
  418. /// Determines character ranges to import from the font. Ranges are defined as unicode numbers.
  419. /// </summary>
  420. public CharRange[] CharRanges
  421. {
  422. get { return Internal_GetCharRanges(mCachedPtr); }
  423. set { Internal_SetCharRanges(mCachedPtr, value); }
  424. }
  425. [MethodImpl(MethodImplOptions.InternalCall)]
  426. private static extern void Internal_CreateInstance(FontImportOptions instance);
  427. [MethodImpl(MethodImplOptions.InternalCall)]
  428. private static extern int[] Internal_GetFontSizes(IntPtr thisPtr);
  429. [MethodImpl(MethodImplOptions.InternalCall)]
  430. private static extern void Internal_SetFontSizes(IntPtr thisPtr, int[] value);
  431. [MethodImpl(MethodImplOptions.InternalCall)]
  432. private static extern int Internal_GetDPI(IntPtr thisPtr);
  433. [MethodImpl(MethodImplOptions.InternalCall)]
  434. private static extern void Internal_SetDPI(IntPtr thisPtr, int value);
  435. [MethodImpl(MethodImplOptions.InternalCall)]
  436. private static extern FontRenderMode Internal_GetRenderMode(IntPtr thisPtr);
  437. [MethodImpl(MethodImplOptions.InternalCall)]
  438. private static extern void Internal_SetRenderMode(IntPtr thisPtr, FontRenderMode value);
  439. [MethodImpl(MethodImplOptions.InternalCall)]
  440. private static extern bool Internal_GetBold(IntPtr thisPtr);
  441. [MethodImpl(MethodImplOptions.InternalCall)]
  442. private static extern void Internal_SetBold(IntPtr thisPtr, bool value);
  443. [MethodImpl(MethodImplOptions.InternalCall)]
  444. private static extern bool Internal_GetItalic(IntPtr thisPtr);
  445. [MethodImpl(MethodImplOptions.InternalCall)]
  446. private static extern void Internal_SetItalic(IntPtr thisPtr, bool value);
  447. [MethodImpl(MethodImplOptions.InternalCall)]
  448. private static extern CharRange[] Internal_GetCharRanges(IntPtr thisPtr);
  449. [MethodImpl(MethodImplOptions.InternalCall)]
  450. private static extern void Internal_SetCharRanges(IntPtr thisPtr, CharRange[] value);
  451. }
  452. /// <summary>
  453. /// Provides various options for controlling how is a script file imported.
  454. /// </summary>
  455. public class ScriptCodeImportOptions : ImportOptions
  456. {
  457. /// <summary>
  458. /// Creates new script import options with default values.
  459. /// </summary>
  460. public ScriptCodeImportOptions()
  461. {
  462. Internal_CreateInstance(this);
  463. }
  464. /// <summary>
  465. /// Determines whether the script is editor-only or a normal game script. Editor scripts are compiled in a separate
  466. /// assembly and may reference editor specific functionality, but are not available in the final game code.
  467. /// </summary>
  468. public bool EditorScript
  469. {
  470. get { return Internal_IsEditorScript(mCachedPtr); }
  471. set { Internal_SetEditorScript(mCachedPtr, value); }
  472. }
  473. [MethodImpl(MethodImplOptions.InternalCall)]
  474. private static extern void Internal_CreateInstance(ScriptCodeImportOptions instance);
  475. [MethodImpl(MethodImplOptions.InternalCall)]
  476. private static extern bool Internal_IsEditorScript(IntPtr thisPtr);
  477. [MethodImpl(MethodImplOptions.InternalCall)]
  478. private static extern void Internal_SetEditorScript(IntPtr thisPtr, bool value);
  479. }
  480. /// <summary>
  481. /// Determines how is a font rendered into the bitmap texture.
  482. /// </summary>
  483. public enum FontRenderMode // Note: Must match C++ enum FontRenderMode
  484. {
  485. /// <summary>Render antialiased fonts without hinting (slightly more blurry).</summary>
  486. Smooth,
  487. /// <summary>Render non-antialiased fonts without hinting (slightly more blurry).</summary>
  488. Raster,
  489. /// <summary>Render antialiased fonts with hinting.</summary>
  490. HintedSmooth,
  491. /// <summary>Render non-antialiased fonts with hinting.</summary>
  492. HintedRaster
  493. }
  494. /// <summary>
  495. /// Provides various options for controlling how is an audio clip file imported.
  496. /// </summary>
  497. public class AudioClipImportOptions : ImportOptions
  498. {
  499. /// <summary>
  500. /// Creates new audio clip import options with default values.
  501. /// </summary>
  502. public AudioClipImportOptions()
  503. {
  504. Internal_CreateInstance(this);
  505. }
  506. /// <summary>
  507. /// Format to import the audio clip as.
  508. /// </summary>
  509. public AudioFormat Format
  510. {
  511. get { return Internal_GetFormat(mCachedPtr); }
  512. set { Internal_SetFormat(mCachedPtr, value); }
  513. }
  514. /// <summary>
  515. /// Determines how is audio data loaded into memory.
  516. /// </summary>
  517. public AudioReadMode ReadMode
  518. {
  519. get { return Internal_GetReadMode(mCachedPtr); }
  520. set { Internal_SetReadMode(mCachedPtr, value); }
  521. }
  522. /// <summary>
  523. /// Determines will the clip be played as spatial (3D) audio or as normal audio.
  524. /// </summary>
  525. public bool Is3D
  526. {
  527. get { return Internal_GetIs3D(mCachedPtr); }
  528. set { Internal_SetIs3D(mCachedPtr, value); }
  529. }
  530. /// <summary>
  531. /// Size of a single sample in bits.
  532. /// </summary>
  533. public AudioBitDepth BitDepth
  534. {
  535. get
  536. {
  537. int bits = Internal_GetBitDepth(mCachedPtr);
  538. switch (bits)
  539. {
  540. case 8:
  541. return AudioBitDepth.Bits8;
  542. case 16:
  543. return AudioBitDepth.Bits16;
  544. case 24:
  545. return AudioBitDepth.Bits24;
  546. case 32:
  547. return AudioBitDepth.Bits32;
  548. }
  549. return AudioBitDepth.Bits16;
  550. }
  551. set { Internal_SetBitDepth(mCachedPtr, (int)value); }
  552. }
  553. [MethodImpl(MethodImplOptions.InternalCall)]
  554. private static extern void Internal_CreateInstance(AudioClipImportOptions instance);
  555. [MethodImpl(MethodImplOptions.InternalCall)]
  556. private static extern AudioFormat Internal_GetFormat(IntPtr thisPtr);
  557. [MethodImpl(MethodImplOptions.InternalCall)]
  558. private static extern void Internal_SetFormat(IntPtr thisPtr, AudioFormat format);
  559. [MethodImpl(MethodImplOptions.InternalCall)]
  560. private static extern AudioReadMode Internal_GetReadMode(IntPtr thisPtr);
  561. [MethodImpl(MethodImplOptions.InternalCall)]
  562. private static extern void Internal_SetReadMode(IntPtr thisPtr, AudioReadMode readMode);
  563. [MethodImpl(MethodImplOptions.InternalCall)]
  564. private static extern bool Internal_GetIs3D(IntPtr thisPtr);
  565. [MethodImpl(MethodImplOptions.InternalCall)]
  566. private static extern void Internal_SetIs3D(IntPtr thisPtr, bool is3d);
  567. [MethodImpl(MethodImplOptions.InternalCall)]
  568. private static extern int Internal_GetBitDepth(IntPtr thisPtr);
  569. [MethodImpl(MethodImplOptions.InternalCall)]
  570. private static extern void Internal_SetBitDepth(IntPtr thisPtr, int bitDepth);
  571. }
  572. /** @} */
  573. }