diff options
author | Ton Roosendaal <ton@blender.org> | 2006-01-24 01:05:47 +0300 |
---|---|---|
committer | Ton Roosendaal <ton@blender.org> | 2006-01-24 01:05:47 +0300 |
commit | 042d612df219c8f6a29afa235537380f227b5684 (patch) | |
tree | 310a2c859b99c559115bbcda0aa70f2543bf962c /source/blender/render/intern/include | |
parent | 5668480c99001a617fd59a2383deb858195ffb26 (diff) |
Giant commit!
A full detailed description of this will be done later... is several days
of work. Here's a summary:
Render:
- Full cleanup of render code, removing *all* globals and bad level calls
all over blender. Render module is now not called abusive anymore
- API-fied calls to rendering
- Full recode of internal render pipeline. Is now rendering tiles by
default, prepared for much smarter 'bucket' render later.
- Each thread now can render a full part
- Renders were tested with 4 threads, goes fine, apart from some lookup
tables in softshadow and AO still
- Rendering is prepared to do multiple layers and passes
- No single 32 bits trick in render code anymore, all 100% floats now.
Writing images/movies
- moved writing images to blender kernel (bye bye 'schrijfplaatje'!)
- made a new Movie handle system, also in kernel. This will enable much
easier use of movies in Blender
PreviewRender:
- Using new render API, previewrender (in buttons) now uses regular render
code to generate images.
- new datafile 'preview.blend.c' has the preview scenes in it
- previews get rendered in exact displayed size (1 pixel = 1 pixel)
3D Preview render
- new; press Pkey in 3d window, for a panel that continuously renders
(pkey is for games, i know... but we dont do that in orange now!)
- this render works nearly identical to buttons-preview render, so it stops
rendering on any event (mouse, keyboard, etc)
- on moving/scaling the panel, the render code doesn't recreate all geometry
- same for shifting/panning view
- all other operations (now) regenerate the full render database still.
- this is WIP... but big fun, especially for simple scenes!
Compositor
- Using same node system as now in use for shaders, you can composit images
- works pretty straightforward... needs much more options/tools and integration
with rendering still
- is not threaded yet, nor is so smart to only recalculate changes... will be
done soon!
- the "Render Result" node will get all layers/passes as output sockets
- The "Output" node renders to a builtin image, which you can view in the Image
window. (yes, output nodes to render-result, and to files, is on the list!)
The Bad News
- "Unified Render" is removed. It might come back in some stage, but this
system should be built from scratch. I can't really understand this code...
I expect it is not much needed, especially with advanced layer/passes
control
- Panorama render, Field render, Motion blur, is not coded yet... (I had to
recode every single feature in render, so...!)
- Lens Flare is also not back... needs total revision, might become composit
effect though (using zbuffer for visibility)
- Part render is gone! (well, thats obvious, its default now).
- The render window is only restored with limited functionality... I am going
to check first the option to render to a Image window, so Blender can become
a true single-window application. :)
For example, the 'Spare render buffer' (jkey) doesnt work.
- Render with border, now default creates a smaller image
- No zbuffers are written yet... on the todo!
- Scons files and MSVC will need work to get compiling again
OK... thats what I can quickly recall. Now go compiling!
Diffstat (limited to 'source/blender/render/intern/include')
23 files changed, 545 insertions, 1107 deletions
diff --git a/source/blender/render/intern/include/RE_callbacks.h b/source/blender/render/intern/include/RE_callbacks.h deleted file mode 100644 index 159eaa84ca4..00000000000 --- a/source/blender/render/intern/include/RE_callbacks.h +++ /dev/null @@ -1,85 +0,0 @@ -/** - * $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 ***** - * Callbacks to make the renderer interact with calling modules. - */ - -#ifndef RE_CALLBACKS_H -#define RE_CALLBACKS_H - -#ifdef __cplusplus -extern "C" { -#endif - - /** - * Test whether operation should be prematurely terminated. - * - * @returns 0 to continue, any other value to break. - */ - int RE_local_test_break(void); - - /** - * Set a red square with the argument as text as cursor. - */ - void RE_local_timecursor(int i); - - /** - * Render these lines from the renderbuffer on screen (needs better spec) - */ - void RE_local_render_display(int i, int j, int k, int l, unsigned int *m); - - /** - * Initialise a render display (needs better spec) - */ - void RE_local_init_render_display(void); - - /** - * Clear/close a render display (needs better spec) - */ - void RE_local_clear_render_display(short); - - /** - * Print render statistics. - */ - void RE_local_printrenderinfo(double time, int i); - - /** Get the data for the scene to render. */ - void RE_local_get_renderdata(void); - - /** Release the data for the scene that was rendered. */ - void RE_local_free_renderdata(void); - - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/source/blender/render/intern/include/envmap.h b/source/blender/render/intern/include/envmap.h index 7a44a139b20..32d72555ca4 100644 --- a/source/blender/render/intern/include/envmap.h +++ b/source/blender/render/intern/include/envmap.h @@ -41,10 +41,11 @@ * (initrender.c) */ +struct Render; struct TexResult; -void make_envmaps(void); -int envmaptex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres); +void make_envmaps(struct Render *re); +int envmaptex(struct Tex *tex, float *texvec, float *dxt, float *dyt, int osatex, struct TexResult *texres); #endif /* ENVMAP_EXT_H */ diff --git a/source/blender/render/intern/include/errorHandler.h b/source/blender/render/intern/include/errorHandler.h deleted file mode 100644 index fb980fa255a..00000000000 --- a/source/blender/render/intern/include/errorHandler.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * errorHandler.h - * - * $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 ***** - */ - -#ifndef ERRORHANDLER_H -#define ERRORHANDLER_H - -/* error codes */ -enum RE_RENDER_ERROR { - RE_NO_ERROR, - RE_DEPTH_MISMATCH, /* 1. conflict resolution detects a bad z value */ - RE_BAD_FACE_TYPE, /* 2. a face type switch fails */ - RE_BAD_FACE_INDEX, /* 3. tried to do an operation with a bad index */ - RE_BAD_DATA_POINTER, - RE_TRACE_COUNTER, - RE_TOO_MANY_FACES, /* 6. overflow on z-buffer depth */ - RE_EDGERENDER_WRITE_OUTSIDE_BUFFER, /* 7. write value outside buffer */ - RE_CANNOT_ALLOCATE_MEMORY, /* 8. no memory for malloc */ - RE_WRITE_OUTSIDE_COLOUR_BUFFER, /* 9. write outside colour target buffer */ - RE_MAX_ERROR -}; - -/** - * Reset all counters for the error trace - */ -void RE_errortrace_reset(void); - -/** - * Signals an error to screen. Counts repetitive errors - */ -void RE_error(int errType, char* fname); - -/** - * Signals an error, and prints an integer argument - */ -void RE_error_int(int errType, char* fname, int valye); - -#endif /* ERRORHANDLER_H */ - diff --git a/source/blender/render/intern/include/gammaCorrectionTables.h b/source/blender/render/intern/include/gammaCorrectionTables.h index 6197f769f6f..3d0928f84a3 100644 --- a/source/blender/render/intern/include/gammaCorrectionTables.h +++ b/source/blender/render/intern/include/gammaCorrectionTables.h @@ -35,26 +35,12 @@ #ifndef GAMMACORRECTIONTABLES_H #define GAMMACORRECTIONTABLES_H -/* Default gamma. For most CRTs, gamma ranges from 2.2 to 2.5 (Foley), so */ -/* 2.35 seems appropriate enough. Experience teaches a different number */ -/* though. Old blender: 2.0. It might be nice to make this a slider */ -#define RE_DEFAULT_GAMMA 2.0 -/* This 400 is sort of based on the number of intensity levels needed for */ -/* the typical dynamic range of a medium, in this case CRTs. (Foley) */ -/* (Actually, it says the number should be between 400 and 535.) */ -#define RE_GAMMA_TABLE_SIZE 400 - /** * Initialise the gamma lookup tables */ void makeGammaTables(float gamma); /** - * Returns true if the table is initialised, false otherwise - */ -int gammaTableIsInitialised(void); - -/** * Apply gamma correction on col */ float gammaCorrect(float col); @@ -64,10 +50,5 @@ float gammaCorrect(float col); */ float invGammaCorrect(float col); -/** - * Tell whether or not to do gamma. - */ -extern int do_gamma; - #endif diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h index 15ec3eb69a3..9a94d193990 100644 --- a/source/blender/render/intern/include/initrender.h +++ b/source/blender/render/intern/include/initrender.h @@ -32,19 +32,21 @@ * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ -#ifndef INITRENDER_EXT_H -#define INITRENDER_EXT_H +#ifndef INITRENDER_H +#define INITRENDER_H -/* type includes */ - -#include "DNA_effect_types.h" /* for PartEff type */ -#include "render_types.h" +struct Object; /* Functions */ -void schrijfplaatje(char *name); -void render(void); /* Switch between the old and the unified renderer. */ -/* void write_screendump(char *name); not here !*/ +void free_sample_tables(Render *re); +void make_sample_tables(Render *re); + +void render_scene_set_window(Render *re, struct Object *camera, int blursample); + +void initparts(Render *re); +void freeparts(Render *re); + -#endif /* INITRENDER_EXT_H */ +#endif /* INITRENDER_H */ diff --git a/source/blender/render/intern/include/jitter.h b/source/blender/render/intern/include/jitter.h deleted file mode 100644 index 696ded297b1..00000000000 --- a/source/blender/render/intern/include/jitter.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * jitter.h - * - * $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 ***** - */ - -#ifndef JITTER_H -#define JITTER_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern float jit[64][2]; - -extern void initjit(float *jitarr, int num); -extern void init_render_jit(int nr); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/source/blender/render/intern/include/pixelblending.h b/source/blender/render/intern/include/pixelblending.h index b82642a34d0..bc44c916701 100644 --- a/source/blender/render/intern/include/pixelblending.h +++ b/source/blender/render/intern/include/pixelblending.h @@ -1,18 +1,12 @@ /* - * pixelblending_ext.h - * external interface for pixelblending - * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL 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. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,9 +20,7 @@ * 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. + * Contributor(s): 2004-2006 Blender Foundation, full recode * * ***** END GPL/BL DUAL LICENSE BLOCK ***** */ @@ -36,41 +28,12 @@ #ifndef PIXELBLENDING_EXT_H #define PIXELBLENDING_EXT_H -/* local includes */ -#include "vanillaRenderPipe_types.h" - -/** - * Halo-add pixel, bring your own R.osa setting, and add factor - */ -void addAddSampColF(float *s, float *d, int m, int osa, char add); - -/** - * Alpha undersamples pixel, bring your own R.osa setting - */ -int addUnderSampColF(float *sampcol, float *dest, int mask, int osaNr); - -/** - * Alpha oversample pixel, bring your own R.osa setting - */ -void addOverSampColF(float *sampcol, float *dest, int mask, int osaNr); /** * add 1 pixel to into filtered three lines * (float vecs to float vec) */ -void add_filt_fmask(unsigned int mask, float *col, float *rb1, float *rb2, float *rb3); - -/** - * Convert a series of oversampled pixels into filtered three lines - * (float vecs to float vec) - */ -void sampleFloatColV2FloatColVFilter(float *sample, float *dest1, float *dest2, float *dest3, int osaNr); - -/** - * Convert a series of oversampled pixels into a single pixel. Uses R.osa to - * count the length! (short vecs to short vec) - */ -void sampleShortColV2ShortColV(unsigned short *sample, unsigned short *dest, int osaNr); +void add_filt_fmask(unsigned int mask, float *col, float *rowbuf, int row_w); /** * Alpha-over blending for floats. @@ -82,50 +45,6 @@ void addAlphaOverFloat(float *dest, float *source); */ void addAlphaUnderFloat(float *dest, float *source); -/** - * Write a 16-bit-colour colour vector to a 8-bit-colour colour vector. - */ -void cpShortColV2CharColV(unsigned short *source, char *dest); - -/** - * Write a 8-bit-colour colour vector to a 16-bit-colour colour vector. - */ -void cpCharColV2ShortColV(char *source, unsigned short *dest); - -/** - * Write a 32-bit-colour colour vector to a 8-bit-colour colour vector. - */ -void cpIntColV2CharColV(unsigned int *source, char *dest); - -/** - * Write a floating-point-colour colour vector to a 8-bit-colour colour - * vector. Clip colours to [0, 1]. - */ -void cpFloatColV2CharColV(float *source, char *dest); - -/** - * Cpoy a 8-bit-colour vector to floating point colour vector. - */ -void cpCharColV2FloatColV(char *source, float *dest); -/** - * Cpoy a 16-bit-colour vector to floating point colour vector. - */ -void cpShortColV2FloatColV(unsigned short *source, float *dest); - -/** - * Copy a float-colour colour vector. - */ -void cpFloatColV(float *source, float *dest); - -/** - * Copy a 16-bit-colour colour vector. - */ -void cpShortColV(unsigned short *source, unsigned short *dest); - -/** - * Copy an 8-bit-colour colour vector. - */ -void cpCharColV(char *source, char *dest); /** * Same for floats @@ -137,26 +56,20 @@ void addalphaAddfacFloat(float *dest, float *source, char addfac); */ void addalphaAddFloat(float *dest, float *source); -/** ols functions: side effects? -void addalphaUnderFloat(char *doel, char *bron); think this already exists... -void addalphaUnderGammaFloat(char *doel, char *bron); -*/ /** * Blend bron under doel, while doing gamma correction */ void addalphaUnderGammaFloat(float *doel, float *bron); /** - * Transform an premul-alpha 32-bit colour into a key-alpha 32-bit colour. +* Copy the colour buffer output to R.rectot, to line y. + */ +void transferColourBufferToOutput(float *buf, int y); +/** +* using default transforms for brightness, gamma, hue, saturation etc. */ -void applyKeyAlphaCharCol(char* target); +void std_floatcol_to_charcol(float *buf, char *target); -/* Old blending functions */ -void keyalpha(char *doel); /* maakt premul 255 */ -void addalphaUnder(char *doel, char *bron); -void addalphaUnderGamma(char *doel, char *bron); -void addalphaOver(char *doel, char *bron); -void addalphaAdd(char *doel, char *bron); #endif /* PIXELBLENDING_EXT_H */ diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h index a7a611ed117..67b0e5bcf3c 100644 --- a/source/blender/render/intern/include/pixelshading.h +++ b/source/blender/render/intern/include/pixelshading.h @@ -1,19 +1,12 @@ /* - * pixelshading.h - * - * These functions determine what actual colour a pixel will have. - * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL 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. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -27,19 +20,20 @@ * 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. + * Contributor(s): 2004-2006, Blender Foundation, full recode * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ +/* pixelshading.h +* +* These functions determine what actual colour a pixel will have. +*/ + + #ifndef PIXELSHADING_H #define PIXELSHADING_H -#include "render.h" -#include "vanillaRenderPipe_types.h" - /** * Render the pixel at (x,y) for object ap. Apply the jitter mask. * Output is given in float collector[4]. The type vector: @@ -51,30 +45,18 @@ * mask is pixel coverage in bits * @return pointer to the object */ -void *renderPixel(RE_COLBUFTYPE *collector, float x, float y, int *t, int mask); - - -void setSkyBlendingMode(enum RE_SkyAlphaBlendingType mode); - void shadeHaloFloat(HaloRen *har, float *col, int zz, float dist, float xn, float yn, short flarec); /** - * Get the sky blending mode. - */ -enum RE_SkyAlphaBlendingType getSkyBlendingMode(void); -/** * Render the sky at pixel (x, y). */ -void renderSkyPixelFloat(RE_COLBUFTYPE *collector, float x, float y, float *rco); -void shadeSkyPixel(RE_COLBUFTYPE *collector, float fx, float fy, float *rco); +void renderSkyPixelFloat(float *collector, float x, float y, float *rco); +void shadeSkyPixel(float *collector, float fx, float fy, float *rco); void shadeSkyPixelFloat(float *colf, float *rco, float *view, float *dxyview); -void renderSpotHaloPixel(float x, float y, float *target); -void fillBackgroundImageChar(char *col, float x, float y); - /* ------------------------------------------------------------------------- */ #endif diff --git a/source/blender/render/intern/include/renderHelp.h b/source/blender/render/intern/include/renderHelp.h deleted file mode 100644 index 318b538d510..00000000000 --- a/source/blender/render/intern/include/renderHelp.h +++ /dev/null @@ -1,64 +0,0 @@ -/* - * renderhelp_ext.h - * - * $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 ***** - */ - -#ifndef RENDERHELP_EXT_H -#define RENDERHELP_EXT_H - -#ifdef __cplusplus -extern "C" { -#endif - - /* Push-pop, because this sometimes is necessary... */ - void pushTempPanoPhi(float p); - void popTempPanoPhi(void); - - float getPanoPhi(void); - float getPanovCo(void); - float getPanovSi(void); - void setPanoRot(int part); - - /** Set clip flags on all data entries, using the given projection - * function */ - void setzbufvlaggen( void (*projectfunc)(float *, float *) ); - -/* external for the time being, since the converter calls it. */ -/** Recalculate all normals on renderdata. */ -/* void set_normalflags(void); */ - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/source/blender/render/intern/include/renderPreAndPost.h b/source/blender/render/intern/include/renderPreAndPost.h deleted file mode 100644 index 59315868010..00000000000 --- a/source/blender/render/intern/include/renderPreAndPost.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * renderpreandpost.h - * - * $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 ***** - */ - -#ifndef RENDERPREANDPOST_H -#define RENDERPREANDPOST_H - -void prepareScene(void); -void finalizeScene(void); -void doClipping( void (*projectfunc)(float *, float *) ); - -#endif - diff --git a/source/blender/render/intern/include/render_types.h b/source/blender/render/intern/include/render_types.h new file mode 100644 index 00000000000..c73deca6d22 --- /dev/null +++ b/source/blender/render/intern/include/render_types.h @@ -0,0 +1,347 @@ +/** + * $Id$ + * + * ***** BEGIN GPL 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. + * + * 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. + * + * Contributor(s): (c) 2006 Blender Foundation, full refactor + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef RENDER_TYPES_H +#define RENDER_TYPES_H + +/* ------------------------------------------------------------------------- */ +/* exposed internal in render module only! */ +/* ------------------------------------------------------------------------- */ + +#include "DNA_scene_types.h" +#include "DNA_world_types.h" +#include "DNA_object_types.h" +#include "DNA_vec_types.h" + +#include "RE_pipeline.h" +#include "RE_shader_ext.h" /* TexResult, ShadeResult, ShadeInput */ + +struct MemArena; +struct VertTableNode; +struct Octree; +struct GHash; + +#define TABLEINITSIZE 1024 +#define LAMPINITSIZE 256 + +typedef struct SampleTables +{ + float centLut[16]; + float *fmask1[9], *fmask2[9]; + char cmask[256], *centmask; + +} SampleTables; + +/* this is handed over to threaded hiding/passes/shading engine */ +typedef struct RenderPart +{ + struct RenderPart *next, *prev; + + /* result of part rendering */ + RenderResult *result; + + unsigned int *rectp; /* polygon index table */ + int *rectz; /* zbuffer */ + long *rectdaps; /* delta acum buffer for pixel structs */ + + rcti disprect; /* part coordinates within total picture */ + int rectx, recty; /* the size */ + short crop, ready; /* crop is amount of pixels we crop, for filter */ + short sample, nr; /* sample can be used by zbuffers, nr is partnr */ + short thread; /* thread id */ + +} RenderPart; + +typedef struct Octree { + struct Branch **adrbranch; + struct Node **adrnode; + float ocsize; /* ocsize: mult factor, max size octree */ + float ocfacx,ocfacy,ocfacz; + float min[3], max[3]; + int ocres; + int branchcount, nodecount; +} Octree; + + +/* controls state of render, everything that's read-only during render stage */ +struct Render +{ + struct Render *next, *prev; + char name[RE_MAXNAME]; + + /* state settings */ + short flag, osa, ok, do_gamma; + + /* result of rendering */ + RenderResult *result; + + /* window size, display rect, viewplane */ + int winx, winy; + rcti disprect; /* part within winx winy */ + rctf viewplane; /* mapped on winx winy */ + float viewdx, viewdy; /* size of 1 pixel */ + + /* final picture width and height (within disprect) */ + int rectx, recty; + + /* correction values for pixels or view */ + float ycor, viewfac; + float bluroffsx, bluroffsy; + float panosi, panoco; + + /* Matrices */ + float grvec[3]; /* for world */ + float imat[3][3]; /* copy of viewinv */ + float viewmat[4][4], viewinv[4][4]; + float winmat[4][4]; + + /* clippping */ + float clipsta; + float clipend; + + /* samples */ + SampleTables *samples; + float jit[32][2]; + + /* scene, and its full copy of renderdata and world */ + Scene *scene; + RenderData r; + World wrld; + + ListBase parts; + + /* octree tables and variables for raytrace */ + Octree oc; + + /* use this instead of R.r.cfra */ + float cfra; + + /* render database */ + int totvlak, totvert, tothalo, totlamp; + ListBase lights; + + int vertnodeslen; + struct VertTableNode *vertnodes; + int blohalen; + struct HaloRen **bloha; + int blovllen; + struct VlakRen **blovl; + + struct GHash *orco_hash; + + /* arena for allocating data for use during render, for + * example dynamic TFaces to go in the VlakRen structure. + */ + struct MemArena *memArena; + + /* callbacks */ + void (*display_init)(RenderResult *rr); + void (*display_clear)(RenderResult *rr); + void (*display_draw)(RenderResult *rr, rcti *rect); + + void (*stats_draw)(RenderStats *ri); + void (*timecursor)(int i); + + int (*test_break)(void); + int (*test_return)(void); + void (*error)(const char *str); + + RenderStats i; +}; + +/* ------------------------------------------------------------------------- */ + + +typedef struct ShadBuf { + short samp, shadhalostep; + float persmat[4][4]; + float viewmat[4][4]; + float winmat[4][4]; + float *jit; + float d,clipend,pixsize,soft; + int co[3]; + int size,bias; + long *zbuf; + char *cbuf; +} ShadBuf; + +/* ------------------------------------------------------------------------- */ + +typedef struct VertRen +{ + float co[3]; + float n[3]; + float ho[4]; + float *orco; + short clip; + unsigned short flag; /* in use for clipping zbuffer parts, temp setting stuff in convertblender.c */ + float accum; /* accum for radio weighting, and for strand texco static particles */ + int index; /* index allows extending vertren with any property */ +} VertRen; + +/* ------------------------------------------------------------------------- */ + +struct halosort { + struct HaloRen *har; + int z; +}; + +/* ------------------------------------------------------------------------- */ +struct Material; +struct TFace; + +typedef struct RadFace { + float unshot[3], totrad[3]; + float norm[3], cent[3], area; + int flag; +} RadFace; + +typedef struct VlakRen +{ + struct VertRen *v1, *v2, *v3, *v4; + unsigned int lay; + float n[3]; + struct Material *mat; + struct TFace *tface; + unsigned int *vcol; + char snproj, puno; + char flag, ec; + RadFace *radface; + Object *ob; +} VlakRen; + +typedef struct HaloRen +{ + short miny, maxy; + float alfa, xs, ys, rad, radsq, sin, cos, co[3], no[3]; + float hard, b, g, r; + int zs, zd; + int zBufDist; /* depth in the z-buffer coordinate system */ + char starpoints, type, add, tex; + char linec, ringc, seed; + short flarec; /* used to be a char. why ?*/ + float hasize; + int pixels; + unsigned int lay; + struct Material *mat; +} HaloRen; + +struct LampRen; +struct MTex; + +/** + * For each lamp in a scene, a LampRen is created. It determines the + * properties of a lightsource. + */ +typedef struct LampRen +{ + float xs, ys, dist; + float co[3]; + short type, mode; + float r, g, b, k; + float energy, haint; + int lay; + float spotsi,spotbl; + float vec[3]; + float xsp, ysp, distkw, inpr; + float halokw, halo; + float ld1,ld2; + + /* copied from Lamp, to decouple more rendering stuff */ + /** Size of the shadowbuffer */ + short bufsize; + /** Number of samples for the shadows */ + short samp; + /** Softness factor for shadow */ + float soft; + /** shadow plus halo: detail level */ + short shadhalostep; + /** Near clip of the lamp */ + float clipsta; + /** Far clip of the lamp */ + float clipend; + /** A small depth offset to prevent self-shadowing. */ + float bias; + + short ray_samp, ray_sampy, ray_sampz, ray_samp_type, area_shape, ray_totsamp; + short xold1, yold1, xold2, yold2; /* last jitter table for area lights */ + float area_size, area_sizey, area_sizez; + + struct ShadBuf *shb; + float *jitter; + + float imat[3][3]; + float spottexfac; + float sh_invcampos[3], sh_zfac; /* sh_= spothalo */ + + float mat[3][3]; /* 3x3 part from lampmat x viewmat */ + float area[8][3], areasize; + + /* yafray: photonlight params */ + int YF_numphotons, YF_numsearch; + short YF_phdepth, YF_useqmc, YF_bufsize; + float YF_causticblur, YF_ltradius; + float YF_glowint, YF_glowofs; + short YF_glowtype; + + /* ray optim */ + VlakRen *vlr_last; + + struct MTex *mtex[MAX_MTEX]; +} LampRen; + +/* **************** defines ********************* */ + +/* mode flag is same as for renderdata */ +/* flag */ +#define R_ZTRA 1 +#define R_HALO 2 +#define R_SEC_FIELD 4 +#define R_LAMPHALO 8 +#define R_RENDERING 16 +#define R_ANIMRENDER 32 +#define R_REDRAW_PRV 64 + +/* vlakren->flag (vlak = face in dutch) char!!! */ +#define R_SMOOTH 1 +#define R_VISIBLE 2 +/* strand flag, means special handling */ +#define R_STRAND 4 +#define R_NOPUNOFLIP 8 +#define R_FULL_OSA 16 +#define R_FACE_SPLIT 32 +/* Tells render to divide face other way. */ +#define R_DIVIDE_24 64 +/* vertex normals are tangent or view-corrected vector, for hair strands */ +#define R_TANGENT 128 + + + + + +#endif /* RENDER_TYPES_H */ + diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h index 8f236c502f4..cfdf34c205b 100644 --- a/source/blender/render/intern/include/rendercore.h +++ b/source/blender/render/intern/include/rendercore.h @@ -46,6 +46,8 @@ struct HaloRen; struct ShadeInput; +/* ------------------------------------------------------------------------- */ + typedef struct PixStr { struct PixStr *next; @@ -53,14 +55,15 @@ typedef struct PixStr unsigned short mask, amount; } PixStr; -/* ------------------------------------------------------------------------- */ - typedef struct PixStrMain { + struct PixStrMain *next, *prev; struct PixStr *ps; - struct PixStrMain *next; + int counter; } PixStrMain; +/* ------------------------------------------------------------------------- */ + void calc_view_vector(float *view, float x, float y); float mistfactor(float zcor, float *co); /* dist and height, return alpha */ @@ -74,34 +77,30 @@ void shade_lamp_loop(struct ShadeInput *shi, ShadeResult *shr); float fresnel_fac(float *view, float *vn, float fresnel, float fac); void calc_R_ref(struct ShadeInput *shi); -float spec(float inp, int hard); -/* -------- ray.c ------- */ +/* for nodes */ +void shade_material_loop(struct ShadeInput *shi, struct ShadeResult *shr); -extern void ray_shadow(ShadeInput *, LampRen *, float *); -extern void ray_trace(ShadeInput *, ShadeResult *); -extern void ray_ao(ShadeInput *, World *, float *); - -/** - * Do z buffer and shade - */ void zbufshade(void); - -/** - * zbuffer and shade, anti aliased - */ void zbufshadeDA(void); /* Delta Accum Pixel Struct */ -/** - * Also called in: zbuf.c - */ -void *shadepixel(float x, float y, int z, int facenr, int mask, float *col, float *rco); +void *shadepixel(RenderPart *pa, float x, float y, int z, int facenr, int mask, float *col, float *rco); -/** - * A cryptic but very efficient way of counting the number of bits that - * is set in the unsigned short. - */ int count_mask(unsigned short mask); +void zbufshade_tile(struct RenderPart *pa); +void zbufshadeDA_tile(struct RenderPart *pa); + +/* -------- ray.c ------- */ + +extern void freeoctree(Render *re); +extern void makeoctree(Render *re); + +extern void ray_shadow(ShadeInput *, LampRen *, float *); +extern void ray_trace(ShadeInput *, ShadeResult *); +extern void ray_ao(ShadeInput *, float *); +extern void init_jitter_plane(LampRen *lar); +extern void init_ao_sphere(float *sphere, int tot, int iter); + #endif /* RENDER_EXT_H */ diff --git a/source/blender/render/intern/include/renderdatabase.h b/source/blender/render/intern/include/renderdatabase.h new file mode 100644 index 00000000000..6996bca7a5c --- /dev/null +++ b/source/blender/render/intern/include/renderdatabase.h @@ -0,0 +1,69 @@ +/** + * $Id$ + * + * ***** BEGIN GPL 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. + * + * 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) 2006 Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +#ifndef RENDERDATABASE_H +#define RENDERDATABASE_H + +struct VlakRen; +struct VertRen; +struct HaloRen; +struct Material; +struct Render; + +/* renderdatabase.c */ +void free_renderdata_tables(struct Render *re); +void set_normalflags(Render *re); +void project_renderdata(struct Render *re, void (*projectfunc)(float *, float mat[][4], float *), int do_pano, int part); + +/* functions are not exported... so wrong names */ + +struct VlakRen *RE_findOrAddVlak(struct Render *re, int nr); +struct VertRen *RE_findOrAddVert(struct Render *re, int nr); +struct HaloRen *RE_findOrAddHalo(struct Render *re, int nr); +struct HaloRen *RE_inithalo(struct Render *re, struct Material *ma, float *vec, float *vec1, float *orco, float hasize, + float vectsize, int seed); + +float *RE_vertren_get_sticky(struct Render *re, struct VertRen *ver, int verify); +float *RE_vertren_get_stress(struct Render *re, struct VertRen *ver, int verify); +float *RE_vertren_get_rad(struct Render *re, struct VertRen *ver, int verify); +float *RE_vertren_get_strand(struct Render *re, struct VertRen *ver, int verify); +float *RE_vertren_get_tangent(struct Render *re, struct VertRen *ver, int verify); + +/* haloren->type: flags */ +#define HA_ONLYSKY 1 +#define HA_VECT 2 +#define HA_XALPHA 4 +#define HA_FLARECIRC 8 + + +void init_render_world(Render *re); + + +#endif /* RENDERDATABASE_H */ + diff --git a/source/blender/render/intern/include/outerRenderLoop.h b/source/blender/render/intern/include/renderpipeline.h index 1c0faf666ae..5ccb2f318dc 100644 --- a/source/blender/render/intern/include/outerRenderLoop.h +++ b/source/blender/render/intern/include/renderpipeline.h @@ -1,17 +1,12 @@ -/* - * outerRenderLoop.h - * +/** * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL 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. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -22,23 +17,25 @@ * 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. + * The Original Code is Copyright (C) 2006 Blender Foundation. * All rights reserved. * * The Original Code is: all of this file. * * Contributor(s): none yet. * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** + * ***** END GPL LICENSE BLOCK ***** */ -#ifndef OUTERRENDERLOOP_H -#define OUTERRENDERLOOP_H +#ifndef PIPELINE_H +#define PIPELINE_H + +struct Render; + +void *RE_mallocN(int len, char *name); +void *RE_callocN(int len, char *name); +void RE_freeN(void *poin); -/** - * Outer loop for rendering a single picture. - */ -void unifiedRenderingLoop(void); -#endif +#endif /* PIPELINE_H */ diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h index 279d5319b21..16127537975 100644 --- a/source/blender/render/intern/include/shadbuf.h +++ b/source/blender/render/intern/include/shadbuf.h @@ -41,7 +41,7 @@ * Calculates shadowbuffers for a vector of shadow-giving lamps * @param lar The vector of lamps */ -void makeshadowbuf(LampRen *lar); +void makeshadowbuf(struct Render *re, LampRen *lar); /** * Determines the shadow factor for a face and lamp. There is some diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h index 4b7ac102d80..9eb4f16a60d 100644 --- a/source/blender/render/intern/include/texture.h +++ b/source/blender/render/intern/include/texture.h @@ -56,6 +56,11 @@ struct Image; void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf); void do_sky_tex(float *rco, float *lo, float *dxyview, float *hor, float *zen, float *blend); +void do_material_tex(struct ShadeInput *shi); +void do_lamp_tex(LampRen *la, float *lavec, struct ShadeInput *shi, float *colf); + +void init_render_textures(void); + void render_realtime_texture(struct ShadeInput *shi); /* imagetexture.h */ diff --git a/source/blender/render/intern/include/vanillaRenderPipe.h b/source/blender/render/intern/include/vanillaRenderPipe.h deleted file mode 100644 index f242b8522fc..00000000000 --- a/source/blender/render/intern/include/vanillaRenderPipe.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * vanillaRenderPipe_ext.h - * - * $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 ***** - */ - -#ifndef VANILLARENDERPIPE_EXT_H -#define VANILLARENDERPIPE_EXT_H - -#include "vanillaRenderPipe_types.h" - -/** - * Render pipeline with all kinds of extras. - * status-------------------------\/ - * - integrated z buffering ok - * - integrated halo rendering ok - */ -void zBufShadeAdvanced(void); - -/** - * Copy the colour buffer output to R.rectot, to line y. - */ -void transferColourBufferToOutput(float *buf, int y); -/** - * using default transforms for brightness, gamma, hue, saturation etc. - */ -void std_floatcol_to_charcol(float *buf, char *target); - - -#endif /* VANILLARENDERPIPE_EXT_H */ - diff --git a/source/blender/render/intern/include/vanillaRenderPipe_types.h b/source/blender/render/intern/include/vanillaRenderPipe_types.h deleted file mode 100644 index df24ed01f5e..00000000000 --- a/source/blender/render/intern/include/vanillaRenderPipe_types.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * vanillaRenderPipe_types.h - * - * $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 ***** - */ - -#ifndef VANILLARENDERPIPE_TYPES_H -#define VANILLARENDERPIPE_TYPES_H - -/* Render defines */ -#define RE_MAX_OSA_COUNT 16 /* The max. number of possible oversamples */ -#define RE_MAX_FACES_PER_PIXEL 1000 /* max. nr of faces rendered behind one */ - /* pixel */ - -enum RE_SkyAlphaBlendingType { - RE_ALPHA_NODEF = 0, - RE_ALPHA_PREMUL, - RE_ALPHA_KEY, - RE_ALPHA_SKY, - RE_ALPHA_MAX -}; - - -/* Render typedefs */ -typedef float RE_COLBUFTYPE; /* datatype for the colour buffer */ - - -/** - * Threshold for add-blending for faces - */ -#define RE_FACE_ADD_THRESHOLD 0.001 - -/** - For oversampling - - New stack: the old stack limits our freedom to do all kinds of - manipulation, so we rewrite it. - - A stacked face needs: - - a face type - - a colour - - a conflict count - - a data pointer (void*) - - a mask - - The stack starts at index 0, with the closest face, and stacks up. - -*/ - -struct RE_faceField { - int faceType; - float colour[4]; - int conflictCount; - void *data; - int mask; -}; - -#endif /* VANILLARENDERPIPE_TYPES_H */ - diff --git a/source/blender/render/intern/include/zblur.h b/source/blender/render/intern/include/zblur.h deleted file mode 100644 index a0e1c6a39ce..00000000000 --- a/source/blender/render/intern/include/zblur.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * $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. - * - * ***** END GPL/BL DUAL LICENSE BLOCK ***** - */ - -#ifndef ZBLUR_H -#define ZBLUR_H - -#ifdef __cplusplus -extern "C" { -#endif - -/*-----------------------------------------------------------*/ -/* Includes */ -/*-----------------------------------------------------------*/ - -/*-----------------------------------------------------------*/ -/* Function */ -/*-----------------------------------------------------------*/ - -void add_zblur(void); - -#ifdef __cplusplus -} -#endif - -#endif - diff --git a/source/blender/render/intern/include/zbuf.h b/source/blender/render/intern/include/zbuf.h index 394e38be47e..7a6c78d5728 100644 --- a/source/blender/render/intern/include/zbuf.h +++ b/source/blender/render/intern/include/zbuf.h @@ -1,18 +1,12 @@ /* - * zbuf_ext.h - * external interface for zbuf.h - * * $Id$ * - * ***** BEGIN GPL/BL DUAL LICENSE BLOCK ***** + * ***** BEGIN GPL 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. + * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of @@ -26,7 +20,7 @@ * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. * All rights reserved. * - * The Original Code is: all of this file. + * Full recode: 2004-2006 Blender Foundation * * Contributor(s): none yet. * @@ -36,158 +30,66 @@ #ifndef ZBUF_H #define ZBUF_H -#ifdef __cplusplus -extern "C" { -#endif - +struct RenderPart; struct LampRen; struct VlakRen; +struct ListBase; -/*-----------------------------------------------------------*/ -/* Includes */ -/*-----------------------------------------------------------*/ - -#include "zbuf_types.h" -#include "render_types.h" -#include "radio_types.h" /* for RadView */ - -/*-----------------------------------------------------------*/ -/* Function */ -/* (11 so far ) */ -/*-----------------------------------------------------------*/ - -/** - * Fill a 'rectangle' with a fixed value. The rectangle contains x by - * y points. The rows are assumed to be contiguous in memory, and to - * consist of uints. This function is used for initializing the z - * buffer. - * (why is x int and y uint? called in envmap, render, zbuf) - * @param rect Pointer to the data representing the rectangle. - * @param x The width of the rectangle - * @param y The height of the rectangle - * @param val The value used to fill the rectangle. - */ void fillrect(int *rect, int x, int y, int val); /** * Converts a world coordinate into a homogenous coordinate in view - * coordinates. The transformation matrix is only allowed to have a - * scaling and translation component. - * Also called in: shadbuf.c render.c radfactors.c - * initrender.c envmap.c editmesh.c - * @param v1 [3 floats] the world coordinate - * @param adr [4 floats] the homogenous view coordinate - */ -void projectvert(float *v1,float *adr); - - -/** - * Do a z buffer calculation pass for shadow calculations. - * Also called in: shadbuf.c - * Note: Uses globals. - * @param lar lamp definition data - */ -void zbuffershad(struct LampRen *lar); - - /* to the external interface, temp, I hope... */ -/** - * Tests whether the first three coordinates should be clipped - * wrt. the fourth component. Bits 1 and 2 test on x, 3 and 4 test on - * y, 5 and 6 test on z: - * xyz > test => set first bit (01), - * xyz < -test => set second bit (10), - * xyz == test => reset both bits (00). - * Note: functionality is duplicated from an internal function - * Also called in: initrender.c, radfactors.c - * @param v [4 floats] a coordinate - * @return a vector of bitfields - */ -/* int testclip(float *v); */ - - -/* The following are only used in zbuf.c and render.c ---------------*/ -/** - * Fills the entire in the alpha DA buffer. (All of it!) - * Note: Uses globals. - * Also called in: render.c - * @param y the line number to set - */ -void abufsetrow(float *acolrow, int y); - - -/** - * Calculate the z buffer for all faces (or edges when in wireframe - * mode) presently visible. - * Note: Uses globals. - * Also called in: render.c + * coordinates. */ -void zbufferall(void); - - -/** - * Initialize accumulation buffers for alpha z buffering. - * The buffers are global variables. Also resets Accu buffer - * y bounds. - * <LI> - * <IT> Acolrow : colour buffer for one line - * <IT> Arectz : distance buffer for one line, depth ABUFPART - * <IT> APixbuf : pixel data buffer for one line, depth ABUFPART - * </LI> - * Also called in: render.c (should migrate) - * Note: Uses globals. - */ -void bgnaccumbuf(void); - -/** - * Discard accumulation buffers for alpha z buffering. - * The buffers are global variables. The released buffers are Acolrow, - * Arectz, APixBuf. - * Also called in: render.c (should migrate) - * Note: Uses globals. - */ -void endaccumbuf(void); - -/** - * Z face intersect? - */ -int vergzvlak(const void *x1, const void *x2); - -/** - * Clip and fill vertex into the z buffer. zbuffunc needs to be set - * before entering, to assure that there is a buffer fill function - * that can be called. Zvlnr must be set to the current valid face - * index . - * Note: uses globals - * @param f1 [4 floats] vertex 1 - * @param f2 [4 floats] vertex 2 - * @param f3 [4 floats] vertex 3 - * @param c1 clip conditions? - * @param c2 - * @param c3 - */ - -/* span fill in method */ +void projectvert(float *v1, float winmat[][4], float *adr); +void projectverto(float *v1, float winmat[][4], float *adr); +int testclip(float *v); + +void set_part_zbuf_clipflag(struct RenderPart *pa); +void zbuffer_shadow(struct Render *re, struct LampRen *lar, int *rectz, int size); +void zbuffer_solid(struct RenderPart *pa); +void zbuffer_transp_shade(struct RenderPart *pa, float *pass); + +typedef struct APixstr { + unsigned short mask[4]; /* jitter mask */ + int z[4]; /* distance */ + int p[4]; /* index */ + struct APixstr *next; +} APixstr; + +typedef struct APixstrMain +{ + struct APixstrMain *next, *prev; + struct APixstr *ps; +} APixstrMain; + +/* span fill in method, is also used to localize data for zbuffering */ typedef struct ZSpan { - int yres, miny, maxy; /* range for clipping */ + int rectx, recty; /* range for clipping */ + int miny1, maxy1, miny2, maxy2; /* actual filled in range */ float *minp1, *maxp1, *minp2, *maxp2; /* vertex pointers detect min/max range in */ float *span1, *span2; + + float zmulx, zmuly, zofsx, zofsy; /* transform from hoco to zbuf co */ + + int *rectz, *arectz; /* zbuffers, arectz is for transparant */ + int *rectp; /* polygon index buffer */ + APixstr *apixbuf, *curpstr; /* apixbuf for transparent */ + struct ListBase *apsmbase; + + int polygon_offset; /* offset in Z */ + int mask, apsmcounter; /* in use by apixbuf */ + + void (*zbuffunc)(struct ZSpan *, int, float *, float *, float *, float *); + void (*zbuflinefunc)(struct ZSpan *, int, float *, float *); + } ZSpan; -void zbufclip(struct ZSpan *zspan, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3); - -/* These function pointers are used for z buffer filling. */ -extern void (*zbuffunc)(struct ZSpan *zspan, int, float *, float *, float *); -extern void (*zbuflinefunc)(int, float *, float *); - -/** - * same, for edges - */ -void zbufclipwire(int zvlnr, struct VlakRen *vlr); - -#ifdef __cplusplus -} -#endif +/* exported for evil edge render... */ +void zbufclip(struct ZSpan *zspan, int zvlnr, float *f1, float *f2, float *f3, int c1, int c2, int c3); +void zbuf_alloc_span(ZSpan *zspan, int rectx, int recty); +void zbufclipwire(ZSpan *zspan, int zvlnr, struct VlakRen *vlr); #endif diff --git a/source/blender/render/intern/include/zbuf_types.h b/source/blender/render/intern/include/zbuf_types.h deleted file mode 100644 index b5ad9c75902..00000000000 --- a/source/blender/render/intern/include/zbuf_types.h +++ /dev/null @@ -1,75 +0,0 @@ -/* - * zbuf_types.h - * type definitions used (and maybe exported) by zbuf.c. - * - * $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 ***** - */ - -#ifndef ZBUF_TYPES_H -#define ZBUF_TYPES_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define ABUFPART 64 - -/** - * Primitive data structure for zbuffering. One struct - * stores data for 4 entries. - */ -typedef struct APixstr { - unsigned short mask[4]; /* jitter mask */ - int z[4]; /* distance */ - int p[4]; /* index */ - struct APixstr *next; -} APixstr; - - -typedef struct APixstrMain -{ - struct APixstr *ps; - struct APixstrMain *next; -} APixstrMain; - - -typedef struct { - float *vert; - float hoco[4]; - int clip; -} VertBucket; - -#ifdef __cplusplus -} -#endif - -#endif /* ZBUF_TYPES_H */ - diff --git a/source/blender/render/intern/include/zbufferdatastruct.h b/source/blender/render/intern/include/zbufferdatastruct.h deleted file mode 100644 index 2cef53dc9f6..00000000000 --- a/source/blender/render/intern/include/zbufferdatastruct.h +++ /dev/null @@ -1,98 +0,0 @@ -/* - * zbufferdatastruct_ext.h - * - * $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 ***** - */ - -#ifndef ZBUFFERDATASTRUCT_EXT_H -#define ZBUFFERDATASTRUCT_EXT_H - -#include "zbufferdatastruct_types.h" - -/** - * Set memory and counters for a fresh z buffer - */ -void initZbuffer(int linewidth); - -/** - * Release memory for the current z buffer - */ -void freeZbuffer(void); - -/** - * Release previous buffer and initialise new buffer. - */ -void resetZbuffer(void); - -/** - * Make a root for a memory block (internal) - */ -RE_APixstrExt *addpsemainA(void); - -/** - * Release a memory chunk - */ -void freepseA(void); - -/** - * Add a structure - */ -RE_APixstrExt *addpseA(void); - -/** - * Add an object to a zbuffer entry. - */ -void insertObject(int teller, - int obindex, - int obtype, - int dist, - int mask); - -/** - * Add a flat object to a zbuffer entry. - */ -void insertFlatObject(RE_APixstrExt* ap, - int obindex, - int obtype, - int dist, - int mask); - -/** - * Add a flat object to a zbuffer entry, but don't do OSA entry testing. - */ -void insertFlatObjectNoOsa(RE_APixstrExt* ap, - int obindex, - int obtype, - int dist, - int mask); - -#endif - diff --git a/source/blender/render/intern/include/zbufferdatastruct_types.h b/source/blender/render/intern/include/zbufferdatastruct_types.h deleted file mode 100644 index 5048adfa8bc..00000000000 --- a/source/blender/render/intern/include/zbufferdatastruct_types.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * zbufferdatastruct_types.h - * - * $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 ***** - */ - -#ifndef ZBUFFERDATASTRUCT_TYPES_H -#define ZBUFFERDATASTRUCT_TYPES_H - -#define RE_ZBUFLEN 64 /* number of lines in the accumulation buffer */ - -/** - * Primitive data structure for zbuffering. One struct - * stores data for 4 entries. This struct has been extended - * for the render pipeline overhaul. - */ -typedef struct RE_APixstrExt { - unsigned short mask[4]; /* jitter masks */ - int zmin[4]; /* min. distance of all samples */ - int zmax[4]; /* max. distance of all samples */ - int p[4]; /* index */ - int t[4]; /* entry type: ZB_POLY or ZB_HALO */ - struct RE_APixstrExt *next; -} RE_APixstrExt; - -/* For now I'll stick to the Blender convention of hand made defines */ -/* but this should definitely be done in a better way. An enum may */ -/* be some help, but masking is still a nice feature... */ -/* object types to buffer in the z buffer */ -/* RE_SOLID is flag for RE_POLY, as speedup */ -#define RE_NONE 0 -#define RE_POLY 1 -#define RE_HALO 2 -#define RE_SKY 4 -#define RE_SOLID 8 - -/* unique indices for each field */ -#define RE_ZMIN 0 -#define RE_INDEX 1 -#define RE_MASK 2 -#define RE_TYPE 3 -#define RE_ZMAX 4 -#define RE_PIXELFIELDSIZE 5 - -typedef struct RE_APixstrExtMain -{ - struct RE_APixstrExt *ps; - struct RE_APixstrExtMain *next; -} RE_APixstrExtMain; - -#endif - |