rlSetVertexAttribute takes pointer as Buffer.
This commit is contained in:
4
API.md
4
API.md
@@ -10520,9 +10520,9 @@ Unload vertex buffer (VBO)
|
||||
|
||||
---
|
||||
|
||||
> RL.rlSetVertexAttribute( int index, int compSize, int type, bool normalized, int stride, int pointer )
|
||||
> RL.rlSetVertexAttribute( int index, int compSize, int type, bool normalized, int stride, buffer pointer )
|
||||
|
||||
Set vertex attribute. NOTE: Pointer should be given in size of bytes
|
||||
Set vertex attribute.
|
||||
|
||||
---
|
||||
|
||||
|
||||
@@ -7333,13 +7333,13 @@ function RL.rlUnloadVertexArray( vaoId ) end
|
||||
---@return any RL.rlUnloadVertexBuffer
|
||||
function RL.rlUnloadVertexBuffer( vboId ) end
|
||||
|
||||
---Set vertex attribute. NOTE: Pointer should be given in size of bytes
|
||||
---Set vertex attribute.
|
||||
---@param index integer
|
||||
---@param compSize integer
|
||||
---@param type integer
|
||||
---@param normalized boolean
|
||||
---@param stride integer
|
||||
---@param pointer integer
|
||||
---@param pointer any
|
||||
---@return any RL.rlSetVertexAttribute
|
||||
function RL.rlSetVertexAttribute( index, compSize, type, normalized, stride, pointer ) end
|
||||
|
||||
|
||||
@@ -106,8 +106,6 @@ local raymath = {
|
||||
MatrixToFloatV = "Can be replaced by Lua equivalent",
|
||||
},
|
||||
info = {
|
||||
Vector3Project = "Will be added",
|
||||
Vector3Reject = "Will be added",
|
||||
},
|
||||
}
|
||||
local easings = {
|
||||
|
||||
@@ -71,6 +71,7 @@ DETAILED CHANGES:
|
||||
- CHANGE: GetPixelDataSize takes Vector2 instead of width and height.
|
||||
- ADDED: LoadBufferFormatted, SetBufferData and CopyBufferData. Compressed resource file example.
|
||||
- ADDED: GetBufferAsString.
|
||||
- FIXED: rlSetVertexAttribute takes pointer as Buffer.
|
||||
|
||||
------------------------------------------------------------------------
|
||||
Release: ReiLua version 0.7.0 Using Raylib 5.0 and Forked Raygui 4.0
|
||||
|
||||
@@ -75,7 +75,7 @@ function PropertyList:updateControl( control )
|
||||
|
||||
if type( control._controls ) == "table" then
|
||||
for _, groupControl in ipairs( control._controls ) do
|
||||
groupControl.visible = control.active
|
||||
groupControl.visible = control.active and control.visible
|
||||
-- Deactivate any subgroups.
|
||||
if not control.active and type( groupControl._controls ) == "table" then
|
||||
groupControl.active = false
|
||||
|
||||
@@ -115,8 +115,8 @@ function RL.init()
|
||||
Rect:new( 464, 256, 128, 32 ),
|
||||
"Health",
|
||||
0,
|
||||
0,
|
||||
10,
|
||||
-100,
|
||||
100,
|
||||
false,
|
||||
{ -- Callbacks.
|
||||
edit = function( self ) print( "Spinner value changed to "..self.value ) end
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
package.path = package.path..";"..RL.GetBasePath().."../resources/lib/?.lua"
|
||||
|
||||
Util = require( "utillib" )
|
||||
Vec2 = require( "vector2" )
|
||||
Vector2 = require( "vector2" )
|
||||
|
||||
local res = Vec2:new( 1024, 720 )
|
||||
local res = Vector2:new( 1024, 720 )
|
||||
local winScale = 1
|
||||
local winSize = res:scale( winScale )
|
||||
local monitor = 0
|
||||
local null = RL.LoadBuffer( {}, RL.BUFFER_UNSIGNED_CHAR );
|
||||
|
||||
local triangle = {
|
||||
texture = {
|
||||
id = -1,
|
||||
data = nil,
|
||||
size = Vec2:new( 0, 0 ),
|
||||
size = Vector2:new( 0, 0 ),
|
||||
mipmaps = 0,
|
||||
format = 0,
|
||||
},
|
||||
@@ -60,7 +61,7 @@ local function loadTexture( path )
|
||||
local image = RL.LoadImage( path )
|
||||
|
||||
triangle.texture.data = RL.GetImageData( image )
|
||||
triangle.texture.size = Vec2:newT( RL.GetImageSize( image ) )
|
||||
triangle.texture.size = Vector2:newT( RL.GetImageSize( image ) )
|
||||
triangle.texture.format = RL.GetImageFormat( image )
|
||||
triangle.texture.mipmaps = RL.GetImageMipmaps( image )
|
||||
|
||||
@@ -96,7 +97,7 @@ local function createTriangle()
|
||||
RL.BUFFER_FLOAT
|
||||
)
|
||||
triangle.vbos.positions = RL.rlLoadVertexBuffer( vertexBuffer, false )
|
||||
RL.rlSetVertexAttribute( 0, 3, RL.RL_FLOAT, false, 0, 0 )
|
||||
RL.rlSetVertexAttribute( 0, 3, RL.RL_FLOAT, false, 0, null )
|
||||
RL.rlEnableVertexAttribute( 0 )
|
||||
|
||||
-- Colors.
|
||||
@@ -109,7 +110,7 @@ local function createTriangle()
|
||||
RL.BUFFER_FLOAT
|
||||
)
|
||||
triangle.vbos.colors = RL.rlLoadVertexBuffer( colors, false )
|
||||
RL.rlSetVertexAttribute( 1, 4, RL.RL_FLOAT, false, 0, 0 )
|
||||
RL.rlSetVertexAttribute( 1, 4, RL.RL_FLOAT, false, 0, null )
|
||||
RL.rlEnableVertexAttribute( 1 )
|
||||
|
||||
-- Texcoords.
|
||||
@@ -122,7 +123,7 @@ local function createTriangle()
|
||||
RL.BUFFER_FLOAT
|
||||
)
|
||||
triangle.vbos.texcoors = RL.rlLoadVertexBuffer( texcoors, false )
|
||||
RL.rlSetVertexAttribute( 2, 2, RL.RL_FLOAT, false, 0, 0 )
|
||||
RL.rlSetVertexAttribute( 2, 2, RL.RL_FLOAT, false, 0, null )
|
||||
RL.rlEnableVertexAttribute( 2 )
|
||||
|
||||
-- Disable.
|
||||
@@ -131,8 +132,8 @@ local function createTriangle()
|
||||
end
|
||||
|
||||
function RL.init()
|
||||
local monitorPos = Vec2:newT( RL.GetMonitorPosition( monitor ) )
|
||||
local monitorSize = Vec2:newT( RL.GetMonitorSize( monitor ) )
|
||||
local monitorPos = Vector2:newT( RL.GetMonitorPosition( monitor ) )
|
||||
local monitorSize = Vector2:newT( RL.GetMonitorSize( monitor ) )
|
||||
|
||||
RL.SetWindowTitle( "RLGL Hello Triangle" )
|
||||
RL.SetWindowState( RL.FLAG_WINDOW_RESIZABLE )
|
||||
|
||||
@@ -2875,6 +2875,23 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||
keyCount++;
|
||||
valueHasChanged = true;
|
||||
}
|
||||
else if ( key == 45 ) {
|
||||
if ( 0 < strtol( textValue, NULL, 10 ) ) {
|
||||
keyCount++;
|
||||
for ( int i = keyCount; 0 < i; i-- ) {
|
||||
textValue[i] = textValue[i-1];
|
||||
}
|
||||
textValue[0] = 45;
|
||||
}
|
||||
else {
|
||||
for ( int i = 0; i < keyCount; i++ ) {
|
||||
textValue[i] = textValue[i+1];
|
||||
}
|
||||
textValue[ keyCount ] = '\0';
|
||||
keyCount--;
|
||||
}
|
||||
valueHasChanged = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2889,7 +2906,8 @@ int GuiValueBox(Rectangle bounds, const char *text, int *value, int minValue, in
|
||||
}
|
||||
}
|
||||
|
||||
if (valueHasChanged) *value = TextToInteger(textValue);
|
||||
// if (valueHasChanged) *value = TextToInteger(textValue);
|
||||
if (valueHasChanged) *value = strtol( textValue, NULL, 10 );
|
||||
|
||||
// NOTE: We are not clamp values until user input finishes
|
||||
//if (*value > maxValue) *value = maxValue;
|
||||
|
||||
@@ -1216,9 +1216,9 @@ int lrlglUnloadVertexBuffer( lua_State* L ) {
|
||||
}
|
||||
|
||||
/*
|
||||
> RL.rlSetVertexAttribute( int index, int compSize, int type, bool normalized, int stride, int pointer )
|
||||
> RL.rlSetVertexAttribute( int index, int compSize, int type, bool normalized, int stride, buffer pointer )
|
||||
|
||||
Set vertex attribute. NOTE: Pointer should be given in size of bytes
|
||||
Set vertex attribute.
|
||||
*/
|
||||
int lrlglSetVertexAttribute( lua_State* L ) {
|
||||
int index = luaL_checkinteger( L, 1 );
|
||||
@@ -1226,9 +1226,9 @@ int lrlglSetVertexAttribute( lua_State* L ) {
|
||||
int type = luaL_checkinteger( L, 3 );
|
||||
bool normalized = uluaGetBoolean( L, 4 );
|
||||
int stride = luaL_checkinteger( L, 5 );
|
||||
int pointer = luaL_checkinteger( L, 6 );
|
||||
Buffer* pointer = uluaGetBuffer( L, 6 );
|
||||
|
||||
rlSetVertexAttribute( index, compSize, type, normalized, stride, (void*)( pointer * sizeof( char ) ) );
|
||||
rlSetVertexAttribute( index, compSize, type, normalized, stride, pointer->data );
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user