Single monochrome texture working
This commit is contained in:
parent
adf11abd16
commit
f6ce668aef
@ -44,12 +44,16 @@ MAP_SIZE = 16
|
||||
DOF = 2*MAP_SIZE # Depth Of Field
|
||||
|
||||
TEXTURE = [
|
||||
1, 0, 1, 0,
|
||||
0, 1, 0, 1,
|
||||
1, 0, 1, 0,
|
||||
0, 1, 0, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 0, 0, 0, 0, 0, 1,
|
||||
1, 0, 1, 0, 0, 0, 0, 1,
|
||||
1, 0, 0, 1, 0, 0, 0, 1,
|
||||
1, 0, 0, 0, 1, 0, 0, 1,
|
||||
1, 0, 0, 0, 0, 1, 0, 1,
|
||||
1, 0, 0, 0, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1,
|
||||
]
|
||||
TEXTURE_SIZE = 4
|
||||
TEXTURE_SIZE = 8
|
||||
|
||||
class Main:
|
||||
|
||||
@ -291,13 +295,15 @@ class Main:
|
||||
textureSegmentLength = lineHeight / TEXTURE_SIZE
|
||||
textureSegmentStart = lineOffset + textureColumnPixel * textureSegmentLength
|
||||
textureSegmentEnd = textureSegmentStart + textureSegmentLength
|
||||
# Obtain texture value in the pixel representing the current segment
|
||||
texColumn = 1
|
||||
texel = TEXTURE[texColumn + textureColumnPixel * TEXTURE_SIZE]
|
||||
# Calculate shading
|
||||
shading = 255
|
||||
# Obtain texture value in the pixel representing the current segment and calculate shading
|
||||
if vertDist > horizDist:
|
||||
texColumn = int(rayX / (MAP_SCALE / TEXTURE_SIZE) % TEXTURE_SIZE)
|
||||
shading = 127
|
||||
else:
|
||||
texColumn = int(rayY / (MAP_SCALE / TEXTURE_SIZE) % TEXTURE_SIZE)
|
||||
shading = 255
|
||||
|
||||
texel = TEXTURE[texColumn + textureColumnPixel * TEXTURE_SIZE]
|
||||
# Calculate color resulting from texture pixel value + shading
|
||||
color = sdl2.ext.Color(texel*shading,texel*shading,texel*shading,255)
|
||||
# Clipping
|
||||
|
Loading…
Reference in New Issue
Block a user