Fixed FloodFill() in GLES2 driver
This commit is contained in:
@@ -921,7 +921,7 @@ int main(int argc, char * argv[])
|
|||||||
//DEBUG START
|
//DEBUG START
|
||||||
//rc_filename = "/home/n00b/projects/bu/constraint_demo/main.bas";
|
//rc_filename = "/home/n00b/projects/bu/constraint_demo/main.bas";
|
||||||
//rc_filename = "/home/n00b/projects/bu/rcbasic_v400A6_linux/rcbasic_v400_linux/examples/tile_demo/main.bas";
|
//rc_filename = "/home/n00b/projects/bu/rcbasic_v400A6_linux/rcbasic_v400_linux/examples/tile_demo/main.bas";
|
||||||
rc_filename = "/home/n00b/projects/rcbasic_alpha3/test_project/main.bas";
|
//rc_filename = "/home/n00b/projects/rcbasic_alpha3/test_project/main.bas";
|
||||||
//DEBUG END
|
//DEBUG END
|
||||||
|
|
||||||
//enable_presets = true;
|
//enable_presets = true;
|
||||||
|
|||||||
@@ -2879,6 +2879,10 @@ void rc_floodFill(int x, int y)
|
|||||||
if(y < 0 || y >= rc_canvas[rc_active_canvas].dimension.Height)
|
if(y < 0 || y >= rc_canvas[rc_active_canvas].dimension.Height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef RC_DRIVER_GLES2
|
||||||
|
y = rc_canvas[rc_active_canvas].texture->getSize().Height - (y+1);
|
||||||
|
#endif // RC_DRIVER_GLES2
|
||||||
|
|
||||||
Uint32* img_pixels = (Uint32*)rc_canvas[rc_active_canvas].texture->lock();
|
Uint32* img_pixels = (Uint32*)rc_canvas[rc_active_canvas].texture->lock();
|
||||||
|
|
||||||
Uint32 flood_size = rc_canvas[rc_active_canvas].texture->getSize().Width*rc_canvas[rc_active_canvas].texture->getSize().Height;
|
Uint32 flood_size = rc_canvas[rc_active_canvas].texture->getSize().Width*rc_canvas[rc_active_canvas].texture->getSize().Height;
|
||||||
@@ -2958,29 +2962,49 @@ int rc_windowClip(int x, int y, int w, int h)
|
|||||||
if(w <= 0 || h <=0)
|
if(w <= 0 || h <=0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if(rc_canvas.size()>0)
|
if(rc_canvas.size() == 0)
|
||||||
{
|
return -1;
|
||||||
if(!rc_canvas[0].texture)
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
irr::video::ITexture* texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)w, (irr::u32)h), "win_clip_image", irr::video::ECF_A8R8G8B8);
|
if(!rc_canvas[0].texture)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
#ifdef RC_DRIVER_GLES2
|
||||||
|
Uint32 size_n = 2;
|
||||||
|
Uint32 dim_max = (w > h ? w : h);
|
||||||
|
while(size_n < dim_max) size_n *= 2;
|
||||||
|
irr::video::ITexture* texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)size_n, (irr::u32)size_n), "canvas_clip_image", ECF_A8R8G8B8);
|
||||||
|
#else
|
||||||
|
irr::video::ITexture* texture = VideoDriver->addRenderTargetTexture(irr::core::dimension2d<irr::u32>((irr::u32)w, (irr::u32)h), "canvas_clip_image", irr::video::ECF_A8R8G8B8);
|
||||||
|
#endif // RC_WEB
|
||||||
|
|
||||||
if(!texture)
|
if(!texture)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
VideoDriver->setRenderTarget(texture);
|
VideoDriver->setRenderTarget(texture);
|
||||||
|
|
||||||
drawCanvasImage(rc_canvas[0].texture, 0, 0, x, y, w, h, w, h);
|
int tgt_w = texture->getSize().Width;
|
||||||
|
int tgt_h = texture->getSize().Height;
|
||||||
|
|
||||||
VideoDriver->setRenderTarget(rc_canvas[0].texture);
|
#ifdef RC_DRIVER_GLES2
|
||||||
|
int canvas_id = 0;
|
||||||
|
|
||||||
if(rc_active_canvas >= 0 && rc_active_canvas < rc_canvas.size())
|
irr::core::vector2d<irr::f32> screenSize( (irr::f32) tgt_w, (irr::f32) tgt_h );
|
||||||
if(rc_canvas[rc_active_canvas].texture)
|
irr::video::SColor color(rc_canvas[canvas_id].color_mod);
|
||||||
VideoDriver->setRenderTarget(rc_canvas[rc_active_canvas].texture, false, false);
|
irr::core::dimension2d<irr::u32> cv_dim(tgt_w, tgt_h);
|
||||||
|
irr::core::position2d<irr::s32> cv_pos(0, 0);
|
||||||
|
irr::core::vector2d<irr::s32> cv_offset(x, rc_canvas[canvas_id].texture->getSize().Height - y - cv_dim.Height);
|
||||||
|
irr::core::rect<s32> src( cv_offset, cv_dim );
|
||||||
|
irr::core::rect<s32> dest( irr::core::vector2d<s32>(cv_pos.X, cv_pos.Y), irr::core::dimension2d<s32>(cv_dim.Width, cv_dim.Height) );
|
||||||
|
draw2DImage2(VideoDriver, rc_canvas[canvas_id].texture, src, dest, irr::core::position2d<irr::s32>(0, 0), 0, true, color, screenSize);
|
||||||
|
|
||||||
|
//rc_setDriverMaterial();
|
||||||
|
//VideoDriver->draw2DImage(rc_canvas[rc_active_canvas].texture, dest, src, 0, 0, false);
|
||||||
|
#else
|
||||||
|
drawCanvasImage(rc_canvas[0].texture, 0, 0, x, y, w, h, tgt_w, tgt_h);
|
||||||
|
#endif // RC_DRIVER_GLES2
|
||||||
|
|
||||||
|
rc_setActiveCanvas(rc_active_canvas);
|
||||||
|
//VideoDriver->setRenderTarget(rc_canvas[rc_active_canvas].texture, false, false);
|
||||||
|
|
||||||
int img_id = -1;
|
int img_id = -1;
|
||||||
rc_image_obj img;
|
rc_image_obj img;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<irrtheora.h>
|
<irrtheora.h>
|
||||||
"rc_func130_cases.h"
|
"rc_func130_cases.h"
|
||||||
|
|
||||||
1733446556 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
|
1733451673 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_os_defines.h
|
||||||
<TargetConditionals.h>
|
<TargetConditionals.h>
|
||||||
|
|
||||||
1733270962 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
|
1733270962 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_defines.h
|
||||||
@@ -1247,7 +1247,7 @@
|
|||||||
1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
|
1727545973 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/RealisticWater.h
|
||||||
<irrlicht.h>
|
<irrlicht.h>
|
||||||
|
|
||||||
1733446561 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
|
1733452182 /home/n00b/Projects/RCBASIC4/rcbasic_runtime/rc_gfx.h
|
||||||
"SDL.h"
|
"SDL.h"
|
||||||
<SDL2/SDL.h>
|
<SDL2/SDL.h>
|
||||||
<irrlicht.h>
|
<irrlicht.h>
|
||||||
|
|||||||
Reference in New Issue
Block a user