Merged uluaGet*Index functions to uluaGet* functions.
This commit is contained in:
@@ -32,6 +32,7 @@ DETAILED CHANGES:
|
||||
- ADDED: DrawTextCodepoint and DrawTextCodepoints.
|
||||
- ADDED: GetGlyphIndex, GetGlyphInfo and GetGlyphAtlasRec.
|
||||
- ADDED: SetWindowIcons, SetWindowOpacity and GetWindowHandle.
|
||||
- CHANGED: Merged uluaGet*Index functions to uluaGet* functions.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Release: ReiLua version 0.5.0 Using Raylib 4.5
|
||||
|
||||
@@ -35,28 +35,18 @@ void luaCallProcess();
|
||||
void luaCallDraw();
|
||||
void luaCallExit();
|
||||
void luaRegister();
|
||||
/* Lua Util functions. */
|
||||
/* Lua get types. */
|
||||
bool uluaGetBoolean( lua_State *L, int index );
|
||||
Color uluaGetColor( lua_State *L );
|
||||
Color uluaGetColorIndex( lua_State *L, int index );
|
||||
Vector2 uluaGetVector2( lua_State *L );
|
||||
Vector2 uluaGetVector2Index( lua_State *L, int index );
|
||||
Vector3 uluaGetVector3( lua_State *L );
|
||||
Vector3 uluaGetVector3Index( lua_State *L, int index );
|
||||
Vector4 uluaGetVector4( lua_State *L );
|
||||
Vector4 uluaGetVector4Index( lua_State *L, int index );
|
||||
Rectangle uluaGetRectangle( lua_State *L );
|
||||
Rectangle uluaGetRectangleIndex( lua_State *L, int index );
|
||||
Quaternion uluaGetQuaternion( lua_State *L );
|
||||
Quaternion uluaGetQuaternionIndex( lua_State *L, int index );
|
||||
Matrix uluaGetMatrix( lua_State *L );
|
||||
Matrix uluaGetMatrixIndex( lua_State *L, int index );
|
||||
BoundingBox uluaGetBoundingBox( lua_State *L );
|
||||
BoundingBox uluaGetBoundingBoxIndex( lua_State *L, int index );
|
||||
Ray uluaGetRay( lua_State *L );
|
||||
Ray uluaGetRayIndex( lua_State *L, int index );
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State *L );
|
||||
NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index );
|
||||
Color uluaGetColor( lua_State *L, int index );
|
||||
Vector2 uluaGetVector2( lua_State *L, int index );
|
||||
Vector3 uluaGetVector3( lua_State *L, int index );
|
||||
Vector4 uluaGetVector4( lua_State *L, int index );
|
||||
Rectangle uluaGetRectangle( lua_State *L, int index );
|
||||
Quaternion uluaGetQuaternion( lua_State *L, int index );
|
||||
Matrix uluaGetMatrix( lua_State *L, int index );
|
||||
BoundingBox uluaGetBoundingBox( lua_State *L, int index );
|
||||
Ray uluaGetRay( lua_State *L, int index );
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State *L, int index );
|
||||
Buffer* uluaGetBuffer( lua_State *L, int index );
|
||||
Image* uluaGetImage( lua_State *L, int index );
|
||||
Texture* uluaGetTexture( lua_State *L, int index );
|
||||
@@ -73,7 +63,7 @@ Light* uluaGetLight( lua_State *L, int index );
|
||||
Material* uluaGetMaterial( lua_State *L, int index );
|
||||
Model* uluaGetModel( lua_State *L, int index );
|
||||
ModelAnimation* uluaGetModelAnimation( lua_State *L, int index );
|
||||
/* Push types. */
|
||||
/* Lua push types. */
|
||||
void uluaPushColor( lua_State *L, Color color );
|
||||
void uluaPushVector2( lua_State *L, Vector2 vector );
|
||||
void uluaPushVector3( lua_State *L, Vector3 vector );
|
||||
@@ -101,6 +91,5 @@ void uluaPushMaterial( lua_State *L, Material material );
|
||||
void uluaPushMesh( lua_State *L, Mesh mesh );
|
||||
void uluaPushModel( lua_State *L, Model model );
|
||||
void uluaPushModelAnimation( lua_State *L, ModelAnimation modelAnimation );
|
||||
|
||||
int uluaGetTableLen( lua_State *L );
|
||||
int uluaGetTableLenIndex( lua_State *L, int index );
|
||||
/* Utils. */
|
||||
int uluaGetTableLen( lua_State *L, int index );
|
||||
|
||||
56
src/core.c
56
src/core.c
@@ -105,7 +105,7 @@ int lcoreSetWindowMonitor( lua_State *L ) {
|
||||
Set window position on screen
|
||||
*/
|
||||
int lcoreSetWindowPosition( lua_State *L ) {
|
||||
Vector2 pos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 pos = uluaGetVector2( L, 1 );
|
||||
|
||||
SetWindowPosition( pos.x, pos.y );
|
||||
|
||||
@@ -118,7 +118,7 @@ int lcoreSetWindowPosition( lua_State *L ) {
|
||||
Set window dimensions
|
||||
*/
|
||||
int lcoreSetWindowSize( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
|
||||
SetWindowSize( (int)size.x, (int)size.y );
|
||||
|
||||
@@ -157,7 +157,7 @@ int lcoreGetWindowHandle( lua_State *L ) {
|
||||
Set window minimum dimensions (for FLAG_WINDOW_RESIZABLE)
|
||||
*/
|
||||
int lcoreSetWindowMinSize( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
|
||||
SetWindowMinSize( (int)size.x, (int)size.y );
|
||||
|
||||
@@ -297,7 +297,7 @@ int lcoreSetWindowIcon( lua_State *L ) {
|
||||
Set icon for window (multiple images, RGBA 32bit, only PLATFORM_DESKTOP)
|
||||
*/
|
||||
int lcoreSetWindowIcons( lua_State *L ) {
|
||||
int count = uluaGetTableLenIndex( L, 1 );
|
||||
int count = uluaGetTableLen( L, 1 );
|
||||
Image images[ count ];
|
||||
|
||||
int t = 1;
|
||||
@@ -603,7 +603,7 @@ int lcoreLoadBuffer( lua_State *L ) {
|
||||
int type = luaL_checkinteger( L, 2 );
|
||||
|
||||
Buffer buffer = { 0 };
|
||||
int len = uluaGetTableLenIndex( L, 1 );
|
||||
int len = uluaGetTableLen( L, 1 );
|
||||
|
||||
switch ( type ) {
|
||||
case BUFFER_UNSIGNED_CHAR:
|
||||
@@ -771,7 +771,7 @@ int lcoreIsCursorOnScreen( lua_State *L ) {
|
||||
Set background color (framebuffer clear color)
|
||||
*/
|
||||
int lcoreClearBackground( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
ClearBackground( color );
|
||||
|
||||
@@ -830,7 +830,7 @@ int lcoreEndBlendMode( lua_State *L ) {
|
||||
Begin scissor mode (define screen area for following drawing)
|
||||
*/
|
||||
int lcoreBeginScissorMode( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
|
||||
BeginScissorMode( rect.x, rect.y, rect.width, rect.height );
|
||||
|
||||
@@ -914,13 +914,13 @@ int lcoreLoadShaderFromMemory( lua_State *L ) {
|
||||
char *fs = NULL;
|
||||
|
||||
if ( lua_isstring( L, 1 ) ) {
|
||||
size_t vsLen = uluaGetTableLenIndex( L, 1 ) + 1;
|
||||
size_t vsLen = uluaGetTableLen( L, 1 ) + 1;
|
||||
|
||||
vs = malloc( vsLen * sizeof( char ) );
|
||||
strcpy( vs, lua_tostring( L, 1 ) );
|
||||
}
|
||||
if ( lua_isstring( L, 2 ) ) {
|
||||
size_t fsLen = uluaGetTableLenIndex( L, 2 ) + 1;
|
||||
size_t fsLen = uluaGetTableLen( L, 2 ) + 1;
|
||||
|
||||
fs = malloc( fsLen * sizeof( char ) );
|
||||
strcpy( fs, lua_tostring( L, 2 ) );
|
||||
@@ -1045,7 +1045,7 @@ Set shader uniform value (matrix 4x4)
|
||||
int lcoreSetShaderValueMatrix( lua_State *L ) {
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
Matrix mat = uluaGetMatrixIndex( L, 3 );
|
||||
Matrix mat = uluaGetMatrix( L, 3 );
|
||||
|
||||
SetShaderValueMatrix( *shader, locIndex, mat );
|
||||
|
||||
@@ -1076,7 +1076,7 @@ NOTE: Even one value should be in table
|
||||
int lcoreSetShaderValue( lua_State *L ) {
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
size_t valueCount = uluaGetTableLenIndex( L, 3 );
|
||||
size_t valueCount = uluaGetTableLen( L, 3 );
|
||||
int uniformType = luaL_checkinteger( L, 4 );
|
||||
|
||||
/* Read values. */
|
||||
@@ -1118,7 +1118,7 @@ NOTE: Even one value should be in table
|
||||
int lcoreSetShaderValueV( lua_State *L ) {
|
||||
Shader *shader = uluaGetShader( L, 1 );
|
||||
int locIndex = luaL_checkinteger( L, 2 );
|
||||
size_t valueCount = uluaGetTableLenIndex( L, 3 );
|
||||
size_t valueCount = uluaGetTableLen( L, 3 );
|
||||
int uniformType = luaL_checkinteger( L, 4 );
|
||||
int count = luaL_checkinteger( L, 5 );
|
||||
|
||||
@@ -1527,7 +1527,7 @@ int lcoreGetMouseDelta( lua_State *L ) {
|
||||
Set mouse position XY
|
||||
*/
|
||||
int lcoreSetMousePosition( lua_State *L ) {
|
||||
Vector2 pos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 pos = uluaGetVector2( L, 1 );
|
||||
|
||||
SetMousePosition( pos.x, pos.y );
|
||||
|
||||
@@ -1540,7 +1540,7 @@ int lcoreSetMousePosition( lua_State *L ) {
|
||||
Set mouse offset
|
||||
*/
|
||||
int lcoreSetMouseOffset( lua_State *L ) {
|
||||
Vector2 offset = uluaGetVector2Index( L, 1 );
|
||||
Vector2 offset = uluaGetVector2( L, 1 );
|
||||
|
||||
SetMouseOffset( offset.x, offset.y );
|
||||
|
||||
@@ -1553,7 +1553,7 @@ int lcoreSetMouseOffset( lua_State *L ) {
|
||||
Set mouse scaling
|
||||
*/
|
||||
int lcoreSetMouseScale( lua_State *L ) {
|
||||
Vector2 scale = uluaGetVector2Index( L, 1 );
|
||||
Vector2 scale = uluaGetVector2( L, 1 );
|
||||
|
||||
SetMouseScale( scale.x, scale.y );
|
||||
|
||||
@@ -2062,7 +2062,7 @@ Set camera target (rotation and zoom origin)
|
||||
*/
|
||||
int lcoreSetCamera2DTarget( lua_State *L ) {
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
Vector2 target = uluaGetVector2Index( L, 2 );
|
||||
Vector2 target = uluaGetVector2( L, 2 );
|
||||
|
||||
camera->target = target;
|
||||
|
||||
@@ -2076,7 +2076,7 @@ Set camera offset (displacement from target)
|
||||
*/
|
||||
int lcoreSetCamera2DOffset( lua_State *L ) {
|
||||
Camera2D *camera = uluaGetCamera2D( L, 1 );
|
||||
Vector2 offset = uluaGetVector2Index( L, 2 );
|
||||
Vector2 offset = uluaGetVector2( L, 2 );
|
||||
|
||||
camera->offset = offset;
|
||||
|
||||
@@ -2224,7 +2224,7 @@ Set camera position (Remember to call "RL.UpdateCamera3D()" to apply changes)
|
||||
*/
|
||||
int lcoreSetCamera3DPosition( lua_State *L ) {
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 pos = uluaGetVector3Index( L, 2 );
|
||||
Vector3 pos = uluaGetVector3( L, 2 );
|
||||
|
||||
camera->position = pos;
|
||||
|
||||
@@ -2238,7 +2238,7 @@ Set camera target it looks-at
|
||||
*/
|
||||
int lcoreSetCamera3DTarget( lua_State *L ) {
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 target = uluaGetVector3Index( L, 2 );
|
||||
Vector3 target = uluaGetVector3( L, 2 );
|
||||
|
||||
camera->target = target;
|
||||
|
||||
@@ -2252,7 +2252,7 @@ Set camera up vector (Rotation over it's axis)
|
||||
*/
|
||||
int lcoreSetCamera3DUp( lua_State *L ) {
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 up = uluaGetVector3Index( L, 2 );
|
||||
Vector3 up = uluaGetVector3( L, 2 );
|
||||
|
||||
camera->up = up;
|
||||
|
||||
@@ -2573,8 +2573,8 @@ Update camera movement, movement/rotation values should be provided by user
|
||||
*/
|
||||
int lcoreUpdateCamera3DPro( lua_State *L ) {
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Vector3 movement = uluaGetVector3Index( L, 2 );
|
||||
Vector3 rotation = uluaGetVector3Index( L, 3 );
|
||||
Vector3 movement = uluaGetVector3( L, 2 );
|
||||
Vector3 rotation = uluaGetVector3( L, 3 );
|
||||
float zoom = luaL_checknumber( L, 4 );
|
||||
|
||||
UpdateCameraPro( camera, movement, rotation, zoom );
|
||||
@@ -2594,7 +2594,7 @@ Get a ray trace from mouse position
|
||||
- Success return Ray
|
||||
*/
|
||||
int lcoreGetMouseRay( lua_State *L ) {
|
||||
Vector2 mousePosition = uluaGetVector2Index( L, 1 );
|
||||
Vector2 mousePosition = uluaGetVector2( L, 1 );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 2 );
|
||||
|
||||
uluaPushRay( L, GetMouseRay( mousePosition, *camera ) );
|
||||
@@ -2640,7 +2640,7 @@ Get the screen space position for a 3d world space position
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lcoreGetWorldToScreen( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 1 );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 2 );
|
||||
|
||||
uluaPushVector2( L, GetWorldToScreen( position, *camera ) );
|
||||
@@ -2656,9 +2656,9 @@ Get size position for a 3d world space position
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lcoreGetWorldToScreenEx( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 1 );
|
||||
Camera3D *camera = uluaGetCamera3D( L, 2 );
|
||||
Vector2 size = uluaGetVector2Index( L, 3 );
|
||||
Vector2 size = uluaGetVector2( L, 3 );
|
||||
|
||||
uluaPushVector2( L, GetWorldToScreenEx( position, *camera, size.x, size.y ) );
|
||||
|
||||
@@ -2673,7 +2673,7 @@ Get the screen space position for a 2d camera world space position
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lcoreGetWorldToScreen2D( lua_State *L ) {
|
||||
Vector2 position = uluaGetVector2Index( L, 1 );
|
||||
Vector2 position = uluaGetVector2( L, 1 );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 2 );
|
||||
|
||||
uluaPushVector2( L, GetWorldToScreen2D( position, *camera ) );
|
||||
@@ -2689,7 +2689,7 @@ Get the world space position for a 2d camera screen space position
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lcoreGetScreenToWorld2D( lua_State *L ) {
|
||||
Vector2 position = uluaGetVector2Index( L, 1 );
|
||||
Vector2 position = uluaGetVector2( L, 1 );
|
||||
Camera2D *camera = uluaGetCamera2D( L, 2 );
|
||||
|
||||
uluaPushVector2( L, GetScreenToWorld2D( position, *camera ) );
|
||||
|
||||
4
src/gl.c
4
src/gl.c
@@ -20,8 +20,8 @@ int lglBlitFramebuffer( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
return 1;
|
||||
}
|
||||
Rectangle srcRect = uluaGetRectangleIndex( L, 3 );
|
||||
Rectangle dstRect = uluaGetRectangleIndex( L, 4 );
|
||||
Rectangle srcRect = uluaGetRectangle( L, 3 );
|
||||
Rectangle dstRect = uluaGetRectangle( L, 4 );
|
||||
int mask = luaL_checkinteger( L, 5 );
|
||||
int filter = luaL_checkinteger( L, 6 );
|
||||
|
||||
|
||||
12
src/lights.c
12
src/lights.c
@@ -20,9 +20,9 @@ Create a light and get shader locations
|
||||
*/
|
||||
int llightsCreateLight( lua_State *L ) {
|
||||
int type = luaL_checkinteger( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
Vector3 target = uluaGetVector3Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Vector3 position = uluaGetVector3( L, 2 );
|
||||
Vector3 target = uluaGetVector3( L, 3 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
Shader *shader = uluaGetShader( L, 5 );
|
||||
|
||||
uluaPushLight( L, CreateLight( type, position, target, color, *shader ) );
|
||||
@@ -65,7 +65,7 @@ Set light position
|
||||
*/
|
||||
int llightsSetLightPosition( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
Vector3 position = uluaGetVector3( L, 2 );
|
||||
|
||||
light->position = position;
|
||||
|
||||
@@ -79,7 +79,7 @@ Set light target
|
||||
*/
|
||||
int llightsSetLightTarget( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
Vector3 target = uluaGetVector3Index( L, 2 );
|
||||
Vector3 target = uluaGetVector3( L, 2 );
|
||||
|
||||
light->target = target;
|
||||
|
||||
@@ -93,7 +93,7 @@ Set light color
|
||||
*/
|
||||
int llightsSetLightColor( lua_State *L ) {
|
||||
Light *light = uluaGetLight( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
light->color = color;
|
||||
|
||||
|
||||
@@ -2379,11 +2379,7 @@ bool uluaGetBoolean( lua_State *L, int index ) {
|
||||
return lua_toboolean( L, index );
|
||||
}
|
||||
|
||||
Color uluaGetColor( lua_State *L ) {
|
||||
return uluaGetColorIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Color uluaGetColorIndex( lua_State *L, int index ) {
|
||||
Color uluaGetColor( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Color color = { 0, 0, 0, 255 };
|
||||
|
||||
@@ -2431,11 +2427,7 @@ Color uluaGetColorIndex( lua_State *L, int index ) {
|
||||
return color;
|
||||
}
|
||||
|
||||
Vector2 uluaGetVector2( lua_State *L ) {
|
||||
return uluaGetVector2Index( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Vector2 uluaGetVector2Index( lua_State *L, int index ) {
|
||||
Vector2 uluaGetVector2( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Vector2 vector = { 0.0f, 0.0f };
|
||||
|
||||
@@ -2471,11 +2463,7 @@ Vector2 uluaGetVector2Index( lua_State *L, int index ) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
Vector3 uluaGetVector3( lua_State *L ) {
|
||||
return uluaGetVector3Index( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Vector3 uluaGetVector3Index( lua_State *L, int index ) {
|
||||
Vector3 uluaGetVector3( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Vector3 vector = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2517,11 +2505,7 @@ Vector3 uluaGetVector3Index( lua_State *L, int index ) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
Vector4 uluaGetVector4( lua_State *L ) {
|
||||
return uluaGetVector4Index( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Vector4 uluaGetVector4Index( lua_State *L, int index ) {
|
||||
Vector4 uluaGetVector4( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Vector4 vector = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2569,11 +2553,7 @@ Vector4 uluaGetVector4Index( lua_State *L, int index ) {
|
||||
return vector;
|
||||
}
|
||||
|
||||
Rectangle uluaGetRectangle( lua_State *L ) {
|
||||
return uluaGetRectangleIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Rectangle uluaGetRectangleIndex( lua_State *L, int index ) {
|
||||
Rectangle uluaGetRectangle( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Rectangle rect = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2621,11 +2601,7 @@ Rectangle uluaGetRectangleIndex( lua_State *L, int index ) {
|
||||
return rect;
|
||||
}
|
||||
|
||||
Quaternion uluaGetQuaternion( lua_State *L ) {
|
||||
return uluaGetQuaternionIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Quaternion uluaGetQuaternionIndex( lua_State *L, int index ) {
|
||||
Quaternion uluaGetQuaternion( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Quaternion quaternion = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
@@ -2673,11 +2649,7 @@ Quaternion uluaGetQuaternionIndex( lua_State *L, int index ) {
|
||||
return quaternion;
|
||||
}
|
||||
|
||||
Matrix uluaGetMatrix( lua_State *L ) {
|
||||
return uluaGetMatrixIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Matrix uluaGetMatrixIndex( lua_State *L, int index ) {
|
||||
Matrix uluaGetMatrix( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Matrix matrix = { 0.0f };
|
||||
float m[4][4];
|
||||
@@ -2709,11 +2681,7 @@ Matrix uluaGetMatrixIndex( lua_State *L, int index ) {
|
||||
return matrix;
|
||||
}
|
||||
|
||||
BoundingBox uluaGetBoundingBox( lua_State *L ) {
|
||||
return uluaGetBoundingBoxIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
BoundingBox uluaGetBoundingBoxIndex( lua_State *L, int index ) {
|
||||
BoundingBox uluaGetBoundingBox( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
BoundingBox box = { .min = { 0.0, 0.0, 0.0 }, .max = { 0.0, 0.0, 0.0 } };
|
||||
|
||||
@@ -2725,10 +2693,10 @@ BoundingBox uluaGetBoundingBoxIndex( lua_State *L, int index ) {
|
||||
if ( lua_isnumber( L, -2 ) ) {
|
||||
switch ( i ) {
|
||||
case 0:
|
||||
box.min = uluaGetVector3( L );
|
||||
box.min = uluaGetVector3( L, lua_gettop( L ) );
|
||||
break;
|
||||
case 1:
|
||||
box.max = uluaGetVector3( L );
|
||||
box.max = uluaGetVector3( L, lua_gettop( L ) );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -2736,10 +2704,10 @@ BoundingBox uluaGetBoundingBoxIndex( lua_State *L, int index ) {
|
||||
}
|
||||
else if ( lua_isstring( L, -2 ) ) {
|
||||
if ( strcmp( "min", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
box.min = uluaGetVector3( L );
|
||||
box.min = uluaGetVector3( L, lua_gettop( L ) );
|
||||
}
|
||||
else if ( strcmp( "max", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
box.max = uluaGetVector3( L );
|
||||
box.max = uluaGetVector3( L, lua_gettop( L ) );
|
||||
}
|
||||
}
|
||||
i++;
|
||||
@@ -2750,11 +2718,7 @@ BoundingBox uluaGetBoundingBoxIndex( lua_State *L, int index ) {
|
||||
return box;
|
||||
}
|
||||
|
||||
Ray uluaGetRay( lua_State *L ) {
|
||||
return uluaGetRayIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
Ray uluaGetRayIndex( lua_State *L, int index ) {
|
||||
Ray uluaGetRay( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
Ray ray = { .position = { 0.0, 0.0, 0.0 }, .direction = { 0.0, 0.0, 0.0 } };
|
||||
|
||||
@@ -2766,10 +2730,10 @@ Ray uluaGetRayIndex( lua_State *L, int index ) {
|
||||
if ( lua_isnumber( L, -2 ) ) {
|
||||
switch ( i ) {
|
||||
case 0:
|
||||
ray.position = uluaGetVector3( L );
|
||||
ray.position = uluaGetVector3( L, lua_gettop( L ) );
|
||||
break;
|
||||
case 1:
|
||||
ray.direction = uluaGetVector3( L );
|
||||
ray.direction = uluaGetVector3( L, lua_gettop( L ) );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -2777,10 +2741,10 @@ Ray uluaGetRayIndex( lua_State *L, int index ) {
|
||||
}
|
||||
else if ( lua_isstring( L, -2 ) ) {
|
||||
if ( strcmp( "position", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
ray.position = uluaGetVector3( L );
|
||||
ray.position = uluaGetVector3( L, lua_gettop( L ) );
|
||||
}
|
||||
else if ( strcmp( "direction", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
ray.direction = uluaGetVector3( L );
|
||||
ray.direction = uluaGetVector3( L, lua_gettop( L ) );
|
||||
}
|
||||
}
|
||||
i++;
|
||||
@@ -2791,11 +2755,7 @@ Ray uluaGetRayIndex( lua_State *L, int index ) {
|
||||
return ray;
|
||||
}
|
||||
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State *L ) {
|
||||
return uluaGetNPatchInfoIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index ) {
|
||||
NPatchInfo uluaGetNPatchInfo( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
NPatchInfo npatch = { .source = { 0.0, 0.0, 0.0, 0.0 }, .left = 0, .top = 0, .right = 0, .bottom = 0, .layout = NPATCH_NINE_PATCH };
|
||||
|
||||
@@ -2807,7 +2767,7 @@ NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index ) {
|
||||
if ( lua_isnumber( L, -2 ) ) {
|
||||
switch ( i ) {
|
||||
case 0:
|
||||
npatch.source = uluaGetRectangle( L );
|
||||
npatch.source = uluaGetRectangle( L, lua_gettop( L ) );
|
||||
break;
|
||||
case 1:
|
||||
npatch.left = lua_tointeger( L, -1 );
|
||||
@@ -2830,7 +2790,7 @@ NPatchInfo uluaGetNPatchInfoIndex( lua_State *L, int index ) {
|
||||
}
|
||||
else if ( lua_isstring( L, -2 ) ) {
|
||||
if ( strcmp( "source", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
npatch.source = uluaGetRectangle( L );
|
||||
npatch.source = uluaGetRectangle( L, lua_gettop( L ) );
|
||||
}
|
||||
else if ( strcmp( "left", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
npatch.left = lua_tointeger( L, -1 );
|
||||
@@ -3248,11 +3208,7 @@ void uluaPushModelAnimation( lua_State *L, ModelAnimation modelAnimation ) {
|
||||
luaL_setmetatable( L, "ModelAnimation" );
|
||||
}
|
||||
|
||||
int uluaGetTableLen( lua_State *L ) {
|
||||
return uluaGetTableLenIndex( L, lua_gettop( L ) );
|
||||
}
|
||||
|
||||
int uluaGetTableLenIndex( lua_State *L, int index ) {
|
||||
int uluaGetTableLen( lua_State *L, int index ) {
|
||||
luaL_checktype( L, index, LUA_TTABLE );
|
||||
int t = index, i = 0;
|
||||
lua_pushnil( L );
|
||||
|
||||
244
src/models.c
244
src/models.c
@@ -132,9 +132,9 @@ void DrawBillboardRecNoRatio( Camera camera, Texture2D texture, Rectangle source
|
||||
Draw a line in 3D world space
|
||||
*/
|
||||
int lmodelsDrawLine3D( lua_State *L ) {
|
||||
Vector3 startPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Vector3 startPos = uluaGetVector3( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawLine3D( startPos, endPos, color);
|
||||
|
||||
@@ -147,8 +147,8 @@ int lmodelsDrawLine3D( lua_State *L ) {
|
||||
Draw a point in 3D space, actually a small line
|
||||
*/
|
||||
int lmodelsDrawPoint3D( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Vector3 position = uluaGetVector3( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
DrawPoint3D( position, color );
|
||||
|
||||
@@ -161,11 +161,11 @@ int lmodelsDrawPoint3D( lua_State *L ) {
|
||||
Draw a circle in 3D world space
|
||||
*/
|
||||
int lmodelsDrawCircle3D( lua_State *L ) {
|
||||
Vector3 center = uluaGetVector3Index( L, 1 );
|
||||
Vector3 center = uluaGetVector3( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Vector3 rotationAxis = uluaGetVector3Index( L, 3 );
|
||||
Vector3 rotationAxis = uluaGetVector3( L, 3 );
|
||||
float rotationAngle = luaL_checknumber( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawCircle3D( center, radius, rotationAxis, rotationAngle, color );
|
||||
|
||||
@@ -178,10 +178,10 @@ int lmodelsDrawCircle3D( lua_State *L ) {
|
||||
Draw a color-filled triangle (Vertex in counter-clockwise order!)
|
||||
*/
|
||||
int lmodelsDrawTriangle3D( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v3 = uluaGetVector3Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
Vector3 v3 = uluaGetVector3( L, 3 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawTriangle3D( v1, v2, v3, color );
|
||||
|
||||
@@ -194,9 +194,9 @@ int lmodelsDrawTriangle3D( lua_State *L ) {
|
||||
Draw cube
|
||||
*/
|
||||
int lmodelsDrawCube( lua_State *L ) {
|
||||
Vector3 pos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 size = uluaGetVector3Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Vector3 pos = uluaGetVector3( L, 1 );
|
||||
Vector3 size = uluaGetVector3( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawCubeV( pos, size, color );
|
||||
|
||||
@@ -209,9 +209,9 @@ int lmodelsDrawCube( lua_State *L ) {
|
||||
Draw cube wires
|
||||
*/
|
||||
int lmodelsDrawCubeWires( lua_State *L ) {
|
||||
Vector3 pos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 size = uluaGetVector3Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Vector3 pos = uluaGetVector3( L, 1 );
|
||||
Vector3 size = uluaGetVector3( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawCubeWiresV( pos, size, color );
|
||||
|
||||
@@ -224,9 +224,9 @@ int lmodelsDrawCubeWires( lua_State *L ) {
|
||||
Draw sphere
|
||||
*/
|
||||
int lmodelsDrawSphere( lua_State *L ) {
|
||||
Vector3 centerPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 centerPos = uluaGetVector3( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawSphere( centerPos, radius, color );
|
||||
|
||||
@@ -239,11 +239,11 @@ int lmodelsDrawSphere( lua_State *L ) {
|
||||
Draw sphere with extended parameters
|
||||
*/
|
||||
int lmodelsDrawSphereEx( lua_State *L ) {
|
||||
Vector3 centerPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 centerPos = uluaGetVector3( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
int rings = luaL_checkinteger( L, 3 );
|
||||
int slices = luaL_checkinteger( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawSphereEx( centerPos, radius, rings, slices, color );
|
||||
|
||||
@@ -256,11 +256,11 @@ int lmodelsDrawSphereEx( lua_State *L ) {
|
||||
Draw sphere wires
|
||||
*/
|
||||
int lmodelsDrawSphereWires( lua_State *L ) {
|
||||
Vector3 centerPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 centerPos = uluaGetVector3( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
int rings = luaL_checkinteger( L, 3 );
|
||||
int slices = luaL_checkinteger( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawSphereWires( centerPos, radius, rings, slices, color );
|
||||
|
||||
@@ -273,12 +273,12 @@ int lmodelsDrawSphereWires( lua_State *L ) {
|
||||
Draw a cylinder/cone
|
||||
*/
|
||||
int lmodelsDrawCylinder( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 1 );
|
||||
float radiusTop = luaL_checknumber( L, 2 );
|
||||
float radiusBottom = luaL_checknumber( L, 3 );
|
||||
float height = luaL_checknumber( L, 4 );
|
||||
int slices = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCylinder( position, radiusTop, radiusBottom, height, slices, color );
|
||||
|
||||
@@ -291,12 +291,12 @@ int lmodelsDrawCylinder( lua_State *L ) {
|
||||
Draw a cylinder with base at startPos and top at endPos
|
||||
*/
|
||||
int lmodelsDrawCylinderEx( lua_State *L ) {
|
||||
Vector3 startPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3Index( L, 2 );
|
||||
Vector3 startPos = uluaGetVector3( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3( L, 2 );
|
||||
float startRadius = luaL_checknumber( L, 3 );
|
||||
float endRadius = luaL_checknumber( L, 4 );
|
||||
int sides = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCylinderEx( startPos, endPos, startRadius, endRadius, sides, color );
|
||||
|
||||
@@ -309,12 +309,12 @@ int lmodelsDrawCylinderEx( lua_State *L ) {
|
||||
Draw a cylinder/cone wires
|
||||
*/
|
||||
int lmodelsDrawCylinderWires( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 1 );
|
||||
float radiusTop = luaL_checknumber( L, 2 );
|
||||
float radiusBottom = luaL_checknumber( L, 3 );
|
||||
float height = luaL_checknumber( L, 4 );
|
||||
int slices = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCylinderWires( position, radiusTop, radiusBottom, height, slices, color );
|
||||
|
||||
@@ -327,12 +327,12 @@ int lmodelsDrawCylinderWires( lua_State *L ) {
|
||||
Draw a cylinder wires with base at startPos and top at endPos
|
||||
*/
|
||||
int lmodelsDrawCylinderWiresEx( lua_State *L ) {
|
||||
Vector3 startPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3Index( L, 2 );
|
||||
Vector3 startPos = uluaGetVector3( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3( L, 2 );
|
||||
float startRadius = luaL_checknumber( L, 3 );
|
||||
float endRadius = luaL_checknumber( L, 4 );
|
||||
int sides = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCylinderWiresEx( startPos, endPos, startRadius, endRadius, sides, color );
|
||||
|
||||
@@ -345,12 +345,12 @@ int lmodelsDrawCylinderWiresEx( lua_State *L ) {
|
||||
Draw a capsule with the center of its sphere caps at startPos and endPos
|
||||
*/
|
||||
int lmodelsDrawCapsule( lua_State *L ) {
|
||||
Vector3 startPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3Index( L, 2 );
|
||||
Vector3 startPos = uluaGetVector3( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
int slices = luaL_checkinteger( L, 4 );
|
||||
int rings = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCapsule( startPos, endPos, radius, slices, rings, color );
|
||||
|
||||
@@ -363,12 +363,12 @@ int lmodelsDrawCapsule( lua_State *L ) {
|
||||
Draw capsule wireframe with the center of its sphere caps at startPos and endPos
|
||||
*/
|
||||
int lmodelsDrawCapsuleWires( lua_State *L ) {
|
||||
Vector3 startPos = uluaGetVector3Index( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3Index( L, 2 );
|
||||
Vector3 startPos = uluaGetVector3( L, 1 );
|
||||
Vector3 endPos = uluaGetVector3( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
int slices = luaL_checkinteger( L, 4 );
|
||||
int rings = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCapsuleWires( startPos, endPos, radius, slices, rings, color );
|
||||
|
||||
@@ -381,9 +381,9 @@ int lmodelsDrawCapsuleWires( lua_State *L ) {
|
||||
Draw a plane XZ
|
||||
*/
|
||||
int lmodelsDrawPlane( lua_State *L ) {
|
||||
Vector3 centerPos = uluaGetVector3Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Vector3 centerPos = uluaGetVector3( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawPlane( centerPos, size, color );
|
||||
|
||||
@@ -406,7 +406,7 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
if ( lua_istable( L, -1 ) && i < 4 ) {
|
||||
vertices[i] = uluaGetVector3( L );
|
||||
vertices[i] = uluaGetVector3( L, lua_gettop( L ) );
|
||||
}
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
@@ -420,7 +420,7 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
if ( lua_istable( L, -1 ) && i < 4 ) {
|
||||
texcoords[i] = uluaGetVector2( L );
|
||||
texcoords[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
}
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
@@ -434,7 +434,7 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
if ( lua_istable( L, -1 ) && i < 4 ) {
|
||||
colors[i] = uluaGetColor( L );
|
||||
colors[i] = uluaGetColor( L, lua_gettop( L ) );
|
||||
}
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
@@ -464,8 +464,8 @@ int lmodelDrawQuad3DTexture( lua_State *L ) {
|
||||
Draw a ray line
|
||||
*/
|
||||
int lmodelsDrawRay( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Ray ray = uluaGetRay( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
DrawRay( ray, color );
|
||||
|
||||
@@ -532,7 +532,7 @@ Generate cuboid mesh
|
||||
- Success return Mesh
|
||||
*/
|
||||
int lmodelsGenMeshCube( lua_State *L ) {
|
||||
Vector3 size = uluaGetVector3Index( L, 1 );
|
||||
Vector3 size = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMesh( L, GenMeshCube( size.x, size.y, size.z ) );
|
||||
|
||||
@@ -635,7 +635,7 @@ Generate heightmap mesh from image data
|
||||
*/
|
||||
int lmodelsGenMeshHeightmap( lua_State *L ) {
|
||||
Image *heightmap = uluaGetImage( L, 1 );
|
||||
Vector3 size = uluaGetVector3Index( L, 2 );
|
||||
Vector3 size = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushMesh( L, GenMeshHeightmap( *heightmap, size ) );
|
||||
|
||||
@@ -660,7 +660,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
if ( strcmp( "vertices", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.vertexCount = len;
|
||||
mesh.triangleCount = len / 3;
|
||||
@@ -671,7 +671,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
Vector3 vec = uluaGetVector3( L );
|
||||
Vector3 vec = uluaGetVector3( L, lua_gettop( L ) );
|
||||
|
||||
mesh.vertices[(i*3)+0] = vec.x;
|
||||
mesh.vertices[(i*3)+1] = vec.y;
|
||||
@@ -681,7 +681,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "texcoords", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.texcoords = (float*)MemAlloc( len * 2 * sizeof(float) );
|
||||
|
||||
@@ -690,7 +690,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
Vector2 vec = uluaGetVector2( L );
|
||||
Vector2 vec = uluaGetVector2( L, lua_gettop( L ) );
|
||||
|
||||
mesh.texcoords[(i*2)+0] = vec.x;
|
||||
mesh.texcoords[(i*2)+1] = vec.y;
|
||||
@@ -699,7 +699,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "texcoords2", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.texcoords2 = (float*)MemAlloc( len * 2 * sizeof(float) );
|
||||
|
||||
@@ -708,7 +708,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
Vector2 vec = uluaGetVector2( L );
|
||||
Vector2 vec = uluaGetVector2( L, lua_gettop( L ) );
|
||||
|
||||
mesh.texcoords2[(i*2)+0] = vec.x;
|
||||
mesh.texcoords2[(i*2)+1] = vec.y;
|
||||
@@ -717,7 +717,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "normals", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.normals = (float*)MemAlloc( len * 3 * sizeof(float) );
|
||||
|
||||
@@ -726,7 +726,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
Vector3 vec = uluaGetVector3( L );
|
||||
Vector3 vec = uluaGetVector3( L, lua_gettop( L ) );
|
||||
|
||||
mesh.normals[(i*3)+0] = vec.x;
|
||||
mesh.normals[(i*3)+1] = vec.y;
|
||||
@@ -736,7 +736,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "tangents", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.tangents = (float*)MemAlloc( len * 4 * sizeof(float) );
|
||||
|
||||
@@ -745,7 +745,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
Vector4 vec = uluaGetVector4( L );
|
||||
Vector4 vec = uluaGetVector4( L, lua_gettop( L ) );
|
||||
|
||||
mesh.tangents[(i*4)+0] = vec.x;
|
||||
mesh.tangents[(i*4)+1] = vec.y;
|
||||
@@ -756,7 +756,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "colors", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.colors = (unsigned char*)MemAlloc( len * 4 * sizeof(unsigned char) );
|
||||
|
||||
@@ -765,7 +765,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
Color color = uluaGetColor( L );
|
||||
Color color = uluaGetColor( L, lua_gettop( L ) );
|
||||
|
||||
mesh.colors[(i*4)+0] = color.r;
|
||||
mesh.colors[(i*4)+1] = color.g;
|
||||
@@ -776,7 +776,7 @@ int lmodelsGenMeshCustom( lua_State *L ) {
|
||||
}
|
||||
}
|
||||
else if ( strcmp( "indices", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
mesh.indices = (unsigned short*)MemAlloc( len * sizeof(unsigned short) );
|
||||
|
||||
@@ -813,7 +813,7 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
if ( strcmp( "vertices", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
Vector3 data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -821,14 +821,14 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 && i < mesh->vertexCount ) {
|
||||
data[i] = uluaGetVector3( L );
|
||||
data[i] = uluaGetVector3( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
UpdateMeshBuffer( *mesh, 0, (void*)data, len * 3 * sizeof( float ), 0 );
|
||||
}
|
||||
else if ( strcmp( "texcoords", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
Vector2 data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -836,14 +836,14 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
data[i] = uluaGetVector2( L );
|
||||
data[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
UpdateMeshBuffer( *mesh, 1, (void*)data, len * 2 * sizeof( float ), 0 );
|
||||
}
|
||||
else if ( strcmp( "texcoords2", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
Vector2 data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -851,14 +851,14 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
data[i] = uluaGetVector2( L );
|
||||
data[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
UpdateMeshBuffer( *mesh, 5, (void*)data, len * 2 * sizeof( float ), 0 );
|
||||
}
|
||||
else if ( strcmp( "normals", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
Vector3 data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -866,14 +866,14 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
data[i] = uluaGetVector3( L );
|
||||
data[i] = uluaGetVector3( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
UpdateMeshBuffer( *mesh, 2, (void*)data, len * 3 * sizeof( float ), 0 );
|
||||
}
|
||||
else if ( strcmp( "tangents", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
Vector4 data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -881,14 +881,14 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
data[i] = uluaGetVector4( L );
|
||||
data[i] = uluaGetVector4( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
UpdateMeshBuffer( *mesh, 4, (void*)data, len * 4 * sizeof( float ), 0 );
|
||||
}
|
||||
else if ( strcmp( "colors", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
Color data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -896,14 +896,14 @@ int lmodelsUpdateMesh( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t2 ) != 0 ) {
|
||||
data[i] = uluaGetColor( L );
|
||||
data[i] = uluaGetColor( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
UpdateMeshBuffer( *mesh, 3, (void*)data, len * 4 * sizeof( unsigned char ), 0 );
|
||||
}
|
||||
else if ( strcmp( "indices", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
|
||||
size_t len = uluaGetTableLen( L );
|
||||
size_t len = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
unsigned short data[ len ];
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
@@ -944,7 +944,7 @@ Draw a 3d mesh with material and transform
|
||||
int lmodelsDrawMesh( lua_State *L ) {
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
Material *material = uluaGetMaterial( L, 2 );
|
||||
Matrix matrix = uluaGetMatrixIndex( L, 3 );
|
||||
Matrix matrix = uluaGetMatrix( L, 3 );
|
||||
|
||||
DrawMesh( *mesh, *material, matrix );
|
||||
|
||||
@@ -969,7 +969,7 @@ int lmodelsDrawMeshInstanced( lua_State *L ) {
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
if ( lua_istable( L, -1 ) ) {
|
||||
transforms[i] = uluaGetMatrix( L );
|
||||
transforms[i] = uluaGetMatrix( L, lua_gettop( L ) );
|
||||
}
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
@@ -990,7 +990,7 @@ NOTE: Currently only works on custom mesh
|
||||
*/
|
||||
int lmodelsSetMeshColor( lua_State *L ) {
|
||||
Mesh *mesh = uluaGetMesh( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
if ( mesh->colors == NULL ) {
|
||||
TraceLog( state->logLevelInvalid, "Mesh doesn't have vertex colors allocated" );
|
||||
@@ -1128,7 +1128,7 @@ int lmodelsCreateMaterial( lua_State *L ) {
|
||||
printf( "Material Create material.maps[map].texture.id = %d\n", material.maps[map].texture.id );
|
||||
}
|
||||
else if ( strcmp( "color", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
material.maps[map].color = uluaGetColorIndex( L, lua_gettop( L ) );
|
||||
material.maps[map].color = uluaGetColor( L, lua_gettop( L ) );
|
||||
}
|
||||
else if ( strcmp( "value", (char*)lua_tostring( L, -2 ) ) == 0 ) {
|
||||
material.maps[map].value = luaL_checkinteger( L, -1 );
|
||||
@@ -1224,7 +1224,7 @@ Set color for a material map type
|
||||
int lmodelsSetMaterialColor( lua_State *L ) {
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
int mapType = luaL_checkinteger( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
material->maps[ mapType ].color = color;
|
||||
|
||||
@@ -1268,7 +1268,7 @@ Set material generic parameters (if required)
|
||||
int lmodelsSetMaterialParams( lua_State *L ) {
|
||||
Material *material = uluaGetMaterial( L, 1 );
|
||||
|
||||
size_t len = uluaGetTableLenIndex( L, 2 );
|
||||
size_t len = uluaGetTableLen( L, 2 );
|
||||
|
||||
float params[ len ];
|
||||
|
||||
@@ -1448,9 +1448,9 @@ Draw a model (With texture if set)
|
||||
*/
|
||||
int lmodelsDrawModel( lua_State *L ) {
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
Vector3 position = uluaGetVector3( L, 2 );
|
||||
float scale = luaL_checknumber( L, 3 );
|
||||
Color tint = uluaGetColorIndex( L, 4 );
|
||||
Color tint = uluaGetColor( L, 4 );
|
||||
|
||||
DrawModel( *model, position, scale, tint );
|
||||
|
||||
@@ -1464,11 +1464,11 @@ Draw a model with extended parameters
|
||||
*/
|
||||
int lmodelsDrawModelEx( lua_State *L ) {
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
Vector3 position = uluaGetVector3Index( L, 2 );
|
||||
Vector3 rotationAxis = uluaGetVector3Index( L, 3 );
|
||||
Vector3 position = uluaGetVector3( L, 2 );
|
||||
Vector3 rotationAxis = uluaGetVector3( L, 3 );
|
||||
float rotationAngle = luaL_checknumber( L, 4 );
|
||||
Vector3 scale = uluaGetVector3Index( L, 5 );
|
||||
Color tint = uluaGetColorIndex( L, 6 );
|
||||
Vector3 scale = uluaGetVector3( L, 5 );
|
||||
Color tint = uluaGetColor( L, 6 );
|
||||
|
||||
DrawModelEx( *model, position, rotationAxis, rotationAngle, scale, tint );
|
||||
|
||||
@@ -1531,9 +1531,9 @@ Draw a billboard texture
|
||||
int lmodelsDrawBillboard( lua_State *L ) {
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Texture *texture = uluaGetTexture( L, 2 );
|
||||
Vector3 position = uluaGetVector3Index( L, 3 );
|
||||
Vector3 position = uluaGetVector3( L, 3 );
|
||||
float size = luaL_checknumber( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
Color tint = uluaGetColor( L, 5 );
|
||||
|
||||
DrawBillboard( *camera, *texture, position, size, tint );
|
||||
|
||||
@@ -1548,10 +1548,10 @@ Draw a billboard texture defined by source
|
||||
int lmodelsDrawBillboardRec( lua_State *L ) {
|
||||
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 );
|
||||
Rectangle source = uluaGetRectangle( L, 3 );
|
||||
Vector3 position = uluaGetVector3( L, 4 );
|
||||
Vector2 size = uluaGetVector2( L, 5 );
|
||||
Color tint = uluaGetColor( L, 6 );
|
||||
|
||||
DrawBillboardRecNoRatio( *camera, *texture, source, position, size, tint );
|
||||
|
||||
@@ -1566,13 +1566,13 @@ Draw a billboard texture defined by source and rotation
|
||||
int lmodelsDrawBillboardPro( lua_State *L ) {
|
||||
Camera3D *camera = uluaGetCamera3D( L, 1 );
|
||||
Texture *texture = uluaGetTexture( L, 2 );
|
||||
Rectangle source = uluaGetRectangleIndex( L, 3 );
|
||||
Vector3 position = uluaGetVector3Index( L, 4 );
|
||||
Vector3 up = uluaGetVector3Index( L, 5 );
|
||||
Vector2 size = uluaGetVector2Index( L, 6 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 7 );
|
||||
Rectangle source = uluaGetRectangle( L, 3 );
|
||||
Vector3 position = uluaGetVector3( L, 4 );
|
||||
Vector3 up = uluaGetVector3( L, 5 );
|
||||
Vector2 size = uluaGetVector2( L, 6 );
|
||||
Vector2 origin = uluaGetVector2( L, 7 );
|
||||
float rotation = luaL_checknumber( L, 8 );
|
||||
Color tint = uluaGetColorIndex( L, 9 );
|
||||
Color tint = uluaGetColor( L, 9 );
|
||||
|
||||
DrawBillboardProNoRatio( *camera, *texture, source, position, up, size, origin, rotation, tint );
|
||||
|
||||
@@ -1586,7 +1586,7 @@ Set model transform matrix
|
||||
*/
|
||||
int lmodelsSetModelTransform( lua_State *L ) {
|
||||
Model *model = uluaGetModel( L, 1 );
|
||||
Matrix transform = uluaGetMatrixIndex( L, 2 );
|
||||
Matrix transform = uluaGetMatrix( L, 2 );
|
||||
|
||||
model->transform = transform;
|
||||
|
||||
@@ -1713,9 +1713,9 @@ Check collision between two spheres
|
||||
- Success return bool
|
||||
*/
|
||||
int lmodelsCheckCollisionSpheres( lua_State *L ) {
|
||||
Vector3 center1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 center1 = uluaGetVector3( L, 1 );
|
||||
float radius1 = luaL_checknumber( L, 2 );
|
||||
Vector3 center2 = uluaGetVector3Index( L, 3 );
|
||||
Vector3 center2 = uluaGetVector3( L, 3 );
|
||||
float radius2 = luaL_checknumber( L, 4 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionSpheres( center1, radius1, center2, radius2 ) );
|
||||
@@ -1731,8 +1731,8 @@ Check collision between two bounding boxes
|
||||
- Success return bool
|
||||
*/
|
||||
int lmodelsCheckCollisionBoxes( lua_State *L ) {
|
||||
BoundingBox box1 = uluaGetBoundingBoxIndex( L, 1 );
|
||||
BoundingBox box2 = uluaGetBoundingBoxIndex( L, 2 );
|
||||
BoundingBox box1 = uluaGetBoundingBox( L, 1 );
|
||||
BoundingBox box2 = uluaGetBoundingBox( L, 2 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionBoxes( box1, box2 ) );
|
||||
|
||||
@@ -1747,8 +1747,8 @@ Check collision between box and sphere
|
||||
- Success return bool
|
||||
*/
|
||||
int lmodelsCheckCollisionBoxSphere( lua_State *L ) {
|
||||
BoundingBox box = uluaGetBoundingBoxIndex( L, 1 );
|
||||
Vector3 center = uluaGetVector3Index( L, 2 );
|
||||
BoundingBox box = uluaGetBoundingBox( L, 1 );
|
||||
Vector3 center = uluaGetVector3( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionBoxSphere( box, center, radius ) );
|
||||
@@ -1764,8 +1764,8 @@ Get collision info between ray and sphere. ( RayCollision is Lua table of { hit,
|
||||
- Success return RayCollision
|
||||
*/
|
||||
int lmodelsGetRayCollisionSphere( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
Vector3 center = uluaGetVector3Index( L, 2 );
|
||||
Ray ray = uluaGetRay( L, 1 );
|
||||
Vector3 center = uluaGetVector3( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushRayCollision( L, GetRayCollisionSphere( ray, center, radius ) );
|
||||
@@ -1781,8 +1781,8 @@ Get collision info between ray and box
|
||||
- Success return RayCollision
|
||||
*/
|
||||
int lmodelsGetRayCollisionBox( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
BoundingBox box = uluaGetBoundingBoxIndex( L, 2 );
|
||||
Ray ray = uluaGetRay( L, 1 );
|
||||
BoundingBox box = uluaGetBoundingBox( L, 2 );
|
||||
|
||||
uluaPushRayCollision( L, GetRayCollisionBox( ray, box ) );
|
||||
|
||||
@@ -1797,9 +1797,9 @@ Get collision info between ray and mesh
|
||||
- Success return RayCollision
|
||||
*/
|
||||
int lmodelsGetRayCollisionMesh( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
Ray ray = uluaGetRay( L, 1 );
|
||||
Mesh *mesh = uluaGetMesh( L, 2 );
|
||||
Matrix transform = uluaGetMatrixIndex( L, 3 );
|
||||
Matrix transform = uluaGetMatrix( L, 3 );
|
||||
|
||||
uluaPushRayCollision( L, GetRayCollisionMesh( ray, *mesh, transform ) );
|
||||
|
||||
@@ -1814,10 +1814,10 @@ Get collision info between ray and triangle
|
||||
- Success return RayCollision
|
||||
*/
|
||||
int lmodelsGetRayCollisionTriangle( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
Vector3 p1 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 p2 = uluaGetVector3Index( L, 3 );
|
||||
Vector3 p3 = uluaGetVector3Index( L, 4 );
|
||||
Ray ray = uluaGetRay( L, 1 );
|
||||
Vector3 p1 = uluaGetVector3( L, 2 );
|
||||
Vector3 p2 = uluaGetVector3( L, 3 );
|
||||
Vector3 p3 = uluaGetVector3( L, 4 );
|
||||
|
||||
uluaPushRayCollision( L, GetRayCollisionTriangle( ray, p1, p2, p3 ) );
|
||||
|
||||
@@ -1832,11 +1832,11 @@ Get collision info between ray and quad
|
||||
- Success return RayCollision
|
||||
*/
|
||||
int lmodelsGetRayCollisionQuad( lua_State *L ) {
|
||||
Ray ray = uluaGetRayIndex( L, 1 );
|
||||
Vector3 p1 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 p2 = uluaGetVector3Index( L, 3 );
|
||||
Vector3 p3 = uluaGetVector3Index( L, 4 );
|
||||
Vector3 p4 = uluaGetVector3Index( L, 5 );
|
||||
Ray ray = uluaGetRay( L, 1 );
|
||||
Vector3 p1 = uluaGetVector3( L, 2 );
|
||||
Vector3 p2 = uluaGetVector3( L, 3 );
|
||||
Vector3 p3 = uluaGetVector3( L, 4 );
|
||||
Vector3 p4 = uluaGetVector3( L, 5 );
|
||||
|
||||
uluaPushRayCollision( L, GetRayCollisionQuad( ray, p1, p2, p3, p4 ) );
|
||||
|
||||
|
||||
82
src/rgui.c
82
src/rgui.c
@@ -215,7 +215,7 @@ Window Box control, shows a window that can be closed
|
||||
- Success return bool
|
||||
*/
|
||||
int lguiGuiWindowBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushboolean( L, GuiWindowBox( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -228,7 +228,7 @@ int lguiGuiWindowBox( lua_State *L ) {
|
||||
Group Box control with text name
|
||||
*/
|
||||
int lguiGuiGroupBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
GuiGroupBox( bounds, luaL_checkstring( L, 2 ) );
|
||||
|
||||
@@ -241,7 +241,7 @@ int lguiGuiGroupBox( lua_State *L ) {
|
||||
Line separator control, could contain text
|
||||
*/
|
||||
int lguiGuiLine( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
GuiLine( bounds, luaL_checkstring( L, 2 ) );
|
||||
|
||||
@@ -254,7 +254,7 @@ int lguiGuiLine( lua_State *L ) {
|
||||
Panel control, useful to group controls
|
||||
*/
|
||||
int lguiGuiPanel( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
GuiPanel( bounds, luaL_checkstring( L, 2 ) );
|
||||
|
||||
@@ -269,9 +269,9 @@ Scroll Panel control
|
||||
- Success return Rectangle, Vector2
|
||||
*/
|
||||
int lguiGuiScrollPanel( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle content = uluaGetRectangleIndex( L, 3 );
|
||||
Vector2 scroll = uluaGetVector2Index( L, 4 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Rectangle content = uluaGetRectangle( L, 3 );
|
||||
Vector2 scroll = uluaGetVector2( L, 4 );
|
||||
|
||||
uluaPushRectangle( L, GuiScrollPanel( bounds, luaL_checkstring( L, 2 ), content, &scroll ) );
|
||||
uluaPushVector2( L, scroll );
|
||||
@@ -289,7 +289,7 @@ int lguiGuiScrollPanel( lua_State *L ) {
|
||||
Label control, shows text
|
||||
*/
|
||||
int lguiGuiLabel( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
GuiLabel( bounds, luaL_checkstring( L, 2 ) );
|
||||
|
||||
@@ -304,7 +304,7 @@ Button control, returns true when clicked
|
||||
- Success return boolean
|
||||
*/
|
||||
int lguiGuiButton( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushboolean( L, GuiButton( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -319,7 +319,7 @@ Label button control, show true when clicked
|
||||
- Success return boolean
|
||||
*/
|
||||
int lguiGuiLabelButton( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushboolean( L, GuiLabelButton( bounds, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -334,7 +334,7 @@ Toggle Button control, returns true when active
|
||||
- Success return boolean
|
||||
*/
|
||||
int lguiGuiToggle( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
bool checked = uluaGetBoolean( L, 3 );
|
||||
|
||||
lua_pushboolean( L, GuiToggle( bounds, luaL_checkstring( L, 2 ), checked ) );
|
||||
@@ -350,7 +350,7 @@ Toggle Group control, returns active toggle index
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiToggleGroup( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
|
||||
lua_pushinteger( L, GuiToggleGroup( bounds, luaL_checkstring( L, 2 ), active ) );
|
||||
@@ -366,7 +366,7 @@ Check Box control, returns true when active
|
||||
- Success return boolean
|
||||
*/
|
||||
int lguiGuiCheckBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
bool checked = uluaGetBoolean( L, 3 );
|
||||
|
||||
lua_pushboolean( L, GuiCheckBox( bounds, luaL_checkstring( L, 2 ), checked ) );
|
||||
@@ -382,7 +382,7 @@ Combo Box control, returns selected item index
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiComboBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
|
||||
lua_pushinteger( L, GuiComboBox( bounds, luaL_checkstring( L, 2 ), active ) );
|
||||
@@ -398,7 +398,7 @@ Text Box control, updates input text
|
||||
- Success return boolean, string
|
||||
*/
|
||||
int lguiGuiTextBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int textSize = luaL_checkinteger( L, 3 );
|
||||
// char text[ STRING_LEN ] = { '\0' };
|
||||
char text[ textSize + 1 ];
|
||||
@@ -419,7 +419,7 @@ Text Box control with multiple lines
|
||||
- Success return boolean, string
|
||||
*/
|
||||
int lguiGuiTextBoxMulti( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int textSize = luaL_checkinteger( L, 3 );
|
||||
// char text[ STRING_LEN ] = { '\0' };
|
||||
char text[ textSize + 1 ];
|
||||
@@ -440,7 +440,7 @@ Spinner control, returns selected value
|
||||
- Success return boolean, int
|
||||
*/
|
||||
int lguiGuiSpinner( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int value = luaL_checkinteger( L, 3 );
|
||||
int minValue = luaL_checkinteger( L, 4 );
|
||||
int maxValue = luaL_checkinteger( L, 5 );
|
||||
@@ -460,7 +460,7 @@ Value Box control, updates input text with numbers
|
||||
- Success return boolean, int
|
||||
*/
|
||||
int lguiGuiValueBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int value = luaL_checkinteger( L, 3 );
|
||||
int minValue = luaL_checkinteger( L, 4 );
|
||||
int maxValue = luaL_checkinteger( L, 5 );
|
||||
@@ -480,7 +480,7 @@ Slider control, returns selected value
|
||||
- Success return float
|
||||
*/
|
||||
int lguiGuiSlider( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 4 );
|
||||
float minValue = luaL_checknumber( L, 5 );
|
||||
float maxValue = luaL_checknumber( L, 6 );
|
||||
@@ -498,7 +498,7 @@ Slider Bar control, returns selected value
|
||||
- Success return float
|
||||
*/
|
||||
int lguiGuiSliderBar( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 4 );
|
||||
float minValue = luaL_checknumber( L, 5 );
|
||||
float maxValue = luaL_checknumber( L, 6 );
|
||||
@@ -516,7 +516,7 @@ Progress Bar control, shows current progress value
|
||||
- Success return float
|
||||
*/
|
||||
int lguiGuiProgressBar( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 4 );
|
||||
float minValue = luaL_checknumber( L, 5 );
|
||||
float maxValue = luaL_checknumber( L, 6 );
|
||||
@@ -534,7 +534,7 @@ Scroll Bar control
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiScrollBar( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int value = luaL_checkinteger( L, 2 );
|
||||
int minValue = luaL_checkinteger( L, 3 );
|
||||
int maxValue = luaL_checkinteger( L, 4 );
|
||||
@@ -552,7 +552,7 @@ Dropdown Box control, returns selected item
|
||||
- Success return bool, int
|
||||
*/
|
||||
int lguiGuiDropdownBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int active = luaL_checkinteger( L, 3 );
|
||||
bool editMode = uluaGetBoolean( L, 4 );
|
||||
|
||||
@@ -568,7 +568,7 @@ int lguiGuiDropdownBox( lua_State *L ) {
|
||||
Status Bar control, shows info text
|
||||
*/
|
||||
int lguiGuiStatusBar( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
GuiStatusBar( bounds, luaL_checkstring( L, 2 ) );
|
||||
|
||||
@@ -581,7 +581,7 @@ int lguiGuiStatusBar( lua_State *L ) {
|
||||
Dummy control for placeholders
|
||||
*/
|
||||
int lguiGuiDummyRec( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
GuiDummyRec( bounds, luaL_checkstring( L, 2 ) );
|
||||
|
||||
@@ -596,7 +596,7 @@ Grid control, returns mouse cell position
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lguiGuiGrid( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float spacing = luaL_checknumber( L, 3 );
|
||||
int subdivs = luaL_checkinteger( L, 4 );
|
||||
|
||||
@@ -617,7 +617,7 @@ List View control, returns selected list item index and scroll index
|
||||
- Success return int, int
|
||||
*/
|
||||
int lguiGuiListView( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int scrollIndex = luaL_checkinteger( L, 3 );
|
||||
int active = luaL_checkinteger( L, 4 );
|
||||
|
||||
@@ -635,7 +635,7 @@ List View with extended parameters, returns selected list item index, scroll ind
|
||||
- Success return int, int, int
|
||||
*/
|
||||
int lguiGuiListViewEx( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int focus = luaL_checkinteger( L, 3 );
|
||||
int scrollIndex = luaL_checkinteger( L, 4 );
|
||||
int active = luaL_checkinteger( L, 5 );
|
||||
@@ -657,7 +657,7 @@ Message Box control, displays a message, returns button index (0 is x button)
|
||||
- Success return int
|
||||
*/
|
||||
int lguiGuiMessageBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
|
||||
lua_pushinteger( L, GuiMessageBox( bounds, luaL_checkstring( L, 2 ), luaL_checkstring( L, 3 ), luaL_checkstring( L, 4 ) ) );
|
||||
|
||||
@@ -672,7 +672,7 @@ Text Input Box control, ask for text, supports secret
|
||||
- Success return int, string, int
|
||||
*/
|
||||
int lguiGuiTextInputBox( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
int textMaxSize = luaL_checkinteger( L, 6 );
|
||||
int secretViewActive = luaL_checkinteger( L, 7 );
|
||||
char text[ textMaxSize + 1 ];
|
||||
@@ -693,8 +693,8 @@ Color Picker control (multiple color controls)
|
||||
- Success return Color
|
||||
*/
|
||||
int lguiGuiColorPicker( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
uluaPushColor( L, GuiColorPicker( bounds, luaL_checkstring( L, 2 ), color ) );
|
||||
|
||||
@@ -709,8 +709,8 @@ Color Panel control
|
||||
- Success return Color
|
||||
*/
|
||||
int lguiGuiColorPanel( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
uluaPushColor( L, GuiColorPanel( bounds, luaL_checkstring( L, 2 ), color ) );
|
||||
|
||||
@@ -725,7 +725,7 @@ Color Bar Alpha control
|
||||
- Success return float
|
||||
*/
|
||||
int lguiGuiColorBarAlpha( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float alpha = luaL_checknumber( L, 3 );
|
||||
|
||||
lua_pushnumber( L, GuiColorBarAlpha( bounds, luaL_checkstring( L, 2 ), alpha ) );
|
||||
@@ -741,7 +741,7 @@ Color Bar Hue control
|
||||
- Success return float
|
||||
*/
|
||||
int lguiGuiColorBarHue( lua_State *L ) {
|
||||
Rectangle bounds = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle bounds = uluaGetRectangle( L, 1 );
|
||||
float value = luaL_checknumber( L, 3 );
|
||||
|
||||
lua_pushnumber( L, GuiColorBarHue( bounds, luaL_checkstring( L, 2 ), value ) );
|
||||
@@ -780,9 +780,9 @@ Draw icon
|
||||
*/
|
||||
int lguiGuiDrawIcon( lua_State *L ) {
|
||||
int iconId = luaL_checkinteger( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
int pixelSize = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
GuiDrawIcon( iconId, pos.x, pos.y, pixelSize, color );
|
||||
|
||||
@@ -809,7 +809,7 @@ Set icon pixel value
|
||||
*/
|
||||
int lguiGuiSetIconPixel( lua_State *L ) {
|
||||
int iconId = luaL_checkinteger( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
|
||||
GuiSetIconPixel( iconId, pos.x, pos.y );
|
||||
|
||||
@@ -823,7 +823,7 @@ Clear icon pixel value
|
||||
*/
|
||||
int lguiGuiClearIconPixel( lua_State *L ) {
|
||||
int iconId = luaL_checkinteger( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
|
||||
GuiClearIconPixel( iconId, pos.x, pos.y );
|
||||
|
||||
@@ -839,7 +839,7 @@ Check icon pixel value
|
||||
*/
|
||||
int lguiGuiCheckIconPixel( lua_State *L ) {
|
||||
int iconId = luaL_checkinteger( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushboolean( L, GuiCheckIconPixel( iconId, pos.x, pos.y ) );
|
||||
|
||||
|
||||
46
src/rlgl.c
46
src/rlgl.c
@@ -57,7 +57,7 @@ int lrlglLoadIdentity( lua_State *L ) {
|
||||
Multiply the current matrix by a translation matrix
|
||||
*/
|
||||
int lrlglTranslatef( lua_State *L ) {
|
||||
Vector3 translation = uluaGetVector3Index( L, 1 );
|
||||
Vector3 translation = uluaGetVector3( L, 1 );
|
||||
|
||||
rlTranslatef( translation.x, translation.y, translation.z );
|
||||
|
||||
@@ -71,7 +71,7 @@ Multiply the current matrix by a rotation matrix
|
||||
*/
|
||||
int lrlglRotatef( lua_State *L ) {
|
||||
float angle = luaL_checknumber( L, 1 );
|
||||
Vector3 rotation = uluaGetVector3Index( L, 2 );
|
||||
Vector3 rotation = uluaGetVector3( L, 2 );
|
||||
|
||||
rlRotatef( angle, rotation.x, rotation.y, rotation.z );
|
||||
|
||||
@@ -84,7 +84,7 @@ int lrlglRotatef( lua_State *L ) {
|
||||
Multiply the current matrix by a scaling matrix
|
||||
*/
|
||||
int lrlglScalef( lua_State *L ) {
|
||||
Vector3 scale = uluaGetVector3Index( L, 1 );
|
||||
Vector3 scale = uluaGetVector3( L, 1 );
|
||||
|
||||
rlScalef( scale.x, scale.y, scale.z );
|
||||
|
||||
@@ -97,7 +97,7 @@ int lrlglScalef( lua_State *L ) {
|
||||
Multiply the current matrix by another matrix
|
||||
*/
|
||||
int lrlglMultMatrixf( lua_State *L ) {
|
||||
Matrix matrix = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix matrix = uluaGetMatrix( L, 1 );
|
||||
|
||||
float matf[16] = {
|
||||
matrix.m0, matrix.m4, matrix.m8, matrix.m12,
|
||||
@@ -153,7 +153,7 @@ Set the viewport area (transformation from normalized device coordinates to wind
|
||||
NOTE: We store current viewport dimensions
|
||||
*/
|
||||
int lrlglViewport( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
|
||||
rlViewport( rect.x, rect.y, rect.width, rect.height );
|
||||
|
||||
@@ -192,7 +192,7 @@ int lrlglEnd( lua_State *L ) {
|
||||
Define one vertex (position)
|
||||
*/
|
||||
int lrlglVertex2f( lua_State *L ) {
|
||||
Vector2 position = uluaGetVector2Index( L, 1 );
|
||||
Vector2 position = uluaGetVector2( L, 1 );
|
||||
|
||||
rlVertex2f( position.x, position.y );
|
||||
|
||||
@@ -205,7 +205,7 @@ int lrlglVertex2f( lua_State *L ) {
|
||||
Define one vertex (position)
|
||||
*/
|
||||
int lrlglVertex3f( lua_State *L ) {
|
||||
Vector3 position = uluaGetVector3Index( L, 1 );
|
||||
Vector3 position = uluaGetVector3( L, 1 );
|
||||
|
||||
rlVertex3f( position.x, position.y, position.z );
|
||||
|
||||
@@ -218,7 +218,7 @@ int lrlglVertex3f( lua_State *L ) {
|
||||
Define one vertex (texture coordinate) - 2 float
|
||||
*/
|
||||
int lrlglTexCoord2f( lua_State *L ) {
|
||||
Vector2 texCoord = uluaGetVector2Index( L, 1 );
|
||||
Vector2 texCoord = uluaGetVector2( L, 1 );
|
||||
|
||||
rlTexCoord2f( texCoord.x, texCoord.y );
|
||||
|
||||
@@ -231,7 +231,7 @@ int lrlglTexCoord2f( lua_State *L ) {
|
||||
Define one vertex (normal) - 3 float
|
||||
*/
|
||||
int lrlglNormal3f( lua_State *L ) {
|
||||
Vector3 normal = uluaGetVector3Index( L, 1 );
|
||||
Vector3 normal = uluaGetVector3( L, 1 );
|
||||
|
||||
rlNormal3f( normal.x, normal.y, normal.z );
|
||||
|
||||
@@ -244,7 +244,7 @@ int lrlglNormal3f( lua_State *L ) {
|
||||
Define one vertex (color) - 4 byte
|
||||
*/
|
||||
int lrlglColor4ub( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
rlColor4ub( color.r, color.g, color.b, color.a );
|
||||
|
||||
@@ -257,7 +257,7 @@ int lrlglColor4ub( lua_State *L ) {
|
||||
Define one vertex (color) - 3 float
|
||||
*/
|
||||
int lrlglColor3f( lua_State *L ) {
|
||||
Vector3 color = uluaGetVector3Index( L, 1 );
|
||||
Vector3 color = uluaGetVector3( L, 1 );
|
||||
|
||||
rlColor3f( color.x, color.y, color.z );
|
||||
|
||||
@@ -270,7 +270,7 @@ int lrlglColor3f( lua_State *L ) {
|
||||
Define one vertex (color) - 4 float
|
||||
*/
|
||||
int lrlglColor4f( lua_State *L ) {
|
||||
Vector4 color = uluaGetVector4Index( L, 1 );
|
||||
Vector4 color = uluaGetVector4( L, 1 );
|
||||
|
||||
rlColor4f( color.x, color.y, color.z, color.w );
|
||||
|
||||
@@ -657,7 +657,7 @@ int lrlglDisableScissorTest( lua_State *L ) {
|
||||
Scissor test
|
||||
*/
|
||||
int lrlglScissor( lua_State *L ) {
|
||||
Rectangle area = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle area = uluaGetRectangle( L, 1 );
|
||||
|
||||
rlScissor( area.x, area.y, area.width, area.height );
|
||||
|
||||
@@ -773,7 +773,7 @@ int lrlglIsStereoRenderEnabled( lua_State *L ) {
|
||||
Clear color buffer with color
|
||||
*/
|
||||
int lrlglClearColor( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
rlClearColor( color.r, color.g, color.b, color.a );
|
||||
|
||||
@@ -1142,7 +1142,7 @@ Set vertex attribute default value
|
||||
int lrlglSetVertexAttributeDefault( lua_State *L ) {
|
||||
int locIndex = luaL_checkinteger( L, 1 );
|
||||
int attribType = luaL_checkinteger( L, 3 );
|
||||
int count = uluaGetTableLenIndex( L, 2 );
|
||||
int count = uluaGetTableLen( L, 2 );
|
||||
float value[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
|
||||
|
||||
int t = 2;
|
||||
@@ -1231,7 +1231,7 @@ Load texture in GPU
|
||||
- Success return int
|
||||
*/
|
||||
int lrlglLoadTexture( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
int format = luaL_checkinteger( L, 2 );
|
||||
int mipmapCount = luaL_checkinteger( L, 3 );
|
||||
|
||||
@@ -1248,7 +1248,7 @@ Load depth texture/renderbuffer (to be attached to fbo)
|
||||
- Success return int
|
||||
*/
|
||||
int lrlglLoadTextureDepth( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
bool useRenderBuffer = uluaGetBoolean( L, 2 );
|
||||
|
||||
lua_pushinteger( L, rlLoadTextureDepth( size.x, size.y, useRenderBuffer ) );
|
||||
@@ -1279,7 +1279,7 @@ Load an empty framebuffer
|
||||
- Success return int
|
||||
*/
|
||||
int lrlglLoadFramebuffer( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
|
||||
lua_pushinteger( L, rlLoadFramebuffer( size.x, size.y ) );
|
||||
|
||||
@@ -1445,7 +1445,7 @@ Set shader value matrix
|
||||
*/
|
||||
int lrlglSetUniformMatrix( lua_State *L ) {
|
||||
int locIndex = luaL_checkinteger( L, 1 );
|
||||
Matrix mat = uluaGetMatrixIndex( L, 2 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
rlSetUniformMatrix( locIndex, mat );
|
||||
|
||||
@@ -1620,7 +1620,7 @@ int lrlglGetMatrixViewOffsetStereo( lua_State *L ) {
|
||||
Set a custom projection matrix (replaces internal projection matrix)
|
||||
*/
|
||||
int lrlglSetMatrixProjection( lua_State *L ) {
|
||||
rlSetMatrixProjection( uluaGetMatrixIndex( L, 1 ) );
|
||||
rlSetMatrixProjection( uluaGetMatrix( L, 1 ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1631,7 +1631,7 @@ int lrlglSetMatrixProjection( lua_State *L ) {
|
||||
Set a custom modelview matrix (replaces internal modelview matrix)
|
||||
*/
|
||||
int lrlglSetMatrixModelview( lua_State *L ) {
|
||||
rlSetMatrixModelview( uluaGetMatrixIndex( L, 1 ) );
|
||||
rlSetMatrixModelview( uluaGetMatrix( L, 1 ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1642,7 +1642,7 @@ int lrlglSetMatrixModelview( lua_State *L ) {
|
||||
Set eyes projection matrices for stereo rendering
|
||||
*/
|
||||
int lrlglSetMatrixProjectionStereo( lua_State *L ) {
|
||||
rlSetMatrixProjectionStereo( uluaGetMatrixIndex( L, 1 ), uluaGetMatrixIndex( L, 2 ) );
|
||||
rlSetMatrixProjectionStereo( uluaGetMatrix( L, 1 ), uluaGetMatrix( L, 2 ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1653,7 +1653,7 @@ int lrlglSetMatrixProjectionStereo( lua_State *L ) {
|
||||
Set eyes view offsets matrices for stereo rendering
|
||||
*/
|
||||
int lrlglSetMatrixViewOffsetStereo( lua_State *L ) {
|
||||
rlSetMatrixViewOffsetStereo( uluaGetMatrixIndex( L, 1 ), uluaGetMatrixIndex( L, 2 ) );
|
||||
rlSetMatrixViewOffsetStereo( uluaGetMatrix( L, 1 ), uluaGetMatrix( L, 2 ) );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
296
src/rmath.c
296
src/rmath.c
@@ -156,8 +156,8 @@ Add two vectors (v1 + v2)
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Add( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Add( v1, v2 ) );
|
||||
|
||||
@@ -172,7 +172,7 @@ Add vector and float value
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2AddValue( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float add = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2AddValue( v, add ) );
|
||||
@@ -188,8 +188,8 @@ Subtract two vectors (v1 - v2)
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Subtract( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Subtract( v1, v2 ) );
|
||||
|
||||
@@ -204,7 +204,7 @@ Subtract vector by float value
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2SubtractValue( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float sub = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2SubtractValue( v, sub ) );
|
||||
@@ -220,7 +220,7 @@ Calculate vector length
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2Length( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector2Length( v ) );
|
||||
|
||||
@@ -235,7 +235,7 @@ Calculate vector square length
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2LengthSqr( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector2LengthSqr( v ) );
|
||||
|
||||
@@ -250,8 +250,8 @@ Calculate two vectors dot product
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2DotProduct( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector2DotProduct( v1, v2 ) );
|
||||
|
||||
@@ -266,8 +266,8 @@ Calculate distance between two vectors
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2Distance( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector2Distance( v1, v2 ) );
|
||||
|
||||
@@ -282,8 +282,8 @@ Calculate square distance between two vectors
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2DistanceSqr( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector2DistanceSqr( v1, v2 ) );
|
||||
|
||||
@@ -298,8 +298,8 @@ Calculate angle from two vectors
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2Angle( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector2Angle( v1, v2 ) );
|
||||
|
||||
@@ -316,8 +316,8 @@ Current implementation should be aligned with glm::angle.
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector2LineAngle( lua_State *L ) {
|
||||
Vector2 start = uluaGetVector2Index( L, 1 );
|
||||
Vector2 end = uluaGetVector2Index( L, 2 );
|
||||
Vector2 start = uluaGetVector2( L, 1 );
|
||||
Vector2 end = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector2LineAngle( start, end ) );
|
||||
|
||||
@@ -332,7 +332,7 @@ Scale vector (multiply by value)
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Scale( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float scale = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Scale( v, scale ) );
|
||||
@@ -348,8 +348,8 @@ Multiply vector by vector
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Multiply( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Multiply( v1, v2 ) );
|
||||
|
||||
@@ -364,7 +364,7 @@ Negate vector
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Negate( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushVector2( L, Vector2Negate( v ) );
|
||||
|
||||
@@ -379,8 +379,8 @@ Divide vector by vector
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Divide( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Divide( v1, v2 ) );
|
||||
|
||||
@@ -395,7 +395,7 @@ Normalize provided vector
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Normalize( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushVector2( L, Vector2Normalize( v ) );
|
||||
|
||||
@@ -410,8 +410,8 @@ Transforms a Vector2 by a given Matrix
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Transform( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Matrix mat = uluaGetMatrixIndex( L, 2 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Transform( v, mat ) );
|
||||
|
||||
@@ -426,8 +426,8 @@ Calculate linear interpolation between two vectors
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Lerp( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushVector2( L, Vector2Lerp( v1, v2, amount ) );
|
||||
@@ -443,8 +443,8 @@ Calculate reflected vector to normal
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Reflect( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Reflect( v1, v2 ) );
|
||||
|
||||
@@ -459,7 +459,7 @@ Rotate vector by angle
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Rotate( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float degs = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector2( L, Vector2Rotate( v, degs ) );
|
||||
@@ -475,8 +475,8 @@ Move Vector towards target
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2MoveTowards( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
float maxDistance = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushVector2( L, Vector2MoveTowards( v1, v2, maxDistance ) );
|
||||
@@ -492,7 +492,7 @@ Invert the given vector
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Invert( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushVector2( L, Vector2Invert( v ) );
|
||||
|
||||
@@ -508,9 +508,9 @@ min and max values specified by the given vectors
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2Clamp( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 min = uluaGetVector2Index( L, 2 );
|
||||
Vector2 max = uluaGetVector2Index( L, 3 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
Vector2 min = uluaGetVector2( L, 2 );
|
||||
Vector2 max = uluaGetVector2( L, 3 );
|
||||
|
||||
uluaPushVector2( L, Vector2Clamp( v, min, max ) );
|
||||
|
||||
@@ -525,7 +525,7 @@ Clamp the magnitude of the vector between two min and max values
|
||||
- Success return Vector2
|
||||
*/
|
||||
int lmathVector2ClampValue( lua_State *L ) {
|
||||
Vector2 v = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v = uluaGetVector2( L, 1 );
|
||||
float min = luaL_checknumber( L, 2 );
|
||||
float max = luaL_checknumber( L, 3 );
|
||||
|
||||
@@ -542,8 +542,8 @@ Check whether two given vectors are almost equal
|
||||
- Success return int
|
||||
*/
|
||||
int lmathVector2Equals( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
|
||||
lua_pushinteger( L, Vector2Equals( v1, v2 ) );
|
||||
|
||||
@@ -588,8 +588,8 @@ Add two vectors
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Add( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Add( v1, v2 ) );
|
||||
|
||||
@@ -604,7 +604,7 @@ Add vector and float value
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3AddValue( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float add = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3AddValue( v, add ) );
|
||||
@@ -620,8 +620,8 @@ Subtract two vectors
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Subtract( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Subtract( v1, v2 ) );
|
||||
|
||||
@@ -636,7 +636,7 @@ Subtract vector by float value
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3SubtractValue( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float sub = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3SubtractValue( v, sub ) );
|
||||
@@ -652,7 +652,7 @@ Multiply vector by scalar
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Scale( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float scalar = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Scale( v, scalar ) );
|
||||
@@ -668,8 +668,8 @@ Multiply vector by vector
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Multiply( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Multiply( v1, v2 ) );
|
||||
|
||||
@@ -684,8 +684,8 @@ Calculate two vectors cross product
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3CrossProduct( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3CrossProduct( v1, v2 ) );
|
||||
|
||||
@@ -700,7 +700,7 @@ Calculate one vector perpendicular vector
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Perpendicular( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Perpendicular( v ) );
|
||||
|
||||
@@ -715,7 +715,7 @@ Calculate vector length
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3Length( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector3Length( v ) );
|
||||
|
||||
@@ -730,7 +730,7 @@ Calculate vector square length
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3LengthSqr( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
lua_pushnumber( L, Vector3LengthSqr( v ) );
|
||||
|
||||
@@ -745,8 +745,8 @@ Calculate two vectors dot product
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3DotProduct( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector3DotProduct( v1, v2 ) );
|
||||
|
||||
@@ -761,8 +761,8 @@ Calculate distance between two vectors
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3Distance( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector3Distance( v1, v2 ) );
|
||||
|
||||
@@ -777,8 +777,8 @@ Calculate square distance between two vectors
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3DistanceSqr( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector3DistanceSqr( v1, v2 ) );
|
||||
|
||||
@@ -793,8 +793,8 @@ Calculate angle between two vectors
|
||||
- Success return float
|
||||
*/
|
||||
int lmathVector3Angle( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
lua_pushnumber( L, Vector3Angle( v1, v2 ) );
|
||||
|
||||
@@ -809,7 +809,7 @@ Negate provided vector (invert direction)
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Negate( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Negate( v ) );
|
||||
|
||||
@@ -824,8 +824,8 @@ Divide vector by vector
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Divide( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Divide( v1, v2 ) );
|
||||
|
||||
@@ -840,7 +840,7 @@ Normalize provided vector
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Normalize( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Normalize( v ) );
|
||||
|
||||
@@ -856,8 +856,8 @@ Gram-Schmidt function implementation
|
||||
- Success return Vector3, Vector3
|
||||
*/
|
||||
int lmathVector3OrthoNormalize( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
Vector3OrthoNormalize( &v1, &v2 );
|
||||
|
||||
@@ -875,8 +875,8 @@ Transforms a Vector3 by a given Matrix
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Transform( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Matrix mat = uluaGetMatrixIndex( L, 2 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Transform( v, mat ) );
|
||||
|
||||
@@ -891,8 +891,8 @@ Transform a vector by quaternion rotation
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3RotateByQuaternion( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 2 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3RotateByQuaternion( v, q ) );
|
||||
|
||||
@@ -907,8 +907,8 @@ Rotates a vector around an axis
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3RotateByAxisAngle( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 axis = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 axis = uluaGetVector3( L, 2 );
|
||||
float angle = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushVector3( L, Vector3RotateByAxisAngle( v, axis, angle ) );
|
||||
@@ -924,8 +924,8 @@ Calculate linear interpolation between two vectors
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Lerp( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushVector3( L, Vector3Lerp( v1, v2, amount ) );
|
||||
@@ -941,8 +941,8 @@ Calculate reflected vector to normal
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Reflect( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 normal = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 normal = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Reflect( v, normal ) );
|
||||
|
||||
@@ -957,8 +957,8 @@ Get min value for each pair of components
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Min( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Min( v1, v2 ) );
|
||||
|
||||
@@ -973,8 +973,8 @@ Get max value for each pair of components
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Max( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushVector3( L, Vector3Max( v1, v2 ) );
|
||||
|
||||
@@ -990,10 +990,10 @@ NOTE: Assumes P is on the plane of the triangle
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Barycenter( lua_State *L ) {
|
||||
Vector3 p = uluaGetVector3Index( L, 1 );
|
||||
Vector3 a = uluaGetVector3Index( L, 2 );
|
||||
Vector3 b = uluaGetVector3Index( L, 3 );
|
||||
Vector3 c = uluaGetVector3Index( L, 4 );
|
||||
Vector3 p = uluaGetVector3( L, 1 );
|
||||
Vector3 a = uluaGetVector3( L, 2 );
|
||||
Vector3 b = uluaGetVector3( L, 3 );
|
||||
Vector3 c = uluaGetVector3( L, 4 );
|
||||
|
||||
uluaPushVector3( L, Vector3Barycenter( p, a, b, c ) );
|
||||
|
||||
@@ -1009,9 +1009,9 @@ NOTE: We are avoiding calling other raymath functions despite available
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Unproject( lua_State *L ) {
|
||||
Vector3 source = uluaGetVector3Index( L, 1 );
|
||||
Matrix projection = uluaGetMatrixIndex( L, 2 );
|
||||
Matrix view = uluaGetMatrixIndex( L, 3 );
|
||||
Vector3 source = uluaGetVector3( L, 1 );
|
||||
Matrix projection = uluaGetMatrix( L, 2 );
|
||||
Matrix view = uluaGetMatrix( L, 3 );
|
||||
|
||||
uluaPushVector3( L, Vector3Unproject( source, projection, view ) );
|
||||
|
||||
@@ -1026,7 +1026,7 @@ Invert the given vector
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Invert( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushVector3( L, Vector3Invert( v ) );
|
||||
|
||||
@@ -1042,9 +1042,9 @@ min and max values specified by the given vectors
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Clamp( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 min = uluaGetVector3Index( L, 2 );
|
||||
Vector3 max = uluaGetVector3Index( L, 3 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 min = uluaGetVector3( L, 2 );
|
||||
Vector3 max = uluaGetVector3( L, 3 );
|
||||
|
||||
uluaPushVector3( L, Vector3Clamp( v, min, max ) );
|
||||
|
||||
@@ -1059,7 +1059,7 @@ Clamp the magnitude of the vector between two values
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3ClampValue( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
float min = luaL_checknumber( L, 2 );
|
||||
float max = luaL_checknumber( L, 3 );
|
||||
|
||||
@@ -1076,8 +1076,8 @@ Check whether two given vectors are almost equal
|
||||
- Success return int
|
||||
*/
|
||||
int lmathVector3Equals( lua_State *L ) {
|
||||
Vector3 v1 = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v1 = uluaGetVector3( L, 1 );
|
||||
Vector3 v2 = uluaGetVector3( L, 2 );
|
||||
|
||||
lua_pushinteger( L, Vector3Equals( v1, v2 ) );
|
||||
|
||||
@@ -1097,8 +1097,8 @@ on the other side of the surface
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathVector3Refract( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 n = uluaGetVector3Index( L, 2 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
Vector3 n = uluaGetVector3( L, 2 );
|
||||
float r = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushVector3( L, Vector3Refract( v, n, r ) );
|
||||
@@ -1118,7 +1118,7 @@ Compute matrix determinant
|
||||
- Success return float
|
||||
*/
|
||||
int lmathMatrixDeterminant( lua_State *L ) {
|
||||
Matrix mat = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
lua_pushnumber( L, MatrixDeterminant( mat ) );
|
||||
|
||||
@@ -1133,7 +1133,7 @@ Get the trace of the matrix (sum of the values along the diagonal)
|
||||
- Success return float
|
||||
*/
|
||||
int lmathMatrixTrace( lua_State *L ) {
|
||||
Matrix mat = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
lua_pushnumber( L, MatrixTrace( mat ) );
|
||||
|
||||
@@ -1148,7 +1148,7 @@ Transposes provided matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixTranspose( lua_State *L ) {
|
||||
Matrix mat = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixTranspose( mat ) );
|
||||
|
||||
@@ -1163,7 +1163,7 @@ Invert provided matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixInvert( lua_State *L ) {
|
||||
Matrix mat = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixInvert( mat ) );
|
||||
|
||||
@@ -1191,8 +1191,8 @@ Add two matrices
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixAdd( lua_State *L ) {
|
||||
Matrix mat1 = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrixIndex( L, 2 );
|
||||
Matrix mat1 = uluaGetMatrix( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrix( L, 2 );
|
||||
|
||||
uluaPushMatrix( L, MatrixAdd( mat1, mat2 ) );
|
||||
|
||||
@@ -1207,8 +1207,8 @@ Subtract two matrices (left - right)
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixSubtract( lua_State *L ) {
|
||||
Matrix mat1 = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrixIndex( L, 2 );
|
||||
Matrix mat1 = uluaGetMatrix( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrix( L, 2 );
|
||||
|
||||
uluaPushMatrix( L, MatrixSubtract( mat1, mat2 ) );
|
||||
|
||||
@@ -1223,8 +1223,8 @@ Get two matrix multiplication
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixMultiply( lua_State *L ) {
|
||||
Matrix mat1 = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrixIndex( L, 2 );
|
||||
Matrix mat1 = uluaGetMatrix( L, 1 );
|
||||
Matrix mat2 = uluaGetMatrix( L, 2 );
|
||||
|
||||
uluaPushMatrix( L, MatrixMultiply( mat1, mat2 ) );
|
||||
|
||||
@@ -1239,7 +1239,7 @@ Get translation matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixTranslate( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixTranslate( v.x, v.y, v.z ) );
|
||||
|
||||
@@ -1254,7 +1254,7 @@ Create rotation matrix from axis and angle. NOTE: Angle should be provided in ra
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotate( lua_State *L ) {
|
||||
Vector3 axis = uluaGetVector3Index( L, 1 );
|
||||
Vector3 axis = uluaGetVector3( L, 1 );
|
||||
float angle = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotate( axis, angle ) );
|
||||
@@ -1315,7 +1315,7 @@ Get xyz-rotation matrix (angles in radians)
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateXYZ( lua_State *L ) {
|
||||
Vector3 angle = uluaGetVector3Index( L, 1 );
|
||||
Vector3 angle = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateXYZ( angle ) );
|
||||
|
||||
@@ -1330,7 +1330,7 @@ Get zyx-rotation matrix (angles in radians)
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixRotateZYX( lua_State *L ) {
|
||||
Vector3 angle = uluaGetVector3Index( L, 1 );
|
||||
Vector3 angle = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixRotateZYX( angle ) );
|
||||
|
||||
@@ -1345,7 +1345,7 @@ Get scaling matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixScale( lua_State *L ) {
|
||||
Vector3 v = uluaGetVector3Index( L, 1 );
|
||||
Vector3 v = uluaGetVector3( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, MatrixScale( v.x, v.y, v.z ) );
|
||||
|
||||
@@ -1418,9 +1418,9 @@ Get camera look-at matrix (View matrix)
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathMatrixLookAt( lua_State *L ) {
|
||||
Vector3 eye = uluaGetVector3Index( L, 1 );
|
||||
Vector3 target = uluaGetVector3Index( L, 2 );
|
||||
Vector3 up = uluaGetVector3Index( L, 3 );
|
||||
Vector3 eye = uluaGetVector3( L, 1 );
|
||||
Vector3 target = uluaGetVector3( L, 2 );
|
||||
Vector3 up = uluaGetVector3( L, 3 );
|
||||
|
||||
uluaPushMatrix( L, MatrixLookAt( eye, target, up ) );
|
||||
|
||||
@@ -1439,8 +1439,8 @@ Add two quaternions
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionAdd( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionAdd( q1, q2 ) );
|
||||
|
||||
@@ -1455,7 +1455,7 @@ Add quaternion and float value
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionAddValue( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float add = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionAddValue( q, add ) );
|
||||
@@ -1471,8 +1471,8 @@ Subtract two quaternions
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionSubtract( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionSubtract( q1, q2 ) );
|
||||
|
||||
@@ -1487,7 +1487,7 @@ Subtract quaternion and float value
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionSubtractValue( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float sub = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionSubtractValue( q, sub ) );
|
||||
@@ -1516,7 +1516,7 @@ Computes the length of a quaternion
|
||||
- Success return float
|
||||
*/
|
||||
int lmathQuaternionLength( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
lua_pushnumber( L, QuaternionLength( q ) );
|
||||
|
||||
@@ -1531,7 +1531,7 @@ Normalize provided quaternion
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionNormalize( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionNormalize( q ) );
|
||||
|
||||
@@ -1546,7 +1546,7 @@ Invert provided quaternion
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionInvert( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionInvert( q ) );
|
||||
|
||||
@@ -1561,8 +1561,8 @@ Calculate two quaternion multiplication
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionMultiply( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionMultiply( q1, q2 ) );
|
||||
|
||||
@@ -1577,7 +1577,7 @@ Scale quaternion by float value
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionScale( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float mul = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionScale( q, mul ) );
|
||||
@@ -1593,8 +1593,8 @@ Divide two quaternions
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionDivide( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionDivide( q1, q2 ) );
|
||||
|
||||
@@ -1609,8 +1609,8 @@ Calculate linear interpolation between two quaternions
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionLerp( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionLerp( q1, q2, amount ) );
|
||||
@@ -1626,8 +1626,8 @@ Calculate slerp-optimized interpolation between two quaternions
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionNlerp( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionNlerp( q1, q2, amount ) );
|
||||
@@ -1643,8 +1643,8 @@ Calculates spherical linear interpolation between two quaternions
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionSlerp( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
float amount = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionSlerp( q1, q2, amount ) );
|
||||
@@ -1660,8 +1660,8 @@ Calculate quaternion based on the rotation from one vector to another
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromVector3ToVector3( lua_State *L ) {
|
||||
Vector3 from = uluaGetVector3Index( L, 1 );
|
||||
Vector3 to = uluaGetVector3Index( L, 2 );
|
||||
Vector3 from = uluaGetVector3( L, 1 );
|
||||
Vector3 to = uluaGetVector3( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionFromVector3ToVector3( from, to ) );
|
||||
|
||||
@@ -1676,7 +1676,7 @@ Get a quaternion for a given rotation matrix
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromMatrix( lua_State *L ) {
|
||||
Matrix mat = uluaGetMatrixIndex( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 1 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionFromMatrix( mat ) );
|
||||
|
||||
@@ -1691,7 +1691,7 @@ Get a quaternion for a given rotation matrix
|
||||
- Success return Matrix
|
||||
*/
|
||||
int lmathQuaternionToMatrix( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushMatrix( L, QuaternionToMatrix( q ) );
|
||||
|
||||
@@ -1707,7 +1707,7 @@ NOTE: angle must be provided in radians
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionFromAxisAngle( lua_State *L ) {
|
||||
Vector3 axis = uluaGetVector3Index( L, 1 );
|
||||
Vector3 axis = uluaGetVector3( L, 1 );
|
||||
float angle = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionFromAxisAngle( axis, angle ) );
|
||||
@@ -1723,7 +1723,7 @@ Get the rotation angle and axis for a given quaternion
|
||||
- Success return Vector3, float
|
||||
*/
|
||||
int lmathQuaternionToAxisAngle( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
float angle = 0.0;
|
||||
Vector3 axis = { 0.0 };
|
||||
|
||||
@@ -1762,7 +1762,7 @@ NOTE: Angles are returned in a Vector3 struct in radians
|
||||
- Success return Vector3
|
||||
*/
|
||||
int lmathQuaternionToEuler( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
|
||||
uluaPushVector3( L, QuaternionToEuler( q ) );
|
||||
|
||||
@@ -1777,8 +1777,8 @@ Transform a quaternion given a transformation matrix
|
||||
- Success return Quaternion
|
||||
*/
|
||||
int lmathQuaternionTransform( lua_State *L ) {
|
||||
Quaternion q = uluaGetQuaternionIndex( L, 1 );
|
||||
Matrix mat = uluaGetMatrixIndex( L, 2 );
|
||||
Quaternion q = uluaGetQuaternion( L, 1 );
|
||||
Matrix mat = uluaGetMatrix( L, 2 );
|
||||
|
||||
uluaPushQuaternion( L, QuaternionTransform( q, mat ) );
|
||||
|
||||
@@ -1793,8 +1793,8 @@ Check whether two given quaternions are almost equal
|
||||
- Success return int
|
||||
*/
|
||||
int lmathQuaternionEquals( lua_State *L ) {
|
||||
Quaternion q1 = uluaGetQuaternionIndex( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternionIndex( L, 2 );
|
||||
Quaternion q1 = uluaGetQuaternion( L, 1 );
|
||||
Quaternion q2 = uluaGetQuaternion( L, 2 );
|
||||
|
||||
lua_pushinteger( L, QuaternionEquals( q1, q2 ) );
|
||||
|
||||
|
||||
220
src/shapes.c
220
src/shapes.c
@@ -17,7 +17,7 @@ defining a font char white rectangle would allow drawing everything in a single
|
||||
*/
|
||||
int lshapesSetShapesTexture( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle source = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle source = uluaGetRectangle( L, 2 );
|
||||
|
||||
SetShapesTexture( *texture, source );
|
||||
|
||||
@@ -30,8 +30,8 @@ int lshapesSetShapesTexture( lua_State *L ) {
|
||||
Draw a pixel
|
||||
*/
|
||||
int lshapesDrawPixel( lua_State *L ) {
|
||||
Vector2 pos = uluaGetVector2Index( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
DrawPixelV( pos, color );
|
||||
|
||||
@@ -44,10 +44,10 @@ int lshapesDrawPixel( lua_State *L ) {
|
||||
Draw a line defining thickness
|
||||
*/
|
||||
int lshapesDrawLine( lua_State *L ) {
|
||||
Vector2 startPos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 startPos = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2( L, 2 );
|
||||
float thickness = luaL_checknumber( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawLineEx( startPos, endPos, thickness, color );
|
||||
|
||||
@@ -60,10 +60,10 @@ int lshapesDrawLine( lua_State *L ) {
|
||||
Draw a line using cubic-bezier curves in-out
|
||||
*/
|
||||
int lshapesDrawLineBezier( lua_State *L ) {
|
||||
Vector2 startPos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 startPos = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2( L, 2 );
|
||||
float thickness = luaL_checknumber( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawLineBezier( startPos, endPos, thickness, color );
|
||||
|
||||
@@ -76,11 +76,11 @@ int lshapesDrawLineBezier( lua_State *L ) {
|
||||
Draw line using quadratic bezier curves with a control point
|
||||
*/
|
||||
int lshapesDrawLineBezierQuad( lua_State *L ) {
|
||||
Vector2 startPos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 controlPos = uluaGetVector2Index( L, 3 );
|
||||
Vector2 startPos = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2( L, 2 );
|
||||
Vector2 controlPos = uluaGetVector2( L, 3 );
|
||||
float thickness = luaL_checknumber( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawLineBezierQuad( startPos, endPos, controlPos, thickness, color );
|
||||
|
||||
@@ -93,12 +93,12 @@ int lshapesDrawLineBezierQuad( lua_State *L ) {
|
||||
Draw line using quadratic bezier curves with a control point
|
||||
*/
|
||||
int lshapesDrawLineBezierCubic( lua_State *L ) {
|
||||
Vector2 startPos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 startControlPos = uluaGetVector2Index( L, 3 );
|
||||
Vector2 endControlPos = uluaGetVector2Index( L, 4 );
|
||||
Vector2 startPos = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos = uluaGetVector2( L, 2 );
|
||||
Vector2 startControlPos = uluaGetVector2( L, 3 );
|
||||
Vector2 endControlPos = uluaGetVector2( L, 4 );
|
||||
float thickness = luaL_checknumber( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawLineBezierCubic( startPos, endPos, startControlPos, endControlPos, thickness, color );
|
||||
|
||||
@@ -111,8 +111,8 @@ int lshapesDrawLineBezierCubic( lua_State *L ) {
|
||||
Draw lines sequence
|
||||
*/
|
||||
int lshapesDrawLineStrip( lua_State *L ) {
|
||||
int pointsCount = uluaGetTableLenIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
int pointsCount = uluaGetTableLen( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
Vector2 points[ pointsCount ];
|
||||
|
||||
@@ -121,7 +121,7 @@ int lshapesDrawLineStrip( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
points[i] = uluaGetVector2( L );
|
||||
points[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
@@ -136,9 +136,9 @@ int lshapesDrawLineStrip( lua_State *L ) {
|
||||
Draw a color-filled circle
|
||||
*/
|
||||
int lshapesDrawCircle( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawCircleV( center, radius, color );
|
||||
|
||||
@@ -151,12 +151,12 @@ int lshapesDrawCircle( lua_State *L ) {
|
||||
Draw a piece of a circle
|
||||
*/
|
||||
int lshapesDrawCircleSector( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
float startAngle = luaL_checknumber( L, 3 );
|
||||
float endAngle = luaL_checknumber( L, 4 );
|
||||
int segments = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCircleSector( center, radius, startAngle, endAngle, segments, color );
|
||||
|
||||
@@ -169,12 +169,12 @@ int lshapesDrawCircleSector( lua_State *L ) {
|
||||
Draw circle sector outline
|
||||
*/
|
||||
int lshapesDrawCircleSectorLines( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
float startAngle = luaL_checknumber( L, 3 );
|
||||
float endAngle = luaL_checknumber( L, 4 );
|
||||
int segments = luaL_checkinteger( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawCircleSectorLines( center, radius, startAngle, endAngle, segments, color );
|
||||
|
||||
@@ -187,10 +187,10 @@ int lshapesDrawCircleSectorLines( lua_State *L ) {
|
||||
Draw a gradient-filled circle
|
||||
*/
|
||||
int lshapesDrawCircleGradient( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color1 = uluaGetColorIndex( L, 3 );
|
||||
Color color2 = uluaGetColorIndex( L, 4 );
|
||||
Color color1 = uluaGetColor( L, 3 );
|
||||
Color color2 = uluaGetColor( L, 4 );
|
||||
|
||||
DrawCircleGradient( center.x, center.y, radius, color1, color2 );
|
||||
|
||||
@@ -203,9 +203,9 @@ int lshapesDrawCircleGradient( lua_State *L ) {
|
||||
Draw circle outline
|
||||
*/
|
||||
int lshapesDrawCircleLines( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawCircleLines( center.x, center.y, radius, color );
|
||||
|
||||
@@ -218,10 +218,10 @@ int lshapesDrawCircleLines( lua_State *L ) {
|
||||
Draw ellipse
|
||||
*/
|
||||
int lshapesDrawEllipse( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radiusH = luaL_checknumber( L, 2 );
|
||||
float radiusV = luaL_checknumber( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawEllipse( center.x, center.y, radiusH, radiusV, color );
|
||||
|
||||
@@ -234,10 +234,10 @@ int lshapesDrawEllipse( lua_State *L ) {
|
||||
Draw ellipse outline
|
||||
*/
|
||||
int lshapesDrawEllipseLines( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radiusH = luaL_checknumber( L, 2 );
|
||||
float radiusV = luaL_checknumber( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawEllipseLines( center.x, center.y, radiusH, radiusV, color );
|
||||
|
||||
@@ -250,13 +250,13 @@ int lshapesDrawEllipseLines( lua_State *L ) {
|
||||
Draw ring
|
||||
*/
|
||||
int lshapesDrawRing( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float innerRadius = luaL_checknumber( L, 2 );
|
||||
float outerRadius = luaL_checknumber( L, 3 );
|
||||
float startAngle = luaL_checknumber( L, 4 );
|
||||
float endAngle = luaL_checknumber( L, 5 );
|
||||
int segments = luaL_checkinteger( L, 6 );
|
||||
Color color = uluaGetColorIndex( L, 7 );
|
||||
Color color = uluaGetColor( L, 7 );
|
||||
|
||||
DrawRing( center, innerRadius, outerRadius, startAngle, endAngle, segments, color );
|
||||
|
||||
@@ -269,13 +269,13 @@ int lshapesDrawRing( lua_State *L ) {
|
||||
Draw ring outline
|
||||
*/
|
||||
int lshapesDrawRingLines( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float innerRadius = luaL_checknumber( L, 2 );
|
||||
float outerRadius = luaL_checknumber( L, 3 );
|
||||
float startAngle = luaL_checknumber( L, 4 );
|
||||
float endAngle = luaL_checknumber( L, 5 );
|
||||
int segments = luaL_checkinteger( L, 6 );
|
||||
Color color = uluaGetColorIndex( L, 7 );
|
||||
Color color = uluaGetColor( L, 7 );
|
||||
|
||||
DrawRingLines( center, innerRadius, outerRadius, startAngle, endAngle, segments, color );
|
||||
|
||||
@@ -288,8 +288,8 @@ int lshapesDrawRingLines( lua_State *L ) {
|
||||
Draw a color-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangle( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
DrawRectangleRec( rect, color );
|
||||
|
||||
@@ -302,10 +302,10 @@ int lshapesDrawRectangle( lua_State *L ) {
|
||||
Draw a color-filled rectangle with pro parameters
|
||||
*/
|
||||
int lshapesDrawRectanglePro( lua_State *L ) {
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 1 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 2 );
|
||||
Rectangle rec = uluaGetRectangle( L, 1 );
|
||||
Vector2 origin = uluaGetVector2( L, 2 );
|
||||
float rotation = luaL_checknumber( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawRectanglePro( rec, origin, rotation, color );
|
||||
|
||||
@@ -318,9 +318,9 @@ int lshapesDrawRectanglePro( lua_State *L ) {
|
||||
Draw a vertical-gradient-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangleGradientV( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Color color1 = uluaGetColorIndex( L, 2 );
|
||||
Color color2 = uluaGetColorIndex( L, 3 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color1 = uluaGetColor( L, 2 );
|
||||
Color color2 = uluaGetColor( L, 3 );
|
||||
|
||||
DrawRectangleGradientV( rect.x, rect.y, rect.width, rect.height, color1, color2 );
|
||||
|
||||
@@ -333,9 +333,9 @@ int lshapesDrawRectangleGradientV( lua_State *L ) {
|
||||
Draw a horizontal-gradient-filled rectangle
|
||||
*/
|
||||
int lshapesDrawRectangleGradientH( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Color color1 = uluaGetColorIndex( L, 2 );
|
||||
Color color2 = uluaGetColorIndex( L, 3 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color1 = uluaGetColor( L, 2 );
|
||||
Color color2 = uluaGetColor( L, 3 );
|
||||
|
||||
DrawRectangleGradientH( rect.x, rect.y, rect.width, rect.height, color1, color2 );
|
||||
|
||||
@@ -348,11 +348,11 @@ int lshapesDrawRectangleGradientH( lua_State *L ) {
|
||||
Draw a gradient-filled rectangle with custom vertex colors
|
||||
*/
|
||||
int lshapesDrawRectangleGradientEx( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Color color1 = uluaGetColorIndex( L, 2 );
|
||||
Color color2 = uluaGetColorIndex( L, 3 );
|
||||
Color color3 = uluaGetColorIndex( L, 4 );
|
||||
Color color4 = uluaGetColorIndex( L, 5 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color1 = uluaGetColor( L, 2 );
|
||||
Color color2 = uluaGetColor( L, 3 );
|
||||
Color color3 = uluaGetColor( L, 4 );
|
||||
Color color4 = uluaGetColor( L, 5 );
|
||||
|
||||
DrawRectangleGradientEx( rect, color1, color2, color3, color4 );
|
||||
|
||||
@@ -365,8 +365,8 @@ int lshapesDrawRectangleGradientEx( lua_State *L ) {
|
||||
Draw rectangle outline
|
||||
*/
|
||||
int lshapesDrawRectangleLines( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
DrawRectangleLines( rect.x, rect.y, rect.width, rect.height, color );
|
||||
|
||||
@@ -379,9 +379,9 @@ int lshapesDrawRectangleLines( lua_State *L ) {
|
||||
Draw rectangle outline with extended parameters
|
||||
*/
|
||||
int lshapesDrawRectangleLinesEx( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
int lineThick = luaL_checkinteger( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawRectangleLinesEx( rect, lineThick, color );
|
||||
|
||||
@@ -394,10 +394,10 @@ int lshapesDrawRectangleLinesEx( lua_State *L ) {
|
||||
Draw rectangle with rounded edges
|
||||
*/
|
||||
int lshapesDrawRectangleRounded( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
float roundness = luaL_checknumber( L, 2 );
|
||||
int segments = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawRectangleRounded( rect, roundness, segments, color );
|
||||
|
||||
@@ -410,11 +410,11 @@ int lshapesDrawRectangleRounded( lua_State *L ) {
|
||||
Draw rectangle with rounded edges outline
|
||||
*/
|
||||
int lshapesDrawRectangleRoundedLines( lua_State *L ) {
|
||||
Rectangle rect = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rect = uluaGetRectangle( L, 1 );
|
||||
float roundness = luaL_checknumber( L, 2 );
|
||||
int segments = luaL_checkinteger( L, 3 );
|
||||
int lineThick = luaL_checkinteger( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawRectangleRoundedLines( rect, roundness, segments, lineThick, color );
|
||||
|
||||
@@ -427,10 +427,10 @@ int lshapesDrawRectangleRoundedLines( lua_State *L ) {
|
||||
Draw a color-filled triangle (Vertex in counter-clockwise order!)
|
||||
*/
|
||||
int lshapesDrawTriangle( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v3 = uluaGetVector2Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
Vector2 v3 = uluaGetVector2( L, 3 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawTriangle( v1, v2, v3, color );
|
||||
|
||||
@@ -443,10 +443,10 @@ int lshapesDrawTriangle( lua_State *L ) {
|
||||
Draw triangle outline (Vertex in counter-clockwise order!)
|
||||
*/
|
||||
int lshapesDrawTriangleLines( lua_State *L ) {
|
||||
Vector2 v1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 v3 = uluaGetVector2Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Vector2 v1 = uluaGetVector2( L, 1 );
|
||||
Vector2 v2 = uluaGetVector2( L, 2 );
|
||||
Vector2 v3 = uluaGetVector2( L, 3 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
DrawTriangleLines( v1, v2, v3, color );
|
||||
|
||||
@@ -459,8 +459,8 @@ int lshapesDrawTriangleLines( lua_State *L ) {
|
||||
Draw a triangle fan defined by points (first vertex is the center)
|
||||
*/
|
||||
int lshapesDrawTriangleFan( lua_State *L ) {
|
||||
int pointsCount = uluaGetTableLenIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
int pointsCount = uluaGetTableLen( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
Vector2 points[ pointsCount ];
|
||||
|
||||
@@ -469,7 +469,7 @@ int lshapesDrawTriangleFan( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
points[i] = uluaGetVector2( L );
|
||||
points[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
@@ -484,8 +484,8 @@ int lshapesDrawTriangleFan( lua_State *L ) {
|
||||
Draw a triangle strip defined by points
|
||||
*/
|
||||
int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||
int pointsCount = uluaGetTableLenIndex( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
int pointsCount = uluaGetTableLen( L, 1 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
Vector2 points[ pointsCount ];
|
||||
|
||||
@@ -494,7 +494,7 @@ int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
points[i] = uluaGetVector2( L );
|
||||
points[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
@@ -509,11 +509,11 @@ int lshapesDrawTriangleStrip( lua_State *L ) {
|
||||
Draw a regular polygon (Vector version)
|
||||
*/
|
||||
int lshapesDrawPoly( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
int sides = luaL_checkinteger( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
float rotation = luaL_checknumber( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawPoly( center, sides, radius, rotation, color );
|
||||
|
||||
@@ -526,11 +526,11 @@ int lshapesDrawPoly( lua_State *L ) {
|
||||
Draw a polygon outline of n sides
|
||||
*/
|
||||
int lshapesDrawPolyLines( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
int sides = luaL_checkinteger( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
float rotation = luaL_checknumber( L, 4 );
|
||||
Color color = uluaGetColorIndex( L, 5 );
|
||||
Color color = uluaGetColor( L, 5 );
|
||||
|
||||
DrawPolyLines( center, sides, radius, rotation, color );
|
||||
|
||||
@@ -543,12 +543,12 @@ int lshapesDrawPolyLines( lua_State *L ) {
|
||||
Draw a polygon outline of n sides with extended parameters
|
||||
*/
|
||||
int lshapesDrawPolyLinesEx( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
int sides = luaL_checkinteger( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
float rotation = luaL_checknumber( L, 4 );
|
||||
float lineThick = luaL_checknumber( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawPolyLinesEx( center, sides, radius, rotation, lineThick, color );
|
||||
|
||||
@@ -567,8 +567,8 @@ Check collision between two rectangles
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionRecs( lua_State *L ) {
|
||||
Rectangle rect1 = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rect2 = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle rect1 = uluaGetRectangle( L, 1 );
|
||||
Rectangle rect2 = uluaGetRectangle( L, 2 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionRecs( rect1, rect2 ) );
|
||||
|
||||
@@ -583,9 +583,9 @@ Check collision between two circles
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionCircles( lua_State *L ) {
|
||||
Vector2 center1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center1 = uluaGetVector2( L, 1 );
|
||||
float radius1 = luaL_checknumber( L, 2 );
|
||||
Vector2 center2 = uluaGetVector2Index( L, 3 );
|
||||
Vector2 center2 = uluaGetVector2( L, 3 );
|
||||
float radius2 = luaL_checknumber( L, 4 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionCircles( center1, radius1, center2, radius2 ) );
|
||||
@@ -601,9 +601,9 @@ Check collision between circle and rectangle
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionCircleRec( lua_State *L ) {
|
||||
Vector2 center = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 1 );
|
||||
float radius = luaL_checknumber( L, 2 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 3 );
|
||||
Rectangle rec = uluaGetRectangle( L, 3 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionCircleRec( center, radius, rec ) );
|
||||
|
||||
@@ -618,8 +618,8 @@ Check if point is inside rectangle
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointRec( lua_State *L ) {
|
||||
Vector2 point = uluaGetVector2Index( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Rectangle rec = uluaGetRectangle( L, 2 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionPointRec( point, rec ) );
|
||||
|
||||
@@ -634,8 +634,8 @@ Check if point is inside circle
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointCircle( lua_State *L ) {
|
||||
Vector2 point = uluaGetVector2Index( L, 1 );
|
||||
Vector2 center = uluaGetVector2Index( L, 2 );
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Vector2 center = uluaGetVector2( L, 2 );
|
||||
float radius = luaL_checknumber( L, 3 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionPointCircle( point, center, radius ) );
|
||||
@@ -651,10 +651,10 @@ Check if point is inside a triangle
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointTriangle( lua_State *L ) {
|
||||
Vector2 point = uluaGetVector2Index( L, 1 );
|
||||
Vector2 p1 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 p2 = uluaGetVector2Index( L, 3 );
|
||||
Vector2 p3 = uluaGetVector2Index( L, 4 );
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Vector2 p1 = uluaGetVector2( L, 2 );
|
||||
Vector2 p2 = uluaGetVector2( L, 3 );
|
||||
Vector2 p3 = uluaGetVector2( L, 4 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionPointTriangle( point, p1, p2, p3 ) );
|
||||
|
||||
@@ -669,8 +669,8 @@ Check if point is within a polygon described by array of vertices
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointPoly( lua_State *L ) {
|
||||
Vector2 point = uluaGetVector2Index( L, 1 );
|
||||
int pointCount = uluaGetTableLenIndex( L, 2 );
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
int pointCount = uluaGetTableLen( L, 2 );
|
||||
Vector2 points[ pointCount ];
|
||||
|
||||
/* t = points index. */
|
||||
@@ -678,7 +678,7 @@ int lshapesCheckCollisionPointPoly( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
points[i] = uluaGetVector2( L );
|
||||
points[i] = uluaGetVector2( L, lua_gettop( L ) );
|
||||
i++;
|
||||
lua_pop( L, 1 );
|
||||
}
|
||||
@@ -695,10 +695,10 @@ Check the collision between two lines defined by two points each, returns collis
|
||||
- Success return bool, Vector2
|
||||
*/
|
||||
int lshapesCheckCollisionLines( lua_State *L ) {
|
||||
Vector2 startPos1 = uluaGetVector2Index( L, 1 );
|
||||
Vector2 endPos1 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 startPos2 = uluaGetVector2Index( L, 3 );
|
||||
Vector2 endPos2 = uluaGetVector2Index( L, 4 );
|
||||
Vector2 startPos1 = uluaGetVector2( L, 1 );
|
||||
Vector2 endPos1 = uluaGetVector2( L, 2 );
|
||||
Vector2 startPos2 = uluaGetVector2( L, 3 );
|
||||
Vector2 endPos2 = uluaGetVector2( L, 4 );
|
||||
|
||||
Vector2 colPoint = { 0, 0 };
|
||||
|
||||
@@ -716,9 +716,9 @@ Check if point belongs to line created between two points [p1] and [p2] with def
|
||||
- Success return bool
|
||||
*/
|
||||
int lshapesCheckCollisionPointLine( lua_State *L ) {
|
||||
Vector2 point = uluaGetVector2Index( L, 1 );
|
||||
Vector2 p1 = uluaGetVector2Index( L, 2 );
|
||||
Vector2 p2 = uluaGetVector2Index( L, 3 );
|
||||
Vector2 point = uluaGetVector2( L, 1 );
|
||||
Vector2 p1 = uluaGetVector2( L, 2 );
|
||||
Vector2 p2 = uluaGetVector2( L, 3 );
|
||||
int threshold = luaL_checkinteger( L, 4 );
|
||||
|
||||
lua_pushboolean( L, CheckCollisionPointLine( point, p1, p2, threshold ) );
|
||||
@@ -734,8 +734,8 @@ Get collision rectangle for two rectangles collision
|
||||
- Success return Rectangle
|
||||
*/
|
||||
int lshapesGetCollisionRec( lua_State *L ) {
|
||||
Rectangle rec1 = uluaGetRectangleIndex( L, 1 );
|
||||
Rectangle rec2 = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle rec1 = uluaGetRectangle( L, 1 );
|
||||
Rectangle rec2 = uluaGetRectangle( L, 2 );
|
||||
|
||||
uluaPushRectangle( L, GetCollisionRec( rec1, rec2 ) );
|
||||
|
||||
|
||||
30
src/text.c
30
src/text.c
@@ -52,7 +52,7 @@ int ltextLoadFontEx( lua_State *L ) {
|
||||
|
||||
if ( FileExists( luaL_checkstring( L, 1 ) ) ) {
|
||||
if ( lua_istable( L, 3 ) ) {
|
||||
int glyphCount = uluaGetTableLenIndex( L, 3 );
|
||||
int glyphCount = uluaGetTableLen( L, 3 );
|
||||
int fontChars[ glyphCount ];
|
||||
|
||||
int t = lua_gettop( L );
|
||||
@@ -88,7 +88,7 @@ Load font from Image ( XNA style)
|
||||
*/
|
||||
int ltextLoadFontFromImage( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color key = uluaGetColorIndex( L, 2 );
|
||||
Color key = uluaGetColor( L, 2 );
|
||||
int firstChar = luaL_checkinteger( L, 3 );
|
||||
|
||||
uluaPushFont( L, LoadFontFromImage( *image, key, firstChar ) );
|
||||
@@ -134,7 +134,7 @@ int ltextUnloadFont( lua_State *L ) {
|
||||
Draw current FPS
|
||||
*/
|
||||
int ltextDrawFPS( lua_State *L ) {
|
||||
Vector2 pos = uluaGetVector2Index( L, 1 );
|
||||
Vector2 pos = uluaGetVector2( L, 1 );
|
||||
|
||||
DrawFPS( pos.x, pos.y );
|
||||
|
||||
@@ -147,9 +147,9 @@ int ltextDrawFPS( lua_State *L ) {
|
||||
Draw text (using default font)
|
||||
*/
|
||||
int ltextDrawText( lua_State *L ) {
|
||||
Vector2 position = uluaGetVector2Index( L, 2 );
|
||||
Vector2 position = uluaGetVector2( L, 2 );
|
||||
float fontSize = luaL_checknumber( L, 3 );
|
||||
Color tint = uluaGetColorIndex( L, 4 );
|
||||
Color tint = uluaGetColor( L, 4 );
|
||||
|
||||
DrawText( luaL_checkstring( L, 1 ), position.x, position.y, fontSize, tint );
|
||||
|
||||
@@ -163,10 +163,10 @@ Draw text using font and additional parameters
|
||||
*/
|
||||
int ltextDrawTextEx( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 3 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
Color tint = uluaGetColorIndex( L, 6 );
|
||||
Color tint = uluaGetColor( L, 6 );
|
||||
|
||||
DrawTextEx( *font, luaL_checkstring( L, 2 ), position, fontSize, spacing, tint );
|
||||
|
||||
@@ -180,12 +180,12 @@ Draw text using Font and pro parameters (rotation)
|
||||
*/
|
||||
int ltextDrawTextPro( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 3 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 4 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
Vector2 origin = uluaGetVector2( L, 4 );
|
||||
float rotation = luaL_checknumber( L, 5 );
|
||||
float fontSize = luaL_checknumber( L, 6 );
|
||||
float spacing = luaL_checknumber( L, 7 );
|
||||
Color tint = uluaGetColorIndex( L, 8 );
|
||||
Color tint = uluaGetColor( L, 8 );
|
||||
|
||||
DrawTextPro( *font, luaL_checkstring( L, 2 ), position, origin, rotation, fontSize, spacing, tint );
|
||||
|
||||
@@ -200,9 +200,9 @@ Draw one character (codepoint)
|
||||
int ltextDrawTextCodepoint( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
int codepoint = luaL_checkinteger( L, 2 );
|
||||
Vector2 position = uluaGetVector2Index( L, 3 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
Color tint = uluaGetColor( L, 5 );
|
||||
|
||||
DrawTextCodepoint( *font, codepoint, position, fontSize, tint );
|
||||
|
||||
@@ -216,12 +216,12 @@ Draw multiple character (codepoint)
|
||||
*/
|
||||
int ltextDrawTextCodepoints( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 3 );
|
||||
Vector2 position = uluaGetVector2( L, 3 );
|
||||
float fontSize = luaL_checknumber( L, 4 );
|
||||
float spacing = luaL_checknumber( L, 5 );
|
||||
Color tint = uluaGetColorIndex( L, 6 );
|
||||
Color tint = uluaGetColor( L, 6 );
|
||||
|
||||
int count = uluaGetTableLenIndex( L, 2 );
|
||||
int count = uluaGetTableLen( L, 2 );
|
||||
int codepoints[ count ];
|
||||
|
||||
int t = 2;
|
||||
|
||||
174
src/textures.c
174
src/textures.c
@@ -122,8 +122,8 @@ Generate image: plain color
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageColor( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
uluaPushImage( L, GenImageColor( size.x, size.y, color ) );
|
||||
|
||||
@@ -138,9 +138,9 @@ Generate image: vertical gradient
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageGradientV( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Color top = uluaGetColorIndex( L, 2 );
|
||||
Color bottom = uluaGetColorIndex( L, 3 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
Color top = uluaGetColor( L, 2 );
|
||||
Color bottom = uluaGetColor( L, 3 );
|
||||
|
||||
uluaPushImage( L, GenImageGradientV( (int)size.x, (int)size.y, top, bottom ) );
|
||||
|
||||
@@ -155,9 +155,9 @@ Generate image: horizontal gradient
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageGradientH( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Color left = uluaGetColorIndex( L, 2 );
|
||||
Color right = uluaGetColorIndex( L, 3 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
Color left = uluaGetColor( L, 2 );
|
||||
Color right = uluaGetColor( L, 3 );
|
||||
|
||||
uluaPushImage( L, GenImageGradientH( (int)size.x, (int)size.y, left, right ) );
|
||||
|
||||
@@ -172,10 +172,10 @@ Generate image: radial gradient
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageGradientRadial( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
float density = luaL_checknumber( L, 2 );
|
||||
Color inner = uluaGetColorIndex( L, 3 );
|
||||
Color outer = uluaGetColorIndex( L, 4 );
|
||||
Color inner = uluaGetColor( L, 3 );
|
||||
Color outer = uluaGetColor( L, 4 );
|
||||
|
||||
uluaPushImage( L, GenImageGradientRadial( (int)size.x, (int)size.y, density, inner, outer ) );
|
||||
|
||||
@@ -190,10 +190,10 @@ Generate image: checked
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageChecked( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 checks = uluaGetVector2Index( L, 2 );
|
||||
Color col1 = uluaGetColorIndex( L, 3 );
|
||||
Color col2 = uluaGetColorIndex( L, 4 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
Vector2 checks = uluaGetVector2( L, 2 );
|
||||
Color col1 = uluaGetColor( L, 3 );
|
||||
Color col2 = uluaGetColor( L, 4 );
|
||||
|
||||
uluaPushImage( L, GenImageChecked( (int)size.x, (int)size.y, (int)checks.x, (int)checks.y, col1, col2 ) );
|
||||
|
||||
@@ -208,7 +208,7 @@ Generate image: white noise
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageWhiteNoise( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
float factor = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushImage( L, GenImageWhiteNoise( (int)size.x, (int)size.y, factor ) );
|
||||
@@ -224,8 +224,8 @@ Generate image: perlin noise
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImagePerlinNoise( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 offset = uluaGetVector2Index( L, 2 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
Vector2 offset = uluaGetVector2( L, 2 );
|
||||
float factor = luaL_checknumber( L, 3 );
|
||||
|
||||
uluaPushImage( L, GenImagePerlinNoise( (int)size.x, (int)size.y, (int)offset.x, (int)offset.y, factor ) );
|
||||
@@ -241,7 +241,7 @@ Generate image: cellular algorithm. Bigger tileSize means bigger cells
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageCellular( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
int tileSize = luaL_checkinteger( L, 2 );
|
||||
|
||||
uluaPushImage( L, GenImageCellular( (int)size.x, (int)size.y, tileSize ) );
|
||||
@@ -257,7 +257,7 @@ Generate image: grayscale image from text data
|
||||
- Success return Image
|
||||
*/
|
||||
int ltexturesGenImageText( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushImage( L, GenImageText( (int)size.x, (int)size.y, luaL_checkstring( L, 2 ) ) );
|
||||
|
||||
@@ -292,7 +292,7 @@ Create an image from another image piece
|
||||
*/
|
||||
int ltexturesImageFromImage( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle rec = uluaGetRectangle( L, 2 );
|
||||
|
||||
uluaPushImage( L, ImageFromImage( *image, rec ) );
|
||||
|
||||
@@ -310,7 +310,7 @@ int ltexturesImageText( lua_State *L ) {
|
||||
Font *font = uluaGetFont( L, 1 );
|
||||
float fontSize = lua_tonumber( L, 3 );
|
||||
float spacing = lua_tonumber( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
Color tint = uluaGetColor( L, 5 );
|
||||
|
||||
uluaPushImage( L, ImageTextEx( *font, luaL_checkstring( L, 2 ), fontSize, spacing, tint ) );
|
||||
|
||||
@@ -338,7 +338,7 @@ Convert image to POT (power-of-two)
|
||||
*/
|
||||
int ltexturesImageToPOT( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color fill = uluaGetColorIndex( L, 2 );
|
||||
Color fill = uluaGetColor( L, 2 );
|
||||
|
||||
ImageToPOT( image, fill );
|
||||
|
||||
@@ -352,7 +352,7 @@ Crop an image to a defined rectangle
|
||||
*/
|
||||
int ltexturesImageCrop( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle crop = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle crop = uluaGetRectangle( L, 2 );
|
||||
|
||||
ImageCrop( image, crop );
|
||||
|
||||
@@ -380,7 +380,7 @@ Clear alpha channel to desired color
|
||||
*/
|
||||
int ltexturesImageAlphaClear( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
float threshold = lua_tonumber( L, 3 );
|
||||
|
||||
ImageAlphaClear( image, color, threshold );
|
||||
@@ -436,7 +436,7 @@ Resize image (Bicubic scaling algorithm)
|
||||
*/
|
||||
int ltexturesImageResize( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
Vector2 size = uluaGetVector2( L, 2 );
|
||||
|
||||
ImageResize( image, (int)size.x, (int)size.y );
|
||||
|
||||
@@ -450,7 +450,7 @@ Resize image (Nearest-Neighbor scaling algorithm)
|
||||
*/
|
||||
int ltexturesImageResizeNN( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
Vector2 size = uluaGetVector2( L, 2 );
|
||||
|
||||
ImageResizeNN( image, (int)size.x, (int)size.y );
|
||||
|
||||
@@ -464,9 +464,9 @@ Resize canvas and fill with color
|
||||
*/
|
||||
int ltexturesImageResizeCanvas( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 size = uluaGetVector2Index( L, 2 );
|
||||
Vector2 offset = uluaGetVector2Index( L, 3 );
|
||||
Color fill = uluaGetColorIndex( L, 4 );
|
||||
Vector2 size = uluaGetVector2( L, 2 );
|
||||
Vector2 offset = uluaGetVector2( L, 3 );
|
||||
Color fill = uluaGetColor( L, 4 );
|
||||
|
||||
ImageResizeCanvas( image, (int)size.x, (int)size.y, (int)offset.x, (int)offset.y, fill );
|
||||
|
||||
@@ -493,7 +493,7 @@ Dither image data to 16bpp or lower (Floyd-Steinberg dithering)
|
||||
*/
|
||||
int ltexturesImageDither( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color bpp = uluaGetColorIndex( L, 2 );
|
||||
Color bpp = uluaGetColor( L, 2 );
|
||||
|
||||
ImageDither( image, bpp.r, bpp.g, bpp.b, bpp.a );
|
||||
|
||||
@@ -559,7 +559,7 @@ Modify image color: tint
|
||||
*/
|
||||
int ltexturesImageColorTint( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
ImageColorTint( image, color );
|
||||
|
||||
@@ -627,8 +627,8 @@ Modify image color: replace color
|
||||
*/
|
||||
int ltexturesImageColorReplace( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color replace = uluaGetColorIndex( L, 3 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
Color replace = uluaGetColor( L, 3 );
|
||||
|
||||
ImageColorReplace( image, color, replace );
|
||||
|
||||
@@ -709,7 +709,7 @@ Get image pixel color at (x, y) position
|
||||
*/
|
||||
int ltexturesGetImageColor( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 pixelPos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 pixelPos = uluaGetVector2( L, 2 );
|
||||
|
||||
uluaPushColor( L, GetImageColor( *image, pixelPos.x, pixelPos.y ) );
|
||||
|
||||
@@ -727,7 +727,7 @@ Clear image background with given color
|
||||
*/
|
||||
int ltexturesImageClearBackground( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Color color = uluaGetColorIndex( L, 2 );
|
||||
Color color = uluaGetColor( L, 2 );
|
||||
|
||||
ImageClearBackground( image, color );
|
||||
|
||||
@@ -741,8 +741,8 @@ Draw pixel within an image
|
||||
*/
|
||||
int ltexturesImageDrawPixel( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 position = uluaGetVector2Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Vector2 position = uluaGetVector2( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
ImageDrawPixelV( image, position, color );
|
||||
|
||||
@@ -756,9 +756,9 @@ Draw line within an image
|
||||
*/
|
||||
int ltexturesImageDrawLine( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 start = uluaGetVector2Index( L, 2 );
|
||||
Vector2 end = uluaGetVector2Index( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Vector2 start = uluaGetVector2( L, 2 );
|
||||
Vector2 end = uluaGetVector2( L, 3 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
ImageDrawLineV( image, start, end, color );
|
||||
|
||||
@@ -772,9 +772,9 @@ Draw circle within an image
|
||||
*/
|
||||
int ltexturesImageDrawCircle( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 center = uluaGetVector2Index( L, 2 );
|
||||
Vector2 center = uluaGetVector2( L, 2 );
|
||||
int radius = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
ImageDrawCircleV( image, center, radius, color );
|
||||
|
||||
@@ -788,9 +788,9 @@ Draw circle outline within an image
|
||||
*/
|
||||
int ltexturesImageDrawCircleLines( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Vector2 center = uluaGetVector2Index( L, 2 );
|
||||
Vector2 center = uluaGetVector2( L, 2 );
|
||||
int radius = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
ImageDrawCircleLinesV( image, center, radius, color );
|
||||
|
||||
@@ -804,8 +804,8 @@ Draw rectangle within an image
|
||||
*/
|
||||
int ltexturesImageDrawRectangle( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Rectangle rec = uluaGetRectangle( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
ImageDrawRectangleRec( image, rec, color );
|
||||
|
||||
@@ -819,9 +819,9 @@ Draw rectangle lines within an image
|
||||
*/
|
||||
int ltexturesImageDrawRectangleLines( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle rec = uluaGetRectangle( L, 2 );
|
||||
int thick = luaL_checkinteger( L, 3 );
|
||||
Color color = uluaGetColorIndex( L, 4 );
|
||||
Color color = uluaGetColor( L, 4 );
|
||||
|
||||
ImageDrawRectangleLines( image, rec, thick, color );
|
||||
|
||||
@@ -836,9 +836,9 @@ Draw a source image within a destination image (Tint applied to source)
|
||||
int ltexturesImageDraw( lua_State *L ) {
|
||||
Image *imageDstId = uluaGetImage( L, 1 );
|
||||
Image *imageSrcId = uluaGetImage( L, 2 );
|
||||
Rectangle srcRec = uluaGetRectangleIndex( L, 3 );
|
||||
Rectangle dstRec = uluaGetRectangleIndex( L, 4 );
|
||||
Color tint = uluaGetColorIndex( L, 5 );
|
||||
Rectangle srcRec = uluaGetRectangle( L, 3 );
|
||||
Rectangle dstRec = uluaGetRectangle( L, 4 );
|
||||
Color tint = uluaGetColor( L, 5 );
|
||||
|
||||
ImageDraw( imageDstId, *imageSrcId, srcRec, dstRec, tint );
|
||||
|
||||
@@ -853,10 +853,10 @@ Draw text (Custom sprite font) within an image (Destination)
|
||||
int ltexturesImageDrawTextEx( lua_State *L ) {
|
||||
Image *image = uluaGetImage( L, 1 );
|
||||
Font *font = uluaGetFont( L, 2 );
|
||||
Vector2 position = uluaGetVector2Index( L, 4 );
|
||||
Vector2 position = uluaGetVector2( L, 4 );
|
||||
float fontSize = luaL_checknumber( L, 5 );
|
||||
float spacing = luaL_checknumber( L, 6 );
|
||||
Color tint = uluaGetColorIndex( L, 7 );
|
||||
Color tint = uluaGetColor( L, 7 );
|
||||
|
||||
ImageDrawTextEx( image, *font, luaL_checkstring( L, 3 ), position, fontSize, spacing, tint );
|
||||
|
||||
@@ -1013,7 +1013,7 @@ Load texture for rendering (framebuffer)
|
||||
- Success return RenderTexture
|
||||
*/
|
||||
int ltexturesLoadRenderTexture( lua_State *L ) {
|
||||
Vector2 size = uluaGetVector2Index( L, 1 );
|
||||
Vector2 size = uluaGetVector2( L, 1 );
|
||||
|
||||
uluaPushRenderTexture( L, LoadRenderTexture( (int)size.x, (int)size.y ) );
|
||||
|
||||
@@ -1118,7 +1118,7 @@ NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 25
|
||||
*/
|
||||
int ltexturesUpdateTexture( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
size_t len = uluaGetTableLenIndex( L, 2 );
|
||||
size_t len = uluaGetTableLen( L, 2 );
|
||||
|
||||
unsigned char *pixels = malloc( len * 4 * sizeof( unsigned char ) );
|
||||
|
||||
@@ -1127,7 +1127,7 @@ int ltexturesUpdateTexture( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
size_t colLen = uluaGetTableLen( L );
|
||||
size_t colLen = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
int j = 0;
|
||||
@@ -1156,8 +1156,8 @@ NOTE! Should be TEXTURE_TYPE_TEXTURE. Pixel should be in format { { 255, 255, 25
|
||||
*/
|
||||
int ltexturesUpdateTextureRec( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle rec = uluaGetRectangleIndex( L, 2 );
|
||||
size_t len = uluaGetTableLenIndex( L, 3 );
|
||||
Rectangle rec = uluaGetRectangle( L, 2 );
|
||||
size_t len = uluaGetTableLen( L, 3 );
|
||||
|
||||
unsigned char *pixels = malloc( len * 4 * sizeof( unsigned char ) );
|
||||
|
||||
@@ -1166,7 +1166,7 @@ int ltexturesUpdateTextureRec( lua_State *L ) {
|
||||
lua_pushnil( L );
|
||||
|
||||
while ( lua_next( L, t ) != 0 ) {
|
||||
size_t colLen = uluaGetTableLen( L );
|
||||
size_t colLen = uluaGetTableLen( L, lua_gettop( L ) );
|
||||
|
||||
int t2 = lua_gettop( L );
|
||||
int j = 0;
|
||||
@@ -1200,8 +1200,8 @@ Draw a Texture2D
|
||||
*/
|
||||
int ltexturesDrawTexture( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Color color = uluaGetColorIndex( L, 3 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
Color color = uluaGetColor( L, 3 );
|
||||
|
||||
DrawTexture( *texture, pos.x, pos.y, color );
|
||||
return 0;
|
||||
@@ -1214,9 +1214,9 @@ Draw a part of a texture defined by a rectangle
|
||||
*/
|
||||
int ltexturesDrawTextureRec( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle srcRect = uluaGetRectangleIndex( L, 2 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 3 );
|
||||
Color tint = uluaGetColorIndex( L, 4 );
|
||||
Rectangle srcRect = uluaGetRectangle( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 3 );
|
||||
Color tint = uluaGetColor( L, 4 );
|
||||
|
||||
DrawTextureRec( *texture, srcRect, pos, tint );
|
||||
return 0;
|
||||
@@ -1229,11 +1229,11 @@ Draw a part of a texture defined by a rectangle with "pro" parameters
|
||||
*/
|
||||
int ltexturesDrawTexturePro( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Rectangle srcRect = uluaGetRectangleIndex( L, 2 );
|
||||
Rectangle dstRect = uluaGetRectangleIndex( L, 3 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 4 );
|
||||
Rectangle srcRect = uluaGetRectangle( L, 2 );
|
||||
Rectangle dstRect = uluaGetRectangle( L, 3 );
|
||||
Vector2 origin = uluaGetVector2( L, 4 );
|
||||
float rot = luaL_checknumber( L, 5 );
|
||||
Color color = uluaGetColorIndex( L, 6 );
|
||||
Color color = uluaGetColor( L, 6 );
|
||||
|
||||
DrawTexturePro( *texture, srcRect, dstRect, origin, rot, color );
|
||||
|
||||
@@ -1247,11 +1247,11 @@ Draws a texture (or part of it) that stretches or shrinks nicely
|
||||
*/
|
||||
int ltexturesDrawTextureNPatch( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
NPatchInfo nPatchInfo = uluaGetNPatchInfoIndex( L, 2 );
|
||||
Rectangle dest = uluaGetRectangleIndex( L, 3 );
|
||||
Vector2 origin = uluaGetVector2Index( L, 4 );
|
||||
NPatchInfo nPatchInfo = uluaGetNPatchInfo( L, 2 );
|
||||
Rectangle dest = uluaGetRectangle( L, 3 );
|
||||
Vector2 origin = uluaGetVector2( L, 4 );
|
||||
float rotation = luaL_checknumber( L, 5 );
|
||||
Color tint = uluaGetColorIndex( L, 6 );
|
||||
Color tint = uluaGetColor( L, 6 );
|
||||
|
||||
DrawTextureNPatch( *texture, nPatchInfo, dest, origin, rotation, tint );
|
||||
|
||||
@@ -1448,7 +1448,7 @@ Returns color with alpha applied, alpha goes from 0.0f to 1.0f
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesFade( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
float alpha = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushColor( L, Fade( color, alpha ) );
|
||||
@@ -1464,7 +1464,7 @@ Returns hexadecimal value for a Color
|
||||
- Success return int
|
||||
*/
|
||||
int ltexturesColorToInt( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
lua_pushinteger( L, ColorToInt( color ) );
|
||||
|
||||
@@ -1479,7 +1479,7 @@ Returns Color normalized as float [0..1]
|
||||
- Success return Vector4
|
||||
*/
|
||||
int ltexturesColorNormalize( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
uluaPushVector4( L, ColorNormalize( color ) );
|
||||
|
||||
@@ -1494,7 +1494,7 @@ Color from normalized values [0..1]
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesColorFromNormalized( lua_State *L ) {
|
||||
Vector4 normalized = uluaGetVector4Index( L, 1 );
|
||||
Vector4 normalized = uluaGetVector4( L, 1 );
|
||||
|
||||
uluaPushColor( L, ColorFromNormalized( normalized ) );
|
||||
|
||||
@@ -1509,7 +1509,7 @@ Returns HSV values for a Color, hue [0..360], saturation/value [0..1]
|
||||
- Success return Vector3
|
||||
*/
|
||||
int ltexturesColorToHSV( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
|
||||
uluaPushVector3( L, ColorToHSV( color ) );
|
||||
|
||||
@@ -1541,8 +1541,8 @@ Get color multiplied with another color
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesColorTint( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color tint = uluaGetColorIndex( L, 2 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
Color tint = uluaGetColor( L, 2 );
|
||||
|
||||
uluaPushColor( L, ColorTint( color, tint ) );
|
||||
|
||||
@@ -1557,7 +1557,7 @@ Get color with brightness correction, brightness factor goes from -1.0f to 1.0f
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesColorBrightness( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
float factor = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushColor( L, ColorBrightness( color, factor ) );
|
||||
@@ -1573,7 +1573,7 @@ Get color with contrast correction, contrast values between -1.0f and 1.0f
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesColorContrast( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
float contrast = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushColor( L, ColorContrast( color, contrast ) );
|
||||
@@ -1589,7 +1589,7 @@ Returns color with alpha applied, alpha goes from 0.0f to 1.0f
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesColorAlpha( lua_State *L ) {
|
||||
Color color = uluaGetColorIndex( L, 1 );
|
||||
Color color = uluaGetColor( L, 1 );
|
||||
float alpha = luaL_checknumber( L, 2 );
|
||||
|
||||
uluaPushColor( L, ColorAlpha( color, alpha ) );
|
||||
@@ -1605,9 +1605,9 @@ Returns src alpha-blended into dst color with tint
|
||||
- Success return Color
|
||||
*/
|
||||
int ltexturesColorAlphaBlend( lua_State *L ) {
|
||||
Color dst = uluaGetColorIndex( L, 1 );
|
||||
Color src = uluaGetColorIndex( L, 2 );
|
||||
Color tint = uluaGetColorIndex( L, 3 );
|
||||
Color dst = uluaGetColor( L, 1 );
|
||||
Color src = uluaGetColor( L, 2 );
|
||||
Color tint = uluaGetColor( L, 3 );
|
||||
|
||||
uluaPushColor( L, ColorAlphaBlend( dst, src, tint ) );
|
||||
|
||||
@@ -1638,7 +1638,7 @@ Get pixel color from source texture
|
||||
*/
|
||||
int ltexturesGetPixelColor( lua_State *L ) {
|
||||
Texture *texture = uluaGetTexture( L, 1 );
|
||||
Vector2 pos = uluaGetVector2Index( L, 2 );
|
||||
Vector2 pos = uluaGetVector2( L, 2 );
|
||||
Image srcImage = LoadImageFromTexture( *texture );
|
||||
|
||||
uluaPushColor( L, GetImageColor( srcImage, pos.x, pos.y ) );
|
||||
|
||||
Reference in New Issue
Block a user