2002-10-12 11:37:38 +00:00
|
|
|
/**
|
|
|
|
|
* $Id$
|
|
|
|
|
*
|
|
|
|
|
* ***** BEGIN GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
|
*
|
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
|
* of the License, or (at your option) any later version. The Blender
|
|
|
|
|
* Foundation also sells licenses for use in proprietary software under
|
|
|
|
|
* the Blender License. See http://www.blender.org/BL/ for information
|
|
|
|
|
* about this.
|
|
|
|
|
*
|
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
|
*
|
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
|
* along with this program; if not, write to the Free Software Foundation,
|
|
|
|
|
* Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
|
|
|
|
|
* All rights reserved.
|
|
|
|
|
*
|
|
|
|
|
* The Original Code is: all of this file.
|
|
|
|
|
*
|
|
|
|
|
* Contributor(s): none yet.
|
|
|
|
|
*
|
|
|
|
|
* ***** END GPL/BL DUAL LICENSE BLOCK *****
|
|
|
|
|
*/
|
2003-06-14 13:34:35 +00:00
|
|
|
|
|
|
|
|
#ifdef WIN32
|
|
|
|
|
/* for the multimedia timer */
|
|
|
|
|
#include <windows.h>
|
|
|
|
|
#include <mmsystem.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include <string.h>
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
|
#include <math.h>
|
|
|
|
|
|
2002-11-25 12:02:15 +00:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
|
#include <config.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#ifdef WIN32
|
|
|
|
|
#include "BLI_winstuff.h"
|
2003-06-13 13:46:00 +00:00
|
|
|
#else
|
|
|
|
|
/* for signal callback, not (fully) supported at windows */
|
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
#include <signal.h>
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#endif
|
|
|
|
|
|
2005-04-18 13:56:19 +00:00
|
|
|
#include <limits.h>
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BLI_blenlib.h"
|
|
|
|
|
|
|
|
|
|
#include "MEM_guardedalloc.h"
|
|
|
|
|
|
|
|
|
|
#include "BMF_Api.h"
|
|
|
|
|
|
|
|
|
|
#include "DNA_view3d_types.h"
|
|
|
|
|
#include "DNA_screen_types.h"
|
|
|
|
|
#include "DNA_vec_types.h"
|
|
|
|
|
|
|
|
|
|
#include "BKE_global.h"
|
2005-07-23 18:52:31 +00:00
|
|
|
#include "BKE_scene.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BKE_utildefines.h"
|
|
|
|
|
|
|
|
|
|
#include "BIF_gl.h"
|
|
|
|
|
#include "BIF_glutil.h"
|
|
|
|
|
#include "BIF_graphics.h"
|
|
|
|
|
#include "BIF_screen.h"
|
|
|
|
|
#include "BIF_space.h"
|
|
|
|
|
#include "BIF_mywindow.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BIF_previewrender.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_renderwin.h"
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
#include "BIF_resources.h"
|
2002-10-12 11:37:38 +00:00
|
|
|
#include "BIF_toets.h"
|
|
|
|
|
|
|
|
|
|
#include "BDR_editobject.h"
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
#include "BPY_extern.h" /* for BPY_do_all_scripts */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
#include "BSE_view.h"
|
|
|
|
|
#include "BSE_drawview.h"
|
|
|
|
|
#include "BSE_filesel.h"
|
|
|
|
|
#include "BSE_headerbuttons.h"
|
|
|
|
|
|
|
|
|
|
#include "blendef.h"
|
|
|
|
|
#include "mydevice.h"
|
|
|
|
|
#include "winlay.h"
|
|
|
|
|
#include "render.h"
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* ------------ renderwin struct, to prevent too much global vars --------- */
|
|
|
|
|
/* ------------ only used for display in a 2nd window --------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* flags escape presses during event handling
|
|
|
|
|
* so we can test for user break later.
|
|
|
|
|
*/
|
|
|
|
|
#define RW_FLAGS_ESCAPE (1<<0)
|
|
|
|
|
/* old zoom style (2x, locked to mouse, exits
|
|
|
|
|
* when mouse leaves window), to be removed
|
|
|
|
|
* at some point.
|
|
|
|
|
*/
|
|
|
|
|
#define RW_FLAGS_OLDZOOM (1<<1)
|
|
|
|
|
/* on when image is being panned with middlemouse
|
|
|
|
|
*/
|
|
|
|
|
#define RW_FLAGS_PANNING (1<<2)
|
|
|
|
|
/* on when the mouse is dragging over the image
|
|
|
|
|
* to examine pixel values.
|
|
|
|
|
*/
|
|
|
|
|
#define RW_FLAGS_PIXEL_EXAMINING (1<<3)
|
|
|
|
|
|
2004-12-02 21:22:17 +00:00
|
|
|
/* forces draw of alpha */
|
|
|
|
|
#define RW_FLAGS_ALPHA (1<<4)
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* space for info text */
|
|
|
|
|
#define RW_HEADERY 18
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
typedef struct {
|
|
|
|
|
Window *win;
|
|
|
|
|
|
|
|
|
|
float zoom, zoomofs[2];
|
|
|
|
|
int active;
|
|
|
|
|
|
|
|
|
|
int mbut[3];
|
|
|
|
|
int lmouse[2];
|
|
|
|
|
|
|
|
|
|
unsigned int flags;
|
|
|
|
|
|
|
|
|
|
float pan_mouse_start[2], pan_ofs_start[2];
|
|
|
|
|
|
|
|
|
|
char *info_text;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
char *render_text, *render_text_spare;
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
} RenderWin;
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
static RenderWin *render_win= NULL;
|
|
|
|
|
|
|
|
|
|
/* --------------- help functions for RenderWin struct ---------------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* only called in function open_renderwin */
|
|
|
|
|
static RenderWin *renderwin_alloc(Window *win)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
RenderWin *rw= MEM_mallocN(sizeof(*rw), "RenderWin");
|
|
|
|
|
rw->win= win;
|
|
|
|
|
rw->zoom= 1.0;
|
|
|
|
|
rw->active= 0;
|
|
|
|
|
rw->flags= 0;
|
|
|
|
|
rw->zoomofs[0]= rw->zoomofs[1]= 0;
|
|
|
|
|
rw->info_text= NULL;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
rw->render_text= rw->render_text_spare= NULL;
|
2003-06-12 10:07:36 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
rw->lmouse[0]= rw->lmouse[1]= 0;
|
|
|
|
|
rw->mbut[0]= rw->mbut[1]= rw->mbut[2]= 0;
|
|
|
|
|
|
|
|
|
|
return rw;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void renderwin_queue_redraw(RenderWin *rw)
|
|
|
|
|
{
|
2003-06-12 10:07:36 +00:00
|
|
|
window_queue_redraw(rw->win); // to ghost
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void renderwin_reshape(RenderWin *rw)
|
|
|
|
|
{
|
|
|
|
|
;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void renderwin_get_disprect(RenderWin *rw, float disprect_r[2][2])
|
|
|
|
|
{
|
|
|
|
|
float display_w, display_h;
|
|
|
|
|
float cent_x, cent_y;
|
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
|
|
window_get_size(rw->win, &w, &h);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
h-= RW_HEADERY;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
display_w= R.rectx*rw->zoom;
|
|
|
|
|
display_h= R.recty*rw->zoom;
|
|
|
|
|
cent_x= (rw->zoomofs[0] + R.rectx/2)*rw->zoom;
|
|
|
|
|
cent_y= (rw->zoomofs[1] + R.recty/2)*rw->zoom;
|
|
|
|
|
|
|
|
|
|
disprect_r[0][0]= w/2 - cent_x;
|
|
|
|
|
disprect_r[0][1]= h/2 - cent_y;
|
|
|
|
|
disprect_r[1][0]= disprect_r[0][0] + display_w;
|
|
|
|
|
disprect_r[1][1]= disprect_r[0][1] + display_h;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Project window coordinate to image pixel coordinate.
|
|
|
|
|
* Returns true if resulting coordinate is within image.
|
|
|
|
|
*/
|
|
|
|
|
static int renderwin_win_to_image_co(RenderWin *rw, int winco[2], int imgco_r[2])
|
|
|
|
|
{
|
|
|
|
|
float disprect[2][2];
|
|
|
|
|
|
|
|
|
|
renderwin_get_disprect(rw, disprect);
|
|
|
|
|
|
2003-03-24 01:46:05 +00:00
|
|
|
imgco_r[0]= (int) ((winco[0]-disprect[0][0])/rw->zoom);
|
|
|
|
|
imgco_r[1]= (int) ((winco[1]-disprect[0][1])/rw->zoom);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
return (imgco_r[0]>=0 && imgco_r[1]>=0 && imgco_r[0]<R.rectx && imgco_r[1]<R.recty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Project window coordinates to normalized device coordinates
|
|
|
|
|
* Returns true if resulting coordinate is within window.
|
|
|
|
|
*/
|
|
|
|
|
static int renderwin_win_to_ndc(RenderWin *rw, int win_co[2], float ndc_r[2])
|
|
|
|
|
{
|
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
|
|
window_get_size(rw->win, &w, &h);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
h-= RW_HEADERY;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2005-09-03 16:20:33 +00:00
|
|
|
ndc_r[0]= ((float)(win_co[0]*2)/(w-1) - 1.0f);
|
|
|
|
|
ndc_r[1]= ((float)(win_co[1]*2)/(h-1) - 1.0f);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
return (fabs(ndc_r[0])<=1.0 && fabs(ndc_r[1])<=1.0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void renderwin_set_infotext(RenderWin *rw, char *info_text)
|
|
|
|
|
{
|
|
|
|
|
if (rw->info_text) MEM_freeN(rw->info_text);
|
|
|
|
|
rw->info_text= info_text?BLI_strdup(info_text):NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
static void renderwin_reset_view(RenderWin *rw)
|
|
|
|
|
{
|
2003-07-18 13:20:47 +00:00
|
|
|
int w, h, rectx, recty;
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
if (rw->info_text) renderwin_set_infotext(rw, NULL);
|
|
|
|
|
|
2003-07-18 13:20:47 +00:00
|
|
|
/* now calculate a zoom for when image is larger than window */
|
|
|
|
|
window_get_size(rw->win, &w, &h);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
h-= RW_HEADERY;
|
|
|
|
|
|
2005-02-12 15:41:07 +00:00
|
|
|
/* at this point the r.rectx/y values are not correct yet */
|
2003-07-18 13:20:47 +00:00
|
|
|
rectx= (G.scene->r.size*G.scene->r.xsch)/100;
|
|
|
|
|
recty= (G.scene->r.size*G.scene->r.ysch)/100;
|
2005-02-12 15:41:07 +00:00
|
|
|
|
|
|
|
|
/* crop option makes image smaller */
|
|
|
|
|
if ((G.scene->r.mode & R_BORDER) && (G.scene->r.mode & R_MOVIECROP)) {
|
2005-02-19 16:31:42 +00:00
|
|
|
if(!(G.scene->r.scemode & R_OGL)) {
|
2005-09-24 16:02:56 +00:00
|
|
|
rectx= (int) (rectx*(G.scene->r.border.xmax-G.scene->r.border.xmin));
|
|
|
|
|
recty= (int) (recty*(G.scene->r.border.ymax-G.scene->r.border.ymin));
|
2005-02-19 16:31:42 +00:00
|
|
|
}
|
2005-02-12 15:41:07 +00:00
|
|
|
}
|
|
|
|
|
|
2003-07-18 13:20:47 +00:00
|
|
|
if(rectx>w || recty>h) {
|
|
|
|
|
if(rectx-w > recty-h) rw->zoom= ((float)w)/((float)rectx);
|
|
|
|
|
else rw->zoom= ((float)h)/((float)recty);
|
|
|
|
|
}
|
|
|
|
|
else rw->zoom= 1.0;
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
rw->zoomofs[0]= rw->zoomofs[1]= 0;
|
|
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
static void renderwin_draw_render_info(RenderWin *rw)
|
|
|
|
|
{
|
|
|
|
|
/* render text is added to top */
|
|
|
|
|
if(RW_HEADERY) {
|
|
|
|
|
float colf[3];
|
|
|
|
|
rcti rect;
|
|
|
|
|
|
|
|
|
|
window_get_size(rw->win, &rect.xmax, &rect.ymax);
|
|
|
|
|
rect.xmin= 0;
|
|
|
|
|
rect.ymin= rect.ymax-RW_HEADERY;
|
|
|
|
|
glEnable(GL_SCISSOR_TEST);
|
|
|
|
|
glaDefine2DArea(&rect);
|
|
|
|
|
|
|
|
|
|
/* clear header rect */
|
|
|
|
|
BIF_SetTheme(NULL); // sets view3d theme by default
|
|
|
|
|
BIF_GetThemeColor3fv(TH_HEADER, colf);
|
|
|
|
|
glClearColor(colf[0], colf[1], colf[2], 1.0);
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
|
|
if(rw->render_text) {
|
|
|
|
|
BIF_ThemeColor(TH_TEXT);
|
|
|
|
|
glRasterPos2i(12, 5);
|
|
|
|
|
BMF_DrawString(G.fonts, rw->render_text);
|
|
|
|
|
}
|
2005-10-03 10:10:19 +00:00
|
|
|
|
|
|
|
|
BIF_SetTheme(curarea); // restore theme
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
static void renderwin_draw(RenderWin *rw, int just_clear)
|
|
|
|
|
{
|
|
|
|
|
float disprect[2][2];
|
2005-01-03 13:40:11 +00:00
|
|
|
int set_back_mainwindow;
|
2002-10-12 11:37:38 +00:00
|
|
|
rcti rect;
|
2005-01-03 13:40:11 +00:00
|
|
|
|
|
|
|
|
/* since renderwin uses callbacks (controlled by ghost) it can
|
|
|
|
|
mess up active window output with redraw events after a render.
|
|
|
|
|
this is patchy, still WIP */
|
|
|
|
|
set_back_mainwindow = (winlay_get_active_window() != rw->win);
|
|
|
|
|
window_make_active(rw->win);
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
rect.xmin= rect.ymin= 0;
|
|
|
|
|
window_get_size(rw->win, &rect.xmax, &rect.ymax);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
rect.ymax-= RW_HEADERY;
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_get_disprect(rw, disprect);
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* do this first, so window ends with correct scissor */
|
|
|
|
|
renderwin_draw_render_info(rw);
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
glEnable(GL_SCISSOR_TEST);
|
|
|
|
|
glaDefine2DArea(&rect);
|
|
|
|
|
|
|
|
|
|
glClearColor(.1875, .1875, .1875, 1.0);
|
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT);
|
|
|
|
|
|
|
|
|
|
if (just_clear || !R.rectot) {
|
|
|
|
|
glColor3ub(0, 0, 0);
|
|
|
|
|
glRectfv(disprect[0], disprect[1]);
|
|
|
|
|
} else {
|
|
|
|
|
glPixelZoom(rw->zoom, rw->zoom);
|
2004-12-02 21:22:17 +00:00
|
|
|
if(rw->flags & RW_FLAGS_ALPHA) {
|
|
|
|
|
char *rect= (char *)R.rectot;
|
|
|
|
|
|
|
|
|
|
glColorMask(1, 0, 0, 0);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
glaDrawPixelsSafe(disprect[0][0], disprect[0][1], R.rectx, R.recty, GL_UNSIGNED_BYTE, rect+3);
|
2004-12-02 21:22:17 +00:00
|
|
|
glColorMask(0, 1, 0, 0);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
glaDrawPixelsSafe(disprect[0][0], disprect[0][1], R.rectx, R.recty, GL_UNSIGNED_BYTE, rect+2);
|
2004-12-02 21:22:17 +00:00
|
|
|
glColorMask(0, 0, 1, 0);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
glaDrawPixelsSafe(disprect[0][0], disprect[0][1], R.rectx, R.recty, GL_UNSIGNED_BYTE, rect+1);
|
2004-12-02 21:22:17 +00:00
|
|
|
glColorMask(1, 1, 1, 1);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
glaDrawPixelsSafe(disprect[0][0], disprect[0][1], R.rectx, R.recty, GL_UNSIGNED_BYTE, R.rectot);
|
2004-12-02 21:22:17 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
glPixelZoom(1.0, 1.0);
|
|
|
|
|
}
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* info text is overlayed on bottom */
|
2002-10-12 11:37:38 +00:00
|
|
|
if (rw->info_text) {
|
2004-02-16 15:29:10 +00:00
|
|
|
float w;
|
|
|
|
|
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
|
|
|
|
|
glEnable(GL_BLEND);
|
|
|
|
|
w=186.0*strlen(rw->info_text)/30;
|
|
|
|
|
glColor4f(.5,.5,.5,.25);
|
|
|
|
|
glRectf(0.0,0.0,w,30.0);
|
|
|
|
|
glDisable(GL_BLEND);
|
2002-10-12 11:37:38 +00:00
|
|
|
glColor3ub(255, 255, 255);
|
|
|
|
|
glRasterPos2i(10, 10);
|
|
|
|
|
BMF_DrawString(G.font, rw->info_text);
|
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
window_swap_buffers(rw->win);
|
2005-01-03 13:40:11 +00:00
|
|
|
|
|
|
|
|
if (set_back_mainwindow) mainwindow_make_active();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* ------ interactivity calls for RenderWin ------------- */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
static void renderwin_mouse_moved(RenderWin *rw)
|
|
|
|
|
{
|
2003-07-19 20:19:31 +00:00
|
|
|
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
|
2002-10-12 11:37:38 +00:00
|
|
|
int imgco[2];
|
|
|
|
|
char buf[64];
|
The zblur plugin (aka as DoF) integrated in render. Compared to patch
submitted by Alexander, changes/improvements are:
- Moved to new Panel in Scene buttons "Post Effects". Together with other
postprocessing options, such as Edge render. It is also not called DoF,
this because that's a bit pretending too much then. It's a zblur still!
- Made it render Alpha as well
- Made it use and deliver float buffers
- Huge cleanup of zblur.c code, was very messy. It was alling things in render
code without need even (win matrices, transform faces, etc)
- Fixed errors in using Z values (zbuffer is signed int)
- Removed very weird gamma corrections for front/back half
- Tweaked gaussian table, allow variable 'Sigma' to be set for gauss curve
- Didn't copy 'auto focus' yet. Use of this is very limited, and gives
false expectations, nor works for rendering anims with deamons well.
Main issue remains: it's not a very advanced feature... I still doubt
very much if this deserves to be released. Spent 2 days on trying to get
the key issues solved, with not much results.
- gauss filter code has weird side effects on large blur size
- having unsharp (blurred) in front also blurs what's around in back.
only blurred in back with sharp in front works a little bit
- severe aliasing errors... also due the code splitting in 2 halves
- doesnt work with unified yet
- won't work for halos, spot halos or transparant faces
Anyhoo... It was promised to be committed, so now artists can play with it.
Who knows it's useful after all, or some fixes can be implemented. :)
2005-04-23 20:49:23 +00:00
|
|
|
int *pxlz; // zbuffer is signed
|
|
|
|
|
char *pxl;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
if (R.rectot && renderwin_win_to_image_co(rw, rw->lmouse, imgco)) {
|
2005-04-18 15:08:31 +00:00
|
|
|
pxl= (char*) &R.rectot[R.rectx*imgco[1] + imgco[0]];
|
2005-04-18 13:56:19 +00:00
|
|
|
|
2005-04-18 15:08:31 +00:00
|
|
|
if (R.rectz) {
|
The zblur plugin (aka as DoF) integrated in render. Compared to patch
submitted by Alexander, changes/improvements are:
- Moved to new Panel in Scene buttons "Post Effects". Together with other
postprocessing options, such as Edge render. It is also not called DoF,
this because that's a bit pretending too much then. It's a zblur still!
- Made it render Alpha as well
- Made it use and deliver float buffers
- Huge cleanup of zblur.c code, was very messy. It was alling things in render
code without need even (win matrices, transform faces, etc)
- Fixed errors in using Z values (zbuffer is signed int)
- Removed very weird gamma corrections for front/back half
- Tweaked gaussian table, allow variable 'Sigma' to be set for gauss curve
- Didn't copy 'auto focus' yet. Use of this is very limited, and gives
false expectations, nor works for rendering anims with deamons well.
Main issue remains: it's not a very advanced feature... I still doubt
very much if this deserves to be released. Spent 2 days on trying to get
the key issues solved, with not much results.
- gauss filter code has weird side effects on large blur size
- having unsharp (blurred) in front also blurs what's around in back.
only blurred in back with sharp in front works a little bit
- severe aliasing errors... also due the code splitting in 2 halves
- doesnt work with unified yet
- won't work for halos, spot halos or transparant faces
Anyhoo... It was promised to be committed, so now artists can play with it.
Who knows it's useful after all, or some fixes can be implemented. :)
2005-04-23 20:49:23 +00:00
|
|
|
pxlz= &R.rectz[R.rectx*imgco[1] + imgco[0]];
|
|
|
|
|
sprintf(buf, "R: %d, G: %d, B: %d, A: %d, Z: %f", pxl[0], pxl[1], pxl[2], pxl[3], 0.5+0.5*( ((float)*pxlz)/(float)INT_MAX) );
|
2005-04-18 15:08:31 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
sprintf(buf, "R: %d, G: %d, B: %d, A: %d", pxl[0], pxl[1], pxl[2], pxl[3]);
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_set_infotext(rw, buf);
|
|
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
} else {
|
|
|
|
|
renderwin_set_infotext(rw, NULL);
|
|
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
2003-07-19 20:19:31 +00:00
|
|
|
}
|
|
|
|
|
else if (rw->flags & RW_FLAGS_PANNING) {
|
2002-10-12 11:37:38 +00:00
|
|
|
int delta_x= rw->lmouse[0] - rw->pan_mouse_start[0];
|
|
|
|
|
int delta_y= rw->lmouse[1] - rw->pan_mouse_start[1];
|
|
|
|
|
|
|
|
|
|
rw->zoomofs[0]= rw->pan_ofs_start[0] - delta_x/rw->zoom;
|
|
|
|
|
rw->zoomofs[1]= rw->pan_ofs_start[1] - delta_y/rw->zoom;
|
|
|
|
|
rw->zoomofs[0]= CLAMPIS(rw->zoomofs[0], -R.rectx/2, R.rectx/2);
|
|
|
|
|
rw->zoomofs[1]= CLAMPIS(rw->zoomofs[1], -R.recty/2, R.recty/2);
|
|
|
|
|
|
|
|
|
|
renderwin_queue_redraw(rw);
|
2003-07-19 20:19:31 +00:00
|
|
|
}
|
|
|
|
|
else if (rw->flags & RW_FLAGS_OLDZOOM) {
|
2002-10-12 11:37:38 +00:00
|
|
|
float ndc[2];
|
|
|
|
|
int w, h;
|
|
|
|
|
|
|
|
|
|
window_get_size(rw->win, &w, &h);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
h-= RW_HEADERY;
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_win_to_ndc(rw, rw->lmouse, ndc);
|
|
|
|
|
|
|
|
|
|
rw->zoomofs[0]= -0.5*ndc[0]*(w-R.rectx*rw->zoom)/rw->zoom;
|
|
|
|
|
rw->zoomofs[1]= -0.5*ndc[1]*(h-R.recty*rw->zoom)/rw->zoom;
|
|
|
|
|
|
|
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static void renderwin_mousebut_changed(RenderWin *rw)
|
|
|
|
|
{
|
|
|
|
|
if (rw->mbut[0]) {
|
|
|
|
|
rw->flags|= RW_FLAGS_PIXEL_EXAMINING;
|
2003-07-19 20:19:31 +00:00
|
|
|
}
|
|
|
|
|
else if (rw->mbut[1]) {
|
2002-10-12 11:37:38 +00:00
|
|
|
rw->flags|= RW_FLAGS_PANNING;
|
|
|
|
|
rw->pan_mouse_start[0]= rw->lmouse[0];
|
|
|
|
|
rw->pan_mouse_start[1]= rw->lmouse[1];
|
|
|
|
|
rw->pan_ofs_start[0]= rw->zoomofs[0];
|
|
|
|
|
rw->pan_ofs_start[1]= rw->zoomofs[1];
|
2003-07-19 20:19:31 +00:00
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (rw->flags & RW_FLAGS_PANNING) {
|
|
|
|
|
rw->flags &= ~RW_FLAGS_PANNING;
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
2003-07-19 20:19:31 +00:00
|
|
|
if (rw->flags & RW_FLAGS_PIXEL_EXAMINING) {
|
2002-10-12 11:37:38 +00:00
|
|
|
rw->flags&= ~RW_FLAGS_PIXEL_EXAMINING;
|
|
|
|
|
renderwin_set_infotext(rw, NULL);
|
|
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* handler for renderwin, passed on to Ghost */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void renderwin_handler(Window *win, void *user_data, short evt, short val, char ascii)
|
|
|
|
|
{
|
|
|
|
|
RenderWin *rw= user_data;
|
2003-06-12 10:07:36 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
// added this for safety, while render it's just creating bezerk results
|
|
|
|
|
if(R.flag & R_RENDERING) {
|
|
|
|
|
if(evt==ESCKEY && val)
|
|
|
|
|
rw->flags|= RW_FLAGS_ESCAPE;
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (evt==RESHAPE) {
|
|
|
|
|
renderwin_reshape(rw);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==REDRAW) {
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_draw(rw, 0);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==WINCLOSE) {
|
2003-06-12 10:07:36 +00:00
|
|
|
BIF_close_render_display();
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==INPUTCHANGE) {
|
2002-10-12 11:37:38 +00:00
|
|
|
rw->active= val;
|
2003-06-12 10:07:36 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (!val && (rw->flags&RW_FLAGS_OLDZOOM)) {
|
|
|
|
|
rw->flags&= ~RW_FLAGS_OLDZOOM;
|
|
|
|
|
renderwin_reset_view(rw);
|
|
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (ELEM(evt, MOUSEX, MOUSEY)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
rw->lmouse[evt==MOUSEY]= val;
|
|
|
|
|
renderwin_mouse_moved(rw);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (ELEM3(evt, LEFTMOUSE, MIDDLEMOUSE, RIGHTMOUSE)) {
|
2002-10-12 11:37:38 +00:00
|
|
|
int which= (evt==LEFTMOUSE)?0:(evt==MIDDLEMOUSE)?1:2;
|
|
|
|
|
rw->mbut[which]= val;
|
|
|
|
|
renderwin_mousebut_changed(rw);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (val) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if (evt==ESCKEY) {
|
|
|
|
|
if (rw->flags&RW_FLAGS_OLDZOOM) {
|
|
|
|
|
rw->flags&= ~RW_FLAGS_OLDZOOM;
|
|
|
|
|
renderwin_reset_view(rw);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2002-10-12 11:37:38 +00:00
|
|
|
rw->flags|= RW_FLAGS_ESCAPE;
|
|
|
|
|
mainwindow_raise();
|
2003-07-09 16:02:39 +00:00
|
|
|
mainwindow_make_active();
|
|
|
|
|
rw->active= 0;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
2004-12-02 21:22:17 +00:00
|
|
|
else if( evt==AKEY) {
|
|
|
|
|
rw->flags ^= RW_FLAGS_ALPHA;
|
|
|
|
|
renderwin_queue_redraw(render_win);
|
|
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
else if (evt==JKEY) {
|
2003-12-03 15:44:11 +00:00
|
|
|
if(R.flag==0) BIF_swap_render_rects();
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==ZKEY) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if (rw->flags&RW_FLAGS_OLDZOOM) {
|
|
|
|
|
rw->flags&= ~RW_FLAGS_OLDZOOM;
|
|
|
|
|
renderwin_reset_view(rw);
|
|
|
|
|
} else {
|
|
|
|
|
rw->zoom= 2.0;
|
|
|
|
|
rw->flags|= RW_FLAGS_OLDZOOM;
|
|
|
|
|
renderwin_mouse_moved(rw);
|
|
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==PADPLUSKEY) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if (rw->zoom<15.9) {
|
2003-11-06 21:31:47 +00:00
|
|
|
if(rw->zoom>0.5 && rw->zoom<1.0) rw->zoom= 1.0;
|
|
|
|
|
else rw->zoom*= 2.0;
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==PADMINUS) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if (rw->zoom>0.26) {
|
2003-11-06 21:31:47 +00:00
|
|
|
if(rw->zoom>1.0 && rw->zoom<2.0) rw->zoom= 1.0;
|
|
|
|
|
else rw->zoom*= 0.5;
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_queue_redraw(rw);
|
|
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==PADENTER || evt==HOMEKEY) {
|
2002-10-12 11:37:38 +00:00
|
|
|
if (rw->flags&RW_FLAGS_OLDZOOM) {
|
|
|
|
|
rw->flags&= ~RW_FLAGS_OLDZOOM;
|
|
|
|
|
}
|
|
|
|
|
renderwin_reset_view(rw);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==F3KEY) {
|
2003-12-03 15:44:11 +00:00
|
|
|
if(R.flag==0) {
|
|
|
|
|
mainwindow_raise();
|
|
|
|
|
mainwindow_make_active();
|
|
|
|
|
rw->active= 0;
|
|
|
|
|
areawinset(find_biggest_area()->win);
|
|
|
|
|
BIF_save_rendered_image();
|
|
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==F11KEY) {
|
2002-10-12 11:37:38 +00:00
|
|
|
BIF_toggle_render_display();
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else if (evt==F12KEY) {
|
2003-12-03 15:44:11 +00:00
|
|
|
/* if it's rendering, this flag is set */
|
|
|
|
|
if(R.flag==0) BIF_do_render(0);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-07-26 17:12:04 +00:00
|
|
|
static char *renderwin_get_title(int doswap)
|
|
|
|
|
{
|
|
|
|
|
static int swap= 0;
|
|
|
|
|
char *title="";
|
|
|
|
|
|
|
|
|
|
swap+= doswap;
|
|
|
|
|
|
|
|
|
|
if(swap & 1) {
|
|
|
|
|
if (G.scene->r.renderer==R_YAFRAY) title = "YafRay:Render (spare)";
|
|
|
|
|
else title = "Blender:Render (spare)";
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
if (G.scene->r.renderer==R_YAFRAY) title = "YafRay:Render";
|
|
|
|
|
else title = "Blender:Render";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return title;
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* opens window and allocs struct */
|
|
|
|
|
static void open_renderwin(int winpos[2], int winsize[2])
|
|
|
|
|
{
|
2004-09-29 10:49:19 +00:00
|
|
|
extern void mywindow_build_and_set_renderwin( int orx, int ory, int sizex, int sizey); // mywindow.c
|
2003-06-12 10:07:36 +00:00
|
|
|
Window *win;
|
2004-07-26 17:12:04 +00:00
|
|
|
char *title;
|
|
|
|
|
|
|
|
|
|
title= renderwin_get_title(0); /* 0 = no swap */
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
win= window_open(title, winpos[0], winpos[1], winsize[0], winsize[1]+RW_HEADERY, 0);
|
2003-06-12 10:07:36 +00:00
|
|
|
|
|
|
|
|
render_win= renderwin_alloc(win);
|
|
|
|
|
|
|
|
|
|
/* Ghost calls handler */
|
|
|
|
|
window_set_handler(win, renderwin_handler, render_win);
|
|
|
|
|
|
|
|
|
|
winlay_process_events(0);
|
|
|
|
|
window_make_active(render_win->win);
|
|
|
|
|
winlay_process_events(0);
|
2004-09-29 10:49:19 +00:00
|
|
|
|
|
|
|
|
/* mywindow has to know about it too */
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
mywindow_build_and_set_renderwin(winpos[0], winpos[1], winsize[0], winsize[1]+RW_HEADERY);
|
2004-09-29 10:49:19 +00:00
|
|
|
/* and we should be able to draw 3d in it */
|
|
|
|
|
init_gl_stuff();
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
renderwin_draw(render_win, 1);
|
|
|
|
|
renderwin_draw(render_win, 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* -------------- callbacks for render loop: Window (RenderWin) ----------------------- */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* calculations for window size and position */
|
2002-10-12 11:37:38 +00:00
|
|
|
void calc_renderwin_rectangle(int posmask, int renderpos_r[2], int rendersize_r[2])
|
|
|
|
|
{
|
|
|
|
|
int scr_w, scr_h, x, y, div= 0;
|
|
|
|
|
float ndc_x= 0.0, ndc_y= 0.0;
|
|
|
|
|
|
|
|
|
|
winlay_get_screensize(&scr_w, &scr_h);
|
2005-11-28 22:49:23 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
rendersize_r[0]= (G.scene->r.size*G.scene->r.xsch)/100;
|
|
|
|
|
rendersize_r[1]= (G.scene->r.size*G.scene->r.ysch)/100;
|
2005-02-12 15:41:07 +00:00
|
|
|
|
|
|
|
|
/* crop option makes image smaller */
|
|
|
|
|
if ((G.scene->r.mode & R_BORDER) && (G.scene->r.mode & R_MOVIECROP)) {
|
|
|
|
|
rendersize_r[0]*= (G.scene->r.border.xmax-G.scene->r.border.xmin);
|
|
|
|
|
rendersize_r[1]*= (G.scene->r.border.ymax-G.scene->r.border.ymin);
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if(G.scene->r.mode & R_PANORAMA) {
|
|
|
|
|
rendersize_r[0]*= G.scene->r.xparts;
|
|
|
|
|
rendersize_r[1]*= G.scene->r.yparts;
|
|
|
|
|
}
|
|
|
|
|
|
2005-12-04 17:18:58 +00:00
|
|
|
rendersize_r[0]= CLAMPIS(rendersize_r[0], 0, scr_w);
|
|
|
|
|
rendersize_r[1]= CLAMPIS(rendersize_r[1], 0, scr_h-RW_HEADERY);
|
|
|
|
|
|
|
|
|
|
for (y=-1; y<=1; y++) {
|
2002-10-12 11:37:38 +00:00
|
|
|
for (x=-1; x<=1; x++) {
|
|
|
|
|
if (posmask & (1<<((y+1)*3 + (x+1)))) {
|
|
|
|
|
ndc_x+= x;
|
|
|
|
|
ndc_y+= y;
|
|
|
|
|
div++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (div) {
|
|
|
|
|
ndc_x/= div;
|
|
|
|
|
ndc_y/= div;
|
|
|
|
|
}
|
2005-11-28 22:49:23 +00:00
|
|
|
|
|
|
|
|
renderpos_r[0]= (scr_w-rendersize_r[0])*(ndc_x*0.5 + 0.5);
|
|
|
|
|
#ifdef __APPLE__
|
|
|
|
|
/* 44 pixels is topbar and window header... awaiting better fixes in ghost :) */
|
2005-12-04 17:18:58 +00:00
|
|
|
rendersize_r[1]= CLAMPIS(rendersize_r[1], 0, scr_h-44-RW_HEADERY);
|
2005-11-28 22:49:23 +00:00
|
|
|
renderpos_r[1]= -44-RW_HEADERY+(scr_h-rendersize_r[1])*(ndc_y*0.5 + 0.5);
|
|
|
|
|
#else
|
|
|
|
|
renderpos_r[1]= (scr_h-rendersize_r[1])*(ndc_y*0.5 + 0.5);
|
|
|
|
|
#endif
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* init renderwin, alloc/open/resize */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void renderwin_init_display_cb(void)
|
|
|
|
|
{
|
|
|
|
|
if (G.afbreek == 0) {
|
|
|
|
|
int rendersize[2], renderpos[2];
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
calc_renderwin_rectangle(G.winpos, renderpos, rendersize);
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
if (!render_win) {
|
|
|
|
|
open_renderwin(renderpos, rendersize);
|
2003-07-18 13:20:47 +00:00
|
|
|
renderwin_reset_view(render_win); // incl. autozoom for large images
|
2002-10-12 11:37:38 +00:00
|
|
|
} else {
|
|
|
|
|
int win_x, win_y;
|
|
|
|
|
int win_w, win_h;
|
|
|
|
|
|
|
|
|
|
window_get_position(render_win->win, &win_x, &win_y);
|
|
|
|
|
window_get_size(render_win->win, &win_w, &win_h);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
win_h-= RW_HEADERY;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
/* XXX, this is nasty and I guess bound to cause problems,
|
|
|
|
|
* but to ensure the window is at the user specified position
|
|
|
|
|
* and size we reopen the window all the time... we need
|
|
|
|
|
* a ghost _set_position to fix this -zr
|
|
|
|
|
*/
|
2004-07-28 12:47:50 +00:00
|
|
|
|
|
|
|
|
/* XXX, well... it is nasty yes, and reopens windows each time on
|
|
|
|
|
subsequent renders. Better rule is to make it reopen only only
|
|
|
|
|
size change, and use the preferred position only on open_renderwin
|
|
|
|
|
cases (ton)
|
|
|
|
|
*/
|
|
|
|
|
if(rendersize[0]!= win_w || rendersize[1]!= win_h) {
|
|
|
|
|
BIF_close_render_display();
|
|
|
|
|
open_renderwin(renderpos, rendersize);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
window_raise(render_win->win);
|
|
|
|
|
window_make_active(render_win->win);
|
Result of 2 weeks of quiet coding work in Greece :)
Aim was to get a total refresh of the animation system. This
is needed because;
- we need to upgrade it with 21st century features
- current code is spaghetti/hack combo, and hides good design
- it should become lag-free with using dependency graphs
A full log, with complete code API/structure/design explanation
will follow, that's a load of work... so here below the list with
hot changes;
- The entire object update system (matrices, geometry) is now
centralized. Calls to where_is_object and makeDispList are
forbidden, instead we tag objects 'changed' and let the
depgraph code sort it out
- Removed all old "Ika" code
- Depgraph is aware of all relationships, including meta balls,
constraints, bevelcurve, and so on.
- Made depgraph aware of relation types and layers, to do smart
flushing of 'changed' events. Nothing gets calculated too often!
- Transform uses depgraph to detect changes
- On frame-advance, depgraph flushes animated changes
Armatures;
Almost all armature related code has been fully built from scratch.
It now reveils the original design much better, with a very clean
implementation, lag free without even calculating each Bone more than
once. Result is quite a speedup yes!
Important to note is;
1) Armature is data containing the 'rest position'
2) Pose is the changes of rest position, and always on object level.
That way more Objects can use same Pose. Also constraints are in Pose
3) Actions only contain the Ipos to change values in Poses.
- Bones draw unrotated now
- Drawing bones speedup enormously (10-20 times)
- Bone selecting in EditMode, selection state is saved for PoseMode,
and vice-versa
- Undo in editmode
- Bone renaming does vertexgroups, constraints, posechannels, actions,
for all users of Armature in entire file
- Added Bone renaming in NKey panel
- Nkey PoseMode shows eulers now
- EditMode and PoseMode now have 'active' bone too (last clicked)
- Parenting in EditMode' CTRL+P, ALT+P, with nice options!
- Pose is added in Outliner now, with showing that constraints are in
the Pose, not Armature
- Disconnected IK solving from constraints. It's a separate phase now,
on top of the full Pose calculations
- Pose itself has a dependency graph too, so evaluation order is lag free.
TODO NOW;
- Rotating in Posemode has incorrect inverse transform (Martin will fix)
- Python Bone/Armature/Pose API disabled... needs full recode too
(wait for my doc!)
- Game engine will need upgrade too
- Depgraph code needs revision, cleanup, can be much faster!
(But, compliments for Jean-Luc, it works like a charm!)
- IK changed, it now doesnt use previous position to advance to next
position anymore. That system looks nice (no flips) but is not well
suited for NLA and background render.
TODO LATER;
We now can do loadsa new nifty features as well; like:
- Kill PoseMode (can be option for armatures itself)
- Make B-Bones (Bezier, Bspline, like for spines)
- Move all silly button level edit to 3d window (like CTRL+I = add
IK)
- Much better & informative drawing
- Fix action/nla editors
- Put all ipos in Actions (object, mesh key, lamp color)
- Add hooks
- Null bones
- Much more advanced constraints...
Bugfixes;
- OGL render (view3d header) had wrong first frame on anim render
- Ipo 'recording' mode had wrong playback speed
- Vertex-key mode now sticks to show 'active key', until frame change
-Ton-
2005-07-03 17:35:38 +00:00
|
|
|
|
|
|
|
|
mywinset(2); // to assign scissor/viewport again in mywindow.c. is hackish yes, but otherwise it draws in header of button for ogl header
|
|
|
|
|
{
|
|
|
|
|
rcti win_rct;
|
|
|
|
|
win_rct.xmin= win_rct.ymin= 0;
|
|
|
|
|
window_get_size(render_win->win, &win_rct.xmax, &win_rct.ymax);
|
|
|
|
|
win_rct.ymax-= RW_HEADERY;
|
|
|
|
|
glaDefine2DArea(&win_rct);
|
|
|
|
|
}
|
2004-07-28 12:47:50 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
renderwin_reset_view(render_win);
|
|
|
|
|
render_win->flags&= ~RW_FLAGS_ESCAPE;
|
2003-07-09 16:02:39 +00:00
|
|
|
render_win->active= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2004-12-02 21:22:17 +00:00
|
|
|
/* make sure we are in normal draw again */
|
|
|
|
|
render_win->flags &= ~RW_FLAGS_ALPHA;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
2003-06-12 10:07:36 +00:00
|
|
|
|
|
|
|
|
/* callback for redraw render win */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void renderwin_clear_display_cb(short ignore)
|
|
|
|
|
{
|
|
|
|
|
if (render_win) {
|
|
|
|
|
window_make_active(render_win->win);
|
|
|
|
|
renderwin_draw(render_win, 1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* XXX, this is not good, we do this without any regard to state
|
|
|
|
|
* ... better is to make this an optimization of a more clear
|
|
|
|
|
* implementation. the bug shows up when you do something like
|
|
|
|
|
* open the window, then draw part of the progress, then get
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
* a redraw event. whatever can go wrong will. -zr
|
|
|
|
|
*
|
|
|
|
|
* Note: blocked queue handling while rendering to prevent that (ton)
|
2003-06-12 10:07:36 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/* in render window; display a couple of scanlines of rendered image (see callback below) */
|
|
|
|
|
static void renderwin_progress(RenderWin *rw, int start_y, int nlines, int rect_w, int rect_h, unsigned char *rect)
|
|
|
|
|
{
|
|
|
|
|
float disprect[2][2];
|
|
|
|
|
rcti win_rct;
|
|
|
|
|
|
|
|
|
|
win_rct.xmin= win_rct.ymin= 0;
|
|
|
|
|
window_get_size(rw->win, &win_rct.xmax, &win_rct.ymax);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
win_rct.ymax-= RW_HEADERY;
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
renderwin_get_disprect(rw, disprect);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
|
|
|
|
/* for efficiency & speed; not drawing in Blender UI while rendering */
|
|
|
|
|
//window_make_active(rw->win);
|
2003-06-12 10:07:36 +00:00
|
|
|
|
|
|
|
|
glEnable(GL_SCISSOR_TEST);
|
|
|
|
|
glaDefine2DArea(&win_rct);
|
|
|
|
|
|
|
|
|
|
glDrawBuffer(GL_FRONT);
|
|
|
|
|
glPixelZoom(rw->zoom, rw->zoom);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
glaDrawPixelsSafe(disprect[0][0], disprect[0][1] + start_y*rw->zoom, rect_w, nlines, GL_UNSIGNED_BYTE, &rect[start_y*rect_w*4]);
|
2003-06-12 10:07:36 +00:00
|
|
|
glPixelZoom(1.0, 1.0);
|
|
|
|
|
glFlush();
|
|
|
|
|
glDrawBuffer(GL_BACK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* in render window; display a couple of scanlines of rendered image */
|
|
|
|
|
static void renderwin_progress_display_cb(int y1, int y2, int w, int h, unsigned int *rect)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
if (render_win) {
|
|
|
|
|
renderwin_progress(render_win, y1, y2-y1+1, w, h, (unsigned char*) rect);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
|
|
|
|
|
/* -------------- callbacks for render loop: in View3D ----------------------- */
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
|
|
|
|
|
static View3D *render_view3d = NULL;
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* init Render view callback */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void renderview_init_display_cb(void)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
|
|
/* Choose the first view with a persp camera,
|
|
|
|
|
* if one doesn't exist we will get the first
|
|
|
|
|
* View3D window.
|
|
|
|
|
*/
|
|
|
|
|
render_view3d= NULL;
|
|
|
|
|
for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
|
|
|
|
|
if (sa->win && sa->spacetype==SPACE_VIEW3D) {
|
|
|
|
|
View3D *vd= sa->spacedata.first;
|
|
|
|
|
|
|
|
|
|
if (vd->persp==2 && vd->camera==G.scene->camera) {
|
|
|
|
|
render_view3d= vd;
|
|
|
|
|
break;
|
|
|
|
|
} else if (!render_view3d) {
|
|
|
|
|
render_view3d= vd;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
|
|
|
|
|
/* in 3d view; display a couple of scanlines of rendered image */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void renderview_progress_display_cb(int y1, int y2, int w, int h, unsigned int *rect)
|
|
|
|
|
{
|
|
|
|
|
if (render_view3d) {
|
|
|
|
|
View3D *v3d= render_view3d;
|
|
|
|
|
int nlines= y2-y1+1;
|
|
|
|
|
float sx, sy, facx, facy;
|
|
|
|
|
rcti win_rct, vb;
|
|
|
|
|
|
|
|
|
|
calc_viewborder(v3d, &vb);
|
2005-02-12 16:05:40 +00:00
|
|
|
|
|
|
|
|
/* if border render */
|
|
|
|
|
if(G.scene->r.mode & R_BORDER) {
|
|
|
|
|
|
|
|
|
|
/* but, if image is full (at end of border render, without crop) we don't */
|
|
|
|
|
if(R.rectx != (G.scene->r.size*G.scene->r.xsch)/100 ||
|
|
|
|
|
R.recty != (G.scene->r.size*G.scene->r.ysch)/100 ) {
|
|
|
|
|
|
|
|
|
|
facx= (float) (vb.xmax-vb.xmin);
|
|
|
|
|
facy= (float) (vb.ymax-vb.ymin);
|
|
|
|
|
|
|
|
|
|
vb.xmax= vb.xmin + facx*G.scene->r.border.xmax;
|
|
|
|
|
vb.ymax= vb.ymin + facy*G.scene->r.border.ymax;
|
|
|
|
|
vb.xmin+= facx*G.scene->r.border.xmin;
|
|
|
|
|
vb.ymin+= facy*G.scene->r.border.ymin;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
facx= (float) (vb.xmax-vb.xmin)/R.rectx;
|
|
|
|
|
facy= (float) (vb.ymax-vb.ymin)/R.recty;
|
|
|
|
|
|
|
|
|
|
bwin_get_rect(v3d->area->win, &win_rct);
|
|
|
|
|
|
|
|
|
|
glaDefine2DArea(&win_rct);
|
|
|
|
|
|
|
|
|
|
glDrawBuffer(GL_FRONT);
|
|
|
|
|
|
|
|
|
|
sx= vb.xmin;
|
|
|
|
|
sy= vb.ymin + facy*y1;
|
|
|
|
|
|
|
|
|
|
glPixelZoom(facx, facy);
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
glaDrawPixelsSafe(sx, sy, w, nlines, GL_UNSIGNED_BYTE, rect+w*y1);
|
2002-10-12 11:37:38 +00:00
|
|
|
glPixelZoom(1.0, 1.0);
|
|
|
|
|
|
|
|
|
|
glFlush();
|
|
|
|
|
glDrawBuffer(GL_BACK);
|
|
|
|
|
v3d->flag |= V3D_DISPIMAGE;
|
|
|
|
|
v3d->area->win_swap= WIN_FRONT_OK;
|
2003-06-13 16:51:22 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* in 3d view; display stats of rendered image */
|
|
|
|
|
static void renderview_draw_render_info(char *str)
|
|
|
|
|
{
|
|
|
|
|
if (render_view3d) {
|
|
|
|
|
View3D *v3d= render_view3d;
|
|
|
|
|
rcti vb, win_rct;
|
|
|
|
|
|
|
|
|
|
calc_viewborder(v3d, &vb);
|
|
|
|
|
|
|
|
|
|
bwin_get_rect(v3d->area->win, &win_rct);
|
|
|
|
|
glaDefine2DArea(&win_rct);
|
|
|
|
|
|
|
|
|
|
glDrawBuffer(GL_FRONT);
|
|
|
|
|
|
|
|
|
|
/* clear header rect */
|
|
|
|
|
BIF_ThemeColor(TH_HEADER);
|
|
|
|
|
glRecti(vb.xmin, vb.ymax, vb.xmax, vb.ymax+RW_HEADERY);
|
|
|
|
|
|
|
|
|
|
if(str) {
|
|
|
|
|
BIF_ThemeColor(TH_TEXT);
|
|
|
|
|
glRasterPos2i(vb.xmin+12, vb.ymax+5);
|
|
|
|
|
BMF_DrawString(G.fonts, str);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
glFlush();
|
|
|
|
|
glDrawBuffer(GL_BACK);
|
|
|
|
|
|
|
|
|
|
v3d->area->win_swap= WIN_FRONT_OK;
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* -------------- callbacks for render loop: interactivity ----------------------- */
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
/* callback for print info in top header of renderwin */
|
|
|
|
|
/* time is only not zero on last call, we then don't update the other stats */
|
2004-04-24 20:27:29 +00:00
|
|
|
static void printrenderinfo_cb(double time, int sample)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
extern int mem_in_use;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
static int totvert=0, totvlak=0, tothalo=0, totlamp=0;
|
|
|
|
|
static float megs_used_memory=0.0;
|
2004-06-22 12:02:19 +00:00
|
|
|
char str[300], *spos= str;
|
2002-10-12 11:37:38 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
if(time==0.0) {
|
|
|
|
|
megs_used_memory= mem_in_use/(1024.0*1024.0);
|
|
|
|
|
totvert= R.totvert;
|
|
|
|
|
totvlak= R.totvlak;
|
|
|
|
|
totlamp= R.totlamp;
|
|
|
|
|
tothalo= R.tothalo;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(tothalo)
|
|
|
|
|
spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d Ha:%d La:%d Mem:%.2fM", (G.scene->r.cfra), totvert, totvlak, tothalo, totlamp, megs_used_memory);
|
|
|
|
|
else
|
|
|
|
|
spos+= sprintf(spos, "Fra:%d Ve:%d Fa:%d La:%d Mem:%.2fM", (G.scene->r.cfra), totvert, totvlak, totlamp, megs_used_memory);
|
|
|
|
|
|
|
|
|
|
if(time==0.0) {
|
|
|
|
|
if (R.r.mode & R_FIELDS) {
|
|
|
|
|
spos+= sprintf(spos, "Field %c ", (R.flag&R_SEC_FIELD)?'B':'A');
|
|
|
|
|
}
|
|
|
|
|
if (sample!=-1) {
|
|
|
|
|
spos+= sprintf(spos, "Sample: %d ", sample);
|
|
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
else {
|
|
|
|
|
extern char info_time_str[32]; // header_info.c
|
|
|
|
|
timestr(time, info_time_str);
|
|
|
|
|
spos+= sprintf(spos, " Time:%s ", info_time_str);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
if(render_win) {
|
|
|
|
|
if(render_win->render_text) MEM_freeN(render_win->render_text);
|
|
|
|
|
render_win->render_text= BLI_strdup(str);
|
|
|
|
|
glDrawBuffer(GL_FRONT);
|
|
|
|
|
renderwin_draw_render_info(render_win);
|
|
|
|
|
glFlush();
|
|
|
|
|
glDrawBuffer(GL_BACK);
|
|
|
|
|
}
|
|
|
|
|
else renderview_draw_render_info(str);
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-13 13:46:00 +00:00
|
|
|
/* -------------- callback system to allow ESC from rendering ----------------------- */
|
|
|
|
|
|
2003-06-14 14:49:12 +00:00
|
|
|
/* POSIX & WIN32: this function is called all the time, and should not use cpu or resources */
|
2004-01-07 23:33:40 +00:00
|
|
|
static int test_break(void)
|
2003-06-13 13:46:00 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(G.afbreek==2) { /* code for testing queue */
|
|
|
|
|
|
|
|
|
|
G.afbreek= 0;
|
|
|
|
|
|
|
|
|
|
blender_test_break(); /* tests blender interface */
|
|
|
|
|
|
|
|
|
|
if (G.afbreek==0 && render_win) { /* tests window */
|
|
|
|
|
winlay_process_events(0);
|
|
|
|
|
// render_win can be closed in winlay_process_events()
|
2003-12-03 15:44:11 +00:00
|
|
|
if (render_win == 0 || (render_win->flags & RW_FLAGS_ESCAPE)) {
|
2003-06-13 13:46:00 +00:00
|
|
|
G.afbreek= 1;
|
2003-12-03 15:44:11 +00:00
|
|
|
}
|
2003-06-13 13:46:00 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(G.afbreek==1) return 1;
|
|
|
|
|
else return 0;
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-14 14:49:12 +00:00
|
|
|
|
|
|
|
|
|
2003-06-14 13:34:35 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
|
/* we use the multimedia time here */
|
|
|
|
|
static UINT uRenderTimerId;
|
|
|
|
|
|
|
|
|
|
void CALLBACK interruptESC(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD dw2)
|
|
|
|
|
{
|
|
|
|
|
if(G.afbreek==0) G.afbreek= 2; /* code for read queue */
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-13 13:54:08 +00:00
|
|
|
/* WIN32: init SetTimer callback */
|
2003-06-13 13:46:00 +00:00
|
|
|
static void init_test_break_callback()
|
|
|
|
|
{
|
2003-06-14 13:34:35 +00:00
|
|
|
timeBeginPeriod(50);
|
|
|
|
|
uRenderTimerId = timeSetEvent(250, 1, interruptESC, 0, TIME_PERIODIC);
|
2003-06-13 13:46:00 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-13 13:54:08 +00:00
|
|
|
/* WIN32: stop SetTimer callback */
|
2003-06-14 13:34:35 +00:00
|
|
|
static void end_test_break_callback()
|
2003-06-13 13:46:00 +00:00
|
|
|
{
|
2003-06-14 13:34:35 +00:00
|
|
|
timeEndPeriod(50);
|
|
|
|
|
timeKillEvent(uRenderTimerId);
|
2003-06-13 13:46:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#else
|
|
|
|
|
/* all other OS's support signal(SIGVTALRM) */
|
|
|
|
|
|
2003-06-13 13:54:08 +00:00
|
|
|
/* POSIX: this function goes in the signal() callback */
|
2003-06-13 13:46:00 +00:00
|
|
|
static void interruptESC(int sig)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
if(G.afbreek==0) G.afbreek= 2; /* code for read queue */
|
|
|
|
|
|
|
|
|
|
/* call again, timer was reset */
|
|
|
|
|
signal(SIGVTALRM, interruptESC);
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-13 13:54:08 +00:00
|
|
|
/* POSIX: initialize timer and signal */
|
2003-06-13 13:46:00 +00:00
|
|
|
static void init_test_break_callback()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
struct itimerval tmevalue;
|
|
|
|
|
|
|
|
|
|
tmevalue.it_interval.tv_sec = 0;
|
|
|
|
|
tmevalue.it_interval.tv_usec = 250000;
|
|
|
|
|
/* wanneer de eerste ? */
|
|
|
|
|
tmevalue.it_value.tv_sec = 0;
|
|
|
|
|
tmevalue.it_value.tv_usec = 10000;
|
|
|
|
|
|
|
|
|
|
signal(SIGVTALRM, interruptESC);
|
|
|
|
|
setitimer(ITIMER_VIRTUAL, &tmevalue, 0);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-13 13:54:08 +00:00
|
|
|
/* POSIX: stop timer and callback */
|
2003-06-13 13:46:00 +00:00
|
|
|
static void end_test_break_callback()
|
|
|
|
|
{
|
|
|
|
|
struct itimerval tmevalue;
|
|
|
|
|
|
|
|
|
|
tmevalue.it_value.tv_sec = 0;
|
|
|
|
|
tmevalue.it_value.tv_usec = 0;
|
|
|
|
|
setitimer(ITIMER_VIRTUAL, &tmevalue, 0);
|
|
|
|
|
signal(SIGVTALRM, SIG_IGN);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* -------------- callbacks for render loop: init & run! ----------------------- */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* - initialize displays
|
|
|
|
|
- both opengl render as blender render
|
|
|
|
|
- set callbacks
|
|
|
|
|
- cleanup
|
|
|
|
|
*/
|
2002-10-12 11:37:38 +00:00
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
static void do_render(View3D *ogl_render_view3d, int anim, int force_dispwin)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2003-12-03 15:44:11 +00:00
|
|
|
|
|
|
|
|
/* we set this flag to prevent renderwindow queue to execute another render */
|
|
|
|
|
R.flag= R_RENDERING;
|
2005-06-06 13:10:02 +00:00
|
|
|
G.afbreek= 0;
|
2003-12-03 15:44:11 +00:00
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
if (G.displaymode == R_DISPLAYWIN || force_dispwin) {
|
2002-10-12 11:37:38 +00:00
|
|
|
RE_set_initrenderdisplay_callback(NULL);
|
2003-06-12 10:07:36 +00:00
|
|
|
RE_set_clearrenderdisplay_callback(renderwin_clear_display_cb);
|
2002-10-12 11:37:38 +00:00
|
|
|
RE_set_renderdisplay_callback(renderwin_progress_display_cb);
|
|
|
|
|
|
|
|
|
|
renderwin_init_display_cb();
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else {
|
2002-10-12 11:37:38 +00:00
|
|
|
BIF_close_render_display();
|
|
|
|
|
RE_set_initrenderdisplay_callback(renderview_init_display_cb);
|
2003-06-12 10:07:36 +00:00
|
|
|
RE_set_clearrenderdisplay_callback(NULL);
|
2002-10-12 11:37:38 +00:00
|
|
|
RE_set_renderdisplay_callback(renderview_progress_display_cb);
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-13 13:46:00 +00:00
|
|
|
init_test_break_callback();
|
2003-06-12 10:07:36 +00:00
|
|
|
RE_set_test_break_callback(test_break);
|
2003-06-13 13:46:00 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
RE_set_timecursor_callback(set_timecursor);
|
|
|
|
|
RE_set_printrenderinfo_callback(printrenderinfo_cb);
|
|
|
|
|
|
2003-07-05 20:38:31 +00:00
|
|
|
if (render_win) {
|
|
|
|
|
window_set_cursor(render_win->win, CURSOR_WAIT);
|
|
|
|
|
// when opening new window... not cross platform identical behaviour, so
|
|
|
|
|
// for now call it each time
|
2004-09-29 10:49:19 +00:00
|
|
|
// if(ogl_render_view3d) init_gl_stuff();
|
2003-07-05 20:38:31 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
waitcursor(1);
|
|
|
|
|
|
|
|
|
|
if(G.obedit && !(G.scene->r.scemode & R_OGL)) {
|
2003-04-30 13:22:26 +00:00
|
|
|
exit_editmode(0); /* 0 = no free data */
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(anim) {
|
|
|
|
|
RE_animrender(ogl_render_view3d);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
RE_initrender(ogl_render_view3d);
|
|
|
|
|
}
|
2003-06-13 16:51:22 +00:00
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
if (render_win) window_set_cursor(render_win->win, CURSOR_STD);
|
|
|
|
|
|
|
|
|
|
free_filesel_spec(G.scene->r.pic);
|
|
|
|
|
|
|
|
|
|
G.afbreek= 0;
|
2003-06-13 13:46:00 +00:00
|
|
|
end_test_break_callback();
|
2004-06-22 12:02:19 +00:00
|
|
|
|
2003-10-10 20:50:21 +00:00
|
|
|
/* in dispiew it will destroy the image otherwise
|
2003-06-23 08:20:30 +00:00
|
|
|
window_make_active() raises window at osx and sends redraws */
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
if(G.displaymode==R_DISPLAYWIN) {
|
|
|
|
|
mainwindow_make_active();
|
|
|
|
|
|
|
|
|
|
/* after an envmap creation... */
|
|
|
|
|
if(R.flag & R_REDRAW_PRV) {
|
Christmas coding work!
********* Node editor work:
- To enable Nodes for Materials, you have to set the "Use Nodes"
button, in the new Material buttons "Nodes" Panel or in header
of the Node editor. Doing this will disable Material-Layers.
- Nodes now execute materials ("shaders"), but still only using the
previewrender code.
- Nodes have (optional) previews for rendered images.
- Node headers allow to hide buttons and/or preview image
- Nodes can be dragged larger/smaller (right-bottom corner)
- Nodes can be hidden (minimized) with hotkey H
- CTRL+click on an Input Socket gives a popup with default values.
- Changing Material/Texture or Mix node will adjust Node title.
- Click-drag outside of a Node changes cursor to "Knife' and allows to
draw a rect where to cut Links.
- Added new node types RGBtoBW, Texture, In/Output, ColorRamp
- Material Nodes have options to ouput diffuse or specular, or to use
a negative normal. The input socket 'Normal' will force the material
to use that normal, otherwise it uses the normal from the Material
that has the node tree.
- When drawing a link between two not-matching sockets, Blender inserts
a converting node (now only for value/rgb combos)
- When drawing a link to an input socket that's already in use, the
old link will either disappear or flip to another unused socket.
- A click on a Material Node will activate it, and show all its settings
in the Material Buttons. Active Material Nodes draw the material icon
in red.
- A click on any node will show its options in the Node Panel in the
Material buttons.
- Multiple Output Nodes can be used, to sample contents of a tree, but
only one Output is the real one, which is indicated in a different
color and red material icon.
- Added ThemeColors for node types
- ALT+C will convert existing Material-Layers to Node... this currently
only adds the material/mix nodes and connects them. Dunno if this is
worth a lot of coding work to make perfect?
- Press C to call another "Solve order", which will show all possible
cyclic conflicts (if there are).
- Technical: nodes now use "Type" structs which define the
structure of nodes and in/output sockets. The Type structs store all
fixed info, callbacks, and allow to reconstruct saved Nodes to match
what is required by Blender.
- Defining (new) nodes now is as simple as filling in a fixed
Type struct, plus code some callbacks. A doc will be made!
- Node preview images are by default float
********* Icon drawing:
- Cleanup of how old icons were implemented in new system, making
them 16x16 too, correctly centered *and* scaled.
- Made drawing Icons use float coordinates
- Moved BIF_calcpreview_image() into interface_icons.c, renamed it
icon_from_image(). Removed a lot of unneeded Imbuf magic here! :)
- Skipped scaling and imbuf copying when icons are OK size
********* Preview render:
- Huge cleanup of code....
- renaming BIF_xxx calls that only were used internally
- BIF_previewrender() now accepts an argument for rendering method,
so it supports icons, buttonwindow previewrender and node editor
- Only a single BIF_preview_changed() call now exists, supporting all
signals as needed for buttos and node editor
********* More stuff:
- glutil.c, glaDrawPixelsSafe() and glaDrawPixelsTex() now accept format
argument for GL_FLOAT rects
- Made the ColorBand become a built-in button for interface.c
Was a load of cleanup work in buttons_shading.c...
- removed a load of unneeded glBlendFunc() calls
- Fixed bug in calculating text length for buttons (ancient!)
2005-12-28 15:42:51 +00:00
|
|
|
BIF_preview_changed(ID_TE);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
}
|
|
|
|
|
allqueue(REDRAWBUTSSCENE, 0); // visualize fbuf for example
|
|
|
|
|
}
|
|
|
|
|
|
2005-11-24 21:53:51 +00:00
|
|
|
R.flag= 0; // before scene update!
|
|
|
|
|
|
|
|
|
|
scene_update_for_newframe(G.scene, G.scene->lay); // no redraw needed, this restores to view as we left it
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
waitcursor(0); // waitcursor checks rendering R.flag...
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* finds area with a 'dispview' set */
|
2002-10-12 11:37:38 +00:00
|
|
|
static ScrArea *find_dispimage_v3d(void)
|
|
|
|
|
{
|
|
|
|
|
ScrArea *sa;
|
|
|
|
|
|
|
|
|
|
for (sa= G.curscreen->areabase.first; sa; sa= sa->next) {
|
|
|
|
|
if (sa->spacetype==SPACE_VIEW3D) {
|
|
|
|
|
View3D *vd= sa->spacedata.first;
|
|
|
|
|
if (vd->flag & V3D_DISPIMAGE)
|
|
|
|
|
return sa;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* used for swapping with spare buffer, when images are different size */
|
2002-10-12 11:37:38 +00:00
|
|
|
static void scalefastrect(unsigned int *recto, unsigned int *rectn, int oldx, int oldy, int newx, int newy)
|
|
|
|
|
{
|
|
|
|
|
unsigned int *rect, *newrect;
|
|
|
|
|
int x, y;
|
|
|
|
|
int ofsx, ofsy, stepx, stepy;
|
|
|
|
|
|
|
|
|
|
stepx = (int)((65536.0 * (oldx - 1.0) / (newx - 1.0)) + 0.5);
|
|
|
|
|
stepy = (int)((65536.0 * (oldy - 1.0) / (newy - 1.0)) + 0.5);
|
|
|
|
|
ofsy = 32768;
|
|
|
|
|
newrect= rectn;
|
|
|
|
|
|
|
|
|
|
for (y = newy; y > 0 ; y--){
|
|
|
|
|
rect = recto;
|
|
|
|
|
rect += (ofsy >> 16) * oldx;
|
|
|
|
|
ofsy += stepy;
|
|
|
|
|
ofsx = 32768;
|
|
|
|
|
for (x = newx ; x>0 ; x--){
|
|
|
|
|
*newrect++ = rect[ofsx >> 16];
|
|
|
|
|
ofsx += stepx;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* -------------- API: externally called --------------- */
|
|
|
|
|
|
2005-03-09 19:45:59 +00:00
|
|
|
/* not used anywhere ??? */
|
|
|
|
|
#if 0
|
2004-09-29 10:49:19 +00:00
|
|
|
void BIF_renderwin_make_active(void)
|
|
|
|
|
{
|
|
|
|
|
if(render_win) {
|
|
|
|
|
window_make_active(render_win->win);
|
|
|
|
|
mywinset(2);
|
|
|
|
|
}
|
|
|
|
|
}
|
2005-03-09 19:45:59 +00:00
|
|
|
#endif
|
2004-09-29 10:49:19 +00:00
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* set up display, render an image or scene */
|
|
|
|
|
void BIF_do_render(int anim)
|
|
|
|
|
{
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
int slink_flag = 0;
|
|
|
|
|
|
|
|
|
|
if (G.f & G_DOSCRIPTLINKS) {
|
|
|
|
|
BPY_do_all_scripts(SCRIPT_RENDER);
|
|
|
|
|
if (!anim) { /* avoid FRAMECHANGED slink in render callback */
|
|
|
|
|
G.f &= ~G_DOSCRIPTLINKS;
|
|
|
|
|
slink_flag = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2004-11-25 18:16:50 +00:00
|
|
|
/* if start render in 3d win, use layer from window (e.g also local view) */
|
|
|
|
|
if(curarea && curarea->spacetype==SPACE_VIEW3D) {
|
|
|
|
|
int lay= G.scene->lay;
|
2004-12-09 12:06:37 +00:00
|
|
|
if(G.vd->lay & 0xFF000000) // localview
|
|
|
|
|
G.scene->lay |= G.vd->lay;
|
|
|
|
|
else G.scene->lay= G.vd->lay;
|
|
|
|
|
|
2004-11-25 18:16:50 +00:00
|
|
|
do_render(NULL, anim, 0);
|
2004-12-09 12:06:37 +00:00
|
|
|
|
2004-11-25 18:16:50 +00:00
|
|
|
G.scene->lay= lay;
|
|
|
|
|
}
|
|
|
|
|
else do_render(NULL, anim, 0);
|
BPython:
- Made Blender.event var (previously only used by script links) hold ascii value -- where it applies -- of current event during events callback registered with Draw.Register(gui, events, button_events). Useful for gui scripts like Campbell's Python console. No problem using this var to hold the value, since in gui scripts it was not used (always None).
- Updated Window and Window.Theme with new theme vars and the Time space.
- Script links:
-- Added "Render" event for script links (runs twice, second time as "PostEvent", for clean-up actions). Now FrameChanged links don't run when a single pic is rendered.
-- Added "Enable Script Links" button in the script buttons tab. Now this bit gets saved in .blends along with the rest of G.f, so users can define per .blend if they are on or off by default. "blender -y" also disables all slinks as happened before with OnLoad ones only.
-- Other small changes in the script buttons tab:
When a link is added (button "new"), it becomes the active one for the window, no need to press a button to reach it.
Also, a pupmenu showing all available texts is shown when "new" is pressed, so users can choose a text w/o having to type. Cancel the popup to leave the string button empty (link exists, but has no script assigned). A pulldown would be better UI-wise, but it's kinda weird to show both scripts and normal texts (Blender doesn't differentiate them) in a script links pulldown. With a popup we can show only texts ending in ".py" (not done in this commit, need opinions) and if the script has no or another extension, case of many in old and current .blend's, there's still the string box for writing its name.
-- Implemented Ton's space handler script links:
Right now only for the 3d View, but it's trivial to add for others. There are two types: EVENT, to receive 3d View events from a chosen window and DRAW, to draw on the window. Ton's idea was to give scripts a controlled way to integrate better within Blender.
Here's how it works:
- scripts must have a proper header, like:
# SPACEHANDLER.VIEW3D.EVENT
and then they are shown in 3d View's View menu, "Space Handler Scripts" submenu. Check (mark, click on it) a script to make it active.
EVENT handlers should consult the Blender.event var to get the current event, which can be compared with values from the Draw module:
import Blender
from Blender import Draw
evt = Blender.event
if evt == Draw.AKEY:
print "a"
elif evt == Draw.LEFTMOUSE:
print "left mouse button"
else:
return # ignore, pass event back to Blender
Blender.event = None # tell Blender not to process itself the event
DRAW handlers are free to draw to their owner 3D View. OpenGL attributes and modelview and projection matrices are pushed before running the handler and poped when it finishes.
To communicate between EVENT and DRAW handler scripts we have the Blender.Registry module, as always.
Still need to code some nice example, which should also serve to test properly space handlers. Simple tests went fine.
- doc updates about the additions.
=======
Note: the UI part of the space handlers and script links is of course open for changes, I just tried to make it understandable. Probably we won't use the scriptlinks icon for "None Available" (check 3d View -> View -> Space Handler Scripts), though it hints at what space handlers are. The tooltips may not be accepted either, since other menus don't use them. Opinions welcomed.
2005-05-08 21:20:34 +00:00
|
|
|
|
|
|
|
|
if (slink_flag) G.f |= G_DOSCRIPTLINKS;
|
|
|
|
|
if (G.f & G_DOSCRIPTLINKS) BPY_do_all_scripts(SCRIPT_POSTRENDER);
|
2003-06-12 10:07:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* set up display, render the current area view in an image */
|
|
|
|
|
void BIF_do_ogl_render(View3D *ogl_render_view3d, int anim)
|
|
|
|
|
{
|
|
|
|
|
G.scene->r.scemode |= R_OGL;
|
|
|
|
|
do_render(ogl_render_view3d, anim, 1);
|
|
|
|
|
G.scene->r.scemode &= ~R_OGL;
|
|
|
|
|
}
|
|
|
|
|
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
void BIF_redraw_render_rect(void)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
/* redraw */
|
|
|
|
|
if (G.displaymode == R_DISPLAYWIN) {
|
|
|
|
|
// don't open render_win if rendering has been
|
|
|
|
|
// canceled or the render_win has been actively closed
|
|
|
|
|
if (render_win) {
|
|
|
|
|
renderwin_queue_redraw(render_win);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
renderview_init_display_cb();
|
|
|
|
|
renderview_progress_display_cb(0, R.recty-1, R.rectx, R.recty, R.rectot);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2002-10-12 11:37:38 +00:00
|
|
|
void BIF_swap_render_rects(void)
|
|
|
|
|
{
|
|
|
|
|
unsigned int *temp;
|
|
|
|
|
|
|
|
|
|
if(R.rectspare==0) {
|
|
|
|
|
R.rectspare= (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
|
|
|
|
|
R.sparex= R.rectx;
|
|
|
|
|
R.sparey= R.recty;
|
|
|
|
|
}
|
|
|
|
|
else if(R.sparex!=R.rectx || R.sparey!=R.recty) {
|
|
|
|
|
temp= (unsigned int *)MEM_callocN(sizeof(int)*R.rectx*R.recty, "rectot");
|
|
|
|
|
|
|
|
|
|
scalefastrect(R.rectspare, temp, R.sparex, R.sparey, R.rectx, R.recty);
|
|
|
|
|
MEM_freeN(R.rectspare);
|
|
|
|
|
R.rectspare= temp;
|
|
|
|
|
|
|
|
|
|
R.sparex= R.rectx;
|
|
|
|
|
R.sparey= R.recty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
temp= R.rectot;
|
|
|
|
|
R.rectot= R.rectspare;
|
|
|
|
|
R.rectspare= temp;
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
|
|
|
|
if (G.displaymode == R_DISPLAYWIN) {
|
2003-06-12 10:07:36 +00:00
|
|
|
if (render_win) {
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
char *tmp= render_win->render_text_spare;
|
|
|
|
|
render_win->render_text_spare= render_win->render_text;
|
|
|
|
|
render_win->render_text= tmp;
|
|
|
|
|
|
2004-07-26 17:12:04 +00:00
|
|
|
window_set_title(render_win->win, renderwin_get_title(1));
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
}
|
|
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
|
|
|
|
|
/* redraw */
|
|
|
|
|
BIF_redraw_render_rect();
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
/* called from usiblender.c too, to free and close renderwin */
|
|
|
|
|
void BIF_close_render_display(void)
|
|
|
|
|
{
|
|
|
|
|
if (render_win) {
|
|
|
|
|
|
|
|
|
|
if (render_win->info_text) MEM_freeN(render_win->info_text);
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
if (render_win->render_text) MEM_freeN(render_win->render_text);
|
|
|
|
|
if (render_win->render_text_spare) MEM_freeN(render_win->render_text_spare);
|
2003-06-12 10:07:36 +00:00
|
|
|
|
|
|
|
|
window_destroy(render_win->win); /* ghost close window */
|
|
|
|
|
MEM_freeN(render_win);
|
|
|
|
|
|
|
|
|
|
render_win= NULL;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* typical with F11 key, show image or hide/close */
|
|
|
|
|
void BIF_toggle_render_display(void)
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
|
|
|
|
ScrArea *sa= find_dispimage_v3d();
|
|
|
|
|
|
2003-07-09 16:02:39 +00:00
|
|
|
if(R.rectot==NULL); // do nothing
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
else if (render_win && G.displaymode==R_DISPLAYWIN) {
|
2003-07-09 16:02:39 +00:00
|
|
|
if(render_win->active) {
|
|
|
|
|
mainwindow_raise();
|
|
|
|
|
mainwindow_make_active();
|
|
|
|
|
render_win->active= 0;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
window_raise(render_win->win);
|
|
|
|
|
window_make_active(render_win->win);
|
|
|
|
|
render_win->active= 1;
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
else if (sa && G.displaymode==R_DISPLAYVIEW) {
|
2002-10-12 11:37:38 +00:00
|
|
|
View3D *vd= sa->spacedata.first;
|
|
|
|
|
vd->flag &= ~V3D_DISPIMAGE;
|
|
|
|
|
scrarea_queue_winredraw(sa);
|
2003-07-09 16:02:39 +00:00
|
|
|
}
|
|
|
|
|
else {
|
Biiig commit! Thanks to 2-3 weeks of cvs freeze...
Render:
- New; support for dual CPU render (SDL thread)
Currently only works with alternating scanlines, but gives excellent
performance. For both normal render as unified implemented.
Note the "mutex" locks on z-transp buffer render and imbuf loads.
- This has been made possible by major cleanups in render code, especially
getting rid of globals (example Tin Tr Tg Tb Ta for textures) or struct
OSA or using Materials or Texture data to write to.
- Made normal render fully 4x32 floats too, and removed all old optimizes
with chars or shorts.
- Made normal render and unified render use same code for sky and halo
render, giving equal (and better) results for halo render. Old render
now also uses PostProcess options (brightness, mul, gamma)
- Added option ("FBuf") in F10 Output Panel, this keeps a 4x32 bits buffer
after render. Using PostProcess menu you will note an immediate re-
display of image too (32 bits RGBA)
- Added "Hue" and "Saturation" sliders to PostProcess options
- Render module is still not having a "nice" API, but amount of dependencies
went down a lot. Next todo: remove abusive "previewrender" code.
The last main global in Render (struct Render) now can be re-used for fully
controlling a render, to allow multiple "instances" of render to open.
- Renderwindow now displays a smal bar on top with the stats, and keeps the
stats after render too. Including "spare" page support.
Not only easier visible that way, but also to remove the awkward code that
was drawing stats in the Info header (extreme slow on some ATIs too)
- Cleaned up blendef.h and BKE_utildefines.h, these two had overlapping
defines.
- I might have forgotten stuff... and will write a nice doc on the architecture!
2004-12-27 19:28:52 +00:00
|
|
|
if (G.displaymode == R_DISPLAYWIN) {
|
2002-10-12 11:37:38 +00:00
|
|
|
renderwin_init_display_cb();
|
|
|
|
|
} else {
|
|
|
|
|
if (render_win) {
|
|
|
|
|
BIF_close_render_display();
|
|
|
|
|
}
|
|
|
|
|
renderview_init_display_cb();
|
|
|
|
|
renderview_progress_display_cb(0, R.recty-1, R.rectx, R.recty, R.rectot);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2003-06-12 10:07:36 +00:00
|
|
|
void BIF_renderwin_set_custom_cursor(unsigned char mask[16][2], unsigned char bitmap[16][2])
|
2002-10-12 11:37:38 +00:00
|
|
|
{
|
2003-06-12 10:07:36 +00:00
|
|
|
if (render_win) {
|
2003-11-12 13:32:11 +00:00
|
|
|
window_set_custom_cursor(render_win->win, mask, bitmap, 7, 7);
|
2003-06-12 10:07:36 +00:00
|
|
|
}
|
2002-10-12 11:37:38 +00:00
|
|
|
}
|