summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorjussi2024-02-24 18:09:53 +0200
committerjussi2024-02-24 18:09:53 +0200
commit631cea6aa7510ba53d4f14b5537e1719a72976b9 (patch)
tree936134d4cfa228a4a1d9964823a3a9889df230ef /src
parent9f1bec39f9d3d67c5d194fa4553c2ace09656a1c (diff)
downloadreilua-enhanced-631cea6aa7510ba53d4f14b5537e1719a72976b9.tar.gz
reilua-enhanced-631cea6aa7510ba53d4f14b5537e1719a72976b9.tar.bz2
reilua-enhanced-631cea6aa7510ba53d4f14b5537e1719a72976b9.zip
Rest of rlgl and raymath functions.
Diffstat (limited to 'src')
-rw-r--r--src/lua_core.c8
-rw-r--r--src/rlgl.c55
-rw-r--r--src/rmath.c32
3 files changed, 95 insertions, 0 deletions
diff --git a/src/lua_core.c b/src/lua_core.c
index fffce5a..3747791 100644
--- a/src/lua_core.c
+++ b/src/lua_core.c
@@ -1881,6 +1881,8 @@ void luaRegister() {
assingGlobalFunction( "Vector3Negate", lmathVector3Negate );
assingGlobalFunction( "Vector3Divide", lmathVector3Divide );
assingGlobalFunction( "Vector3Normalize", lmathVector3Normalize );
+ assingGlobalFunction( "Vector3Project", lmathVector3Project );
+ assingGlobalFunction( "Vector3Reject", lmathVector3Reject );
assingGlobalFunction( "Vector3OrthoNormalize", lmathVector3OrthoNormalize );
assingGlobalFunction( "Vector3Transform", lmathVector3Transform );
assingGlobalFunction( "Vector3RotateByQuaternion", lmathVector3RotateByQuaternion );
@@ -2057,6 +2059,10 @@ void luaRegister() {
assingGlobalFunction( "rlDisableVertexBufferElement", lrlglDisableVertexBufferElement );
assingGlobalFunction( "rlEnableVertexAttribute", lrlglEnableVertexAttribute );
assingGlobalFunction( "rlDisableVertexAttribute", lrlglDisableVertexAttribute );
+#if defined( GRAPHICS_API_OPENGL_11 )
+ assingGlobalFunction( "rlEnableStatePointer", lrlglEnableStatePointer );
+ assingGlobalFunction( "rlDisableStatePointer", lrlglDisableStatePointer );
+#endif
/* Textures state. */
assingGlobalFunction( "rlActiveTextureSlot", lrlglActiveTextureSlot );
assingGlobalFunction( "rlEnableTexture", lrlglEnableTexture );
@@ -2072,6 +2078,7 @@ void luaRegister() {
assingGlobalFunction( "rlEnableFramebuffer", lrlglEnableFramebuffer );
assingGlobalFunction( "rlDisableFramebuffer", lrlglDisableFramebuffer );
assingGlobalFunction( "rlActiveDrawBuffers", lrlglActiveDrawBuffers );
+ assingGlobalFunction( "rlBlitFramebuffer", lrlglBlitFramebuffer );
/* General render state. */
assingGlobalFunction( "rlEnableColorBlend", lrlglEnableColorBlend );
assingGlobalFunction( "rlDisableColorBlend", lrlglDisableColorBlend );
@@ -2086,6 +2093,7 @@ void luaRegister() {
assingGlobalFunction( "rlDisableScissorTest", lrlglDisableScissorTest );
assingGlobalFunction( "rlScissor", lrlglScissor );
assingGlobalFunction( "rlEnableWireMode", lrlglEnableWireMode );
+ assingGlobalFunction( "rlEnablePointMode", lrlglEnablePointMode );
assingGlobalFunction( "rlDisableWireMode", lrlglDisableWireMode );
assingGlobalFunction( "rlSetLineWidth", lrlglSetLineWidth );
assingGlobalFunction( "rlGetLineWidth", lrlglGetLineWidth );
diff --git a/src/rlgl.c b/src/rlgl.c
index b0bd067..71f91c7 100644
--- a/src/rlgl.c
+++ b/src/rlgl.c
@@ -374,6 +374,35 @@ int lrlglDisableVertexAttribute( lua_State* L ) {
return 0;
}
+#if defined( GRAPHICS_API_OPENGL_11 )
+/*
+> RL.rlEnableStatePointer( int vertexAttribType, Buffer buffer )
+
+Enable attribute state pointer
+*/
+int lrlglEnableStatePointer( lua_State* L ) {
+ int vertexAttribType = luaL_checkinteger( L, 1 );
+ Buffer* buffer = uluaGetBuffer( L, 2 );
+
+ rlEnableStatePointer( vertexAttribType, buffer->data );
+
+ return 0;
+}
+
+/*
+> RL.rlDisableStatePointer( int vertexAttribType )
+
+Disable attribute state pointer
+*/
+int lrlglDisableStatePointer( lua_State* L ) {
+ int vertexAttribType = luaL_checkinteger( L, 1 );
+
+ rlDisableStatePointer( vertexAttribType );
+
+ return 0;
+}
+#endif
+
/*
## RLGL - Textures state
*/
@@ -527,6 +556,21 @@ int lrlglActiveDrawBuffers( lua_State* L ) {
}
/*
+> RL.rlBlitFramebuffer( Rectangle srcRect, Rectangle dstRect, int bufferMask )
+
+Blit active framebuffer to main framebuffer
+*/
+int lrlglBlitFramebuffer( lua_State* L ) {
+ Rectangle src = uluaGetRectangle( L, 1 );
+ Rectangle dst = uluaGetRectangle( L, 2 );
+ int bufferMask = luaL_checkinteger( L, 3 );
+
+ rlBlitFramebuffer( (int)src.x, (int)src.y, (int)src.width, (int)src.height, (int)dst.x, (int)dst.y, (int)dst.width, (int)dst.height, bufferMask );
+
+ return 0;
+}
+
+/*
## RLGL - General render state
*/
@@ -676,6 +720,17 @@ int lrlglEnableWireMode( lua_State* L ) {
}
/*
+> RL.rlEnablePointMode()
+
+Enable point mode
+*/
+int lrlglEnablePointMode( lua_State* L ) {
+ rlEnablePointMode();
+
+ return 0;
+}
+
+/*
> RL.rlDisableWireMode()
Disable wire mode
diff --git a/src/rmath.c b/src/rmath.c
index d8f85b6..2b05c7e 100644
--- a/src/rmath.c
+++ b/src/rmath.c
@@ -849,6 +849,38 @@ int lmathVector3Normalize( lua_State* L ) {
}
/*
+> result = RL.Vector3Project( Vector3 v1, Vector3 v2 )
+
+Calculate the projection of the vector v1 on to v2
+
+- Success return Vector3
+*/
+int lmathVector3Project( lua_State* L ) {
+ Vector3 v1 = uluaGetVector3( L, 1 );
+ Vector3 v2 = uluaGetVector3( L, 2 );
+
+ uluaPushVector3( L, Vector3Project( v1, v2 ) );
+
+ return 1;
+}
+
+/*
+> result = RL.Vector3Reject( Vector3 v1, Vector3 v2 )
+
+Calculate the rejection of the vector v1 on to v2
+
+- Success return Vector3
+*/
+int lmathVector3Reject( lua_State* L ) {
+ Vector3 v1 = uluaGetVector3( L, 1 );
+ Vector3 v2 = uluaGetVector3( L, 2 );
+
+ uluaPushVector3( L, Vector3Reject( v1, v2 ) );
+
+ return 1;
+}
+
+/*
> v1, v2 = RL.Vector3OrthoNormalize( Vector3 v1, Vector3 v2 )
Orthonormalize provided vectors. Makes vectors normalized and orthogonal to each other.