Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2004-12-27 22:28:52 +0300
committerTon Roosendaal <ton@blender.org>2004-12-27 22:28:52 +0300
commit610cec55c7134c3dada168530ee833276677bae7 (patch)
tree428e061d0d42b79b9332688951baa3f189a3a985 /source/blender/src
parentc43c38140d59e9204d55a62c87e0b701f50f2538 (diff)
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!
Diffstat (limited to 'source/blender/src')
-rw-r--r--source/blender/src/buttons_editing.c7
-rw-r--r--source/blender/src/buttons_scene.c79
-rw-r--r--source/blender/src/drawimage.c2
-rw-r--r--source/blender/src/drawmesh.c3
-rw-r--r--source/blender/src/drawobject.c2
-rw-r--r--source/blender/src/drawseq.c3
-rw-r--r--source/blender/src/drawview.c268
-rw-r--r--source/blender/src/editaction.c9
-rw-r--r--source/blender/src/editface.c2
-rw-r--r--source/blender/src/editipo.c22
-rw-r--r--source/blender/src/editlattice.c3
-rw-r--r--source/blender/src/editmball.c2
-rw-r--r--source/blender/src/editmesh.c1
-rw-r--r--source/blender/src/editmesh_mods.c10
-rw-r--r--source/blender/src/editobject.c4
-rw-r--r--source/blender/src/editoops.c1
-rw-r--r--source/blender/src/editscreen.c2
-rw-r--r--source/blender/src/editseq.c1
-rw-r--r--source/blender/src/editsima.c1
-rw-r--r--source/blender/src/filesel.c2
-rw-r--r--source/blender/src/header_action.c1
-rw-r--r--source/blender/src/header_image.c1
-rw-r--r--source/blender/src/header_info.c4
-rw-r--r--source/blender/src/header_nla.c7
-rw-r--r--source/blender/src/headerbuttons.c1
-rw-r--r--source/blender/src/meshtools.c72
-rw-r--r--source/blender/src/previewrender.c133
-rw-r--r--source/blender/src/renderwin.c217
-rw-r--r--source/blender/src/resources.c2
-rw-r--r--source/blender/src/screendump.c2
-rw-r--r--source/blender/src/seqaudio.c2
-rw-r--r--source/blender/src/sequence.c9
-rw-r--r--source/blender/src/toets.c4
-rw-r--r--source/blender/src/toolbox.c2
-rw-r--r--source/blender/src/usiblender.c3
-rw-r--r--source/blender/src/view.c2
-rw-r--r--source/blender/src/writeavicodec.c2
-rw-r--r--source/blender/src/writeimage.c2
38 files changed, 368 insertions, 522 deletions
diff --git a/source/blender/src/buttons_editing.c b/source/blender/src/buttons_editing.c
index 3aa41c0f7fc..6b27cf32113 100644
--- a/source/blender/src/buttons_editing.c
+++ b/source/blender/src/buttons_editing.c
@@ -153,6 +153,8 @@
#include "LOD_DependKludge.h"
#include "LOD_decimation.h"
+#include "RE_renderconverter.h" // make_sticky
+
#include "butspace.h" // own module
static int decim_faces=0;
@@ -441,6 +443,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
new_material_to_objectdata((G.scene->basact) ? (G.scene->basact->object) : 0);
scrarea_queue_winredraw(curarea);
BIF_undo_push("New material");
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWVIEW3D_Z, 0);
allqueue(REDRAWOOPS, 0);
break;
@@ -448,6 +451,7 @@ void do_common_editbuts(unsigned short event) // old name, is a mix of object an
delete_material_index();
scrarea_queue_winredraw(curarea);
BIF_undo_push("Delete material index");
+ allqueue(REDRAWBUTSSHADING, 0);
allqueue(REDRAWVIEW3D_Z, 0);
allqueue(REDRAWOOPS, 0);
break;
@@ -1899,7 +1903,8 @@ void do_meshbuts(unsigned short event)
allqueue(REDRAWBUTSEDIT, 0);
break;
case B_MAKESTICKY:
- make_sticky();
+ RE_make_sticky();
+ allqueue(REDRAWBUTSEDIT, 0);
break;
case B_MAKEEDGES:
diff --git a/source/blender/src/buttons_scene.c b/source/blender/src/buttons_scene.c
index 98a856a731d..4561b183b7d 100644
--- a/source/blender/src/buttons_scene.c
+++ b/source/blender/src/buttons_scene.c
@@ -64,14 +64,15 @@
#include "BIF_gl.h"
#include "BIF_graphics.h"
+#include "BIF_glutil.h"
+#include "BIF_interface.h"
#include "BIF_keyval.h"
#include "BIF_mainqueue.h"
+#include "BIF_mywindow.h"
#include "BIF_resources.h"
+#include "BIF_renderwin.h"
#include "BIF_screen.h"
-#include "BIF_mywindow.h"
#include "BIF_space.h"
-#include "BIF_glutil.h"
-#include "BIF_interface.h"
#include "BIF_toolbox.h"
#include "BIF_butspace.h"
@@ -85,7 +86,6 @@
#include "DNA_image_types.h"
#include "BKE_writeavi.h"
#include "BKE_image.h"
-#include "BIF_renderwin.h"
#include "BIF_writeimage.h"
#include "BIF_writeavicodec.h"
#include "BIF_editsound.h"
@@ -475,7 +475,7 @@ static void run_playanim(char *file) {
char str[FILE_MAXDIR+FILE_MAXFILE];
int pos[2], size[2];
- calc_renderwin_rectangle(R.winpos, pos, size);
+ calc_renderwin_rectangle(G.winpos, pos, size);
sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
system(str);
@@ -793,6 +793,21 @@ void do_render_panels(unsigned short event)
case B_CLEARSET:
scene_change_set(G.scene, NULL);
break;
+ case B_FBUF_REDO:
+ if(R.rectftot) {
+ /* copy is needed... not so nice, but how better? */
+ R.r.postgamma= G.scene->r.postgamma;
+ R.r.postigamma= 1.0/R.r.postgamma;
+ R.r.postadd= G.scene->r.postadd;
+ R.r.postmul= G.scene->r.postmul;
+ R.r.posthue= G.scene->r.posthue;
+ R.r.postsat= G.scene->r.postsat;
+ R.r.dither_intensity= G.scene->r.dither_intensity;
+
+ RE_floatbuffer_to_output();
+ BIF_redraw_render_rect();
+ }
+ break;
}
}
@@ -843,14 +858,18 @@ static uiBlock *post_render_menu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "post render", UI_EMBOSS, UI_HELV, curarea->win);
/* use this for a fake extra empy space around the buttons */
- uiDefBut(block, LABEL, 0, "", -10, 10, 200, 80, NULL, 0, 0, 0, 0, "");
-
- uiDefButF(block, NUMSLI, 0,"Add:", 0,60,180,19, &G.scene->r.postadd, -1.0, 1.0, 0, 0, "");
- uiDefButF(block, NUMSLI, 0,"Mul:", 0,40,180,19, &G.scene->r.postmul, 0.01, 4.0, 0, 0, "");
- uiDefButF(block, NUMSLI, 0,"Gamma:", 0,20,180,19, &G.scene->r.postgamma, 0.2, 2.0, 0, 0, "");
+ uiDefBut(block, LABEL, 0, "", -10, -10, 200, 120, NULL, 0, 0, 0, 0, "");
+ uiBlockBeginAlign(block);
+ uiDefButF(block, NUMSLI, 0, "Add:", 0,80,180,19, &G.scene->r.postadd, -1.0, 1.0, 0, 0, "");
+ uiDefButF(block, NUMSLI, 0, "Mul:", 0,60,180,19, &G.scene->r.postmul, 0.01, 4.0, 0, 0, "");
+ uiDefButF(block, NUMSLI, 0, "Gamma:", 0,40,180,19, &G.scene->r.postgamma, 0.1, 4.0, 0, 0, "");
+ uiDefButF(block, NUMSLI, 0, "Hue:", 0,20,180,19, &G.scene->r.posthue, -0.5, 0.5, 0, 0, "");
+ uiDefButF(block, NUMSLI, 0, "Sat:", 0, 0,180,19, &G.scene->r.postsat, 0.0, 4.0, 0, 0, "");
uiBlockSetDirection(block, UI_TOP);
+ addqueue(curarea->win, UI_BUT_EVENT, B_FBUF_REDO);
+
return block;
}
@@ -1039,41 +1058,47 @@ static void render_panel_output(void)
uiBlockEndAlign(block);
uiBlockSetCol(block, TH_BUT_SETTING1);
- uiDefButS(block, TOG|BIT|0, 0,"Backbuf", 10, 94, 60, 20, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
+ uiDefButS(block, TOG|BIT|0, B_NOP,"Backbuf", 10, 94, 80, 20, &G.scene->r.bufflag, 0, 0, 0, 0, "Enable/Disable use of Backbuf image");
+ uiDefButI(block, TOG|BIT|19, B_NOP,"Threads", 10, 68, 80, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable/Disable render in two threads");
uiBlockSetCol(block, TH_AUTO);
uiBlockBeginAlign(block);
for(b=2; b>=0; b--)
for(a=0; a<3; a++)
- uiDefButS(block, TOG|BIT|(3*b+a), 800,"", (short)(10+18*a),(short)(10+14*b),16,12, &R.winpos, 0, 0, 0, 0, "Render window placement on screen");
+ uiDefButS(block, TOG|BIT|(3*b+a), 800,"", (short)(10+18*a),(short)(10+14*b),16,12, &G.winpos, 0, 0, 0, 0, "Render window placement on screen");
uiBlockEndAlign(block);
uiBlockBeginAlign(block);
uiDefButS(block, TOG|BIT|2, REDRAWVIEW3D, "Passepartout", 72, 30, 122, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Draws darkened passepartout in camera view");
- uiDefButS(block, ROW, B_REDR, "DispWin", 72, 10, 60, 20, &R.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window");
- uiDefButS(block, ROW, B_REDR, "DispView", 134, 10, 60, 20, &R.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view");
+ uiDefButS(block, ROW, B_REDR, "DispWin", 72, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYWIN, 0, 0, "Sets render output to display in a seperate window");
+ uiDefButS(block, ROW, B_REDR, "DispView", 134, 10, 60, 20, &G.displaymode, 0.0, (float)R_DISPLAYVIEW, 0, 0, "Sets render output to display in 3D view");
uiBlockEndAlign(block);
- uiDefButS(block, TOG|BIT|4, 0, "Extensions", 250, 10, 60, 20, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
+ uiDefButS(block, TOG|BIT|4, 0, "Extensions", 205, 10, 105, 19, &G.scene->r.scemode, 0.0, 0.0, 0, 0, "Adds extensions to the output when rendering animations");
/* Dither control */
uiDefButF(block, NUM,B_DIFF, "Dither:", 205,31,105,19, &G.scene->r.dither_intensity, 0.0, 2.0, 0, 0, "The amount of dithering noise present in the output image (0.0 = no dithering)");
/* Toon shading buttons */
uiBlockBeginAlign(block);
- uiDefButI(block, TOG|BIT|5, 0,"Edge", 155, 94, 44, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon shading");
- uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 200, 94, 110, 20, "Display edge settings");
- uiBlockEndAlign(block);
+ uiDefButI(block, TOG|BIT|5, 0,"Edge", 100, 94, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Enable Toon edge shading");
+ uiDefBlockBut(block, edge_render_menu, NULL, "Edge Settings", 170, 94, 140, 20, "Display edge settings");
- /* unified render buttons */
- if(G.scene->r.mode & R_UNIFIED) {
- uiDefBlockBut(block, post_render_menu, NULL, "Post process", 200, 68, 110, 20, "Only for unified render");
- if (G.scene->r.mode & R_GAMMA) {
- uiDefButF(block, NUMSLI, 0,"Gamma:", 10, 68, 142, 20,
- &(G.scene->r.gamma), 0.2, 5.0, B_GAMMASLI, 0,
- "The gamma value for blending oversampled images (1.0 = no correction).");
- }
- }
+ /* postprocess render buttons */
+ uiBlockBeginAlign(block);
+ if(R.rectftot)
+ uiDefIconTextButI(block, TOG|BIT|18, B_NOP, ICON_IMAGE_DEHLT," Fbuf", 100, 68, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render; buffer available");
+ else
+ uiDefButI(block, TOG|BIT|18, 0,"Fbuf", 100, 68, 70, 20, &G.scene->r.mode, 0, 0, 0, 0, "Keep RGBA float buffer after render, no buffer available now");
+ uiDefBlockBut(block, post_render_menu, NULL, "Post process", 170, 68, 140, 20, "Applies on RGBA floats while render or with Fbuf available");
+ uiBlockEndAlign(block);
+
+ /* removed, for time being unified and normal render will use same gamma for blending (2.0) */
+ //if (G.scene->r.mode & R_GAMMA) {
+ // uiDefButF(block, NUMSLI, 0,"Gamma:", 10, 68, 142, 20,
+ // &(G.scene->r.gamma), 0.2, 5.0, B_GAMMASLI, 0,
+ // "The gamma value for blending oversampled images (1.0 = no correction).");
+ //}
}
static void render_panel_render(void)
diff --git a/source/blender/src/drawimage.c b/source/blender/src/drawimage.c
index 99fd85b2ed1..35dd0196fd0 100644
--- a/source/blender/src/drawimage.c
+++ b/source/blender/src/drawimage.c
@@ -53,6 +53,7 @@
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_packedFile_types.h"
+#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
#include "DNA_userdef_types.h"
@@ -82,7 +83,6 @@
/* Modules used */
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
#include "butspace.h" // event codes
diff --git a/source/blender/src/drawmesh.c b/source/blender/src/drawmesh.c
index 6bd1dbe25c3..cc6c3ae7558 100644
--- a/source/blender/src/drawmesh.c
+++ b/source/blender/src/drawmesh.c
@@ -68,6 +68,7 @@
#include "BKE_mesh.h"
#include "BKE_object.h"
#include "BKE_property.h"
+#include "BKE_utildefines.h"
#include "BIF_resources.h"
#include "BIF_gl.h"
@@ -785,7 +786,7 @@ static int set_gl_light(Object *ob)
static Material *give_current_material_or_def(Object *ob, int matnr)
{
- extern Material defmaterial;
+ extern Material defmaterial; // render module abuse...
Material *ma= give_current_material(ob, matnr);
return ma?ma:&defmaterial;
diff --git a/source/blender/src/drawobject.c b/source/blender/src/drawobject.c
index e9327f06a47..f3ea29b3056 100644
--- a/source/blender/src/drawobject.c
+++ b/source/blender/src/drawobject.c
@@ -127,7 +127,7 @@ static float matbuf[MAXMATBUF][2][4];
static void init_gl_materials(Object *ob)
{
- extern Material defmaterial;
+ extern Material defmaterial; // render module abuse...
Material *ma;
int a;
diff --git a/source/blender/src/drawseq.c b/source/blender/src/drawseq.c
index a5aba43f502..8f9b85a1ec1 100644
--- a/source/blender/src/drawseq.c
+++ b/source/blender/src/drawseq.c
@@ -56,9 +56,10 @@
#include "DNA_space_types.h"
#include "DNA_view2d_types.h"
-#include "BKE_utildefines.h"
#include "BKE_global.h"
#include "BKE_plugin_types.h"
+#include "BKE_scene.h"
+#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "BIF_mywindow.h"
diff --git a/source/blender/src/drawview.c b/source/blender/src/drawview.c
index 9f60de5153d..f631d7851d1 100644
--- a/source/blender/src/drawview.c
+++ b/source/blender/src/drawview.c
@@ -126,14 +126,9 @@
#include "butspace.h" // event codes
/* Modules used */
-#include "render.h"
+#include "render.h" // for ogl render
#include "radio.h"
-/* for physics in animation playback */
-#ifdef NAN_LINEAR_PHYSICS
-#include "sumo.h"
-#endif
-
/* locals */
void drawname(Object *ob);
void star_stuff_init_func(void);
@@ -2234,253 +2229,6 @@ double key_to_swaptime(int key)
return speed_to_swaptime(G.animspeed);
}
-#ifdef NAN_LINEAR_PHYSICS
-
-void sumo_callback(void *obp)
-{
- Object *ob= obp;
- SM_Vector3 vec;
- float matf[3][3];
- int i, j;
-
- SM_GetMatrixf(ob->sumohandle, ob->obmat[0]);
-
- VECCOPY(ob->loc, ob->obmat[3]);
-
- for (i = 0; i < 3; ++i) {
- for (j = 0; j < 3; ++j) {
- matf[i][j] = ob->obmat[i][j];
- }
- }
- Mat3ToEul(matf, ob->rot);
-}
-
-/* for test and fun, i've written the next functions to play with dynamics
- using a variant of play-anim... was never released nor really tested (ton) */
-
-void init_anim_sumo(void)
-{
- extern Material defmaterial;
- Base *base;
- Mesh *me;
- Object *ob;
- Material *mat;
- MFace *mface;
- MVert *mvert;
- float centre[3], size[3];
- int a;
- SM_ShapeHandle shape;
- SM_SceneHandle scene;
- SM_Material material;
- SM_MassProps massprops;
- SM_Vector3 vec;
- SM_Vector3 scaling;
-
- scene= SM_CreateScene();
- G.scene->sumohandle = scene;
-
- vec[0]= 0.0;
- vec[1]= 0.0;
- vec[2]= -9.8;
- SM_SetForceField(scene, vec);
-
- /* ton: cylinders & cones are still Y-axis up, will be Z-axis later */
- /* ton: write location/rotation save and restore */
-
- base= FIRSTBASE;
- while (base) {
- if (G.vd->lay & base->lay) {
- ob= base->object;
-
- /* define shape, for now only meshes take part in physics */
- get_local_bounds(ob, centre, size);
-
- if (ob->type==OB_MESH) {
- me= ob->data;
-
- if (ob->gameflag & OB_DYNAMIC) {
- if (me->sumohandle)
- shape= me->sumohandle;
- else {
- /* make new handle */
- switch(ob->boundtype) {
- case OB_BOUND_BOX:
- shape= SM_Box(2.0*size[0], 2.0*size[1], 2.0*size[2]);
- break;
- case OB_BOUND_SPHERE:
- shape= SM_Sphere(size[0]);
- break;
- case OB_BOUND_CYLINDER:
- shape= SM_Cylinder(size[0], 2.0*size[2]);
- break;
- case OB_BOUND_CONE:
- shape= SM_Cone(size[0], 2.0*size[2]);
- break;
- }
-
- me->sumohandle= shape;
- }
- /* sumo material properties */
- mat= give_current_material(ob, 0);
- if(mat==NULL)
- mat= &defmaterial;
-
- material.restitution= mat->reflect;
- material.static_friction= mat->friction;
- material.dynamic_friction= mat->friction;
-
- /* sumo mass properties */
- massprops.mass= ob->mass;
- massprops.center[0]= 0.0;
- massprops.center[1]= 0.0;
- massprops.center[2]= 0.0;
-
- massprops.inertia[0]= 0.5*ob->mass;
- massprops.inertia[1]= 0.5*ob->mass;
- massprops.inertia[2]= 0.5*ob->mass;
-
- massprops.orientation[0]= 0.0;
- massprops.orientation[1]= 0.0;
- massprops.orientation[2]= 0.0;
- massprops.orientation[3]= 1.0;
-
- ob->sumohandle = SM_CreateObject(ob, shape, &material,
- &massprops, sumo_callback);
- SM_AddObject(scene, ob->sumohandle);
-
- scaling[0] = ob->size[0];
- scaling[1] = ob->size[1];
- scaling[2] = ob->size[2];
- SM_SetMatrixf(ob->sumohandle, ob->obmat[0]);
- SM_SetScaling(ob->sumohandle, scaling);
-
- }
- else {
- if(me->sumohandle) shape= me->sumohandle;
- else {
- /* make new handle */
- shape= SM_NewComplexShape();
-
- mface= me->mface;
- mvert= me->mvert;
- for(a=0; a<me->totface; a++,mface++) {
- if(mface->v3) {
- SM_Begin();
- SM_Vertex( (mvert+mface->v1)->co[0], (mvert+mface->v1)->co[1], (mvert+mface->v1)->co[2]);
- SM_Vertex( (mvert+mface->v2)->co[0], (mvert+mface->v2)->co[1], (mvert+mface->v2)->co[2]);
- SM_Vertex( (mvert+mface->v3)->co[0], (mvert+mface->v3)->co[1], (mvert+mface->v3)->co[2]);
- if(mface->v4)
- SM_Vertex( (mvert+mface->v4)->co[0], (mvert+mface->v4)->co[1], (mvert+mface->v4)->co[2]);
- SM_End();
- }
- }
-
- SM_EndComplexShape();
-
- me->sumohandle= shape;
- }
- /* sumo material properties */
- mat= give_current_material(ob, 0);
- if(mat==NULL)
- mat= &defmaterial;
- material.restitution= mat->reflect;
- material.static_friction= mat->friction;
- material.dynamic_friction= mat->friction;
-
- /* sumo mass properties */
- massprops.mass= ob->mass;
- massprops.center[0]= 0.0;
- massprops.center[1]= 0.0;
- massprops.center[2]= 0.0;
-
- massprops.inertia[0]= 0.5*ob->mass;
- massprops.inertia[1]= 0.5*ob->mass;
- massprops.inertia[2]= 0.5*ob->mass;
-
- massprops.orientation[0]= 0.0;
- massprops.orientation[1]= 0.0;
- massprops.orientation[2]= 0.0;
- massprops.orientation[3]= 1.0;
-
- ob->sumohandle= SM_CreateObject(ob, shape, &material, NULL, NULL);
- SM_AddObject(scene, ob->sumohandle);
-
- scaling[0] = ob->size[0];
- scaling[1] = ob->size[1];
- scaling[2] = ob->size[2];
- SM_SetMatrixf(ob->sumohandle, ob->obmat[0]);
- SM_SetScaling(ob->sumohandle, scaling);
- }
- }
- }
- base= base->next;
- }
-}
-
-/* update animated objects */
-void update_anim_sumo(void)
-{
- SM_Vector3 scaling;
-
- Base *base;
- Object *ob;
- Mesh *me;
-
- base= FIRSTBASE;
- while(base) {
- if(G.vd->lay & base->lay) {
- ob= base->object;
-
- if(ob->sumohandle) {
- if((ob->gameflag & OB_DYNAMIC)==0) {
- /* maybe: optimise, check for anim */
- scaling[0] = ob->size[0];
- scaling[1] = ob->size[1];
- scaling[2] = ob->size[2];
- SM_SetMatrixf(ob->sumohandle, ob->obmat[0]);
- SM_SetScaling(ob->sumohandle, scaling);
- }
- }
- }
- base= base->next;
- }
-
-}
-
-void end_anim_sumo(void)
-{
- Base *base;
- Object *ob;
- Mesh *me;
-
- base= FIRSTBASE;
- while(base) {
- if(G.vd->lay & base->lay) {
- ob= base->object;
-
- if(ob->type==OB_MESH) {
- if(ob->sumohandle) {
- SM_RemoveObject(G.scene->sumohandle, ob->sumohandle);
- SM_DeleteObject(ob->sumohandle);
- ob->sumohandle= NULL;
- }
- me= ob->data;
- if(me->sumohandle) {
- SM_DeleteShape(me->sumohandle);
- me->sumohandle= NULL;
- }
- }
- }
- base= base->next;
- }
- if(G.scene->sumohandle) {
- SM_DeleteScene(G.scene->sumohandle);
- G.scene->sumohandle= NULL;
- }
-}
-
-#endif
-
void inner_play_anim_loop(int init, int mode)
{
ScrArea *sa;
@@ -2494,9 +2242,7 @@ void inner_play_anim_loop(int init, int mode)
swaptime= speed_to_swaptime(G.animspeed);
tottime= 0.0;
curmode= mode;
-#ifdef NAN_LINEAR_PHYSICS
- init_anim_sumo();
-#endif
+
return;
}
@@ -2511,11 +2257,7 @@ void inner_play_anim_loop(int init, int mode)
update_for_newframe_muted();
//test_all_displists();
-#ifdef NAN_LINEAR_PHYSICS
- update_anim_sumo();
-
- SM_Proceed(G.scene->sumohandle, swaptime, 40, NULL);
-#endif
+
sa= G.curscreen->areabase.first;
while(sa) {
if(sa==oldsa) {
@@ -2639,9 +2381,7 @@ int play_anim(int mode)
allqueue (REDRAWACTION, 0);
/* for the time being */
update_for_newframe_muted();
-#ifdef NAN_LINEAR_PHYSICS
- end_anim_sumo();
-#endif
+
waitcursor(0);
G.f &= ~G_PLAYANIM;
diff --git a/source/blender/src/editaction.c b/source/blender/src/editaction.c
index bed71e1a398..32110fa88e5 100644
--- a/source/blender/src/editaction.c
+++ b/source/blender/src/editaction.c
@@ -61,16 +61,17 @@
#include "DNA_mesh_types.h"
#include "DNA_lattice_types.h"
+#include "BKE_action.h"
#include "BKE_armature.h"
#include "BKE_constraint.h"
-#include "BKE_displist.h"
#include "BKE_curve.h"
-#include "BKE_ipo.h"
+#include "BKE_displist.h"
#include "BKE_global.h"
+#include "BKE_ipo.h"
+#include "BKE_key.h"
#include "BKE_library.h"
#include "BKE_main.h"
-#include "BKE_action.h"
-#include "BKE_key.h"
+#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "BIF_mywindow.h"
diff --git a/source/blender/src/editface.c b/source/blender/src/editface.c
index 16c44f5259f..efd5c30729e 100644
--- a/source/blender/src/editface.c
+++ b/source/blender/src/editface.c
@@ -57,6 +57,7 @@
#include "DNA_object_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
+#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "DNA_userdef_types.h"
@@ -87,7 +88,6 @@
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
#include "butspace.h"
#include "TPT_DependKludge.h"
diff --git a/source/blender/src/editipo.c b/source/blender/src/editipo.c
index fa327316642..8bffeda1b0c 100644
--- a/source/blender/src/editipo.c
+++ b/source/blender/src/editipo.c
@@ -62,23 +62,24 @@
#include "DNA_constraint_types.h"
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
-#include "DNA_object_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_sound_types.h"
#include "DNA_camera_types.h"
-#include "DNA_material_types.h"
-#include "DNA_texture_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_group_types.h"
+#include "DNA_ika_types.h"
+#include "DNA_ipo_types.h"
#include "DNA_key_types.h"
+#include "DNA_lamp_types.h"
+#include "DNA_material_types.h"
+#include "DNA_object_types.h"
#include "DNA_screen_types.h"
#include "DNA_scene_types.h"
-#include "DNA_ipo_types.h"
-#include "DNA_curve_types.h"
#include "DNA_space_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_sound_types.h"
+#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
#include "DNA_view3d_types.h"
-#include "DNA_group_types.h"
-#include "DNA_ika_types.h"
+#include "DNA_world_types.h"
#include "BKE_utildefines.h"
#include "BKE_action.h"
@@ -118,7 +119,6 @@
#include "blendef.h"
#include "mydevice.h"
-#include "render.h"
/* forwards */
#define BEZSELECTED(bezt) (((bezt)->f1 & 1) || ((bezt)->f2 & 1) || ((bezt)->f3 & 1))
diff --git a/source/blender/src/editlattice.c b/source/blender/src/editlattice.c
index 581278809d8..1469cf97d11 100644
--- a/source/blender/src/editlattice.c
+++ b/source/blender/src/editlattice.c
@@ -58,6 +58,7 @@
#include "BKE_displist.h"
#include "BKE_lattice.h"
#include "BKE_global.h"
+#include "BKE_utildefines.h"
#include "BIF_space.h"
#include "BIF_screen.h"
@@ -74,8 +75,6 @@
#include "blendef.h"
#include "mydevice.h"
-#include "render.h"
-
#include "BKE_armature.h"
/* ***************************** */
diff --git a/source/blender/src/editmball.c b/source/blender/src/editmball.c
index 609fc166764..096c5049c71 100644
--- a/source/blender/src/editmball.c
+++ b/source/blender/src/editmball.c
@@ -47,6 +47,7 @@
#include "DNA_screen_types.h"
#include "DNA_meta_types.h"
#include "DNA_object_types.h"
+#include "DNA_scene_types.h"
#include "DNA_view3d_types.h"
#include "BKE_utildefines.h"
@@ -67,7 +68,6 @@
#include "BSE_edit.h"
#include "BSE_view.h"
-#include "render.h"
#include "blendef.h"
#include "mydevice.h"
diff --git a/source/blender/src/editmesh.c b/source/blender/src/editmesh.c
index 69a8320b638..a9b1c3bbb45 100644
--- a/source/blender/src/editmesh.c
+++ b/source/blender/src/editmesh.c
@@ -93,7 +93,6 @@
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
/* own include */
#include "editmesh.h"
diff --git a/source/blender/src/editmesh_mods.c b/source/blender/src/editmesh_mods.c
index 19b862074bd..7919c6d0d77 100644
--- a/source/blender/src/editmesh_mods.c
+++ b/source/blender/src/editmesh_mods.c
@@ -95,7 +95,7 @@ editmesh_mods.c, UI level access, no geometry changes
#include "mydevice.h"
#include "blendef.h"
-#include "render.h" // externtex, badlevel call (ton)
+#include "render.h" // externtex
#include "editmesh.h"
@@ -2158,7 +2158,6 @@ void vertexsmooth(void)
void vertexnoise(void)
{
EditMesh *em = G.editMesh;
- extern float Tin;
Material *ma;
Tex *tex;
EditVert *eve;
@@ -2189,10 +2188,9 @@ void vertexnoise(void)
VecAddf(eve->co, eve->co, vec);
}
else {
-
- externtex(ma->mtex[0], eve->co);
-
- eve->co[2]+= 0.05*Tin;
+ float tin, dum;
+ externtex(ma->mtex[0], eve->co, &tin, &dum, &dum, &dum, &dum);
+ eve->co[2]+= 0.05*tin;
}
}
eve= eve->next;
diff --git a/source/blender/src/editobject.c b/source/blender/src/editobject.c
index 9a65370c69e..1e6eb0dbf4c 100644
--- a/source/blender/src/editobject.c
+++ b/source/blender/src/editobject.c
@@ -60,6 +60,7 @@
#include "DNA_action_types.h"
#include "DNA_armature_types.h"
#include "DNA_camera_types.h"
+#include "DNA_constraint_types.h"
#include "DNA_curve_types.h"
#include "DNA_effect_types.h"
#include "DNA_ika_types.h"
@@ -68,6 +69,7 @@
#include "DNA_key_types.h"
#include "DNA_lamp_types.h"
#include "DNA_lattice_types.h"
+#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_meta_types.h"
@@ -80,7 +82,6 @@
#include "DNA_userdef_types.h"
#include "DNA_property_types.h"
#include "DNA_vfont_types.h"
-#include "DNA_constraint_types.h"
#include "BLI_blenlib.h"
#include "BLI_arithb.h"
@@ -153,7 +154,6 @@
#include "BDR_editcurve.h"
#include "BDR_unwrapper.h"
-#include "render.h"
#include <time.h>
#include "mydevice.h"
#include "nla.h"
diff --git a/source/blender/src/editoops.c b/source/blender/src/editoops.c
index f6a26279c90..584d6a7b2d0 100644
--- a/source/blender/src/editoops.c
+++ b/source/blender/src/editoops.c
@@ -61,6 +61,7 @@
#include "BKE_scene.h"
#include "BKE_library.h"
#include "BKE_material.h"
+#include "BKE_utildefines.h"
#include "BIF_space.h"
#include "BIF_screen.h"
diff --git a/source/blender/src/editscreen.c b/source/blender/src/editscreen.c
index 2134b45a840..9d5c290aa6c 100644
--- a/source/blender/src/editscreen.c
+++ b/source/blender/src/editscreen.c
@@ -101,7 +101,7 @@
#include "BPY_extern.h"
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
+#include "render.h" /* R.flag */
#include "winlay.h"
diff --git a/source/blender/src/editseq.c b/source/blender/src/editseq.c
index d3fac5f87d2..7de296bd7b6 100644
--- a/source/blender/src/editseq.c
+++ b/source/blender/src/editseq.c
@@ -70,6 +70,7 @@
#include "BKE_image.h"
#include "BKE_library.h"
#include "BKE_main.h"
+#include "BKE_scene.h"
#include "BIF_space.h"
#include "BIF_interface.h"
diff --git a/source/blender/src/editsima.c b/source/blender/src/editsima.c
index b3436b70ba7..9c3b8f30033 100644
--- a/source/blender/src/editsima.c
+++ b/source/blender/src/editsima.c
@@ -63,6 +63,7 @@
#include "BKE_global.h"
#include "BKE_mesh.h"
#include "BKE_displist.h"
+#include "BKE_utildefines.h"
#include "BIF_gl.h"
#include "BIF_interface.h"
diff --git a/source/blender/src/filesel.c b/source/blender/src/filesel.c
index 43ca05840b8..4440ecaa86d 100644
--- a/source/blender/src/filesel.c
+++ b/source/blender/src/filesel.c
@@ -65,6 +65,7 @@
#include "DNA_image_types.h"
#include "DNA_ipo_types.h"
#include "DNA_vfont_types.h"
+#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_object_types.h"
#include "DNA_texture_types.h"
@@ -101,7 +102,6 @@
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
#include "nla.h"
diff --git a/source/blender/src/header_action.c b/source/blender/src/header_action.c
index ba65c029362..2d86f7a44e2 100644
--- a/source/blender/src/header_action.c
+++ b/source/blender/src/header_action.c
@@ -74,6 +74,7 @@
#include "BKE_main.h"
#include "BKE_constraint.h"
#include "BKE_armature.h"
+#include "BKE_utildefines.h"
#include "BSE_drawipo.h"
#include "BSE_editaction.h"
diff --git a/source/blender/src/header_image.c b/source/blender/src/header_image.c
index 597b1985aa9..2987ca7e53f 100644
--- a/source/blender/src/header_image.c
+++ b/source/blender/src/header_image.c
@@ -67,6 +67,7 @@
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_packedFile.h"
+#include "BKE_utildefines.h"
#include "BLI_blenlib.h"
#include "BIF_drawimage.h"
diff --git a/source/blender/src/header_info.c b/source/blender/src/header_info.c
index 61a74d0ae2d..3221115931e 100644
--- a/source/blender/src/header_info.c
+++ b/source/blender/src/header_info.c
@@ -111,8 +111,6 @@
#include "BPY_extern.h"
#include "BPY_menus.h"
-#include "render.h" // for R - should use BKE_bad_level_calls.h instead?
-
#include "blendef.h"
#include "mydevice.h"
@@ -1524,7 +1522,7 @@ static void run_playanim(char *file)
char str[FILE_MAXDIR+FILE_MAXFILE];
int pos[2], size[2];
- calc_renderwin_rectangle(R.winpos, pos, size);
+ calc_renderwin_rectangle(G.winpos, pos, size);
sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
system(str);
diff --git a/source/blender/src/header_nla.c b/source/blender/src/header_nla.c
index cdf2763eeab..1e821a14271 100644
--- a/source/blender/src/header_nla.c
+++ b/source/blender/src/header_nla.c
@@ -58,14 +58,17 @@
#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
+
+#include "BKE_global.h"
+#include "BKE_main.h"
+#include "BKE_utildefines.h"
+
#include "BIF_interface.h"
#include "BIF_resources.h"
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_editnla.h"
-#include "BKE_global.h"
-#include "BKE_main.h"
#include "BSE_drawipo.h"
#include "BSE_headerbuttons.h"
diff --git a/source/blender/src/headerbuttons.c b/source/blender/src/headerbuttons.c
index 20852aa1464..6a2d139f17d 100644
--- a/source/blender/src/headerbuttons.c
+++ b/source/blender/src/headerbuttons.c
@@ -173,7 +173,6 @@
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
#include "nla.h" /* __NLA : To be removed later */
#include "butspace.h" // test_idbutton
diff --git a/source/blender/src/meshtools.c b/source/blender/src/meshtools.c
index bf832024d20..6279dba6c89 100644
--- a/source/blender/src/meshtools.c
+++ b/source/blender/src/meshtools.c
@@ -35,7 +35,6 @@
meshtools.c: no editmode, tools operating on meshes
void join_mesh(void);
-void make_sticky(void);
void fasterdraw(void);
void slowerdraw(void);
@@ -91,8 +90,6 @@ void sort_faces(void);
#include "mydevice.h"
#include "blendef.h"
-#include "render.h" // bad level call (ton)
-
/* * ********************** no editmode!!! *********** */
@@ -440,75 +437,6 @@ void join_mesh(void)
}
-void make_sticky(void)
-{
- Object *ob;
- Base *base;
- MVert *mvert;
- Mesh *me;
- MSticky *ms;
- float ho[4], mat[4][4];
- int a;
-
- if(G.scene->camera==0) return;
-
- if(G.obedit) {
- error("Unable to make sticky in Edit Mode");
- return;
- }
- base= FIRSTBASE;
- while(base) {
- if TESTBASELIB(base) {
- if(base->object->type==OB_MESH) {
- ob= base->object;
-
- me= ob->data;
- mvert= me->mvert;
- if(me->msticky) MEM_freeN(me->msticky);
- me->msticky= MEM_mallocN(me->totvert*sizeof(MSticky), "sticky");
-
- /* like convert to render data */
- R.r= G.scene->r;
- R.r.xsch= (R.r.size*R.r.xsch)/100;
- R.r.ysch= (R.r.size*R.r.ysch)/100;
-
- R.afmx= R.r.xsch/2;
- R.afmy= R.r.ysch/2;
-
- R.ycor= ( (float)R.r.yasp)/( (float)R.r.xasp);
-
- R.rectx= R.r.xsch;
- R.recty= R.r.ysch;
- R.xstart= -R.afmx;
- R.ystart= -R.afmy;
- R.xend= R.xstart+R.rectx-1;
- R.yend= R.ystart+R.recty-1;
-
- where_is_object(G.scene->camera);
- Mat4CpyMat4(R.viewinv, G.scene->camera->obmat);
- Mat4Ortho(R.viewinv);
- Mat4Invert(R.viewmat, R.viewinv);
-
- RE_setwindowclip(1, -1);
-
- where_is_object(ob);
- Mat4MulMat4(mat, ob->obmat, R.viewmat);
-
- ms= me->msticky;
- for(a=0; a<me->totvert; a++, ms++, mvert++) {
- VECCOPY(ho, mvert->co);
- Mat4MulVecfl(mat, ho);
- RE_projectverto(ho, ho);
- ms->co[0]= ho[0]/ho[3];
- ms->co[1]= ho[1]/ho[3];
- }
- }
- }
- base= base->next;
- }
- allqueue(REDRAWBUTSEDIT, 0);
-}
-
void fasterdraw(void)
{
Base *base;
diff --git a/source/blender/src/previewrender.c b/source/blender/src/previewrender.c
index 52cf6734e2d..970083f0a35 100644
--- a/source/blender/src/previewrender.c
+++ b/source/blender/src/previewrender.c
@@ -61,6 +61,7 @@
#include "DNA_world_types.h"
#include "DNA_camera_types.h"
#include "DNA_image_types.h"
+#include "DNA_material_types.h"
#include "DNA_object_types.h"
#include "DNA_lamp_types.h"
#include "DNA_space_types.h"
@@ -407,7 +408,7 @@ static void sky_preview_pixel(float lens, int x, int y, char *rect)
static void lamp_preview_pixel(ShadeInput *shi, LampRen *la, int x, int y, char *rect)
{
- float inpr, i, t, dist, distkw, vec[3];
+ float inpr, i, t, dist, distkw, vec[3], lacol[3];
int col;
shi->co[0]= (float)x/(PR_RECTX/4);
@@ -420,7 +421,11 @@ static void lamp_preview_pixel(ShadeInput *shi, LampRen *la, int x, int y, char
VECCOPY(shi->view, vec);
dist= Normalise(shi->view);
- if(la->mode & LA_TEXTURE) do_lamp_tex(la, vec, shi);
+ lacol[0]= la->r;
+ lacol[1]= la->g;
+ lacol[2]= la->b;
+
+ if(la->mode & LA_TEXTURE) do_lamp_tex(la, vec, shi, lacol);
if(la->type==LA_SUN || la->type==LA_HEMI) {
dist= 1.0;
@@ -471,13 +476,13 @@ static void lamp_preview_pixel(ShadeInput *shi, LampRen *la, int x, int y, char
}
else if ELEM(la->type, LA_LOCAL, LA_AREA) dist*= shi->view[2];
- col= 255.0*dist*la->r;
+ col= 255.0*dist*lacol[0];
if(col<=0) rect[0]= 0; else if(col>=255) rect[0]= 255; else rect[0]= col;
- col= 255.0*dist*la->g;
+ col= 255.0*dist*lacol[1];
if(col<=0) rect[1]= 0; else if(col>=255) rect[1]= 255; else rect[1]= col;
- col= 255.0*dist*la->b;
+ col= 255.0*dist*lacol[2];
if(col<=0) rect[2]= 0; else if(col>=255) rect[2]= 255; else rect[2]= col;
}
@@ -492,9 +497,9 @@ static void init_previewhalo(HaloRen *har, Material *mat)
har->radsq= PR_RECTX*PR_RECTX/4.0;
har->alfa= mat->alpha;
har->add= 255.0*mat->add;
- har->r= 255.0*mat->r;
- har->g= 255.0*mat->g;
- har->b= 255.0*mat->b;
+ har->r= mat->r;
+ har->g= mat->g;
+ har->b= mat->b;
har->xs= PR_RECTX/2.0;
har->ys= PR_RECTX/2.0;
har->zs= har->zd= 0;
@@ -520,7 +525,7 @@ static void init_previewhalo(HaloRen *har, Material *mat)
static void halo_preview_pixel(HaloRen *har, int startx, int endx, int y, char *rect)
{
- float dist, xn, yn, xsq, ysq;
+ float dist, xn, yn, xsq, ysq, colf[4];
int x;
char front[4];
@@ -536,10 +541,8 @@ static void halo_preview_pixel(HaloRen *har, int startx, int endx, int y, char *
xsq= xn*xn;
dist= xsq+ysq;
-
-
if(dist<har->radsq) {
- RE_shadehalo(har, front, 0, dist, xn, yn, har->flarec);
+ RE_shadehalo(har, front, colf, 0, dist, xn, yn, har->flarec);
RE_addalphaAddfac(rect, front, har->add);
}
rect+= 4;
@@ -591,12 +594,12 @@ static void previewflare(SpaceButs *sbuts, HaloRen *har, unsigned int *rect)
R.rectot= rectot;
}
-extern float Tin, Tr, Tg, Tb, Ta; /* texture.c */
static void texture_preview_pixel(Tex *tex, int x, int y, char *rect)
{
- float i, v1, xsq, ysq, texvec[3], dummy[3];
+ float i, v1, xsq, ysq, texvec[3];
+ float tin=1.0, tr, tg, tb, ta;
int rgbnor, tracol, skip=0;
-
+
if(tex->type==TEX_IMAGE) {
v1= 1.0/PR_RECTX;
@@ -637,12 +640,12 @@ static void texture_preview_pixel(Tex *tex, int x, int y, char *rect)
}
else {
skip= 1;
- Ta= 0.0;
+ ta= 0.0;
}
}
else {
skip= 1;
- Ta= 0.0;
+ ta= 0.0;
}
}
else {
@@ -653,44 +656,32 @@ static void texture_preview_pixel(Tex *tex, int x, int y, char *rect)
texvec[2]= 0.0;
}
- /* does not return Tin */
- if(tex->type==TEX_STUCCI) {
- tex->nor= dummy;
- dummy[0]= 1.0;
- dummy[1]= dummy[2]= 0.0;
- }
-
- if(skip==0) rgbnor= multitex(tex, texvec, NULL, NULL, 0);
+ if(skip==0) rgbnor= multitex_ext(tex, texvec, &tin, &tr, &tg, &tb, &ta);
else rgbnor= 1;
if(rgbnor & 1) {
- v1= 255.0*Tr;
+ v1= 255.0*tr;
rect[0]= CLAMPIS(v1, 0, 255);
- v1= 255.0*Tg;
+ v1= 255.0*tg;
rect[1]= CLAMPIS(v1, 0, 255);
- v1= 255.0*Tb;
+ v1= 255.0*tb;
rect[2]= CLAMPIS(v1, 0, 255);
- if(Ta!=1.0) {
+ if(ta!=1.0) {
tracol= 64+100*(abs(x)>abs(y));
- tracol= (1.0-Ta)*tracol;
+ tracol= (1.0-ta)*tracol;
- rect[0]= tracol+ (rect[0]*Ta) ;
- rect[1]= tracol+ (rect[1]*Ta) ;
- rect[2]= tracol+ (rect[2]*Ta) ;
+ rect[0]= tracol+ (rect[0]*ta) ;
+ rect[1]= tracol+ (rect[1]*ta) ;
+ rect[2]= tracol+ (rect[2]*ta) ;
}
}
else {
-
- if(tex->type==TEX_STUCCI) {
- Tin= 0.5 + 0.7*tex->nor[0];
- CLAMP(Tin, 0.0, 1.0);
- }
- rect[0]= 255.0*Tin;
- rect[1]= 255.0*Tin;
- rect[2]= 255.0*Tin;
+ rect[0]= 255.0*tin;
+ rect[1]= 255.0*tin;
+ rect[2]= 255.0*tin;
}
}
@@ -740,14 +731,23 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
int temp, a;
char tracol;
- mat= shi->matren;
+ mat= shi->mat;
+ // copy all relevant material vars, note, keep this synced with render_types.h
+ memcpy(&shi->r, &mat->r, 23*sizeof(float));
+ // set special cases:
+ shi->har= mat->har;
+ if((mat->mode & MA_RAYMIRROR)==0) shi->ray_mirror= 0.0;
+
v1= 1.0/PR_RECTX;
shi->view[0]= v1*x;
shi->view[1]= v1*y;
shi->view[2]= 1.0;
Normalise(shi->view);
+ shi->xs= (float)x;
+ shi->ys= (float)y;
+
shi->refcol[0]= shi->refcol[1]= shi->refcol[2]= shi->refcol[3]= 0.0;
/* texture handling */
@@ -824,7 +824,7 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
}
/* set it here, because ray_mirror will affect it */
- alpha= mat->alpha;
+ alpha= shi->alpha;
if(mat->mapto & MAP_DISPLACE) { /* Quick hack of fake displacement preview */
shi->vn[0]-=2.0*shi->displace[2];
@@ -838,13 +838,13 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
alpha*= fresnel_fac(shi->view, shi->vn, mat->fresnel_tra_i, mat->fresnel_tra);
if(mat->mode & MA_SHLESS) {
- temp= 255.0*(mat->r);
+ temp= 255.0*(shi->r);
if(temp>255) rect[0]= 255; else if(temp<0) rect[0]= 0; else rect[0]= temp;
- temp= 255.0*(mat->g);
+ temp= 255.0*(shi->g);
if(temp>255) rect[1]= 255; else if(temp<0) rect[1]= 0; else rect[1]= temp;
- temp= 255.0*(mat->b);
+ temp= 255.0*(shi->b);
if(temp>255) rect[2]= 255; else if(temp<0) rect[2]= 0; else rect[2]= temp;
}
else {
@@ -864,22 +864,22 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
is= shi->vn[0]*lv[0]+shi->vn[1]*lv[1]+shi->vn[2]*lv[2];
if(is<0.0) is= 0.0;
- if(mat->spec) {
+ if(shi->spec>0.0) {
if(is>0.0) {
/* specular shaders */
float specfac;
if(mat->spec_shader==MA_SPEC_PHONG)
- specfac= Phong_Spec(shi->vn, lv, shi->view, mat->har);
+ specfac= Phong_Spec(shi->vn, lv, shi->view, shi->har);
else if(mat->spec_shader==MA_SPEC_COOKTORR)
- specfac= CookTorr_Spec(shi->vn, lv, shi->view, mat->har);
+ specfac= CookTorr_Spec(shi->vn, lv, shi->view, shi->har);
else if(mat->spec_shader==MA_SPEC_BLINN)
- specfac= Blinn_Spec(shi->vn, lv, shi->view, mat->refrac, (float)mat->har);
+ specfac= Blinn_Spec(shi->vn, lv, shi->view, mat->refrac, (float)shi->har);
else
specfac= Toon_Spec(shi->vn, lv, shi->view, mat->param[2], mat->param[3]);
- inprspec= specfac*mat->spec;
+ inprspec= specfac*shi->spec;
if(mat->mode & MA_RAMP_SPEC) {
float spec[3];
@@ -889,9 +889,9 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
isb+= inprspec*spec[2];
}
else {
- isr+= inprspec*mat->specr;
- isg+= inprspec*mat->specg;
- isb+= inprspec*mat->specb;
+ isr+= inprspec*shi->specr;
+ isg+= inprspec*shi->specg;
+ isb+= inprspec*shi->specb;
}
}
}
@@ -900,7 +900,7 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
else if(mat->diff_shader==MA_DIFF_TOON) is= Toon_Diff(shi->vn, lv, shi->view, mat->param[0], mat->param[1]);
// else Lambert
- inp= (mat->ref*is + mat->emit);
+ inp= (shi->refl*is + shi->emit);
if(a==0) la= pr1_col;
else la= pr2_col;
@@ -924,7 +924,7 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
/* scale */
div= (0.85*shi->ref[1]);
- shi->refcol[0]= mat->ray_mirror*fresnel_fac(shi->view, shi->vn, mat->fresnel_mir_i, mat->fresnel_mir);
+ shi->refcol[0]= shi->ray_mirror*fresnel_fac(shi->view, shi->vn, mat->fresnel_mir_i, mat->fresnel_mir);
/* not real 'alpha', but mirror overriding transparency */
if(mat->mode & MA_RAYTRANSP) {
float fac= sqrt(shi->refcol[0]);
@@ -953,40 +953,40 @@ static void shade_preview_pixel(ShadeInput *shi, float *vec, int x, int y,char *
if(mat->mode & MA_RAMP_SPEC) ramp_spec_result(&isr, &isg, &isb, shi);
if(shi->refcol[0]==0.0) {
- a= 255.0*(diff[0] +mat->ambr +isr);
+ a= 255.0*(diff[0] +shi->ambr +isr);
if(a>255) a=255; else if(a<0) a= 0;
rect[0]= a;
- a= 255.0*(diff[1] +mat->ambg +isg);
+ a= 255.0*(diff[1] +shi->ambg +isg);
if(a>255) a=255; else if(a<0) a= 0;
rect[1]= a;
- a= 255*(diff[2] +mat->ambb +isb);
+ a= 255*(diff[2] +shi->ambb +isb);
if(a>255) a=255; else if(a<0) a= 0;
rect[2]= a;
}
else {
- a= 255.0*( mat->mirr*shi->refcol[1] + (1.0 - mat->mirr*shi->refcol[0])*(diff[0] +mat->ambr) +isr);
+ a= 255.0*( shi->mirr*shi->refcol[1] + (1.0 - shi->mirr*shi->refcol[0])*(diff[0] +shi->ambr) +isr);
if(a>255) a=255; else if(a<0) a= 0;
rect[0]= a;
- a= 255.0*( mat->mirg*shi->refcol[2] + (1.0 - mat->mirg*shi->refcol[0])*(diff[1] +mat->ambg) +isg);
+ a= 255.0*( shi->mirg*shi->refcol[2] + (1.0 - shi->mirg*shi->refcol[0])*(diff[1] +shi->ambg) +isg);
if(a>255) a=255; else if(a<0) a= 0;
rect[1]= a;
- a= 255.0*( mat->mirb*shi->refcol[3] + (1.0 - mat->mirb*shi->refcol[0])*(diff[2] +mat->ambb) +isb);
+ a= 255.0*( shi->mirb*shi->refcol[3] + (1.0 - shi->mirb*shi->refcol[0])*(diff[2] +shi->ambb) +isb);
if(a>255) a=255; else if(a<0) a= 0;
rect[2]= a;
}
}
/* ztra shade */
- if(mat->spectra!=0.0) {
+ if(shi->spectra!=0.0) {
inp = MAX3(isr, isg, isb);
- inp *= mat->spectra;
+ inp *= shi->spectra;
if(inp>1.0) inp= 1.0;
alpha= (1.0-inp)*alpha+inp;
}
if(alpha!=1.0) {
if(mat->mode & MA_RAYTRANSP) {
- refraction_prv(&x, &y, shi->vn, mat->ang);
+ refraction_prv(&x, &y, shi->vn, shi->ang);
}
tracol= previewback(mat->pr_back, x, y) & 255;
@@ -1091,8 +1091,8 @@ void BIF_previewrender(SpaceButs *sbuts)
}
}
shi.vlr= 0;
+
shi.mat= mat;
- shi.matren= mat->ren;
if(mat->mode & MA_HALO) init_previewhalo(&har, mat);
}
@@ -1293,7 +1293,6 @@ void BIF_previewrender(SpaceButs *sbuts)
}
else if(la) {
if(R.totlamp) {
- if(R.la[0]->org) MEM_freeN(R.la[0]->org);
MEM_freeN(R.la[0]);
}
R.totlamp= 0;
diff --git a/source/blender/src/renderwin.c b/source/blender/src/renderwin.c
index 5fbe58523cb..19b7ee96a15 100644
--- a/source/blender/src/renderwin.c
+++ b/source/blender/src/renderwin.c
@@ -72,7 +72,9 @@
#include "BIF_screen.h"
#include "BIF_space.h"
#include "BIF_mywindow.h"
+#include "BIF_previewrender.h"
#include "BIF_renderwin.h"
+#include "BIF_resources.h"
#include "BIF_toets.h"
#include "BDR_editobject.h"
@@ -111,6 +113,9 @@
/* forces draw of alpha */
#define RW_FLAGS_ALPHA (1<<4)
+/* space for info text */
+#define RW_HEADERY 18
+
typedef struct {
Window *win;
@@ -125,6 +130,8 @@ typedef struct {
float pan_mouse_start[2], pan_ofs_start[2];
char *info_text;
+ char *render_text, *render_text_spare;
+
} RenderWin;
static RenderWin *render_win= NULL;
@@ -142,6 +149,7 @@ static RenderWin *renderwin_alloc(Window *win)
rw->flags= 0;
rw->zoomofs[0]= rw->zoomofs[1]= 0;
rw->info_text= NULL;
+ rw->render_text= rw->render_text_spare= NULL;
rw->lmouse[0]= rw->lmouse[1]= 0;
rw->mbut[0]= rw->mbut[1]= rw->mbut[2]= 0;
@@ -167,6 +175,7 @@ static void renderwin_get_disprect(RenderWin *rw, float disprect_r[2][2])
int w, h;
window_get_size(rw->win, &w, &h);
+ h-= RW_HEADERY;
display_w= R.rectx*rw->zoom;
display_h= R.recty*rw->zoom;
@@ -204,6 +213,7 @@ 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);
+ h-= RW_HEADERY;
ndc_r[0]= ((float)(win_co[0]*2)/(w-1) - 1.0);
ndc_r[1]= ((float)(win_co[1]*2)/(h-1) - 1.0);
@@ -225,6 +235,8 @@ static void renderwin_reset_view(RenderWin *rw)
/* now calculate a zoom for when image is larger than window */
window_get_size(rw->win, &w, &h);
+ h-= RW_HEADERY;
+
/* at this point the r.rectx/y values are not correct yet */
rectx= (G.scene->r.size*G.scene->r.xsch)/100;
recty= (G.scene->r.size*G.scene->r.ysch)/100;
@@ -239,6 +251,34 @@ static void renderwin_reset_view(RenderWin *rw)
renderwin_queue_redraw(rw);
}
+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);
+ }
+ }
+
+}
+
static void renderwin_draw(RenderWin *rw, int just_clear)
{
float disprect[2][2];
@@ -246,10 +286,15 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
rect.xmin= rect.ymin= 0;
window_get_size(rw->win, &rect.xmax, &rect.ymax);
+ rect.ymax-= RW_HEADERY;
+
renderwin_get_disprect(rw, disprect);
window_make_active(rw->win);
+ /* do this first, so window ends with correct scissor */
+ renderwin_draw_render_info(rw);
+
glEnable(GL_SCISSOR_TEST);
glaDefine2DArea(&rect);
@@ -279,6 +324,7 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
glPixelZoom(1.0, 1.0);
}
+ /* info text is overlayed on bottom */
if (rw->info_text) {
float w;
glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA);
@@ -291,7 +337,7 @@ static void renderwin_draw(RenderWin *rw, int just_clear)
glRasterPos2i(10, 10);
BMF_DrawString(G.font, rw->info_text);
}
-
+
window_swap_buffers(rw->win);
}
@@ -330,6 +376,7 @@ static void renderwin_mouse_moved(RenderWin *rw)
int w, h;
window_get_size(rw->win, &w, &h);
+ h-= RW_HEADERY;
renderwin_win_to_ndc(rw, rw->lmouse, ndc);
rw->zoomofs[0]= -0.5*ndc[0]*(w-R.rectx*rw->zoom)/rw->zoom;
@@ -370,6 +417,13 @@ static void renderwin_handler(Window *win, void *user_data, short evt, short val
{
RenderWin *rw= user_data;
+ // 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;
+ }
+
if (evt==RESHAPE) {
renderwin_reshape(rw);
}
@@ -492,7 +546,7 @@ static void open_renderwin(int winpos[2], int winsize[2])
char *title;
title= renderwin_get_title(0); /* 0 = no swap */
- win= window_open(title, winpos[0], winpos[1], winsize[0], winsize[1], 0);
+ win= window_open(title, winpos[0], winpos[1], winsize[0], winsize[1]+RW_HEADERY, 0);
render_win= renderwin_alloc(win);
@@ -504,7 +558,7 @@ static void open_renderwin(int winpos[2], int winsize[2])
winlay_process_events(0);
/* mywindow has to know about it too */
- mywindow_build_and_set_renderwin(winpos[0], winpos[1], winsize[0], winsize[1]);
+ mywindow_build_and_set_renderwin(winpos[0], winpos[1], winsize[0], winsize[1]+RW_HEADERY);
/* and we should be able to draw 3d in it */
init_gl_stuff();
@@ -561,7 +615,7 @@ static void renderwin_init_display_cb(void)
if (G.afbreek == 0) {
int rendersize[2], renderpos[2];
- calc_renderwin_rectangle(R.winpos, renderpos, rendersize);
+ calc_renderwin_rectangle(G.winpos, renderpos, rendersize);
if (!render_win) {
open_renderwin(renderpos, rendersize);
@@ -572,6 +626,7 @@ static void renderwin_init_display_cb(void)
window_get_position(render_win->win, &win_x, &win_y);
window_get_size(render_win->win, &win_w, &win_h);
+ win_h-= RW_HEADERY;
/* XXX, this is nasty and I guess bound to cause problems,
* but to ensure the window is at the user specified position
@@ -616,7 +671,9 @@ static void renderwin_clear_display_cb(short ignore)
* ... 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
-* a redraw event. whatever can go wrong will.
+* a redraw event. whatever can go wrong will. -zr
+*
+* Note: blocked queue handling while rendering to prevent that (ton)
*/
/* in render window; display a couple of scanlines of rendered image (see callback below) */
@@ -627,9 +684,12 @@ static void renderwin_progress(RenderWin *rw, int start_y, int nlines, int rect_
win_rct.xmin= win_rct.ymin= 0;
window_get_size(rw->win, &win_rct.xmax, &win_rct.ymax);
+ win_rct.ymax-= RW_HEADERY;
+
renderwin_get_disprect(rw, disprect);
-
- window_make_active(rw->win);
+
+ /* for efficiency & speed; not drawing in Blender UI while rendering */
+ //window_make_active(rw->win);
glEnable(GL_SCISSOR_TEST);
glaDefine2DArea(&win_rct);
@@ -717,29 +777,87 @@ static void renderview_progress_display_cb(int y1, int y2, int w, int h, unsigne
}
}
+/* 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;
+
+ }
+}
+
+
/* -------------- callbacks for render loop: interactivity ----------------------- */
-/* callback for print info in top header in interface */
+/* 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 */
static void printrenderinfo_cb(double time, int sample)
{
extern int mem_in_use;
- extern char info_time_str[32]; // header_info.c
- float megs_used_memory= mem_in_use/(1024.0*1024.0);
+ static int totvert=0, totvlak=0, tothalo=0, totlamp=0;
+ static float megs_used_memory=0.0;
char str[300], *spos= str;
- timestr(time, info_time_str);
- spos+= sprintf(spos, "RENDER Fra:%d Ve:%d Fa:%d La:%d", (G.scene->r.cfra), R.totvert, R.totvlak, R.totlamp);
- spos+= sprintf(spos, "Mem:%.2fM Time:%s ", megs_used_memory, info_time_str);
-
- if (R.r.mode & R_FIELDS) {
- spos+= sprintf(spos, "Field %c ", (R.flag&R_SEC_FIELD)?'B':'A');
+ 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);
+ }
}
- if (sample!=-1) {
- spos+= sprintf(spos, "Sample: %d ", sample);
+ else {
+ extern char info_time_str[32]; // header_info.c
+ timestr(time, info_time_str);
+ spos+= sprintf(spos, " Time:%s ", info_time_str);
}
- screen_draw_info_text(G.curscreen, str);
+ 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);
}
/* -------------- callback system to allow ESC from rendering ----------------------- */
@@ -854,7 +972,7 @@ static void do_render(View3D *ogl_render_view3d, int anim, int force_dispwin)
/* we set this flag to prevent renderwindow queue to execute another render */
R.flag= R_RENDERING;
- if (R.displaymode == R_DISPLAYWIN || force_dispwin) {
+ if (G.displaymode == R_DISPLAYWIN || force_dispwin) {
RE_set_initrenderdisplay_callback(NULL);
RE_set_clearrenderdisplay_callback(renderwin_clear_display_cb);
RE_set_renderdisplay_callback(renderwin_progress_display_cb);
@@ -895,10 +1013,8 @@ static void do_render(View3D *ogl_render_view3d, int anim, int force_dispwin)
}
if(anim) update_for_newframe_muted(); // only when anim, causes redraw event which frustrates dispview
- R.flag= 0;
if (render_win) window_set_cursor(render_win->win, CURSOR_STD);
- waitcursor(0);
free_filesel_spec(G.scene->r.pic);
@@ -907,8 +1023,18 @@ static void do_render(View3D *ogl_render_view3d, int anim, int force_dispwin)
/* in dispiew it will destroy the image otherwise
window_make_active() raises window at osx and sends redraws */
- if(R.displaymode==R_DISPLAYWIN) mainwindow_make_active();
-
+ if(G.displaymode==R_DISPLAYWIN) {
+ mainwindow_make_active();
+
+ /* after an envmap creation... */
+ if(R.flag & R_REDRAW_PRV) {
+ BIF_all_preview_changed();
+ }
+ allqueue(REDRAWBUTSSCENE, 0); // visualize fbuf for example
+ }
+
+ R.flag= 0;
+ waitcursor(0); // waitcursor checks rendering R.flag...
}
/* finds area with a 'dispview' set */
@@ -986,6 +1112,22 @@ void BIF_do_ogl_render(View3D *ogl_render_view3d, int anim)
G.scene->r.scemode &= ~R_OGL;
}
+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);
+ }
+}
+
void BIF_swap_render_rects(void)
{
unsigned int *temp;
@@ -1009,19 +1151,20 @@ void BIF_swap_render_rects(void)
temp= R.rectot;
R.rectot= R.rectspare;
R.rectspare= temp;
-
- /* redraw */
- if (R.displaymode == R_DISPLAYWIN) {
- // don't open render_win if rendering has been
- // canceled or the render_win has been actively closed
+
+ if (G.displaymode == R_DISPLAYWIN) {
if (render_win) {
+ char *tmp= render_win->render_text_spare;
+ render_win->render_text_spare= render_win->render_text;
+ render_win->render_text= tmp;
+
window_set_title(render_win->win, renderwin_get_title(1));
- renderwin_queue_redraw(render_win);
+
}
- } else {
- renderview_init_display_cb();
- renderview_progress_display_cb(0, R.recty-1, R.rectx, R.recty, R.rectot);
}
+
+ /* redraw */
+ BIF_redraw_render_rect();
}
/* called from usiblender.c too, to free and close renderwin */
@@ -1030,6 +1173,8 @@ void BIF_close_render_display(void)
if (render_win) {
if (render_win->info_text) MEM_freeN(render_win->info_text);
+ if (render_win->render_text) MEM_freeN(render_win->render_text);
+ if (render_win->render_text_spare) MEM_freeN(render_win->render_text_spare);
window_destroy(render_win->win); /* ghost close window */
MEM_freeN(render_win);
@@ -1045,7 +1190,7 @@ void BIF_toggle_render_display(void)
ScrArea *sa= find_dispimage_v3d();
if(R.rectot==NULL); // do nothing
- else if (render_win && R.displaymode==R_DISPLAYWIN) {
+ else if (render_win && G.displaymode==R_DISPLAYWIN) {
if(render_win->active) {
mainwindow_raise();
mainwindow_make_active();
@@ -1057,13 +1202,13 @@ void BIF_toggle_render_display(void)
render_win->active= 1;
}
}
- else if (sa && R.displaymode==R_DISPLAYVIEW) {
+ else if (sa && G.displaymode==R_DISPLAYVIEW) {
View3D *vd= sa->spacedata.first;
vd->flag &= ~V3D_DISPIMAGE;
scrarea_queue_winredraw(sa);
}
else {
- if (R.displaymode == R_DISPLAYWIN) {
+ if (G.displaymode == R_DISPLAYWIN) {
renderwin_init_display_cb();
} else {
if (render_win) {
diff --git a/source/blender/src/resources.c b/source/blender/src/resources.c
index 4bef0da4d07..ead7577b0d0 100644
--- a/source/blender/src/resources.c
+++ b/source/blender/src/resources.c
@@ -52,6 +52,8 @@
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
+#include "BKE_utildefines.h"
+
#include "BIF_gl.h"
#include "BIF_resources.h"
diff --git a/source/blender/src/screendump.c b/source/blender/src/screendump.c
index 114be17afa3..7e54791dbd2 100644
--- a/source/blender/src/screendump.c
+++ b/source/blender/src/screendump.c
@@ -48,6 +48,7 @@
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
+#include "DNA_scene_types.h"
#include "DNA_screen_types.h"
#include "DNA_space_types.h"
@@ -65,7 +66,6 @@
#include "BSE_filesel.h"
-#include "render.h"
#include "mydevice.h"
static unsigned int *dumprect=0;
diff --git a/source/blender/src/seqaudio.c b/source/blender/src/seqaudio.c
index 4c6ca1a2226..6f7eede12e2 100644
--- a/source/blender/src/seqaudio.c
+++ b/source/blender/src/seqaudio.c
@@ -82,7 +82,7 @@
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
+#include "render.h" // RE_make_existing_file()
void audio_fill(void *mixdown, Uint8 *sstream, int len);
diff --git a/source/blender/src/sequence.c b/source/blender/src/sequence.c
index d7b8f6c22ad..e30edf6b874 100644
--- a/source/blender/src/sequence.c
+++ b/source/blender/src/sequence.c
@@ -74,7 +74,7 @@
#include "BSE_sequence.h"
#include "blendef.h"
-#include "render.h"
+#include "render.h" // talks to entire render API, and igamtab
Sequence *seq_arr[MAXSEQ+1];
int seqrectx, seqrecty;
@@ -628,7 +628,6 @@ void do_cross_effect(float facf0, float facf1, int x, int y, unsigned int *rect1
void do_gammacross_effect(float facf0, float facf1, int x, int y, unsigned int *rect1, unsigned int *rect2, unsigned int *out)
{
-/* extern unsigned short *igamtab1, *gamtab; render.h */
int fac1, fac2, col;
int xo;
char *rt1, *rt2, *rt;
@@ -1949,11 +1948,11 @@ void do_build_seqar_cfra(ListBase *seqbase, Sequence ***seqar, int cfra)
oldcfra= CFRA; CFRA= seq->sfra + se->nr;
waitcursor(1);
- rectot= R.rectot; R.rectot= 0;
+ rectot= R.rectot; R.rectot= NULL;
oldx= R.rectx; oldy= R.recty;
/* needed because current 3D window cannot define the layers, like in a background render */
vd= G.vd;
- G.vd= 0;
+ G.vd= NULL;
RE_initrender(NULL);
if (!G.background) {
@@ -1970,7 +1969,7 @@ void do_build_seqar_cfra(ListBase *seqbase, Sequence ***seqar, int cfra)
se->ibuf->zbuf= (int *)R.rectz;
/* make sure ibuf frees it */
se->ibuf->mall |= IB_zbuf;
- R.rectz= 0;
+ R.rectz= NULL;
}
/* and restore */
diff --git a/source/blender/src/toets.c b/source/blender/src/toets.c
index dcef102e54c..fd9a35df17a 100644
--- a/source/blender/src/toets.c
+++ b/source/blender/src/toets.c
@@ -97,7 +97,7 @@
#include "BSE_headerbuttons.h"
#include "blendef.h"
-#include "render.h"
+#include "render.h" // darn schrijfplaatje() (ton)
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -106,7 +106,7 @@
#include "BIF_poseobject.h"
-/* only used in toets.c */
+/* only used in toets.c and initrender.c */
/* this function doesn't really belong here */
/* ripped from render module */
void schrijfplaatje(char *name);
diff --git a/source/blender/src/toolbox.c b/source/blender/src/toolbox.c
index 48d6919da7b..aac377af9f9 100644
--- a/source/blender/src/toolbox.c
+++ b/source/blender/src/toolbox.c
@@ -109,7 +109,7 @@
#include "mydevice.h"
#include "blendef.h"
-#include "render.h"
+#include "render.h" // R.flag
static int tbx1, tbx2, tby1, tby2, tbfontyofs, tbmain=0;
static int tbmemx=TBOXX/2, tbmemy=(TBOXEL-0.5)*TBOXH, tboldwin, addmode= 0;
diff --git a/source/blender/src/usiblender.c b/source/blender/src/usiblender.c
index 9bc8a1a152a..43fd434ebf2 100644
--- a/source/blender/src/usiblender.c
+++ b/source/blender/src/usiblender.c
@@ -116,7 +116,7 @@
#include "blendef.h"
#include "radio.h"
-#include "render.h"
+#include "render.h" // RE_ free stuff
#include "datatoc.h"
#include "SYS_System.h"
@@ -616,7 +616,6 @@ void exit_usiblender(void)
#endif
RE_free_render_data();
- RE_free_filt_mask();
free_txt_data();
diff --git a/source/blender/src/view.c b/source/blender/src/view.c
index cc4fd82bc2f..f809d9bde1b 100644
--- a/source/blender/src/view.c
+++ b/source/blender/src/view.c
@@ -81,7 +81,7 @@
#include "blendef.h"
/* Modules used */
-#include "render.h"
+#include "render.h" /* R. stuff for ogl view render */
#define TRACKBALLSIZE (1.1)
#define BL_NEAR_CLIP 0.001
diff --git a/source/blender/src/writeavicodec.c b/source/blender/src/writeavicodec.c
index 582b1e6503f..d832e4bdc68 100644
--- a/source/blender/src/writeavicodec.c
+++ b/source/blender/src/writeavicodec.c
@@ -53,7 +53,7 @@
#include "DNA_userdef_types.h"
#include "render_types.h"
-#include "render.h"
+#include "render.h" // lotsof R. stuff
#include "BKE_global.h"
#include "BKE_scene.h"
diff --git a/source/blender/src/writeimage.c b/source/blender/src/writeimage.c
index c4dde911d49..75b215f70bd 100644
--- a/source/blender/src/writeimage.c
+++ b/source/blender/src/writeimage.c
@@ -42,7 +42,7 @@
#include "BIF_writeimage.h"
-#include "render.h" // RE_make_existing_file
+#include "render.h" // RE_make_existing_file, R. stuff
#ifdef HAVE_CONFIG_H
#include <config.h>