Horde3D
http://www.horde3d.org/forums/

DDS cubemap loading check
http://www.horde3d.org/forums/viewtopic.php?f=3&t=1327
Page 1 of 1

Author:  phoenix64 [ 23.11.2010, 22:40 ]
Post subject:  DDS cubemap loading check

egTexture.cpp:
Code:
      if( !(ddsHeader.caps.dwCaps2 & DDSCAPS2_CM_COMPLETE) )
         raiseError( "DDS cubemap does not contain all cube sides" );


Is this correct? What about
Code:
      if((ddsHeader.caps.dwCaps2 & DDSCAPS2_CM_COMPLETE) != DDSCAPS2_CM_COMPLETE )

?
Looks more like what was intended.

EDIT:
Code:
      if( ddsHeader.pixFormat.dwRBitMask == 0x00ff0000 &&
          ddsHeader.pixFormat.dwGBitMask == 0x0000ff00 &&
          ddsHeader.pixFormat.dwBBitMask == 0x000000ff ) pixFmt = pfBGR;
      else
      if( ddsHeader.pixFormat.dwRBitMask == 0x00ff0000 &&
          ddsHeader.pixFormat.dwGBitMask == 0x0000ff00 &&
          ddsHeader.pixFormat.dwBBitMask == 0x000000ff ) pixFmt = pfRGB;

2x the same check?

Author:  marciano [ 24.11.2010, 22:17 ]
Post subject:  Re: DDS cubemap loading check

The check for the cubemap flags is correct. This is just standard bitmask/flag logic:
Code:
set flag: flags |= MY_FLAG
unset flag: flags &= ~MY_FLAG
check for flag:  if( flags & MY_FLAG )

However, the double format check is wrong of course. I think the second condition should have the red and blue masks swapped.

Author:  phoenix64 [ 25.11.2010, 14:52 ]
Post subject:  Re: DDS cubemap loading check

are you checking that at least one cube side exists, or are you checking for all sides? You initialize numSlices to 6, even if only one of the bits within DDSCAPS2_CM_COMPLETE is set, although the file only contains 5 or less sides. But that check will pass in this case as & checks for the existance of at least one bit in the area of that bit mask.

So:
Code:
set flag: flags |= MY_FLAG
unset flag: flags &= ~MY_FLAG
check for flag:  if( flags & MY_FLAG )
check for a single bit in a mask:  if( flags & MY_MASK )
check for ALL bits in a mask:  if( ( flags & MY_MASK ) == MY_MASK )

Author:  marciano [ 29.11.2010, 21:39 ]
Post subject:  Re: DDS cubemap loading check

Ah right, DDSCAPS2_CM_COMPLETE is a combination of several flags, so you are right. Will be fixed, thanks for bringing this up.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/