DDS File Reference DDS的档案编号

DDS File Reference DDS的档案编号 google自动翻译:原文地址:http://msdn.microsoft.com/en-us/library/bb172993(VS.85).aspx

The DirectDraw Surface (.dds) file format is used to store textures and cubic environment maps, both with and without mipmap levels. DirectDraw的表面(。dds的)文件格式是用来存储纹理,立方环境映射具有和不具有多重映像水平。 This format can store uncompressed and compressed pixel formats, and is the preferred file format for storing DXTn compressed data.这种格式可以存储压缩和压缩图像格式,并且是压缩数据存储DXTn首选文件格式。 This file format is supported by the DirectX Texture tool ( DirectX Texture Editor (Dxtex.exe) ), as well as some non-Microsoft tools, and by the D3DX library.此文件格式支持DirectX纹理工具(DirectX纹理编辑器(Dxtex.exe)),以及一些非微软的工具,和的D3DX库。

This format was introduced with DirectX 7.介绍了这种格式与DirectX 7。 In DirectX 8, support for volume textures was added.在DirectX 8,支持音量纹理增加了。

File Layout文件布局

The basic structure of a .dds file is a header, and one or more surfaces written to a binary file.一。DDS的文件的基本结构是一个头,以及一个或多个表面写入二进制文件。 The header consists of a FOURCC and a DDSURFACEDESC2 structure.标头包含一个都自动检测和DDSURFACEDESC2结构。 This header contains all the information needed to determine the contents of the entire file.此标头包含所有需要确定整个文件的内容的信息。 The image below shows the layout of a .dds file.下面的图片显示了。DDS的布局文件。

DDS的文件格式布局

Surface Format Header表面格式头

The DDSURFACEDESC2 structure describes the file contents using the standard flags and values defined in the DirectDraw documentation, but files should use a restricted set of values to ensure full compatibility.在DDSURFACEDESC2结构描述了文件的内容使用标准的国旗和DirectDraw的文档定义的值,但文件应该使用一套价值观限制以确保兼容性。 A robust reader should verify key values and a robust writer should ensure all required flags are set for the different fields and options to ensure easy loading by the application or other tool.阿强劲读者应核实键值和强有力的作家应确保所有必需的标志是为不同领域和选项,以确保应用程序或其它工具很容易加载。 Also, a robust reader should not use a field unless the corresponding flag is set, and a robust writer should set all undefined fields to 0.此外,强大的读者不应该使用一个字段,除非相应的标志,以及一个强大的作家应该设置为0所有未定义的领域。

The table below shows the members of the DDSURFACEDESC2 structure.下表显示的DDSURFACEDESC2结构的成员。

Member会员 Description描述 DWORD dwSize双字节值dwSize Size of structure.大小结构。 This member must be set to 124.该成员必须设置为124。 DWORD dwFlags双字节值dwFlags Flags to indicate valid fields.标志,以表明有效的领域。 Always include DDSD_CAPS, DDSD_PIXELFORMAT, DDSD_WIDTH, DDSD_HEIGHT.总是包括DDSD_CAPS,DDSD_PIXELFORMAT,DDSD_WIDTH,DDSD_HEIGHT。 DWORD dwHeight双字节值dwHeight Height of the main image in pixels主要图像的高度,以像素 DWORD dwWidth双字节值dwWidth Width of the main image in pixels主要图像的像素宽度 DWORD dwPitchOrLinearSize双字节值dwPitchOrLinearSize For uncompressed formats, this is the number of bytes per scan line (DWORD> aligned) for the main image.对于压缩格式,这是每扫描图像的主要线路(双字节值“对齐)的字节数。 dwFlags should include DDSD_PITCH in this case. dwFlags应包括在这种情况下DDSD_PITCH。 For compressed formats, this is the total number of bytes for the main image.对于压缩格式,这是个字节为主要形象的总数。 dwFlags should be include DDSD_LINEARSIZE in this case. dwFlags应该包括在这种情况下DDSD_LINEARSIZE。 DWORD dwDepth双字节值dwDepth For volume textures, this is the depth of the volume.对于批量纹理,这是卷的深度。 dwFlags should include DDSD_DEPTH in this case. dwFlags应包括在这种情况下DDSD_DEPTH。 DWORD dwMipMapCount双字节值dwMipMapCount For items with mipmap levels, this is the total number of levels in the mipmap chain of the main image.对于多重映像水平的项目,这是各级主要形象多重映像链的总数。 dwFlags should include DDSD_MIPMAPCOUNT in this case. dwFlags应包括在这种情况下DDSD_MIPMAPCOUNT。 DWORD dwReserved1[11]双字节值dwReserved1 [11] Unused未使用 DDPIXELFORMAT ddpfPixelFormat DDPIXELFORMAT ddpfPixelFormat 32-byte value that specifies the pixel format structure. 32字节值,指定的像素格式结构。 DDCAPS2 ddsCaps DDCAPS2 ddsCaps 16-byte value that specifies the capabilities structure. 16字节的值,指定的功能结构。 DWORD dwReserved2双字节值dwReserved2 Unused未使用

Note that the field names used in this description do not correspond exactly with the DDSURFACEDESC2 fields due to the restrictions placed on the .dds file format, but a standard DDSURFACEDESC2 structure can and should be used.请注意,在此字段名称用于描述不完全一致的,由于在。DDS的文件格式的限制DDSURFACEDESC2领域,而是一个标准DDSURFACEDESC2结构可以而且应该被使用。 Use the magic DDS value and the header dwSize value to validate the file.使用神奇的DDS的价值和头dwSize值来验证文件。

The pixel format of the image is given in the ddpfPixelFormat field of the header, and can describe all the formats supported by Direct3D.图像的像素格式是由于在头ddpfPixelFormat领域,可以描述的所有的Direct3D支持的格式。 DDS files are usually restricted to either RGB or FOURCC formats, and the use of other formats is not generally supported. DDS的文件通常仅限于RGB或fourcc值格式,其他格式的使用并不普遍支持。 Restrict usage to RGB formats A8R8G8B8, A1R5G5B5, A4R4G4B4, R8G8B8, R5G6B5; and FOURCC formats DXT1, DXT2, DXT3, DXT4, and DXT5 to ensure the best support.限制使用RGB格式A8R8G8B8,A1R5G5B5,A4R4G4B4,R8G8B8,R5G6B5和fourcc值格式DXT1,DXT2,DXT3,DXT4,并DXT5,以确保最佳的支持。 A well-written reader should handle more formats, if possible.良好的书面读者应该处理更多的格式,如果可能的话。

The following table shows the layout of the DDPIXELFORMAT structure.下表显示了DDPIXELFORMAT结构布局。

Member会员 Description描述 DWORD dwSize双字节值dwSize Size of structure.大小结构。 This member must be set to 32.该成员必须设置为32。 DWORD dwFlags双字节值dwFlags Flags to indicate valid fields.标志,以表明有效的领域。 Uncompressed formats will usually use DDPF_RGB to indicate an RGB format, while compressed formats will use DDPF_FOURCC with a four-character code.无压缩格式,一般会用DDPF_RGB,以表示RGB格式,而压缩格式将使用四个字符的代码DDPF_FOURCC。 DWORD dwFourCC双字节值dwFourCC This is the four-character code for compressed formats.这是4个字符的压缩格式的代码。 dwFlags should include DDPF_FOURCC in this case. dwFlags应包括在这种情况下DDPF_FOURCC。 For DXTn compression, this is set to "DXT1", "DXT2", "DXT3", "DXT4", or "DXT5".对于DXTn压缩,这是设置为“DXT1”,“DXT2”,“DXT3”,“DXT4”或“DXT5”。 DWORD dwRGBBitCount双字节值dwRGBBitCount For RGB formats, this is the total number of bits in the format.对于RGB格式,这是位格式的总数。 dwFlags should include DDPF_RGB in this case. dwFlags应包括在这种情况下DDPF_RGB。 This value is usually 16, 24, or 32.这个值通常是16,24或32。 For A8R8G8B8, this value would be 32.对于A8R8G8B8,此值将是32。 DWORD dwRBitMask, DWORD dwGBitMask, DWORD dwBBitMask双字节值dwRBitMask,双字节值dwGBitMask,双字节值dwBBitMask For RGB formats, these three fields contain the masks for the red, green, and blue channels.对于RGB格式,这三个领域包含了红色,绿色和蓝色通道的面具。 For A8R8G8B8, these values would be 0x00ff0000, 0x0000ff00, and 0x000000ff respectively.对于A8R8G8B8,这些值将0x00ff0000,0x0000ff00和0x000000ff分别。 DWORD dwRGBAlphaBitMask双字节值dwRGBAlphaBitMask For RGB formats, this contains the mask for the alpha channel, if any.对于RGB格式,这包含了alpha通道面具,如果有的话。 dwFlags should include DDPF_ALPHAPIXELS in this case. dwFlags应包括在这种情况下DDPF_ALPHAPIXELS。 For A8R8G8B8, this value would be 0xff000000.对于A8R8G8B8,此值将0xff000000。

The final details of the format are inferred from the capabilities bits set in the ddsCaps field of the header.格式的最后细节推断,在头ddsCaps字段设置的功能位。 The layout of the ddsCaps structure is shown in the table below.该ddsCaps结构布局载于下表。

Member会员 Description描述 DWORD dwCaps1双字节值dwCaps1 DDS files should always include DDSCAPS_TEXTURE. DDS的文件应该包括DDSCAPS_TEXTURE。 If the file contains mipmaps, DDSCAPS_MIPMAP should be set.如果该文件包含mipmaps,DDSCAPS_MIPMAP应设置。 For any .dds file with more than one main surface, such as a mipmaps, cubic environment map, or volume texture, DDSCAPS_COMPLEX should also be set.对于任何。dds的文件中有一个以上的主要表面如mipmaps,立方环境映射,或体积纹理,DDSCAPS_COMPLEX也应该建立。 DWORD dwCaps2双字节值dwCaps2 For cubic environment maps, DDSCAPS2_CUBEMAP should be included as well as one or more faces of the map (DDSCAPS2_CUBEMAP_POSITIVEX, DDSCAPS2_CUBEMAP_NEGATIVEX, DDSCAPS2_CUBEMAP_POSITIVEY, DDSCAPS2_CUBEMAP_NEGATIVEY, DDSCAPS2_CUBEMAP_POSITIVEZ, DDSCAPS2_CUBEMAP_NEGATIVEZ).对于立方环境映射,DDSCAPS2_CUBEMAP应列入以及一个或多个面的地图(DDSCAPS2_CUBEMAP_POSITIVEX,DDSCAPS2_CUBEMAP_NEGATIVEX,DDSCAPS2_CUBEMAP_POSITIVEY,DDSCAPS2_CUBEMAP_NEGATIVEY,DDSCAPS2_CUBEMAP_POSITIVEZ,DDSCAPS2_CUBEMAP_NEGATIVEZ)。 For volume textures, DDSCAPS2_VOLUME should be included.对于批量的纹理,DDSCAPS2_VOLUME应包括在内。 DWORD Reserved[2]双字节值保留[2] Unused未使用

Note that as of DirectX 8, cubic environment maps are always written with all faces defined.请注意,由于DirectX的8立方环境映射总是面临的所有书面界定。

DDS File Layout for Textures DDS的文件布局纹理 DDS File Layout for Cubic Environment Maps DDS的文件布局立方环境映射 DDS File Layout for Volume Textures DDS的文件布局体积纹理 DDS Bit Flag Values DDS位标志值
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值