summaryrefslogtreecommitdiff
path: root/examples/lightmap/main.lua
diff options
context:
space:
mode:
authorjussi2023-04-06 12:31:37 +0300
committerjussi2023-04-06 12:31:37 +0300
commit2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a (patch)
tree825775577403d9341045571adb266173513c4bbd /examples/lightmap/main.lua
parent198a74c0aa27389c062c47bc29187c58a9d6c4a1 (diff)
downloadreilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.tar.gz
reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.tar.bz2
reilua-enhanced-2526c9732e7ea35bc9ed3e43a4db77b7e6364c5a.zip
All global variables and functions are not in global RL table. doc_parser creates also ReiLua_API.lua.
Diffstat (limited to 'examples/lightmap/main.lua')
-rw-r--r--examples/lightmap/main.lua76
1 files changed, 38 insertions, 38 deletions
diff --git a/examples/lightmap/main.lua b/examples/lightmap/main.lua
index e0b5da0..ae81345 100644
--- a/examples/lightmap/main.lua
+++ b/examples/lightmap/main.lua
@@ -10,20 +10,20 @@ local shader = -1
local matrix = {}
-function init()
- local mPos = RL_GetMonitorPosition( monitor )
- local mSize = RL_GetMonitorSize( monitor )
- local winSize = RL_GetScreenSize()
+function RL.init()
+ local mPos = RL.GetMonitorPosition( monitor )
+ local mSize = RL.GetMonitorSize( monitor )
+ local winSize = RL.GetScreenSize()
- RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
- RL_SetWindowState( FLAG_VSYNC_HINT )
- RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
+ RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
+ 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 } )
- RL_SetCameraMode( camera, CAMERA_FREE )
+ camera = RL.CreateCamera3D()
+ 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 = {
@@ -33,61 +33,61 @@ function init()
{ 0, 0 }, { ts, ts }, { ts, 0 } },
texcoords2 = { { 0, 0 }, { 0, 1 }, { 1, 1 },
{ 0, 0 }, { 1, 1 }, { 1, 0 } },
- colors = { WHITE, WHITE, WHITE,
- WHITE, WHITE, WHITE },
+ colors = { RL.WHITE, RL.WHITE, RL.WHITE,
+ RL.WHITE, RL.WHITE, RL.WHITE },
normals = { { 0, 1, 0 }, { 0, 1, 0 }, { 0, 1, 0 },
{ 0, 1, 0 }, { 0, 1, 0 }, { 0, 1, 0 } },
}
- mesh = RL_GenMeshCustom( meshData, true )
+ 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, TEXTURE_FILTER_TRILINEAR )
- lightmap = RL_LoadTexture( RL_GetBasePath().."../resources/images/lightmap.png" )
- RL_GenTextureMipmaps( lightmap )
- RL_SetTextureFilter( lightmap, TEXTURE_FILTER_TRILINEAR )
- RL_SetTextureWrap( lightmap, TEXTURE_WRAP_CLAMP )
+ -- RL.UpdateMesh( mesh, meshEdit )
+
+ tileTexture = RL.LoadTexture( RL.GetBasePath().."../resources/images/tile.png" )
+ RL.GenTextureMipmaps( tileTexture )
+ RL.SetTextureFilter( tileTexture, RL.TEXTURE_FILTER_TRILINEAR )
+ lightmap = RL.LoadTexture( RL.GetBasePath().."../resources/images/lightmap.png" )
+ RL.GenTextureMipmaps( lightmap )
+ RL.SetTextureFilter( lightmap, RL.TEXTURE_FILTER_TRILINEAR )
+ RL.SetTextureWrap( lightmap, RL.TEXTURE_WRAP_CLAMP )
- shader = RL_LoadShader( RL_GetBasePath().."../resources/shaders/glsl330/lightmap.vs",
- RL_GetBasePath().."../resources/shaders/glsl330/lightmap.fs" )
+ shader = RL.LoadShader( RL.GetBasePath().."../resources/shaders/glsl330/lightmap.vs",
+ RL.GetBasePath().."../resources/shaders/glsl330/lightmap.fs" )
local materialData = {
shader = shader,
maps = {
{
- MATERIAL_MAP_ALBEDO,
+ RL.MATERIAL_MAP_ALBEDO,
{
texture = tileTexture,
- color = WHITE,
+ color = RL.WHITE,
value = 1.0,
},
},
{
- MATERIAL_MAP_METALNESS,
+ RL.MATERIAL_MAP_METALNESS,
{
texture = lightmap,
- color = WHITE,
+ color = RL.WHITE,
value = 1.0,
},
},
},
}
- material = RL_CreateMaterial( materialData )
+ material = RL.CreateMaterial( materialData )
- matrix = RL_MatrixMultiply( RL_MatrixIdentity(), RL_MatrixTranslate( { -4, 0, -4 } ) )
+ matrix = RL.MatrixMultiply( RL.MatrixIdentity(), RL.MatrixTranslate( { -4, 0, -4 } ) )
end
-function draw()
- RL_ClearBackground( { 25, 50, 50 } )
- RL_UpdateCamera3D( camera )
+function RL.draw()
+ RL.ClearBackground( { 25, 50, 50 } )
+ RL.UpdateCamera3D( camera )
- RL_BeginMode3D( camera )
- RL_DrawMesh( mesh, material, matrix )
- RL_EndMode3D()
+ RL.BeginMode3D( camera )
+ RL.DrawMesh( mesh, material, matrix )
+ RL.EndMode3D()
end