MCPcopy Create free account
hub / github.com/GarageGames/Torque3D / writeHeader

Method writeHeader

Engine/source/gfx/bitmap/ddsLoader.cpp:619–713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

617}
618
619bool DDSFile::writeHeader( Stream &s )
620{
621 // Read the FOURCC
622 s.write( 4, "DDS " );
623
624 U32 tmp = 0;
625
626 // Read the size of the header.
627 s.write( 124 );
628
629 // Read some flags...
630 U32 ddsdFlags = DDSDCaps | DDSDPixelFormat | DDSDWidth | DDSDHeight;
631
632 if ( mFlags.test( CompressedData ) )
633 ddsdFlags |= DDSDLinearSize;
634 else
635 ddsdFlags |= DDSDPitch;
636
637 if ( mMipMapCount > 0 )
638 ddsdFlags |= DDSDMipMapCount;
639
640 s.write( ddsdFlags );
641
642 // Read height and width (always present)
643 s.write( mHeight );
644 s.write( mWidth );
645
646 // Ok, some flags are set, so let's do some reading.
647 s.write( mPitchOrLinearSize );
648
649 // Do we need to read depth? If so, we are a volume texture!
650 s.write( mDepth );
651
652 // Deal with mips!
653 s.write( mMipMapCount );
654
655 // Deal with 11 DWORDS of reserved space (this reserved space brought to
656 // you by DirectDraw and the letters F and U).
657 for(U32 i=0; i<11; i++)
658 s.write( tmp ); // is this right?
659
660 // Now we're onto the pixel format!
661
662 // This is the size, in bits,
663 // of the pixel format data.
664 tmp = 32;
665 s.write( tmp );
666
667 U32 ddpfFlags;
668
669 U32 fourCC = 0;
670
671 if ( mFlags.test( CompressedData ) )
672 {
673 ddpfFlags = DDPFFourCC;
674 if (mFormat == GFXFormatDXT1)
675 fourCC = FOURCC_DXT1;
676 if (mFormat == GFXFormatDXT3)

Callers

nothing calls this directly

Calls 2

writeMethod · 0.45
testMethod · 0.45

Tested by

no test coverage detected