@@ -454,15 +454,20 @@ sub ourBuildTextures
454
454
# Build texture from scratch if OpenGL::Image not available
455
455
else
456
456
{
457
- my $hole_size = 3300; # ~ == 57.45 ^ 2.
457
+ my $hole_size = int (($Tex_Width / 2.2) ** 2);
458
+ my $hole_border = int ($hole_size /30);
459
+ my $w_2 = $Tex_Width /2;
460
+ my $w_4 = $Tex_Width /4;
461
+ my $w_16 = $Tex_Width /16;
462
+ my $w_32 = $Tex_Width /32;
458
463
# Iterate across the texture array.
459
464
for (my $y =0; $y <$Tex_Height ; $y ++)
460
465
{
461
466
for (my $x =0; $x <$Tex_Width ; $x ++)
462
467
{
463
468
# A simple repeating squares pattern.
464
469
# Dark blue on white.
465
- if ( ( ($x +4)%32 < 8 ) && ( ($y +4)%32 < 8 ))
470
+ if ( ( ($x +$w_32 ) %$w_4 < $w_16 ) && ( ($y +$w_32 ) %$w_4 < $w_16 ))
466
471
{
467
472
$tex .= pack " C3" , 0,0,120; # Dark blue
468
473
}
@@ -473,13 +478,13 @@ sub ourBuildTextures
473
478
474
479
# Make a round dot in the texture's alpha-channel.
475
480
# Calculate distance to center (squared).
476
- my $t = ($x -64 )*($x -64 ) + ($y -64 )*($y -64 );
481
+ my $t = ($x -$w_2 )*($x -$w_2 ) + ($y -$w_2 )*($y -$w_2 );
477
482
478
483
if ( $t < $hole_size )
479
484
{
480
485
$tex .= pack " C" , 255; # The dot itself is opaque.
481
486
}
482
- elsif ($t < $hole_size + 100 )
487
+ elsif ($t < $hole_size + $hole_border )
483
488
{
484
489
$tex .= pack " C" , 128; # Give our dot an anti-aliased edge.
485
490
}
0 commit comments