From 47ed28b006db71d823cfaa24fa143ab5cfcf279b Mon Sep 17 00:00:00 2001 From: jussi Date: Sun, 25 Feb 2024 14:06:59 +0200 Subject: Added various missing functions. --- src/models.c | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) (limited to 'src/models.c') diff --git a/src/models.c b/src/models.c index 2133632..db98b31 100644 --- a/src/models.c +++ b/src/models.c @@ -172,6 +172,32 @@ int lmodelsDrawTriangle3D( lua_State* L ) { return 0; } +/* +> RL.DrawTriangleStrip3D( Vector3{} points, Color color ) + +Draw a triangle strip defined by points +*/ +int lmodelsDrawTriangleStrip3D( lua_State* L ) { + int pointCount = uluaGetTableLen( L, 1 ); + Color color = uluaGetColor( L, 2 ); + + Vector3 points[ pointCount ]; + + int t = 1, i = 0; + lua_pushnil( L ); + + while ( lua_next( L, t ) != 0 ) { + if ( lua_istable( L, -1 ) ) { + points[i] = uluaGetVector3( L, lua_gettop( L ) ); + } + i++; + lua_pop( L, 1 ); + } + DrawTriangleStrip3D( points, pointCount, color ); + + return 0; +} + /* > RL.DrawCube( Vector3 position, Vector3 size, Color color ) @@ -1304,6 +1330,23 @@ int lmodelsGenMeshSphere( lua_State* L ) { return 1; } +/* +> mesh = RL.GenMeshHemiSphere( float radius, int rings, int slices ) + +Generate half-sphere mesh (no bottom cap) + +- Success return Mesh +*/ +int lmodelsGenMeshHemiSphere( lua_State* L ) { + float radius = luaL_checknumber( L, 1 ); + int rings = luaL_checkinteger( L, 2 ); + int slices = luaL_checkinteger( L, 3 ); + + uluaPushMesh( L, GenMeshHemiSphere( radius, rings, slices ) ); + + return 1; +} + /* > mesh = RL.GenMeshCylinder( float radius, float height, int slices ) -- cgit v1.2.3