選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 
 
 

141 行
4.4 KiB

  1. /*
  2. ---------------------------------------------------------------------------
  3. Open Asset Import Library (ASSIMP)
  4. ---------------------------------------------------------------------------
  5. Copyright (c) 2006-2009, ASSIMP Development Team
  6. All rights reserved.
  7. Redistribution and use of this software in source and binary forms,
  8. with or without modification, are permitted provided that the following
  9. conditions are met:
  10. * Redistributions of source code must retain the above
  11. copyright notice, this list of conditions and the
  12. following disclaimer.
  13. * Redistributions in binary form must reproduce the above
  14. copyright notice, this list of conditions and the
  15. following disclaimer in the documentation and/or other
  16. materials provided with the distribution.
  17. * Neither the name of the ASSIMP team, nor the names of its
  18. contributors may be used to endorse or promote products
  19. derived from this software without specific prior
  20. written permission of the ASSIMP Development Team.
  21. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. ---------------------------------------------------------------------------
  33. */
  34. /**
  35. * The data structures necessary to use Assimip with a custom IO system.
  36. */
  37. module assimp.fileIO;
  38. import assimp.types;
  39. extern ( C ) {
  40. // aiFile callbacks
  41. alias size_t function( aiFile*, char*, size_t, size_t ) aiFileWriteProc;
  42. alias size_t function( aiFile*, char*, size_t, size_t ) aiFileReadProc;
  43. alias size_t function( aiFile* ) aiFileTellProc;
  44. alias void function( aiFile* ) aiFileFlushProc;
  45. alias aiReturn function( aiFile*, size_t, aiOrigin ) aiFileSeek;
  46. // aiFileIO callbacks
  47. alias aiFile* function( aiFileIO*, char*, char* ) aiFileOpenProc;
  48. alias void function( aiFileIO*, aiFile* ) aiFileCloseProc;
  49. /**
  50. * Represents user-defined data.
  51. */
  52. alias char* aiUserData;
  53. /**
  54. * File system callbacks.
  55. *
  56. * Provided are functions to open and close files. Supply a custom structure
  57. * to the import function. If you don't, a default implementation is used.
  58. * Use custom file systems to enable reading from other sources, such as
  59. * ZIPs or memory locations.
  60. */
  61. struct aiFileIO {
  62. /**
  63. * Function used to open a new file
  64. */
  65. aiFileOpenProc OpenProc;
  66. /**
  67. * Function used to close an existing file
  68. */
  69. aiFileCloseProc CloseProc;
  70. /**
  71. * User-defined, opaque data.
  72. */
  73. aiUserData UserData;
  74. }
  75. /**
  76. * File callbacks.
  77. *
  78. * Actually, it's a data structure to wrap a set of <code>fXXXX</code>
  79. * (e.g <code>fopen()</code>) replacement functions.
  80. *
  81. * The default implementation of the functions utilizes the <code>fXXX</code>
  82. * functions from the CRT. However, you can supply a custom implementation
  83. * to Assimp by passing a custom <code>aiFileIO</code>. Use this to enable
  84. * reading from other sources such as ZIP archives or memory locations.
  85. */
  86. struct aiFile {
  87. /**
  88. * Callback to read from a file.
  89. */
  90. aiFileReadProc ReadProc;
  91. /**
  92. * Callback to write to a file.
  93. */
  94. aiFileWriteProc WriteProc;
  95. /**
  96. * Callback to retrieve the current position of the file cursor
  97. * (<code>ftell()</code>).
  98. */
  99. aiFileTellProc TellProc;
  100. /**
  101. * Callback to retrieve the size of the file, in bytes.
  102. */
  103. aiFileTellProc FileSizeProc;
  104. /**
  105. * Callback to set the current position of the file cursor
  106. * (<code>fseek()</code>).
  107. */
  108. aiFileSeek SeekProc;
  109. /**
  110. * Callback to flush the file contents.
  111. */
  112. aiFileFlushProc FlushProc;
  113. /**
  114. * User-defined, opaque data.
  115. */
  116. aiUserData UserData;
  117. }
  118. }