Create material using correct texture source.

This commit is contained in:
jussi
2022-07-26 16:33:04 +03:00
parent 314d0412a5
commit 4f54a0a499
9 changed files with 21 additions and 7 deletions

View File

@@ -331,7 +331,7 @@ int lcoreSetWindowState( lua_State *L ) {
}
/*
> state = RL_IsWindowState( int flag ) )
> state = RL_IsWindowState( int flag )
Check if one specific window flag is enabled ( FLAG_FULLSCREEN_MODE, FLAG_WINDOW_RESIZABLE... )

View File

@@ -1554,7 +1554,13 @@ int lmodelsCreateMaterial( lua_State *L ) {
while ( lua_next( L, t4 ) != 0 ) {
if ( strcmp( "texture", (char*)lua_tostring( L, -2 ) ) == 0 && lua_isnumber( L, -1 ) ) {
state->materials[i]->maps[map].texture = *state->textures[ lua_tointeger( L, -1 ) ];
size_t texId = lua_tointeger( L, -1 );
if ( !validSourceTexture( texId ) ) {
lua_pushboolean( L, false );
return 1;
}
state->materials[i]->maps[map].texture = *texturesGetSourceTexture( texId );
}
else if ( strcmp( "color", (char*)lua_tostring( L, -2 ) ) == 0 && lua_istable( L, -1 ) ) {
state->materials[i]->maps[map].color = uluaGetColor( L );

View File

@@ -1285,7 +1285,7 @@ Get image pixel color at ( x, y ) position
- Success return Color
*/
int ltexturesGetImageColor( lua_State *L ) {
if ( !lua_isnumber( L, -2 ) || !lua_isnumber( L, -1 ) ) {
if ( !lua_isnumber( L, -2 ) || !lua_istable( L, -1 ) ) {
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL_GetImageColor( Image image, Vector2 pixelPos )" );
lua_pushboolean( L, false );
return 1;