v0.3.
This commit is contained in:
3
API.md
3
API.md
@@ -4017,7 +4017,8 @@ Generate custom mesh from vertex attribute data and uploads it into a VAO ( if s
|
|||||||
|
|
||||||
> success = RL_UpdateMesh( Mesh{} )
|
> success = RL_UpdateMesh( Mesh{} )
|
||||||
|
|
||||||
Update mesh vertex data in GPU. ( Mainly intented to be used with custom meshes )
|
Update mesh vertex data in GPU.
|
||||||
|
Note! Mainly intented to be used with custom meshes.
|
||||||
|
|
||||||
- Failure return false
|
- Failure return false
|
||||||
- Success return true
|
- Success return true
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ local pos = { 2, 0.5, 6 }
|
|||||||
local speed = 5.0
|
local speed = 5.0
|
||||||
local camera = -1
|
local camera = -1
|
||||||
local texture = -1
|
local texture = -1
|
||||||
local mesh = -1
|
|
||||||
local textureSize = { 256, 96 }
|
local textureSize = { 256, 96 }
|
||||||
local res = { 384, 216 }
|
local res = { 384, 216 }
|
||||||
local winSize = RL_GetWindowSize()
|
local winSize = RL_GetWindowSize()
|
||||||
@@ -79,7 +78,6 @@ function init()
|
|||||||
|
|
||||||
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
|
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tiles.png" )
|
||||||
camera = RL_CreateCamera3D()
|
camera = RL_CreateCamera3D()
|
||||||
mesh = RL_GenMeshCube( { 1, 2, 1 } )
|
|
||||||
RL_SetCamera3DPosition( camera, pos )
|
RL_SetCamera3DPosition( camera, pos )
|
||||||
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
RL_SetCamera3DTarget( camera, { 0, 0, 0 } )
|
||||||
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
RL_SetCamera3DUp( camera, { 0, 1, 0 } )
|
||||||
|
|||||||
@@ -24,11 +24,12 @@ function init()
|
|||||||
local monitor = 0
|
local monitor = 0
|
||||||
local mPos = RL_GetMonitorPosition( monitor )
|
local mPos = RL_GetMonitorPosition( monitor )
|
||||||
local mSize = RL_GetMonitorSize( monitor )
|
local mSize = RL_GetMonitorSize( monitor )
|
||||||
local winSize = RL_GetWindowSize()
|
local winSize = { 1920, 1080 }
|
||||||
|
|
||||||
RL_GuiSetFont( 0 )
|
RL_GuiSetFont( 0 )
|
||||||
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
RL_SetWindowState( FLAG_WINDOW_RESIZABLE )
|
||||||
RL_SetWindowState( FLAG_VSYNC_HINT )
|
RL_SetWindowState( FLAG_VSYNC_HINT )
|
||||||
|
RL_SetWindowSize( winSize )
|
||||||
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
RL_SetWindowPosition( { mPos[1] + mSize[1] / 2 - winSize[1] / 2, mPos[2] + mSize[2] / 2 - winSize[2] / 2 } )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ local tilemap = {
|
|||||||
|
|
||||||
local player = {
|
local player = {
|
||||||
vel = Vec2:new( 0, 0 ),
|
vel = Vec2:new( 0, 0 ),
|
||||||
pos = Vec2:new( 32, 32 ), -- Center down.
|
pos = Vec2:new( 32, 32 ), -- Center bottom.
|
||||||
colRect = { 0, 0, 12, 14 },
|
colRect = { 0, 0, 12, 14 },
|
||||||
onFloor = false,
|
onFloor = false,
|
||||||
frames = {
|
frames = {
|
||||||
@@ -49,11 +49,6 @@ local player = {
|
|||||||
facing = 1,
|
facing = 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
local kissa = { Vec2:new( 2, 4 ), 23 }
|
|
||||||
|
|
||||||
-- print( table.concat( kissa ) )
|
|
||||||
print( kissa[1] )
|
|
||||||
|
|
||||||
local function createMap()
|
local function createMap()
|
||||||
for x = 1, tilemap.size.x do
|
for x = 1, tilemap.size.x do
|
||||||
table.insert( tilemap.tiles, {} )
|
table.insert( tilemap.tiles, {} )
|
||||||
@@ -199,16 +194,6 @@ local function playerMovement( delta )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Alternative top down movement.
|
|
||||||
|
|
||||||
-- if RL_IsKeyDown( KEY_DOWN ) then
|
|
||||||
-- player.vel.y = player.vel.y + PLAYER_ACCELL * delta
|
|
||||||
-- moving[2] = true
|
|
||||||
-- elseif RL_IsKeyDown( KEY_UP ) then
|
|
||||||
-- player.vel.y = player.vel.y - PLAYER_ACCELL * delta
|
|
||||||
-- moving[2] = true
|
|
||||||
-- end
|
|
||||||
|
|
||||||
if RL_IsKeyPressed( KEY_SPACE ) and player.onFloor then
|
if RL_IsKeyPressed( KEY_SPACE ) and player.onFloor then
|
||||||
player.vel.y = -JUMP_STR
|
player.vel.y = -JUMP_STR
|
||||||
player.onFloor = false
|
player.onFloor = false
|
||||||
@@ -226,18 +211,7 @@ local function playerMovement( delta )
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if not moving[2] then
|
|
||||||
-- if delta * PLAYER_DEACCELL < player.vel.y then
|
|
||||||
-- player.vel.y = player.vel.y - PLAYER_DEACCELL * delta
|
|
||||||
-- elseif player.vel.y < -delta * PLAYER_DEACCELL then
|
|
||||||
-- player.vel.y = player.vel.y + PLAYER_DEACCELL * delta
|
|
||||||
-- else
|
|
||||||
-- player.vel.y = 0.0
|
|
||||||
-- end
|
|
||||||
-- end
|
|
||||||
|
|
||||||
player.vel.x = util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
|
player.vel.x = util.clamp( player.vel.x, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
|
||||||
-- player.vel.y = util.clamp( player.vel.y, -PLAYER_MAXSPEED, PLAYER_MAXSPEED )
|
|
||||||
|
|
||||||
player.vel.y = player.vel.y + GRAVITY * delta
|
player.vel.y = player.vel.y + GRAVITY * delta
|
||||||
|
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ function init()
|
|||||||
RL_SetCameraMode( camera, CAMERA_FREE )
|
RL_SetCameraMode( camera, CAMERA_FREE )
|
||||||
|
|
||||||
calcNormal( tri )
|
calcNormal( tri )
|
||||||
|
|
||||||
|
texture = RL_LoadTexture( RL_GetBasePath().."../resources/images/tile.png" )
|
||||||
end
|
end
|
||||||
|
|
||||||
local function checkCollisionPointTriangle( p, a, b, c, n )
|
local function checkCollisionPointTriangle( p, a, b, c, n )
|
||||||
|
|||||||
13
src/models.c
13
src/models.c
@@ -567,7 +567,7 @@ Note! Could be replaced something like "DrawPlaneTextureRec"
|
|||||||
- Success return true
|
- Success return true
|
||||||
*/
|
*/
|
||||||
int lmodelDrawQuad3DTexture( lua_State *L ) {
|
int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||||
if ( !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
if ( !lua_isnumber( L, -4 ) || !lua_istable( L, -3 ) || !lua_istable( L, -2 ) || !lua_istable( L, -1 ) ) {
|
||||||
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawQuad3DTexture( texture, Vector3{} vertices, Vector2{} texCoords, Color color )" );
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_DrawQuad3DTexture( texture, Vector3{} vertices, Vector2{} texCoords, Color color )" );
|
||||||
lua_pushboolean( L, false );
|
lua_pushboolean( L, false );
|
||||||
return 1;
|
return 1;
|
||||||
@@ -605,6 +605,10 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
|
|||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
}
|
}
|
||||||
lua_pop( L, 1 );
|
lua_pop( L, 1 );
|
||||||
|
|
||||||
|
//TODO Normals. maybe something like Vector3Normalize(Vector3CrossProduct(Vector3Subtract(vB, vA), Vector3Subtract(vC, vA)));
|
||||||
|
|
||||||
|
/* Texture. */
|
||||||
size_t texId = lua_tointeger( L, -1 );
|
size_t texId = lua_tointeger( L, -1 );
|
||||||
|
|
||||||
if ( !validSourceTexture( texId ) ) {
|
if ( !validSourceTexture( texId ) ) {
|
||||||
@@ -612,12 +616,10 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw.
|
/* Draw. */
|
||||||
rlCheckRenderBatchLimit( 4 );
|
rlCheckRenderBatchLimit( 4 );
|
||||||
rlSetTexture( texturesGetSourceTexture( texId )->id );
|
rlSetTexture( texturesGetSourceTexture( texId )->id );
|
||||||
|
|
||||||
//TODO Normals. maybe something like Vector3Normalize(Vector3CrossProduct(Vector3Subtract(vB, vA), Vector3Subtract(vC, vA)));
|
|
||||||
|
|
||||||
rlBegin( RL_QUADS );
|
rlBegin( RL_QUADS );
|
||||||
rlColor4ub( color.r, color.g, color.b, color.a );
|
rlColor4ub( color.r, color.g, color.b, color.a );
|
||||||
|
|
||||||
@@ -1091,7 +1093,8 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
|||||||
/*
|
/*
|
||||||
> success = RL_UpdateMesh( Mesh{} )
|
> success = RL_UpdateMesh( Mesh{} )
|
||||||
|
|
||||||
Update mesh vertex data in GPU. ( Mainly intented to be used with custom meshes )
|
Update mesh vertex data in GPU.
|
||||||
|
Note! Mainly intented to be used with custom meshes.
|
||||||
|
|
||||||
- Failure return false
|
- Failure return false
|
||||||
- Success return true
|
- Success return true
|
||||||
|
|||||||
Reference in New Issue
Block a user