diff options
Diffstat (limited to 'src/models.c')
| -rw-r--r-- | src/models.c | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/src/models.c b/src/models.c index dbedb07..97e930c 100644 --- a/src/models.c +++ b/src/models.c @@ -708,7 +708,7 @@ Draw 3D textured quad. ( Texture coordinates opengl style 0.0 - 1.0 ). - Success return true */ int lmodelDrawQuad3DTexture( lua_State *L ) { - if ( !isValidTexture( L, 1 ) || !lua_istable( L, 2 ) || !lua_istable( L, 3 ) || !lua_istable( L, 4 ) ) { + if ( !isValidTexture( L, 1, true ) || !lua_istable( L, 2 ) || !lua_istable( L, 3 ) || !lua_istable( L, 4 ) ) { TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawQuad3DTexture( Texture2D texture, Vector3{} vertices, Vector2{} texCoords, Color{} colors )" ); lua_pushboolean( L, false ); return 1; @@ -1743,7 +1743,7 @@ Set texture for a material map type ( MATERIAL_MAP_ALBEDO, MATERIAL_MAP_METALNES - Success return true */ int lmodelsSetMaterialTexture( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !isValidTexture( L, 3 ) ) { + if ( !lua_isnumber( L, 1 ) || !lua_isnumber( L, 2 ) || !isValidTexture( L, 3, true ) ) { TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.SetMaterialTexture( Material material, int mapType, Texture2D texture )" ); lua_pushboolean( L, false ); return 1; @@ -2263,7 +2263,7 @@ int lmodelsSetModelMeshMaterial( lua_State *L ) { } /* -> success = RL.DrawBillboard( Camera camera, Texture2D texture, Vector3 position, float size, Color tint ) +> success = RL.DrawBillboard( Camera3D camera, Texture2D texture, Vector3 position, float size, Color tint ) Draw a billboard texture @@ -2271,30 +2271,26 @@ Draw a billboard texture - Success return true */ int lmodelsDrawBillboard( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !isValidTexture( L, 2 ) || !lua_istable( L, 3 ) + if ( !isValidCamera3D( L, 1, true ) || !isValidTexture( L, 2, true ) || !lua_istable( L, 3 ) || !lua_isnumber( L, 4 ) || !lua_istable( L, 5 ) ) { TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawBillboard( Camera camera, Texture2D texture, Vector3 position, float size, Color tint )" ); lua_pushboolean( L, false ); return 1; } - size_t cameraId = lua_tointeger( L, 1 ); + Camera3D camera = uluaGetCamera3D( L, 1 ); Texture texture = uluaGetTexture( L, 2 ); Vector3 position = uluaGetVector3Index( L, 3 ); float size = lua_tonumber( L, 4 ); Color tint = uluaGetColorIndex( L, 5 ); - if ( !validCamera3D( cameraId ) ) { - lua_pushboolean( L, false ); - return 1; - } - DrawBillboard( *state->camera3Ds[ cameraId ], texture, position, size, tint ); + DrawBillboard( camera, texture, position, size, tint ); lua_pushboolean( L, true ); return 1; } /* -> success = RL.DrawBillboardRec( Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint ) +> success = RL.DrawBillboardRec( Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint ) Draw a billboard texture defined by source @@ -2302,32 +2298,28 @@ Draw a billboard texture defined by source - Success return true */ int lmodelsDrawBillboardRec( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !isValidTexture( L, 2 ) || !lua_istable( L, 3 ) + if ( !isValidCamera3D( L, 1, true ) || !isValidTexture( L, 2, true ) || !lua_istable( L, 3 ) || !lua_istable( L, 4 ) || !lua_istable( L, 5 ) || !lua_istable( L, 6 ) ) { TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawBillboardRec( Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector2 size, Color tint )" ); lua_pushboolean( L, false ); return 1; } - size_t cameraId = lua_tointeger( L, 1 ); + Camera3D camera = uluaGetCamera3D( L, 1 ); Texture texture = uluaGetTexture( L, 2 ); Rectangle source = uluaGetRectangleIndex( L, 3 ); Vector3 position = uluaGetVector3Index( L, 4 ); Vector2 size = uluaGetVector2Index( L, 5 ); Color tint = uluaGetColorIndex( L, 6 ); - if ( !validCamera3D( cameraId ) ) { - lua_pushboolean( L, false ); - return 1; - } // DrawBillboardRec( *state->camera3Ds[ cameraId ], *texturesGetSourceTexture( texId ), source, position, size, tint ); - DrawBillboardRecNoRatio( *state->camera3Ds[ cameraId ], texture, source, position, size, tint ); + DrawBillboardRecNoRatio( camera, texture, source, position, size, tint ); lua_pushboolean( L, true ); return 1; } /* -> success = RL.DrawBillboardPro( Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint ) +> success = RL.DrawBillboardPro( Camera3D camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint ) Draw a billboard texture defined by source and rotation @@ -2335,14 +2327,14 @@ Draw a billboard texture defined by source and rotation - Success return true */ int lmodelsDrawBillboardPro( lua_State *L ) { - if ( !lua_isnumber( L, 1 ) || !isValidTexture( L, 2 ) || !lua_istable( L, 3 ) + if ( !isValidCamera3D( L, 1, true ) || !isValidTexture( L, 2, true ) || !lua_istable( L, 3 ) || !lua_istable( L, 4 ) || !lua_istable( L, 5 ) || !lua_istable( L, 6 ) || !lua_istable( L, 7 ) || !lua_isnumber( L, 8 ) || !lua_istable( L, 9 ) ) { TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.DrawBillboardPro( Camera camera, Texture2D texture, Rectangle source, Vector3 position, Vector3 up, Vector2 size, Vector2 origin, float rotation, Color tint )" ); lua_pushboolean( L, false ); return 1; } - size_t cameraId = lua_tointeger( L, 1 ); + Camera3D camera = uluaGetCamera3D( L, 1 ); Texture texture = uluaGetTexture( L, 2 ); Rectangle source = uluaGetRectangleIndex( L, 3 ); Vector3 position = uluaGetVector3Index( L, 4 ); @@ -2352,12 +2344,8 @@ int lmodelsDrawBillboardPro( lua_State *L ) { float rotation = lua_tonumber( L, 8 ); Color tint = uluaGetColorIndex( L, 9 ); - if ( !validCamera3D( cameraId ) ) { - lua_pushboolean( L, false ); - return 1; - } // DrawBillboardPro( *state->camera3Ds[ cameraId ], *texturesGetSourceTexture( texId ), source, position, up, size, origin, rotation, tint ); - DrawBillboardProNoRatio( *state->camera3Ds[ cameraId ], texture, source, position, up, size, origin, rotation, tint ); + DrawBillboardProNoRatio( camera, texture, source, position, up, size, origin, rotation, tint ); lua_pushboolean( L, true ); return 1; |
