@@ -2444,9 +2444,9 @@ static void R_CreateFogImage()
2444
2444
R_CreateDefaultImage
2445
2445
==================
2446
2446
*/
2447
- static const int DEFAULT_SIZE = 128 ;
2448
2447
static void R_CreateDefaultImage ()
2449
2448
{
2449
+ constexpr int DEFAULT_SIZE = 128 ;
2450
2450
int x;
2451
2451
byte data[ DEFAULT_SIZE ][ DEFAULT_SIZE ][ 4 ];
2452
2452
byte *dataPtr = &data[0 ][0 ][0 ];
@@ -2710,9 +2710,10 @@ R_CreateBuiltinImages
2710
2710
*/
2711
2711
void R_CreateBuiltinImages ()
2712
2712
{
2713
+ constexpr int DIMENSION = 8 ;
2713
2714
int x;
2714
- byte data[ DEFAULT_SIZE ][ DEFAULT_SIZE ][ 4 ];
2715
- byte *dataPtr = & data[ 0 ][ 0 ][ 0 ] ;
2715
+ byte data[ DIMENSION * DIMENSION * 4 ];
2716
+ byte *dataPtr = data;
2716
2717
byte *out;
2717
2718
2718
2719
R_CreateDefaultImage ();
@@ -2725,41 +2726,41 @@ void R_CreateBuiltinImages()
2725
2726
imageParams.filterType = filterType_t::FT_LINEAR;
2726
2727
imageParams.wrapType = wrapTypeEnum_t::WT_REPEAT;
2727
2728
2728
- tr.whiteImage = R_CreateImage ( " _white" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2729
+ tr.whiteImage = R_CreateImage ( " _white" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
2729
2730
2730
2731
// we use a solid black image instead of disabling texturing
2731
2732
memset ( data, 0 , sizeof ( data ) );
2732
- tr.blackImage = R_CreateImage ( " _black" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2733
+ tr.blackImage = R_CreateImage ( " _black" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
2733
2734
2734
2735
// red
2735
- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2736
+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
2736
2737
{
2737
2738
out[ 1 ] = out[ 2 ] = 0 ;
2738
2739
out[ 0 ] = out[ 3 ] = 255 ;
2739
2740
}
2740
2741
2741
- tr.redImage = R_CreateImage ( " _red" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2742
+ tr.redImage = R_CreateImage ( " _red" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
2742
2743
2743
2744
// green
2744
- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2745
+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
2745
2746
{
2746
2747
out[ 0 ] = out[ 2 ] = 0 ;
2747
2748
out[ 1 ] = out[ 3 ] = 255 ;
2748
2749
}
2749
2750
2750
- tr.greenImage = R_CreateImage ( " _green" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2751
+ tr.greenImage = R_CreateImage ( " _green" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
2751
2752
2752
2753
// blue
2753
- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2754
+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
2754
2755
{
2755
2756
out[ 0 ] = out[ 1 ] = 0 ;
2756
2757
out[ 2 ] = out[ 3 ] = 255 ;
2757
2758
}
2758
2759
2759
- tr.blueImage = R_CreateImage ( " _blue" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2760
+ tr.blueImage = R_CreateImage ( " _blue" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
2760
2761
2761
2762
// generate a default normalmap with a fully opaque heightmap (no displacement)
2762
- for ( x = DEFAULT_SIZE * DEFAULT_SIZE , out = & data[ 0 ][ 0 ][ 0 ] ; x; --x, out += 4 )
2763
+ for ( x = DIMENSION * DIMENSION , out = data; x; --x, out += 4 )
2763
2764
{
2764
2765
out[ 0 ] = out[ 1 ] = 128 ;
2765
2766
out[ 2 ] = 255 ;
@@ -2768,7 +2769,7 @@ void R_CreateBuiltinImages()
2768
2769
2769
2770
imageParams.bits = IF_NOPICMIP | IF_NORMALMAP;
2770
2771
2771
- tr.flatImage = R_CreateImage ( " _flat" , ( const byte ** ) &dataPtr, 8 , 8 , 1 , imageParams );
2772
+ tr.flatImage = R_CreateImage ( " _flat" , ( const byte ** ) &dataPtr, DIMENSION, DIMENSION , 1 , imageParams );
2772
2773
2773
2774
imageParams.bits = IF_NOPICMIP;
2774
2775
imageParams.wrapType = wrapTypeEnum_t::WT_CLAMP;
0 commit comments