glBlitFramebuffer.
This commit is contained in:
26
API.md
26
API.md
@@ -921,6 +921,18 @@ LIGHT_DIRECTIONAL
|
|||||||
|
|
||||||
LIGHT_POINT
|
LIGHT_POINT
|
||||||
|
|
||||||
|
## Globals - OpenGL
|
||||||
|
|
||||||
|
GL_COLOR_BUFFER_BIT
|
||||||
|
|
||||||
|
GL_DEPTH_BUFFER_BIT
|
||||||
|
|
||||||
|
GL_STENCIL_BUFFER_BIT
|
||||||
|
|
||||||
|
GL_NEAREST
|
||||||
|
|
||||||
|
GL_LINEAR
|
||||||
|
|
||||||
## Types
|
## Types
|
||||||
|
|
||||||
Raylib structs in Lua
|
Raylib structs in Lua
|
||||||
@@ -6388,6 +6400,20 @@ Get the line drawing width
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## OpenGL - Framebuffer management
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
> success = RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter )
|
||||||
|
|
||||||
|
Copy a block of pixels from one framebuffer object to another.
|
||||||
|
Use -1 RenderTexture for window framebuffer.
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## Easings - Linear Easing functions
|
## Easings - Linear Easing functions
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -542,6 +542,14 @@ RL.HUEBAR_SELECTOR_OVERFLOW=20
|
|||||||
|
|
||||||
RL.LIGHT_DIRECTIONAL=0
|
RL.LIGHT_DIRECTIONAL=0
|
||||||
RL.LIGHT_POINT=1
|
RL.LIGHT_POINT=1
|
||||||
|
|
||||||
|
-- Globals - OpenGL
|
||||||
|
|
||||||
|
RL.GL_COLOR_BUFFER_BIT=16384
|
||||||
|
RL.GL_DEPTH_BUFFER_BIT=256
|
||||||
|
RL.GL_STENCIL_BUFFER_BIT=1024
|
||||||
|
RL.GL_NEAREST=9728
|
||||||
|
RL.GL_LINEAR=9729
|
||||||
-- Core - Window
|
-- Core - Window
|
||||||
|
|
||||||
---Check if window has been initialized successfully
|
---Check if window has been initialized successfully
|
||||||
@@ -5199,6 +5207,21 @@ function RL.rlSetLineWidth( width ) end
|
|||||||
---@return any width
|
---@return any width
|
||||||
function RL.rlGetLineWidth() end
|
function RL.rlGetLineWidth() end
|
||||||
|
|
||||||
|
-- OpenGL - Framebuffer management
|
||||||
|
|
||||||
|
---Copy a block of pixels from one framebuffer object to another.
|
||||||
|
---Use -1 RenderTexture for window framebuffer.
|
||||||
|
---- Failure return false
|
||||||
|
---- Success return true
|
||||||
|
---@param srcTex any
|
||||||
|
---@param dstTex any
|
||||||
|
---@param srcRect table
|
||||||
|
---@param dstRect table
|
||||||
|
---@param mask integer
|
||||||
|
---@param filter integer
|
||||||
|
---@return any success
|
||||||
|
function RL.glBlitFramebuffer( srcTex, dstTex, srcRect, dstRect, mask, filter ) end
|
||||||
|
|
||||||
-- Easings - Linear Easing functions
|
-- Easings - Linear Easing functions
|
||||||
|
|
||||||
---Ease linear
|
---Ease linear
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ Detailed changes:
|
|||||||
- ADDED: Camera3DRoll
|
- ADDED: Camera3DRoll
|
||||||
- ADDED: GetCamera3DViewMatrix
|
- ADDED: GetCamera3DViewMatrix
|
||||||
- ADDED: GetCamera3DProjectionMatrix
|
- ADDED: GetCamera3DProjectionMatrix
|
||||||
|
- ADDED: glBlitFramebuffer
|
||||||
|
|
||||||
------------------------------------------------------------------------
|
------------------------------------------------------------------------
|
||||||
Release: ReiLua version 0.4.0 Using Raylib 4.2
|
Release: ReiLua version 0.4.0 Using Raylib 4.2
|
||||||
|
|||||||
1
devnotes
1
devnotes
@@ -1,5 +1,4 @@
|
|||||||
Current {
|
Current {
|
||||||
* ReiLua camera3D lib.
|
|
||||||
* Check new functions from https://github.com/raysan5/raylib/blob/master/CHANGELOG
|
* Check new functions from https://github.com/raysan5/raylib/blob/master/CHANGELOG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -122,6 +122,7 @@ luaApiFile:write(
|
|||||||
|
|
||||||
local srcFile = io.open( "../src/lua_core.c", "r" )
|
local srcFile = io.open( "../src/lua_core.c", "r" )
|
||||||
local writing = false
|
local writing = false
|
||||||
|
local globalVariableCount = 0
|
||||||
|
|
||||||
repeat
|
repeat
|
||||||
line = srcFile:read( "*l" )
|
line = srcFile:read( "*l" )
|
||||||
@@ -144,6 +145,7 @@ repeat
|
|||||||
local value = RL[ globalName ]
|
local value = RL[ globalName ]
|
||||||
|
|
||||||
globalName = "RL."..globalName
|
globalName = "RL."..globalName
|
||||||
|
globalVariableCount = globalVariableCount + 1
|
||||||
|
|
||||||
if value == nil then
|
if value == nil then
|
||||||
luaApiFile:write( globalName.."=nil\n" )
|
luaApiFile:write( globalName.."=nil\n" )
|
||||||
@@ -259,9 +261,12 @@ local sourceFiles = {
|
|||||||
"rgui",
|
"rgui",
|
||||||
"lights",
|
"lights",
|
||||||
"rlgl",
|
"rlgl",
|
||||||
|
"gl",
|
||||||
"easings",
|
"easings",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local functionCount = 0
|
||||||
|
|
||||||
for _, src in ipairs( sourceFiles ) do
|
for _, src in ipairs( sourceFiles ) do
|
||||||
srcFile = io.open( "../src/"..src..".c", "r" )
|
srcFile = io.open( "../src/"..src..".c", "r" )
|
||||||
local line = ""
|
local line = ""
|
||||||
@@ -289,6 +294,7 @@ for _, src in ipairs( sourceFiles ) do
|
|||||||
luaApiFile:write( "-- "..line:sub( 4 ).."\n" )
|
luaApiFile:write( "-- "..line:sub( 4 ).."\n" )
|
||||||
elseif line:sub( 1, 1 ) == ">" then
|
elseif line:sub( 1, 1 ) == ">" then
|
||||||
funcStr = parseFunction( line )
|
funcStr = parseFunction( line )
|
||||||
|
functionCount = functionCount + 1
|
||||||
elseif line:sub( 1, 1 ) ~= "" then
|
elseif line:sub( 1, 1 ) ~= "" then
|
||||||
luaApiFile:write( "---"..line.."\n" )
|
luaApiFile:write( "---"..line.."\n" )
|
||||||
end
|
end
|
||||||
@@ -310,3 +316,5 @@ end
|
|||||||
if not separate then
|
if not separate then
|
||||||
apiFile:close()
|
apiFile:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
print( "Parsed:\n"..globalVariableCount.." Global variables\n"..functionCount.." Functions" )
|
||||||
@@ -39,8 +39,8 @@ function RL.init()
|
|||||||
camera:setPosition( { 0, 8, 16 } )
|
camera:setPosition( { 0, 8, 16 } )
|
||||||
camera:setTarget( { 0, 0, 0 } )
|
camera:setTarget( { 0, 0, 0 } )
|
||||||
camera:setUp( { 0, 1, 0 } )
|
camera:setUp( { 0, 1, 0 } )
|
||||||
-- camera.mode = camera.MODES.ORBITAL
|
camera.mode = camera.MODES.ORBITAL
|
||||||
camera.mode = camera.MODES.FREE
|
-- camera.mode = camera.MODES.FREE
|
||||||
-- camera.mode = camera.MODES.FIRST_PERSON
|
-- camera.mode = camera.MODES.FIRST_PERSON
|
||||||
|
|
||||||
heigthImage = RL.LoadImage( RL.GetBasePath().."../resources/images/heightmap.png" )
|
heigthImage = RL.LoadImage( RL.GetBasePath().."../resources/images/heightmap.png" )
|
||||||
|
|||||||
@@ -300,7 +300,9 @@ function RL.draw()
|
|||||||
drawPlayer()
|
drawPlayer()
|
||||||
RL.EndTextureMode()
|
RL.EndTextureMode()
|
||||||
|
|
||||||
RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
|
-- RL.SetTextureSource( RL.TEXTURE_SOURCE_RENDER_TEXTURE )
|
||||||
RL.DrawTexturePro( framebuffer, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE )
|
-- RL.DrawTexturePro( framebuffer, { 0, 0, res.x, -res.y }, { 0, 0, winSize.x, winSize.y }, { 0, 0 }, 0.0, RL.WHITE )
|
||||||
RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
|
-- RL.SetTextureSource( RL.TEXTURE_SOURCE_TEXTURE )
|
||||||
|
|
||||||
|
RL.glBlitFramebuffer( framebuffer, -1, res, winSize, RL.GL_COLOR_BUFFER_BIT, RL.GL_NEAREST )
|
||||||
end
|
end
|
||||||
|
|||||||
8682
include/glad.h
Normal file
8682
include/glad.h
Normal file
File diff suppressed because it is too large
Load Diff
4
include/lgl.h
Normal file
4
include/lgl.h
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
/* Framebuffer management. */
|
||||||
|
int lglBlitFramebuffer( lua_State *L );
|
||||||
@@ -7,15 +7,16 @@
|
|||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_DEV 1
|
#define VERSION_DEV 1
|
||||||
|
|
||||||
|
#include "glad.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
#include "rlgl.h"
|
||||||
#include "raymath.h"
|
#include "raymath.h"
|
||||||
#include "raygui.h"
|
#include "raygui.h"
|
||||||
#include "rlights.h"
|
#include "rlights.h"
|
||||||
#include "rcamera.h"
|
#include "rcamera.h"
|
||||||
#include "rlgl.h"
|
|
||||||
#include "glfw3.h"
|
#include "glfw3.h"
|
||||||
#include "glfw3native.h"
|
#include "glfw3native.h"
|
||||||
#include <lua.h>
|
#include <lua.h>
|
||||||
|
|||||||
@@ -80,10 +80,8 @@ int ltexturesUpdateTextureRec( lua_State *L );
|
|||||||
/* Texture Drawing. */
|
/* Texture Drawing. */
|
||||||
int ltexturesDrawTexture( lua_State *L );
|
int ltexturesDrawTexture( lua_State *L );
|
||||||
int ltexturesDrawTextureRec( lua_State *L );
|
int ltexturesDrawTextureRec( lua_State *L );
|
||||||
// int ltexturesDrawTextureTiled( lua_State *L );
|
|
||||||
int ltexturesDrawTexturePro( lua_State *L );
|
int ltexturesDrawTexturePro( lua_State *L );
|
||||||
int ltexturesDrawTextureNPatch( lua_State *L );
|
int ltexturesDrawTextureNPatch( lua_State *L );
|
||||||
// int ltexturesDrawTexturePoly( lua_State *L );
|
|
||||||
int ltexturesBeginTextureMode( lua_State *L );
|
int ltexturesBeginTextureMode( lua_State *L );
|
||||||
int ltexturesEndTextureMode( lua_State *L );
|
int ltexturesEndTextureMode( lua_State *L );
|
||||||
int ltexturesSetTextureSource( lua_State *L );
|
int ltexturesSetTextureSource( lua_State *L );
|
||||||
|
|||||||
65
src/gl.c
Normal file
65
src/gl.c
Normal file
@@ -0,0 +1,65 @@
|
|||||||
|
#include "main.h"
|
||||||
|
#include "state.h"
|
||||||
|
#include "lua_core.h"
|
||||||
|
#include "textures.h"
|
||||||
|
#include "lgl.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
## OpenGL - Framebuffer management
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
> success = RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter )
|
||||||
|
|
||||||
|
Copy a block of pixels from one framebuffer object to another.
|
||||||
|
Use -1 RenderTexture for window framebuffer.
|
||||||
|
|
||||||
|
- Failure return false
|
||||||
|
- Success return true
|
||||||
|
*/
|
||||||
|
int lglBlitFramebuffer( lua_State *L ) {
|
||||||
|
if ( !lua_isnumber( L, 1) || !lua_isnumber( L, 2 ) || !lua_istable( L, 3 )
|
||||||
|
|| !lua_istable( L, 4 ) || !lua_isnumber( L, 5 ) || !lua_isnumber( L, 6 ) ) {
|
||||||
|
TraceLog( LOG_WARNING, "%s", "Bad call of function. RL.glBlitFramebuffer( RenderTexture srcTex, RenderTexture dstTex, Rectangle srcRect, Rectangle dstRect, int mask, int filter )" );
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
int srcTexId = lua_tointeger( L, 1 );
|
||||||
|
int dstTexId = lua_tointeger( L, 2 );
|
||||||
|
Rectangle srcRect = uluaGetRectangleIndex( L, 3 );
|
||||||
|
Rectangle dstRect = uluaGetRectangleIndex( L, 4 );
|
||||||
|
int mask = lua_tointeger( L, 5 );
|
||||||
|
int filter = lua_tointeger( L, 6 );
|
||||||
|
|
||||||
|
if ( ( !validRenderTexture( srcTexId ) && srcTexId != -1 ) && ( !validRenderTexture( dstTexId ) && dstTexId != -1 ) ) {
|
||||||
|
lua_pushboolean( L, false );
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( srcTexId == -1 ) {
|
||||||
|
glBindFramebuffer( GL_READ_FRAMEBUFFER, 0 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glBindFramebuffer( GL_READ_FRAMEBUFFER, state->renderTextures[ srcTexId ]->id );
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( dstTexId == -1 ) {
|
||||||
|
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, 0 );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
glBindFramebuffer( GL_DRAW_FRAMEBUFFER, state->renderTextures[ dstTexId ]->id );
|
||||||
|
}
|
||||||
|
|
||||||
|
glBlitFramebuffer(
|
||||||
|
srcRect.x, srcRect.y, srcRect.width, srcRect.height,
|
||||||
|
dstRect.x, dstRect.y, dstRect.width, dstRect.height,
|
||||||
|
mask,
|
||||||
|
filter
|
||||||
|
// GL_COLOR_BUFFER_BIT, // mask
|
||||||
|
// GL_NEAREST // filter
|
||||||
|
);
|
||||||
|
|
||||||
|
lua_pushboolean( L, true );
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
@@ -11,6 +11,7 @@
|
|||||||
#include "rgui.h"
|
#include "rgui.h"
|
||||||
#include "lights.h"
|
#include "lights.h"
|
||||||
#include "lrlgl.h"
|
#include "lrlgl.h"
|
||||||
|
#include "lgl.h"
|
||||||
#include "reasings.h"
|
#include "reasings.h"
|
||||||
|
|
||||||
static void assignGlobalInt( int value, const char *name ) {
|
static void assignGlobalInt( int value, const char *name ) {
|
||||||
@@ -491,6 +492,12 @@ void defineGlobals() {
|
|||||||
/* LightType */
|
/* LightType */
|
||||||
assignGlobalInt( LIGHT_DIRECTIONAL, "LIGHT_DIRECTIONAL" );
|
assignGlobalInt( LIGHT_DIRECTIONAL, "LIGHT_DIRECTIONAL" );
|
||||||
assignGlobalInt( LIGHT_POINT, "LIGHT_POINT" );
|
assignGlobalInt( LIGHT_POINT, "LIGHT_POINT" );
|
||||||
|
/* OpenGL */
|
||||||
|
assignGlobalInt( GL_COLOR_BUFFER_BIT, "GL_COLOR_BUFFER_BIT" );
|
||||||
|
assignGlobalInt( GL_DEPTH_BUFFER_BIT, "GL_DEPTH_BUFFER_BIT" );
|
||||||
|
assignGlobalInt( GL_STENCIL_BUFFER_BIT, "GL_STENCIL_BUFFER_BIT" );
|
||||||
|
assignGlobalInt( GL_NEAREST, "GL_NEAREST" );
|
||||||
|
assignGlobalInt( GL_LINEAR, "GL_LINEAR" );
|
||||||
/*DOC_END*/
|
/*DOC_END*/
|
||||||
|
|
||||||
lua_pop( L, -1 );
|
lua_pop( L, -1 );
|
||||||
@@ -999,10 +1006,8 @@ void luaRegister() {
|
|||||||
/* Texture Drawing. */
|
/* Texture Drawing. */
|
||||||
assingGlobalFunction( "DrawTexture", ltexturesDrawTexture );
|
assingGlobalFunction( "DrawTexture", ltexturesDrawTexture );
|
||||||
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
|
assingGlobalFunction( "DrawTextureRec", ltexturesDrawTextureRec );
|
||||||
// assingGlobalFunction( "DrawTextureTiled", ltexturesDrawTextureTiled );
|
|
||||||
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
|
assingGlobalFunction( "DrawTexturePro", ltexturesDrawTexturePro );
|
||||||
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
|
assingGlobalFunction( "DrawTextureNPatch", ltexturesDrawTextureNPatch );
|
||||||
// assingGlobalFunction( "DrawTexturePoly", ltexturesDrawTexturePoly );
|
|
||||||
assingGlobalFunction( "BeginTextureMode", ltexturesBeginTextureMode );
|
assingGlobalFunction( "BeginTextureMode", ltexturesBeginTextureMode );
|
||||||
assingGlobalFunction( "EndTextureMode", ltexturesEndTextureMode );
|
assingGlobalFunction( "EndTextureMode", ltexturesEndTextureMode );
|
||||||
assingGlobalFunction( "SetTextureSource", ltexturesSetTextureSource );
|
assingGlobalFunction( "SetTextureSource", ltexturesSetTextureSource );
|
||||||
@@ -1038,7 +1043,6 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "DrawTriangle3D", lmodelsDrawTriangle3D );
|
assingGlobalFunction( "DrawTriangle3D", lmodelsDrawTriangle3D );
|
||||||
assingGlobalFunction( "DrawCube", lmodelsDrawCube );
|
assingGlobalFunction( "DrawCube", lmodelsDrawCube );
|
||||||
assingGlobalFunction( "DrawCubeWires", lmodelsDrawCubeWires );
|
assingGlobalFunction( "DrawCubeWires", lmodelsDrawCubeWires );
|
||||||
// assingGlobalFunction( "DrawCubeTexture", lmodelsDrawCubeTexture );
|
|
||||||
assingGlobalFunction( "DrawSphere", lmodelsDrawSphere );
|
assingGlobalFunction( "DrawSphere", lmodelsDrawSphere );
|
||||||
assingGlobalFunction( "DrawSphereEx", lmodelsDrawSphereEx );
|
assingGlobalFunction( "DrawSphereEx", lmodelsDrawSphereEx );
|
||||||
assingGlobalFunction( "DrawSphereWires", lmodelsDrawSphereWires );
|
assingGlobalFunction( "DrawSphereWires", lmodelsDrawSphereWires );
|
||||||
@@ -1138,9 +1142,6 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "StopSound", laudioStopSound );
|
assingGlobalFunction( "StopSound", laudioStopSound );
|
||||||
assingGlobalFunction( "PauseSound", laudioPauseSound );
|
assingGlobalFunction( "PauseSound", laudioPauseSound );
|
||||||
assingGlobalFunction( "ResumeSound", laudioResumeSound );
|
assingGlobalFunction( "ResumeSound", laudioResumeSound );
|
||||||
// assingGlobalFunction( "PlaySoundMulti", laudioPlaySoundMulti );
|
|
||||||
// assingGlobalFunction( "StopSoundMulti", laudioStopSoundMulti );
|
|
||||||
// assingGlobalFunction( "GetSoundsPlaying", laudioGetSoundsPlaying );
|
|
||||||
assingGlobalFunction( "IsSoundPlaying", laudioIsSoundPlaying );
|
assingGlobalFunction( "IsSoundPlaying", laudioIsSoundPlaying );
|
||||||
assingGlobalFunction( "SetSoundVolume", laudioSetSoundVolume );
|
assingGlobalFunction( "SetSoundVolume", laudioSetSoundVolume );
|
||||||
assingGlobalFunction( "SetSoundPitch", laudioSetSoundPitch );
|
assingGlobalFunction( "SetSoundPitch", laudioSetSoundPitch );
|
||||||
@@ -1347,6 +1348,10 @@ void luaRegister() {
|
|||||||
assingGlobalFunction( "rlglSetLineWidth", lrlglSetLineWidth );
|
assingGlobalFunction( "rlglSetLineWidth", lrlglSetLineWidth );
|
||||||
assingGlobalFunction( "rlglGetLineWidth", lrlglGetLineWidth );
|
assingGlobalFunction( "rlglGetLineWidth", lrlglGetLineWidth );
|
||||||
|
|
||||||
|
/* OpenGL */
|
||||||
|
/* Framebuffer management. */
|
||||||
|
assingGlobalFunction( "glBlitFramebuffer", lglBlitFramebuffer );
|
||||||
|
|
||||||
/* Easings */
|
/* Easings */
|
||||||
/* Linear Easing functions. */
|
/* Linear Easing functions. */
|
||||||
assingGlobalFunction( "EaseLinear", leasingsEaseLinear );
|
assingGlobalFunction( "EaseLinear", leasingsEaseLinear );
|
||||||
|
|||||||
Reference in New Issue
Block a user