summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
Diffstat (limited to 'examples')
-rw-r--r--examples/dungeon_crawler/main.lua5
-rw-r--r--examples/lightmap/main.lua11
-rw-r--r--examples/ray/main.lua5
3 files changed, 6 insertions, 15 deletions
diff --git a/examples/dungeon_crawler/main.lua b/examples/dungeon_crawler/main.lua
index c572348..3818f67 100644
--- a/examples/dungeon_crawler/main.lua
+++ b/examples/dungeon_crawler/main.lua
@@ -82,11 +82,6 @@ function RL.init()
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
- -- for x = 0, 3 do
- -- for y = 0, 9 do
- -- table.insert( sprites, { pos = { x + 0.5, y + 0.5 + 1 }, tile = { 1, 1 }, dis = 0, size = 0.8 } )
- -- end
- -- end
table.insert( sprites, { pos = { 2.5, 2.5 }, tile = { 1, 1 }, dis = 0, size = 0.8 } )
table.insert( sprites, { pos = { 1.5, 3.5 }, tile = { 3, 1 }, dis = 0, size = 0.5 } )
table.insert( sprites, { pos = { 0.5, 3.5 }, tile = { 3, 0 }, dis = 0, size = 0.7 } )
diff --git a/examples/lightmap/main.lua b/examples/lightmap/main.lua
index ae81345..a85527e 100644
--- a/examples/lightmap/main.lua
+++ b/examples/lightmap/main.lua
@@ -23,7 +23,6 @@ function RL.init()
RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
RL.SetCamera3DUp( camera, { 0, 1, 0 } )
- RL.SetCameraMode( camera, RL.CAMERA_FREE )
local ts = PLANE_SIZE
local meshData = {
@@ -40,12 +39,6 @@ function RL.init()
}
mesh = RL.GenMeshCustom( meshData, true )
- -- local meshEdit = {
- -- vertices = { { 0, 1, 0 }, { 0, 0, PLANE_SIZE }, { PLANE_SIZE, 0, PLANE_SIZE },
- -- { 0, 1, 0 }, { PLANE_SIZE, 0, PLANE_SIZE }, { PLANE_SIZE, 0, 0 } },
- -- }
- -- RL.UpdateMesh( mesh, meshEdit )
-
tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tile.png" )
RL.GenTextureMipmaps( tileTexture )
RL.SetTextureFilter( tileTexture, RL.TEXTURE_FILTER_TRILINEAR )
@@ -85,8 +78,8 @@ end
function RL.draw()
RL.ClearBackground( { 25, 50, 50 } )
- RL.UpdateCamera3D( camera )
-
+ RL.UpdateCamera3D( camera, RL.CAMERA_ORBITAL )
+
RL.BeginMode3D( camera )
RL.DrawMesh( mesh, material, matrix )
RL.EndMode3D()
diff --git a/examples/ray/main.lua b/examples/ray/main.lua
index 79ba7ee..9e09683 100644
--- a/examples/ray/main.lua
+++ b/examples/ray/main.lua
@@ -1,6 +1,7 @@
local camera = -1
local sphereMesh = -1
local ray = { { 0.5, 0, 4 }, { 0.1, 0, -1 } }
+local rayCol = {}
local function setupWindow()
local monitor = 0
@@ -14,7 +15,7 @@ local function setupWindow()
end
function ray_collision()
- local rayCol = RL.GetRayCollisionMesh( ray, sphereMesh, RL.MatrixIdentity() )
+ rayCol = RL.GetRayCollisionMesh( ray, sphereMesh, RL.MatrixIdentity() )
if rayCol ~= nil and rayCol.hit then
print( "hit", rayCol.hit )
@@ -53,5 +54,7 @@ function RL.draw()
RL.DrawRay( ray, { 255, 100, 100 } )
RL.DrawMesh( sphereMesh, 0, RL.MatrixIdentity() )
+ RL.DrawSphereWires( rayCol.point, 0.05, 4, 8, RL.BLUE )
+ RL.DrawLine3D( rayCol.point, RL.Vector3Add( rayCol.point, rayCol.normal ), RL.GREEN )
RL.EndMode3D()
end