Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
 
 
 
 
 
 

123 wiersze
4.6 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. * Contains helper structures to handle textures in Assimp.
  36. *
  37. * Used for file formats which embed their textures into the model file.
  38. * Supported are both normal textures, which are stored as uncompressed pixels,
  39. * and "compressed" textures, which are stored in a file format such as PNG or
  40. * TGA.
  41. */
  42. module assimp.texture;
  43. extern ( C ) {
  44. /**
  45. * Helper structure to represent a texel in a ARGB8888 format.
  46. *
  47. * Used by aiTexture.
  48. */
  49. struct aiTexel {
  50. align ( 1 ):
  51. ubyte b, g, r, a;
  52. }
  53. /**
  54. * Helper structure to describe an embedded texture.
  55. *
  56. * Usually textures are contained in external files but some file formats
  57. * embed them directly in the model file. There are two types of
  58. * embedded textures:
  59. *
  60. * <em>1. Uncompressed textures</em>: The color data is given in an
  61. * uncompressed format.
  62. *
  63. * <em>2. Compressed textures</em> stored in a file format like PNG or JPEG.
  64. * The raw file bytes are given so the application must utilize an image
  65. * decoder (e.g. DevIL) to get access to the actual color data.
  66. */
  67. struct aiTexture {
  68. /**
  69. * Width of the texture, in pixels.
  70. *
  71. * If <code>mHeight</code> is zero the texture is compressed in a format
  72. * like JPEG. In this case, this value specifies the size of the memory
  73. * area <code>pcData</code> is pointing to, in bytes.
  74. */
  75. uint mWidth;
  76. /**
  77. * Height of the texture, in pixels.
  78. *
  79. * If this value is zero, <code>pcData</code> points to an compressed
  80. * texture in any format (e.g. JPEG).
  81. */
  82. uint mHeight;
  83. /**
  84. * A hint from the loader to make it easier for applications to determine
  85. * the type of embedded compressed textures.
  86. *
  87. * If <code>mHeight</code> is not 0, this member is undefined. Otherwise
  88. * it is set set to '\0\0\0\0' if the loader has no additional
  89. * information about the texture file format used, or the file extension
  90. * of the format without a trailing dot. If there are multiple file
  91. * extensions for a format, the shortest extension is chosen (JPEG maps
  92. * to 'jpg', not to 'jpeg'). E.g. 'dds\0', 'pcx\0', 'jpg\0'. All
  93. * characters are lower-case. The fourth byte will always be '\0'.
  94. */
  95. char achFormatHint[4];
  96. /**
  97. * Data of the texture.
  98. *
  99. * Points to an array of <code>mWidth * mHeight</code>
  100. * <code>aiTexel</code>s. The format of the texture data is always
  101. * ARGB8888 to make the implementation for user of the library as easy as
  102. * possible.
  103. *
  104. * If <code>mHeight</code> is 0, this is a pointer to a memory buffer of
  105. * size <code>mWidth</code> containing the compressed texture data.
  106. */
  107. aiTexel* pcData;
  108. }
  109. }