summaryrefslogtreecommitdiff
path: root/examples/lightmap
diff options
context:
space:
mode:
authorjussi2023-05-01 18:23:36 +0300
committerjussi2023-05-01 18:23:36 +0300
commitacc56fc7c2bedde6eced005eab0a37b6281b9a23 (patch)
tree6298f7eeee27469f20d6d992c93118aa162b49a8 /examples/lightmap
parent8b6337446dd79faf226ea9df40d4d06d81c38436 (diff)
downloadreilua-enhanced-acc56fc7c2bedde6eced005eab0a37b6281b9a23.tar.gz
reilua-enhanced-acc56fc7c2bedde6eced005eab0a37b6281b9a23.tar.bz2
reilua-enhanced-acc56fc7c2bedde6eced005eab0a37b6281b9a23.zip
Texture now can be either Texture or RenderTexture. No need to change texture source anymore.
Diffstat (limited to 'examples/lightmap')
-rw-r--r--examples/lightmap/main.lua38
1 files changed, 31 insertions, 7 deletions
diff --git a/examples/lightmap/main.lua b/examples/lightmap/main.lua
index 991bc2d..a6a5bde 100644
--- a/examples/lightmap/main.lua
+++ b/examples/lightmap/main.lua
@@ -1,3 +1,7 @@
+package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
+
+Cam3D = require( "camera3d" )
+
local PLANE_SIZE = 8
local monitor = 0
@@ -19,10 +23,18 @@ function RL.init()
RL.SetWindowState( RL.FLAG_VSYNC_HINT )
RL.SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
- camera = RL.CreateCamera3D()
- RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
- RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
- RL.SetCamera3DUp( camera, { 0, 1, 0 } )
+ -- camera = RL.CreateCamera3D()
+ -- RL.SetCamera3DPosition( camera, { 0, 8, 16 } )
+ -- RL.SetCamera3DTarget( camera, { 0, 0, 0 } )
+ -- RL.SetCamera3DUp( camera, { 0, 1, 0 } )
+ camera = Cam3D:new()
+
+ camera:setPosition( { 0, 8, 16 } )
+ camera:setTarget( { 0, 0, 0 } )
+ camera:setUp( { 0, 1, 0 } )
+ camera.mode = camera.MODES.ORBITAL
+ -- camera.mode = camera.MODES.FREE
+ -- camera.mode = camera.MODES.FIRST_PERSON
local ts = PLANE_SIZE
local meshData = {
@@ -76,13 +88,25 @@ function RL.init()
matrix = RL.MatrixMultiply( RL.MatrixIdentity(), RL.MatrixTranslate( { -4, 0, -4 } ) )
end
+function RL.process( delta )
+ camera:process( delta )
+
+ if RL.IsKeyPressed( RL.KEY_SPACE ) then
+ if camera.mode == camera.MODES.FREE then
+ camera.mode = camera.MODES.FIRST_PERSON
+ else
+ camera.mode = camera.MODES.FREE
+ end
+ end
+end
+
function RL.draw()
RL.ClearBackground( { 25, 50, 50 } )
-- RL.UpdateCamera3D( camera, RL.CAMERA_ORBITAL )
-- RL.UpdateCamera3D( camera, RL.CAMERA_FREE )
- RL.UpdateCamera3D( camera, RL.CAMERA_FIRST_PERSON )
+ -- RL.UpdateCamera3D( camera, RL.CAMERA_FIRST_PERSON )
- RL.BeginMode3D( camera )
+ camera:beginMode3D()
RL.DrawMesh( mesh, material, matrix )
- RL.EndMode3D()
+ camera:endMode3D()
end