MCPcopy Create free account
hub / github.com/codestation/qcma / GetAlphas

Method GetAlphas

common/dds.cpp:450–476  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

448 uchar bits[6];
449
450 void GetAlphas( uchar alpha_array[8] ) {
451 alpha_array[0] = alpha0;
452 alpha_array[1] = alpha1;
453
454 // 8-alpha or 6-alpha block?
455 if( alpha_array[0] > alpha_array[1] ) {
456 // 8-alpha block: derive the other 6 alphas.
457 // 000 = alpha_0, 001 = alpha_1, others are interpolated
458
459 alpha_array[2] = ( 6 * alpha0 + alpha1) / 7; // bit code 010
460 alpha_array[3] = ( 5 * alpha0 + 2 * alpha1) / 7; // Bit code 011
461 alpha_array[4] = ( 4 * alpha0 + 3 * alpha1) / 7; // Bit code 100
462 alpha_array[5] = ( 3 * alpha0 + 4 * alpha1) / 7; // Bit code 101
463 alpha_array[6] = ( 2 * alpha0 + 5 * alpha1) / 7; // Bit code 110
464 alpha_array[7] = ( alpha0 + 6 * alpha1) / 7; // Bit code 111
465 } else {
466 // 6-alpha block: derive the other alphas.
467 // 000 = alpha_0, 001 = alpha_1, others are interpolated
468
469 alpha_array[2] = (4 * alpha0 + alpha1) / 5; // Bit code 010
470 alpha_array[3] = (3 * alpha0 + 2 * alpha1) / 5; // Bit code 011
471 alpha_array[4] = (2 * alpha0 + 3 * alpha1) / 5; // Bit code 100
472 alpha_array[5] = ( alpha0 + 4 * alpha1) / 5; // Bit code 101
473 alpha_array[6] = 0x00; // Bit code 110
474 alpha_array[7] = 0xFF; // Bit code 111
475 }
476 }
477
478 void GetBits( uchar bit_array[16] ) {
479 // Split 24 packed bits into 8 bytes, 3 bits at a time.

Callers 3

LoadDXT5Function · 0.80
LoadRXGBFunction · 0.80
LoadATI2Function · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected