MCPcopy Create free account
hub / github.com/TorqueGameEngines/Torque3D / WriteAlphaBlock

Function WriteAlphaBlock

Engine/lib/squish/alpha.cpp:144–172  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

142}
143
144static void WriteAlphaBlock( int alpha0, int alpha1, u8 const* indices, void* block )
145{
146 u8* bytes = reinterpret_cast< u8* >( block );
147
148 // write the first two bytes
149 bytes[0] = ( u8 )alpha0;
150 bytes[1] = ( u8 )alpha1;
151
152 // pack the indices with 3 bits each
153 u8* dest = bytes + 2;
154 u8 const* src = indices;
155 for( int i = 0; i < 2; ++i )
156 {
157 // pack 8 3-bit values
158 int value = 0;
159 for( int j = 0; j < 8; ++j )
160 {
161 int index = *src++;
162 value |= ( index << 3*j );
163 }
164
165 // store in 3 bytes
166 for( int j = 0; j < 3; ++j )
167 {
168 int byte = ( value >> 8*j ) & 0xff;
169 *dest++ = ( u8 )byte;
170 }
171 }
172}
173
174static void WriteAlphaBlock5( int alpha0, int alpha1, u8 const* indices, void* block )
175{

Callers 2

WriteAlphaBlock5Function · 0.85
WriteAlphaBlock7Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected