Textured floor, some tests of matrices
This commit is contained in:
parent
bb363312a2
commit
11a7308820
|
@ -30,6 +30,17 @@ main :: proc() {
|
||||||
|
|
||||||
rl.InitWindow(800, 400, "By The Fire")
|
rl.InitWindow(800, 400, "By The Fire")
|
||||||
rl.SetTargetFPS(60)
|
rl.SetTargetFPS(60)
|
||||||
|
|
||||||
|
img := rl.GenImageChecked(64, 64, 8, 8, PAL[1], PAL[2])
|
||||||
|
defer rl.UnloadImage(img)
|
||||||
|
tex := rl.LoadTextureFromImage(img)
|
||||||
|
defer rl.UnloadTexture(tex)
|
||||||
|
rl.SetTextureFilter(tex, rl.TextureFilter.POINT)
|
||||||
|
|
||||||
|
plane := rl.GenMeshPlane(32, 32, 16, 16)
|
||||||
|
defer rl.UnloadMesh(plane)
|
||||||
|
mat := rl.LoadMaterialDefault()
|
||||||
|
rl.SetMaterialTexture(&mat, rl.MaterialMapIndex.ALBEDO, tex)
|
||||||
|
|
||||||
player := player_create()
|
player := player_create()
|
||||||
|
|
||||||
|
@ -43,7 +54,25 @@ main :: proc() {
|
||||||
BeginMode3D(player.camera)
|
BeginMode3D(player.camera)
|
||||||
|
|
||||||
ClearBackground(PAL[0])
|
ClearBackground(PAL[0])
|
||||||
DrawPlane({0, 0, 0}, {32,32}, PAL[1])
|
rlPushMatrix()
|
||||||
|
rlRotatef(45, 0, 1, 0)
|
||||||
|
DrawMesh(plane, mat, rl.MatrixIdentity())
|
||||||
|
rlPopMatrix()
|
||||||
|
|
||||||
|
|
||||||
|
rlPushMatrix()
|
||||||
|
rlTranslatef(player.position.x, player.position.y, player.position.z)
|
||||||
|
rlTranslatef(player.cameraOffset.x, player.cameraOffset.y, player.cameraOffset.z)
|
||||||
|
rlRotatef(math.to_degrees(player.direction), 0, 1, 0)
|
||||||
|
rlRotatef(math.to_degrees(-player.yaw), 1, 0, 0)
|
||||||
|
rlTranslatef(-1, -0.3, 1)
|
||||||
|
rlScalef(0.5, 0.5, 0.5)
|
||||||
|
DrawCube({0, 0, 0}, 1,1,1, PAL[4])
|
||||||
|
rlTranslatef(0, 0, 1)
|
||||||
|
rlScalef(0.4, 0.4, 1)
|
||||||
|
DrawCube({0, 0, 0}, 1,1,1, PAL[4])
|
||||||
|
|
||||||
|
rlPopMatrix()
|
||||||
|
|
||||||
EndMode3D()
|
EndMode3D()
|
||||||
EndDrawing()
|
EndDrawing()
|
||||||
|
|
|
@ -18,6 +18,7 @@ player_create :: proc() -> Player {
|
||||||
camera = rl.Camera3D{
|
camera = rl.Camera3D{
|
||||||
up = {0, 1, 0},
|
up = {0, 1, 0},
|
||||||
fovy = 80,
|
fovy = 80,
|
||||||
|
target = {0, 0, 10},
|
||||||
projection = rl.CameraProjection.PERSPECTIVE,
|
projection = rl.CameraProjection.PERSPECTIVE,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue