Good topic, great examples.
Here you are 3 in 1
Enjoy (Use A and D keys in PC usage)
// Project: ..::..
// Created: 2021-12-26
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "*!*" )
SetWindowSize( 1920, 1080, 0 )
SetWindowAllowResize( 1 ) // allow the user to resize the window
// set display properties
SetVirtualResolution( 1920, 1080 ) // doesn't have to match the window
SetOrientationAllowed( 0, 0, 0, 0 ) // allow both portrait and landscape on mobile devices
SetSyncRate( 0, 1 ) // 30fps instead of 60 to save battery
SetScissor( 0,0,0,0 ) // use the maximum available screen space, no black borders
//UseNewDefaultFonts( 1 ) // since version 2.0.22 we can use nicer default fonts
#Constant _SCREEN_WIDTH_ 240
#Constant _SCREEN_HEIGHT_ 135
#Constant _SCREEN_MIDX_ 120
#Constant _SCREEN_MIDY_ 62.5
#Constant _TEXTURE_SIZE_ 256
#Constant _TEXTURE_AND_ 255
Type _VEC_4_
X As Float
Y As Float
Z As Float
W As Float
EndType
Global ProjectionPlaneWidth As Float
Global ProjectionPlaneHeight As Float
Global ProjectionPlaneDistance As Float
Global CameraFOV As Float
Global CameraHalfFOV As Float
Global CameraDeltaAngle As Float
Global CameraAngle As _VEC_4_
Global CameraPosition As _VEC_4_
Global _GRID_SIZE_ As Float
Global TurnSpeed As Float
Global MoveSpeed As Float
Global _TEXTURE_ As Float[8, _TEXTURE_SIZE_, _TEXTURE_SIZE_, 3]
Global _EOL_ As String
_EOL_ = Chr(13) + Chr(10)
Global _MAP_ As Integer[64, 64], _SURFACE_ As Integer[_SCREEN_HEIGHT_]
Global _CHAR_SIZE_ As Float
Global _X_TILES_ As Integer, _Z_TILES_ As Integer
_LOAD_MAP_()
_CREATE_TEXTURES_()
Do
//_CLS_() no need to clear the screen
_GET_USER_INPUT_()
_RAY_CAST_()
_SHOW_CONTROLS_()
Sync()
Loop
Function _RAY_CAST_()
Local X As Integer, Y As Integer, i As Integer, Ax As Integer, Size As Integer, cX As Integer, cY As Integer, C As Integer
Local ScanAngle As Float, EyeAngle As Float, DeltaAngle As Float, f As Float, g As Float, h As Float
Local S As String, E As String
Local SinY As Float, CosY As Float, RayDirX As Float, RayDirZ As Float, StartX As Float, StartZ As Float
Local ddx As Float, ddz As Float, SideX As Float, SideZ As Float, Distance As Float
Local xMap As Integer, zMap As Integer, iX As Integer, iZ As Integer
Local StepX As Integer, StepZ As Integer, Wall As Integer, Side As Integer, WallHeight As Integer
Local YStart As Integer, YEnd As Integer
Local t00 As Float, t01 As Float, tU As Float, tV As Float, uTU As Float, tX As Integer, tY As Integer, xIntersect As Float, zIntersect As Float, vStep As Float
ScanAngle = CameraAngle.Y - CameraHalfFOV
EyeAngle = -CameraHalfFOV
DeltaAngle = CameraDeltaAngle
Size = 60
//cx = (_SCREEN_WIDTH_ - Size * _X_TILES_)/2
//cy = _SCREEN_HEIGHT_ - (_SCREEN_HEIGHT_ - Size * _Z_TILES_)/2
ScanAngle = ScanAngle - DeltaAngle
EyeAngle = EyeAngle - DeltaAngle
StartX = CameraPosition.X
StartZ = CameraPosition.Z
iX = Floor(StartX)
iZ = Floor(StartZ)
For X = 0 To _SCREEN_WIDTH_ - 1
ScanAngle = ScanAngle + DeltaAngle
EyeAngle = EyeAngle + DeltaAngle
SinY = Sin(ScanAngle)
CosY = Cos(ScanAngle)
raydirx = CosY
raydirz = SinY
ddx = sqrt(1 + (SinY * SinY)/(CosY * Cosy))
ddz = sqrt(1 + (CosY * Cosy)/(SinY * SinY))
xMap = iX
zMap = iZ
f = xMap
g = zMap
If CosY < 0
StepX = -1
SideX = (StartX - f) * ddx
Else
StepX = 1
SideX = (1 + f - StartX) * ddx
EndIf
If SinY < 0
StepZ = -1
SideZ = (StartZ - g) * ddz
Else
StepZ = 1
SideZ = (1 + g - StartZ) * ddz
EndIf
Do
If SideX < SideZ
SideX = SideX + ddx
xMap = xMap + StepX
Side = 0
Else
SideZ = SideZ + ddz
zMap = zMap + StepZ
Side = 1
EndIf
If (xMap < 0) Or (xMap >= _X_TILES_) Or (zMap < 0) Or (zMap >= _Z_TILES_) Then Exit
Wall = _MAP_[xMap, zMap]
If Wall Then Exit
Loop
If Side = 0
Distance = Abs((xMap - StartX + (1 - StepX)/2)/CosY)
tU = StartZ + ((xMap - StartX + (1 - StepX)/2)/CosY)*SinY
If CosY < 0 Then Side = 1
xIntersect = StartX + Distance * CosY / Abs(Cos(EyeAngle))
zIntersect = StartZ + Distance * SinY / Abs(Cos(EyeAngle))
Else
Distance = Abs((zMap - StartZ + (1 - StepZ)/2)/SinY)
tU = StartX + ((zMap - StartZ + (1 - StepZ)/2)/SinY)*CosY
Side = Side * 2
If SinY < 0 Then Side = 3
xIntersect = StartX + Distance * CosY / Abs(Cos(EyeAngle))
zIntersect = StartZ + Distance * SinY / Abs(Cos(EyeAngle))
EndIf
f = _SCREEN_HEIGHT_
WallHeight = Abs(Floor(f/(Distance * Cos(EyeAngle))))
Ax = X //+ 1
YStart = 0
YEnd = Floor(_SCREEN_HEIGHT_ - WallHeight)/2
If YEnd > _SCREEN_HEIGHT_ - 1 Then YEnd = _SCREEN_HEIGHT_ - 1
If YEnd < 0 Then YEnd = 0
h = YStart
f = _SCREEN_MIDY_ - h
g = X - _SCREEN_MIDX_
g = g * _TEXTURE_AND_
h = _SCREEN_WIDTH_
h = h * _TEXTURE_AND_
For i = YStart To YEnd
t00 = g/f
t01 = h/f
tU = t00 * CosY + t01 * SinY
tV = t01 * CosY - t00 * SinY
tX = tU/8
tY = tV/8
tX = tX && _TEXTURE_AND_
tY = tY && _TEXTURE_AND_
SetTextCharColor(_SURFACE_[i], X, _TEXTURE_[0, tX, tY, 2], _TEXTURE_[0, tX, tY, 1], _TEXTURE_[0, tX, tY, 0], 255)
f = f - 1
Next
YStart = (_SCREEN_HEIGHT_ - WallHeight)/2 + 1
YEnd = (_SCREEN_HEIGHT_ + WallHeight)/2
If YEnd > _SCREEN_HEIGHT_ - 1 Then YEnd = _SCREEN_HEIGHT_ - 1
If YEnd < 0 Then YEnd = 0
tU = uTU
f = WallHeight
h = _TEXTURE_AND_
VStep = h/f
tV = 0
tX = Floor(tU * _TEXTURE_AND_) && _TEXTURE_AND_
If YStart < 0
h = YStart
tv = -vSTep * h
YStart = 0
EndIf
Side = Side + 2
For i = YStart To YEnd
tY = Floor(tV) && _TEXTURE_AND_
tV = tV + VStep
SetTextCharColor(_SURFACE_[i], Ax, _TEXTURE_[Side, tX, tY, 2], _TEXTURE_[Side, tX, tY, 1], _TEXTURE_[Side, tX, tY, 0], 255)
Next
YStart = YEnd + 1
YEnd = _SCREEN_HEIGHT_ - 1
f = Ystart - _SCREEN_MIDY_
h = _TEXTURE_AND_
g = _SCREEN_MIDY_
g = g * h/Distance
For i = YStart To YEnd
t00 = g/f
t01 = h - t00
tU = t00 * xIntersect + t01 * StartX
tV = t00 * zIntersect + t01 * StartZ
tX = Floor(tU) && _TEXTURE_AND_
tY = Floor(tV) && _TEXTURE_AND_
SetTextCharColor(_SURFACE_[i], Ax, _TEXTURE_[1, tX, tY, 2], _TEXTURE_[1, tX, tY, 1], _TEXTURE_[1, tX, tY, 0], 255)
f = f + 1
Next
Next
EndFunction
Function _LOAD_MAP_()
Local S As String, i As Integer, j As Integer, k As Integer
For i = 0 To _SCREEN_WIDTH_ - 1
S = S + "Q"
Next
j = CreateText(S)
_CHAR_SIZE_ = 100
Do
SetTextSize(j, _CHAR_SIZE_)
If GetTextTotalWidth(j) < 1920 Then Exit
_CHAR_SIZE_ = _CHAR_SIZE_ - 0.5
Loop
_CHAR_SIZE_ = _CHAR_SIZE_ + 0.5
DeleteText(j)
_X_TILES_ = 32
_Z_TILES_ = 32
S = ""
S = S + "11111111111111111111111111111111"
S = S + "1 1"
S = S + "1 11111 1 1"
S = S + "1 1"
S = S + "1 1111 111 1"
S = S + "1 1 1 1"
S = S + "1 1111 1111 1 1 1"
S = S + "1 1 1 1 1 1"
S = S + "1 1 1 1"
S = S + "1 1111 1111 1"
S = S + "1 11111 1 1"
S = S + "1 1 1 1"
S = S + "11111111111 11111111 1"
S = S + "1 1 1"
S = S + "1 11111 1 1 1"
S = S + "1 1 1 1 1 1"
S = S + "1 1 1 1 11111 1"
S = S + "1 1 1 1 1 1"
S = S + "1 111 1111 1111111 1"
S = S + "1 1 1"
S = S + "1 1 1111 1"
S = S + "1 111111 1 1 1"
S = S + "1 11111 1 1"
S = S + "1 1 1"
S = S + "1 1111 1"
S = S + "1 1 1 1 1"
S = S + "1 1 1111 1 1"
S = S + "1 11111 1 11 11 111 1"
S = S + "1 1 1 1 1"
S = S + "1 1 111 1"
S = S + "1 1 1"
S = S + "11111111111111111111111111111111"
k = 1
For i = 0 To _Z_TILES_ - 1
For j = 0 To _X_TILES_ - 1
_MAP_[j, i] = 0
If Mid(S, k, 1) <> " " Then _MAP_[j, i] = 1
k = k + 1
Next
Next
_GRID_SIZE_ = 1
TurnSpeed = 50
MoveSpeed = _GRID_SIZE_
CameraPosition.X = 12.23 * _GRID_SIZE_
CameraPosition.Y = 0.5 * _GRID_SIZE_
CameraPosition.Z = 12.23 * _GRID_SIZE_
CameraPosition.W = 0 * _GRID_SIZE_
CameraFOV = 60
CameraHalfFOV = CameraFOV/2
CameraDeltaAngle = CameraFOV/(_SCREEN_WIDTH_)
ProjectionPlaneDistance = (_SCREEN_WIDTH_/2)/Tan(CameraFov/2)
For i = 0 To _SCREEN_HEIGHT_ - 1
S = ""
For j = 0 To _SCREEN_WIDTH_ - 1
S = S + Chr(65 + (Random() >> 12))
Next
_SURFACE_[i] = CreateText(S)
SetTextPosition(_SURFACE_[i], 0, i * (_CHAR_SIZE_ - 4))
SetTextSize(_SURFACE_[i], _CHAR_SIZE_)
SetTextColor(_SURFACE_[i], 0, 0, 0, 255)
Next
EndFunction
/*
Function _CLS_()
Local i As Integer
For i = 0 To _SCREEN_HEIGHT_ - 1
SetTextColor(_SURFACE_[i], 0, 0, 0, 255)
Next
EndFunction
*/
Function _SHOW_CONTROLS_()
Local X As Integer, Y As Integer, i As Integer, Ax As Integer, Bx As Integer, Ay As Integer
Ax = X + 17
Bx = _SCREEN_WIDTH_ - 21
For X = 0 To 15
Y = 15 - X
Ay = _SCREEN_HEIGHT_ - Y/2 - 25
For i = 0 To Y
SetTextCharColor(_SURFACE_[Ay + i], Ax, 255, 255, 0, 255)
SetTextCharColor(_SURFACE_[Ay + i], Bx, 255, 255, 0, 255)
Next
SetTextCharColor(_SURFACE_[2 + i], Bx - 1, 255, 0, 0, 255)
SetTextCharColor(_SURFACE_[2 + i], Bx, 255, 0, 0, 255)
SetTextCharColor(_SURFACE_[2 + i], _SCREEN_WIDTH_ - 24 + Ax, 255, 0, 0, 255)
SetTextCharColor(_SURFACE_[2 + i], _SCREEN_WIDTH_ - 24 + Ax + 1, 255, 0, 0, 255)
Ax = Ax - 1
Bx = Bx + 1
Next
EndFunction
Function _GET_USER_INPUT_()
Local _FPS_ As Float
Local Move As Float, Turn As Float, SinY As Float, CosY As Float, SinS As Float, CosS As Float, VMove As Float, HMove As Float
Local MouseMove As _VEC_4_, DeltaAngle As _VEC_4_, DeltaPos As _VEC_4_
Local xMap As Integer, zMap As Integer
_FPS_ = ScreenFPS()
Turn = TurnSpeed/_FPS_
Move = MoveSpeed/_FPS_
MouseMove.X = 0
If GetPointerState()
CosY = GetPointerX()
SinY = GetPointerY()
If SinY >= 930
If SinY <= 1070
If CosY <= 150
If CosY >= 15 Then MouseMove.X = -1
Else
If CosY >= 1780
If CosY <= 1910 Then MouseMove.X = 1
EndIf
EndIf
EndIf
EndIf
If SinY >= 30
If SinY <= 170
If CosY <= 1910
If CosY >= 1780 Then END
EndIf
EndIf
EndIf
EndIf
If GetRawKeyState(65) Then MouseMove.X = -1
If GetRawKeyState(68) Then MouseMove.X = 1
MouseMove.X = MouseMove.X * Turn
CameraAngle.Y = CameraAngle.Y + MouseMove.X
SinY = Sin(CameraAngle.Y)
CosY = Cos(CameraAngle.Y)
SinS = Sin(CameraAngle.Y + 90)
CosS = Cos(CameraAngle.Y + 90)
VMove = 1
If GetRawKeyState(Asc("W")) Then VMove = 1
If GetRawKeyState(Asc("S")) Then VMove = -1
DeltaPos.X = CosY * VMove * Move
DeltaPos.Y = 0
DeltaPos.Z = SinY * VMove * Move
DeltaPos.W = 0
CameraPosition.X = CameraPosition.X + DeltaPos.X
xMap = Floor(CameraPosition.X + DeltaPos.X)
zMap = Floor(CameraPosition.Z + DeltaPos.Z)
If _MAP_[xMap, zMap] Then CameraPosition.X = CameraPosition.X - DeltaPos.X
CameraPosition.Z = CameraPosition.Z + DeltaPos.Z
xMap = Floor(CameraPosition.X + DeltaPos.X)
zMap = Floor(CameraPosition.Z + DeltaPos.Z)
If _MAP_[xMap, zMap] Then CameraPosition.Z = CameraPosition.Z - DeltaPos.Z
EndFunction
Function _CREATE_TEXTURES_()
Local e1 As Integer, e2 As Integer, d As Integer, R As Integer, G As Integer, B As Integer, i As Integer, j As Integer
e1 = _TEXTURE_SIZE_
d = _TEXTURE_SIZE_
_TEXTURE_[0, 0, 0, 0] = 245
_TEXTURE_[0, 0, 0, 1] = 64
_TEXTURE_[0, 0, 0, 2] = 16
Do
If d <= 1 Then Exit
e2 = d/2
For i = 0 to _TEXTURE_AND_ Step d
For j = 0 to _TEXTURE_AND_ Step d
R = (_TEXTURE_[0, i, j, 2] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, j, 2] + (_RND_() - 0.5) * e1)/2
G = (_TEXTURE_[0, i, j, 1] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, j, 1] + (_RND_() - 0.5) * e1)/2
B = (_TEXTURE_[0, i, j, 0] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, j, 0] + (_RND_() - 0.5) * e1)/2
If R > 255 Then R = 255
If G > 255 Then G = 255
If B > 255 Then B = 255
If R < 0 Then R = 0
If G < 0 Then G = 0
If B < 0 Then B = 0
_TEXTURE_[0, (i + e2) && _TEXTURE_AND_, j, 0] = B
_TEXTURE_[0, (i + e2) && _TEXTURE_AND_, j, 1] = G
_TEXTURE_[0, (i + e2) && _TEXTURE_AND_, j, 2] = R
R = (_TEXTURE_[0, i, j, 2] + _TEXTURE_[0, i, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
G = (_TEXTURE_[0, i, j, 1] + _TEXTURE_[0, i, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
B = (_TEXTURE_[0, i, j, 0] + _TEXTURE_[0, i, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
If R > 255 Then R = 255
If G > 255 Then G = 255
If B > 255 Then B = 255
If R < 0 Then R = 0
If G < 0 Then G = 0
If B < 0 Then B = 0
_TEXTURE_[0, i, (j + e2) && _TEXTURE_AND_, 0] = B
_TEXTURE_[0, i, (j + e2) && _TEXTURE_AND_, 1] = G
_TEXTURE_[0, i, (j + e2) && _TEXTURE_AND_, 2] = R
R = (_TEXTURE_[0, i, j, 2] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
G = (_TEXTURE_[0, i, j, 1] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
B = (_TEXTURE_[0, i, j, 0] + _TEXTURE_[0, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
If R > 255 Then R = 255
If G > 255 Then G = 255
If B > 255 Then B = 255
If R < 0 Then R = 0
If G < 0 Then G = 0
If B < 0 Then B = 0
_TEXTURE_[0, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 0] = B
_TEXTURE_[0, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 1] = G
_TEXTURE_[0, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 2] = R
Next
Next
e1 = e1/2
d = e1
Loop
e1 = _TEXTURE_SIZE_
d = _TEXTURE_SIZE_
_TEXTURE_[1, 0, 0, 0] = 8
_TEXTURE_[1, 0, 0, 1] = 64
_TEXTURE_[1, 0, 0, 2] = 16
Do
If d <= 1 Then Exit
e2 = d/2
For i = 0 to _TEXTURE_AND_ Step d
For j = 0 to _TEXTURE_AND_ Step d
R = (_TEXTURE_[1, i, j, 2] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, j, 2] + (_RND_() - 0.5) * e1)/2
G = (_TEXTURE_[1, i, j, 1] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, j, 1] + (_RND_() - 0.5) * e1)/2
B = (_TEXTURE_[1, i, j, 0] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, j, 0] + (_RND_() - 0.5) * e1)/2
If R > 255 Then R = 255
If G > 255 Then G = 255
If B > 255 Then B = 255
If R < 0 Then R = 0
If G < 0 Then G = 0
If B < 0 Then B = 0
_TEXTURE_[1, (i + e2) && _TEXTURE_AND_, j, 0] = B
_TEXTURE_[1, (i + e2) && _TEXTURE_AND_, j, 1] = G
_TEXTURE_[1, (i + e2) && _TEXTURE_AND_, j, 2] = R
R = (_TEXTURE_[1, i, j, 2] + _TEXTURE_[1, i, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
G = (_TEXTURE_[1, i, j, 1] + _TEXTURE_[1, i, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
B = (_TEXTURE_[1, i, j, 0] + _TEXTURE_[1, i, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
If R > 255 Then R = 255
If G > 255 Then G = 255
If B > 255 Then B = 255
If R < 0 Then R = 0
If G < 0 Then G = 0
If B < 0 Then B = 0
_TEXTURE_[1, i, (j + e2) && _TEXTURE_AND_, 0] = B
_TEXTURE_[1, i, (j + e2) && _TEXTURE_AND_, 1] = G
_TEXTURE_[1, i, (j + e2) && _TEXTURE_AND_, 2] = R
R = (_TEXTURE_[1, i, j, 2] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 2] + (_RND_() - 0.5) * e1)/2
G = (_TEXTURE_[1, i, j, 1] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 1] + (_RND_() - 0.5) * e1)/2
B = (_TEXTURE_[1, i, j, 0] + _TEXTURE_[1, (i + d) && _TEXTURE_AND_, (j + d) && _TEXTURE_AND_, 0] + (_RND_() - 0.5) * e1)/2
If R > 255 Then R = 255
If G > 255 Then G = 255
If B > 255 Then B = 255
If R < 0 Then R = 0
If G < 0 Then G = 0
If B < 0 Then B = 0
_TEXTURE_[1, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 0] = B
_TEXTURE_[1, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 1] = G
_TEXTURE_[1, (i + e2) && _TEXTURE_AND_, (j + e2) && _TEXTURE_AND_, 2] = R
Next
Next
e1 = e1/2
d = e1
Loop
For i = 0 To _TEXTURE_AND_
For j = 0 To _TEXTURE_AND_
B = 4 + _RND_() * 4
G = 16 + _RND_() * 8
R = 128 + _RND_() * 32
_TEXTURE_[2, j, i, 0] = B
_TEXTURE_[2, j, i, 1] = G
_TEXTURE_[2, j, i, 2] = R
_TEXTURE_[3, j, i, 0] = B * 100/150
_TEXTURE_[3, j, i, 1] = G * 100/150
_TEXTURE_[3, j, i, 2] = R * 100/150
_TEXTURE_[4, j, i, 0] = B * 100/260
_TEXTURE_[4, j, i, 1] = G * 100/260
_TEXTURE_[4, j, i, 2] = R * 100/260
_TEXTURE_[5, j, i, 0] = B * 100/150
_TEXTURE_[5, j, i, 1] = G * 100/150
_TEXTURE_[5, j, i, 2] = R * 100/150
Next
Next
e1 = _TEXTURE_SIZE_/4
For i = 0 To 3
For G = 0 To 3
For j = 0 To _TEXTURE_AND_
R = 245 + _RND_() * 10
_TEXTURE_[2, j, i * e1 + G, 0] = R
_TEXTURE_[2, j, i * e1 + G, 1] = R
_TEXTURE_[2, j, i * e1 + G, 2] = R
_TEXTURE_[3, j, i * e1 + G, 0] = R * 100/150
_TEXTURE_[3, j, i * e1 + G, 1] = R * 100/150
_TEXTURE_[3, j, i * e1 + G, 2] = R * 100/150
_TEXTURE_[4, j, i * e1 + G, 0] = R * 100/260
_TEXTURE_[4, j, i * e1 + G, 1] = R * 100/260
_TEXTURE_[4, j, i * e1 + G, 2] = R * 100/260
_TEXTURE_[5, j, i * e1 + G, 0] = R * 100/150
_TEXTURE_[5, j, i * e1 + G, 1] = R * 100/150
_TEXTURE_[5, j, i * e1 + G, 2] = R * 100/150
Next
Next
Next
EndFunction
Function _RND_()
Local f As Float
f = Random()
f = f/65535
EndFunction f