diff options
Diffstat (limited to 'source/blender/render/intern/include')
31 files changed, 2716 insertions, 0 deletions
diff --git a/source/blender/render/intern/include/RE_DummyShadowBuffer.h b/source/blender/render/intern/include/RE_DummyShadowBuffer.h new file mode 100644 index 00000000000..d5308277f6c --- /dev/null +++ b/source/blender/render/intern/include/RE_DummyShadowBuffer.h @@ -0,0 +1,70 @@ +/** + * $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 RE_DUMMYSHADOWBUFFER_H +#define RE_DUMMYSHADOWBUFFER_H + +#include "RE_ShadowBuffer.h" + +struct LampRen; + +class RE_DummyShadowBuffer : public RE_ShadowBuffer { + + public: + /** + * Make an empty shadow buffer + */ + RE_DummyShadowBuffer(void); + + /** + * Delete and clear this buffer + */ + virtual ~RE_DummyShadowBuffer(void); + + /** + * Place this scene in the buffer + */ + virtual void importScene(struct LampRen* lar); + + /** + * Always return a fixed shadow factor. + * @param inp ignored + * @param shb ignored + * @param shadowResult a vector of 3 floats with rgb shadow values + */ + virtual void readShadowValue(struct ShadBuf *shb, + float inp, + float* shadowResult); + +}; + +#endif /* RE_SHADOWBUFFER_H */ diff --git a/source/blender/render/intern/include/RE_ShadowBuffer.h b/source/blender/render/intern/include/RE_ShadowBuffer.h new file mode 100644 index 00000000000..3b015597bb9 --- /dev/null +++ b/source/blender/render/intern/include/RE_ShadowBuffer.h @@ -0,0 +1,61 @@ +/** + * $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 RE_SHADOWBUFFER_H +#define RE_SHADOWBUFFER_H + +#include <iostream.h> + +struct ShadBuf; +struct LampRen; + +class RE_ShadowBuffer { + + public: + + virtual ~RE_ShadowBuffer(void){}; + /** + * Place this scene in the buffer + */ + virtual void importScene(struct LampRen* lar) = 0; + + /** + * Test the shadow factor at a location in the buffer + * @param shadowResult a vector of 3 floats with rgb shadow values + */ + virtual void readShadowValue(struct ShadBuf *shb, + float inp, + float* shadowResult) = 0; + +}; + +#endif /* RE_SHADOWBUFFER_H */ diff --git a/source/blender/render/intern/include/RE_basicShadowBuffer.h b/source/blender/render/intern/include/RE_basicShadowBuffer.h new file mode 100644 index 00000000000..8d5e9237205 --- /dev/null +++ b/source/blender/render/intern/include/RE_basicShadowBuffer.h @@ -0,0 +1,94 @@ +/** + * $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 RE_BASICSHADOWBUFFER_H +#define RE_BASICSHADOWBUFFER_H + +#include "RE_ShadowBuffer.h" + +struct LampRen; +struct Lamp; + +class RE_BasicShadowBuffer : public RE_ShadowBuffer { + + private: + + void lrectreadRectz(int x1, int y1, int x2, int y2, char *r1); + int sizeoflampbuf(struct ShadBuf *shb); + int firstreadshadbuf(struct ShadBuf *shb, int xs, int ys, int nr); + float readshadowbuf(struct ShadBuf *shb, int xs, int ys, int zs); + float readshadowbuf_halo(struct ShadBuf *shb, int xs, int ys, int zs); + float *give_jitter_tab(int samp); + + int bias; + + public: + /** + * Make a shadow buffer from these settings + */ + RE_BasicShadowBuffer(struct LampRen *lar, float mat[][4]); + + /** + * Delete and clear this buffer + */ + virtual ~RE_BasicShadowBuffer(void); + + /** + * Calculates shadowbuffers for a vector of shadow-giving lamps + * @param lar The vector of lamps + */ + void importScene(LampRen *lar); + + /** + * Determines the shadow factor for a face and lamp. There is some + * communication with global variables here. + * @param shadres The RGB shadow factors: 1.0 for no shadow, 0.0 for complete + * shadow. There must be a float[3] to write the result to. + * @param shb The shadowbuffer to find the shadow factor in. + * @param inp The inproduct between viewvector and ? + * + */ + virtual void readShadowValue(struct ShadBuf *shb, + float inp, + float* shadowResult); + + /** + * Determines the shadow factor for lamp <lar>, between <p1> + * and <p2>. (Which CS?) + */ + float shadow_halo(LampRen *lar, float *p1, float *p2); + +}; + +#endif /* RE_BASICSHADOWBUFFER_H */ + + diff --git a/source/blender/render/intern/include/RE_callbacks.h b/source/blender/render/intern/include/RE_callbacks.h new file mode 100644 index 00000000000..30734728b4b --- /dev/null +++ b/source/blender/render/intern/include/RE_callbacks.h @@ -0,0 +1,84 @@ +/** + * $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/edgeRender.h b/source/blender/render/intern/include/edgeRender.h new file mode 100644 index 00000000000..d6e2fcb989e --- /dev/null +++ b/source/blender/render/intern/include/edgeRender.h @@ -0,0 +1,63 @@ +/* + * edgeRender.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 EDGERENDER_H +#define EDGERENDER_H +/* ------------------------------------------------------------------------- */ + +/** + * Add edges to <targetbuf>, which is of size <iw> by <ih>. Use <osanr> + * samples, and intensity <i>. <compat> indicates an extra shift in the + * image, for backwards compatibility with the old renderpipe. <mode> + * indicates which edges should be considered. The edges will be shaded + * to <rgb> + */ +void +addEdges( + char * targetbuf, + int iw, + int ih, + int osanr, + short int i, + short int i_red, + int compat, + int mode, + float r, + float g, + float b + ); + +/* ------------------------------------------------------------------------- */ + +#endif /* EDGERENDER_H */ diff --git a/source/blender/render/intern/include/envmap.h b/source/blender/render/intern/include/envmap.h new file mode 100644 index 00000000000..62640454151 --- /dev/null +++ b/source/blender/render/intern/include/envmap.h @@ -0,0 +1,49 @@ +/* + * envmap_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 ENVMAP_EXT_H +#define ENVMAP_EXT_H + +/* no types!!! */ +/* #include "envmap_types.h" */ + +/** + * Make environment maps for all objects in the scene that have an + * environment map as texture. + * (initrender.c) + */ +void make_envmaps(void); + +#endif /* ENVMAP_EXT_H */ + diff --git a/source/blender/render/intern/include/errorHandler.h b/source/blender/render/intern/include/errorHandler.h new file mode 100644 index 00000000000..190cd0c9a35 --- /dev/null +++ b/source/blender/render/intern/include/errorHandler.h @@ -0,0 +1,69 @@ +/* + * 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 new file mode 100644 index 00000000000..14c2d2d4a68 --- /dev/null +++ b/source/blender/render/intern/include/gammaCorrectionTables.h @@ -0,0 +1,79 @@ +/* + * gammacorrectiontables.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 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); + +/** + * Apply inverse gamma correction on col + */ +float invGammaCorrect(float col); + +/** + * Tell whether or not to do gamma. + */ +int doGamma(void); + +/** + * Set/unset performing gamma corrections. + */ +void setDoGamma(int); + +#endif diff --git a/source/blender/render/intern/include/initrender.h b/source/blender/render/intern/include/initrender.h new file mode 100644 index 00000000000..06c5f032c7d --- /dev/null +++ b/source/blender/render/intern/include/initrender.h @@ -0,0 +1,59 @@ +/* + * initrender_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 INITRENDER_EXT_H +#define INITRENDER_EXT_H + +/* type includes */ + +#include "DNA_effect_types.h" /* for PartEff type */ +#include "render_types.h" + +/* Functions */ + +void init_def_material(void); +void init_render_jit(int nr); +float calc_weight(float *weight, int i, int j); +void defaultlamp(void); +void schrijfplaatje(char *name); +void initparts(void); +short setpart(short nr); /* return 0 als geen goede part */ +void addparttorect(short nr, Part *part); +void add_to_blurbuf(int blur); +void oldRenderLoop(void); /* Calls the old renderer. Contains the PART and FIELD loops. */ +void render(void); /* Switch between the old and the unified renderer. */ +/* void write_screendump(char *name); not here !*/ + +#endif /* INITRENDER_EXT_H */ + diff --git a/source/blender/render/intern/include/jitter.h b/source/blender/render/intern/include/jitter.h new file mode 100644 index 00000000000..eff8c7bf805 --- /dev/null +++ b/source/blender/render/intern/include/jitter.h @@ -0,0 +1,50 @@ +/* + * 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]; + +void initjit(float *jit, int num); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/source/blender/render/intern/include/old_zbuffer_types.h b/source/blender/render/intern/include/old_zbuffer_types.h new file mode 100644 index 00000000000..7eb3159f438 --- /dev/null +++ b/source/blender/render/intern/include/old_zbuffer_types.h @@ -0,0 +1,58 @@ +/** + * $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 ***** + * Datatypes for old zbuffering algorithms. + */ + +#ifndef OLD_ZBUFFER_TYPES_H +#define OLD_ZBUFFER_TYPES_H "$Id$" + +/* ------------------------------------------------------------------------- */ + +typedef struct PixStr +{ + struct PixStr *next; + int vlak0, vlak; + unsigned int z; + unsigned int mask; + short aantal, ronde; +} PixStr; + +/* ------------------------------------------------------------------------- */ + +typedef struct PixStrMain +{ + struct PixStr *ps; + struct PixStrMain *next; +} PixStrMain; + +/* ------------------------------------------------------------------------- */ + +#endif diff --git a/source/blender/render/intern/include/outerRenderLoop.h b/source/blender/render/intern/include/outerRenderLoop.h new file mode 100644 index 00000000000..965516c9525 --- /dev/null +++ b/source/blender/render/intern/include/outerRenderLoop.h @@ -0,0 +1,43 @@ +/* + * outerRenderLoop.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 OUTERRENDERLOOP_H +#define OUTERRENDERLOOP_H + +/** + * Outer loop for rendering a single picture. + */ +void unifiedRenderingLoop(void); + +#endif diff --git a/source/blender/render/intern/include/pixelblending.h b/source/blender/render/intern/include/pixelblending.h new file mode 100644 index 00000000000..39c439505e0 --- /dev/null +++ b/source/blender/render/intern/include/pixelblending.h @@ -0,0 +1,209 @@ +/* + * pixelblending_ext.h + * external interface for pixelblending + * + * $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 PIXELBLENDING_EXT_H +#define PIXELBLENDING_EXT_H + +/* local includes */ +#include "vanillaRenderPipe_types.h" + +/* own include */ +#include "pixelblending_types.h" + +/** + * Samples pixel, depending on R.osa setting + */ +int addtosampcol(unsigned short *sampcol, unsigned short *shortcol, int mask); + +/** + * Samples pixel, bring your own R.osa setting + */ +int addToSampCol(unsigned short *sampcol, unsigned short *shortcol, int mask, int osaNr); + +/** + * 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); + +/** + * Convert a series of oversampled pixels into a single pixel. + * (float vecs to float vec) + */ +void sampleFloatColV2FloatColV(float *sample, float *dest, 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); + +/** + * Take colour <bron>, and apply it to <doel> using the alpha value of + * <bron>. + * @param doel + * @param bron + */ +void addAlphaOverShort(unsigned short *doel, unsigned short *bron); + +/** + * Take colour <bron>, and apply it to <doel> using the alpha value of + * <doel>. + * @param doel + * @param bron + */ +void addAlphaUnderShort(unsigned short *doel, unsigned short *bron); + +/** + * Alpha-over blending for floats. + */ +void addAlphaOverFloat(float *dest, float *source); + +/** + * Alpha-under blending for floats. + */ +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); + +/** + * Add a fraction of <source> to <dest>. Result ends up in <dest>. + * The internal calculation is done with floats. + * + * col(dest) = (1 - alpha(source)*(1 - addfac)) * dest + source + * alpha(dest) = alpha(source) + alpha (dest) + */ +void addalphaAddfacShort(unsigned short *dest, unsigned short *source, char addfac); + +/** + * Same for floats + */ +void addalphaAddfacFloat(float *dest, float *source, char addfac); + +/** + * Add two halos. Result ends up in <dest>. This should be the + * addition of two light sources. So far, I use normal alpha-under blending here. + * The internal calculation is done with floats. The add-factors have to be + * compensated outside this routine. + * col(dest) = s + (1 - alpha(s))d + * alpha(dest) = alpha(s) + (1 - alpha(s))alpha (d) + */ +void addHaloToHaloShort(unsigned short *dest, unsigned short *source); + +/** + * dest = dest + source + */ +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. + */ +void applyKeyAlphaCharCol(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); +void addalphaAddshort(unsigned short *doel, unsigned short *bron); +/* void addalphaAddfac(char *doel, char *bron, char addfac); to ext, temporarily */ +void addalphaAddfacshort(unsigned short *doel, + unsigned short *bron, + short addfac); + + +#endif /* PIXELBLENDING_EXT_H */ diff --git a/source/blender/render/intern/include/pixelblending_types.h b/source/blender/render/intern/include/pixelblending_types.h new file mode 100644 index 00000000000..71e2baa994c --- /dev/null +++ b/source/blender/render/intern/include/pixelblending_types.h @@ -0,0 +1,61 @@ +/* + * pixelblending_types.h + * types pixelblending + * + * $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 PIXELBLENDING_TYPES_H +#define PIXELBLENDING_TYPES_H + +/* #include "blender.h" */ + +/* Threshold for a 'full' pixel: pixels with alpha above this level are */ +/* considered opaque This is the decimal value for 0xFFF0 / 0xFFFF */ +#define RE_FULL_COLOUR_FLOAT 0.9998 +/* Threshold for an 'empty' pixel: pixels with alpha above this level are */ +/* considered completely transparent. This is the decimal value */ +/* for 0x000F / 0xFFFF */ +#define RE_EMPTY_COLOUR_FLOAT 0.0002 +/* A 100% pixel. Sometimes, seems to be too little.... Hm....... */ +#define RE_UNITY_COLOUR_FLOAT 1.0 +/* A 0% pixel. I wonder how 0 the 0.0 is... */ +#define RE_ZERO_COLOUR_FLOAT 0.0 + +/* threshold for alpha */ +#define RE_FULL_ALPHA_FLOAT 0.9998 + +/* Same set of defines for shorts */ +#define RE_FULL_COLOUR_SHORT 0xFFF0 +#define RE_EMPTY_COLOUR_SHORT 0x0000 + +#endif /* PIXELBLENDING_EXT_H */ + diff --git a/source/blender/render/intern/include/pixelshading.h b/source/blender/render/intern/include/pixelshading.h new file mode 100644 index 00000000000..de75e96a225 --- /dev/null +++ b/source/blender/render/intern/include/pixelshading.h @@ -0,0 +1,122 @@ +/* + * pixelshading.h + * + * These functions determine what actual colour a pixel will have. + * + * $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 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: + * t[0] - min. distance + * t[1] - face/halo index + * t[2] - jitter mask + * t[3] - type ZB_POLY or ZB_HALO + * t[4] - max. distance + * @return pointer to the object + */ +void *renderPixel(float x, float y, int *t); + +/** + * Spothalos on otherwise empty pixels. + */ +void renderSpotHaloPixel(float x, float y, float* colbuf); + +/** + * Set the sky blending to the indicated type. + */ +void setSkyBlendingMode(enum RE_SkyAlphaBlendingType mode); + +/** + * Get the sky blending mode. + */ +enum RE_SkyAlphaBlendingType getSkyBlendingMode(void); +/** + * Render the sky at pixel (x, y). + */ +void renderSkyPixelFloat(float x, float y); + +/* ------------------------------------------------------------------------- */ +/* All these are supposed to be internal. I should move these to a separate */ +/* header. */ + +/** + * Determine colour for pixel at SCS x,y for face <vlaknr>. Result end up in + * <collector> + * @return pointer to this object's VlakRen + */ +void *renderFacePixel(float x, float y, int vlaknr); + +/** + * Render this pixel for halo haloNr. Leave result in <collector>. + * @return pointer to this object's HaloRen + */ +void *renderHaloPixel(float x, float y, int haloNr); + +/** + * Shade the halo at the given location + */ +void shadeHaloFloat(HaloRen *har, float *col, unsigned int zz, + float dist, float xn, float yn, short flarec); + +/** + * Shade a sky pixel on a certain line, into collector[4] + * The x-coordinate (y as well, actually) are communicated through + * R.view[3] + */ +void shadeSkyPixel(float x, float y); + +void shadeSpotHaloPixelFloat(float *col); +void spotHaloFloat(struct LampRen *lar, float *view, float *intens); +void shadeLampLusFloat(void); + +/* this should be replaced by shadeSpotHaloPixelFloat(), but there's */ +/* something completely fucked up here with the arith. */ +/* void renderspothaloFix(unsigned short *col); */ +void renderspothaloFix(float *col); + +/* used by shadeSkyPixel: */ +void shadeSkyPixelFloat(float y); +void fillBackgroundImage(float x, float y); + +/* ------------------------------------------------------------------------- */ + +#endif diff --git a/source/blender/render/intern/include/renderHelp.h b/source/blender/render/intern/include/renderHelp.h new file mode 100644 index 00000000000..7e192a5460e --- /dev/null +++ b/source/blender/render/intern/include/renderHelp.h @@ -0,0 +1,63 @@ +/* + * 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 new file mode 100644 index 00000000000..74438f10df7 --- /dev/null +++ b/source/blender/render/intern/include/renderPreAndPost.h @@ -0,0 +1,43 @@ +/* + * 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_intern.h b/source/blender/render/intern/include/render_intern.h new file mode 100644 index 00000000000..1f058821b2b --- /dev/null +++ b/source/blender/render/intern/include/render_intern.h @@ -0,0 +1,60 @@ +/* + * render_int.h + * misc internal defines for renderer + * + * $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 ***** + */ + + /* XXX, should die, no good reason to write + * regular (non-file related) endian dependant + * code. + */ +#if defined(__sgi) || defined(__sparc) || defined (__PPC__) || defined (__ppc__) || defined (__BIG_ENDIAN__) +#define RCOMP 3 +#define GCOMP 2 +#define BCOMP 1 +#define ACOMP 0 +#else +#define RCOMP 0 +#define GCOMP 1 +#define BCOMP 2 +#define ACOMP 3 +#endif + +#define VECCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2);} +#define QUATCOPY(v1,v2) {*(v1)= *(v2); *(v1+1)= *(v2+1); *(v1+2)= *(v2+2); *(v1+3)= *(v2+3);} + +#define CLAMPIS(a, b, c) ((a)<(b) ? (b) : (a)>(c) ? (c) : (a)) + +typedef struct { + int a, b, c, d; +} byte16; +#define COPY_16(a,b) (*((byte16 *)(a))= *((byte16 *)(b))) diff --git a/source/blender/render/intern/include/rendercore.h b/source/blender/render/intern/include/rendercore.h new file mode 100644 index 00000000000..6138fbc3e3a --- /dev/null +++ b/source/blender/render/intern/include/rendercore.h @@ -0,0 +1,117 @@ +/* + * rendercore_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 RENDERCORE_H +#define RENDERCORE_H +#include "render_types.h" + +struct HaloRen; + +float mistfactor(float *co); /* dist en hoogte, return alpha */ +/* void sky(char *col); */ +void renderspothalo(unsigned short *col); +void render_lighting_halo(struct HaloRen *har, float *colf); +unsigned int calchalo_z(struct HaloRen *har, unsigned int zz); +float CookTorr(float *n, float *l, float *v, int hard); +void shadelamplus(void); +/* void renderflare(struct HaloRen *har); */ +void add_halo_flare(void); + +/** + * Apply the background (sky). Depending on the active alphamode and + * worldmode, different filling strategies are applied. + * Active alphamode = R.r.alphamode + * Active worldmode = R.wrld.mode + * <LI> + * <IT> R_ALPHAPREMUL - do not fill sky, but apply alpha to colours + * <IT> R_ALPHAKEY - do not fill sky, do not apply alpha to colours + * <IT> R_ADDSKY - fill skycolour in the background, blend + * transparent colours with the background + * (there's also a world dependency here? + * <LI> + * <IT> R.wrld.mode == WO_MIST + * <IT> R.r.bufflag == 1, R.flag == R_SEC_FIELD + * <IT> R.wrld.skytype == ( WO_SKYBLEND ^ WO_SKYTEX) + * <IT> R.wrld.skytype == WO_SKYPAPER + * <IT> R.r.mode == R_PANORAMA ) + * </LI> + * </LI> + * @param rect + * @param y + */ +void scanlinesky(char *rect, int y); + +/** + * Do z buffer stuff. + */ +void zbufshade(void); + +/** + * Insert transparent faces into the z buffer? + */ +void zbufshadeDA(void); /* Delta Accum Pixel Struct */ + +/** + * Also called in: zbuf.c + */ +void shadepixel(float x, float y, int vlaknr); + +/** + * Shade the pixel at xn, yn for halo har, and write the result to col. + * Also called in: previewrender.c + * @param har The halo to be rendered on this location + * @param col [unsigned int 3] The destination colour vector + * @param zz Some kind of distance + * @param dist Square of the distance of this coordinate to the halo's center + * @param x [f] Pixel x relative to center + * @param y [f] Pixel y relative to center + * @param flarec Flare counter? Always har->flarec... + */ +/* void shadehalo(struct HaloRen *har, char *col, unsigned int zz, float dist, float x, float y, short flarec); */ + +/** + * 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); + +/* These defines are only used internally :) */ +/* dirty hack: pointers are negative, indices positive */ +/* pointers should be converted to positive numbers */ + +#define IS_A_POINTER_CODE(a) ((a)<0) +#define POINTER_FROM_CODE(a) ((void *)(-(a))) +#define POINTER_TO_CODE(a) (-(long)(a)) + +#endif /* RENDER_EXT_H */ diff --git a/source/blender/render/intern/include/rendercore_int.h b/source/blender/render/intern/include/rendercore_int.h new file mode 100644 index 00000000000..8b1fd0ed759 --- /dev/null +++ b/source/blender/render/intern/include/rendercore_int.h @@ -0,0 +1,55 @@ +/* + * render_int.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 RENDER_INT_H +#define RENDER_INT_H + +#include "zbuf_types.h" +#include "render_types.h" + +/* float CookTorr(float *n, float *l, float *v, int hard); */ +void do_lamphalo_tex(LampRen *lar, float *p1, float *p2, float *intens); +void spothalo(struct LampRen *lar, float *view, float *intens); +void add_filt_mask(unsigned int mask, unsigned short *col, unsigned int *rb1, unsigned int *rb2, unsigned int *rb3); +void addps(long *rd, int vlak, unsigned int z, short ronde); +PixStr *addpsmain(void); +float count_maskf(unsigned short mask); +void freeps(void); +void halovert(void); +void renderhalo(HaloRen *har); /* postprocess versie */ +void scanlinehaloPS(unsigned int *rectz, long *rectdelta, unsigned int *rectt, short ys); + + +#endif /* RENDER_INT_H */ + diff --git a/source/blender/render/intern/include/shadbuf.h b/source/blender/render/intern/include/shadbuf.h new file mode 100644 index 00000000000..6060edfed95 --- /dev/null +++ b/source/blender/render/intern/include/shadbuf.h @@ -0,0 +1,75 @@ +/* + * shadbuf_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 SHADBUF_EXT_H +#define SHADBUF_EXT_H + +#include "render_types.h" + +#ifdef __cplusplus +extern "C" { +#endif + +/** Init memory for old-style shodow buffers. */ +void initshadowbuf(struct LampRen *lar, float mat[][4]); + + +/** + * Calculates shadowbuffers for a vector of shadow-giving lamps + * @param lar The vector of lamps + */ +void makeshadowbuf(LampRen *lar); + +/** + * Determines the shadow factor for a face and lamp. There is some + * communication with global variables here. + * @returns The shadow factors: 1.0 for no shadow, 0.0 for complete + * shadow. + * @param shb The shadowbuffer to find the shadow factor in. + * @param inp The inproduct between viewvector and ? + * + */ +float testshadowbuf(struct ShadBuf *shb, float inp); + +/** + * Determines the shadow factor for lamp <lar>, between <p1> + * and <p2>. (Which CS?) + */ +float shadow_halo(LampRen *lar, float *p1, float *p2); + +#ifdef __cplusplus +} +#endif + +#endif /* SHADBUF_EXT_H */ diff --git a/source/blender/render/intern/include/shadowBuffer.h b/source/blender/render/intern/include/shadowBuffer.h new file mode 100644 index 00000000000..4df95c20674 --- /dev/null +++ b/source/blender/render/intern/include/shadowBuffer.h @@ -0,0 +1,79 @@ +/** + * $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 SHADOWBUFFER_H +#define SHADOWBUFFER_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef RE_SHADOWBUFFERHANDLE +#define RE_SHADOWBUFFERHANDLE +#define RE_DECLARE_HANDLE(name) typedef struct name##__ { int unused; } *name +RE_DECLARE_HANDLE(RE_ShadowBufferHandle); +#endif + + struct ShadBuf; + struct LampRen; + +/** + * Calculates shadowbuffers for a vector of shadow-giving lamps + * @param lar The vector of lamps + * @returns a handle to the buffer + */ + extern void RE_buildShadowBuffer(RE_ShadowBufferHandle dsbh, + struct LampRen *lar); + +/** + * Determines the shadow factor for a face and lamp. There is some + * communication with global variables here? Should be made explicit... + * @param shadres The RGB shadow factors: 1.0 for no shadow, 0.0 for complete + * shadow. There must be a float[3] to write the result to. + * @param shb The shadowbuffer to find the shadow factor in. + * @param inp The inproduct between viewvector and ? + * + */ + void RE_testshadowbuf(RE_ShadowBufferHandle dsbh, + struct ShadBuf* shbp, + float inp, + float* shadres); + +/** + * Determines a shadow factor for halo-shadows. + */ + +#ifdef __cplusplus +} +#endif + +#endif /* SHADOWBUFFER_H */ diff --git a/source/blender/render/intern/include/texture.h b/source/blender/render/intern/include/texture.h new file mode 100644 index 00000000000..9d033ac26dd --- /dev/null +++ b/source/blender/render/intern/include/texture.h @@ -0,0 +1,86 @@ +/* + * texture_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 TEXTURE_EXT_H +#define TEXTURE_EXT_H "$Id$" +#define TEXTURE_EXT_H "Copyright (C) 2001 NaN Technologies B.V. + +/* no types!!! */ +/* #include "texture_types.h" */ + +struct Tex; +struct MTex; +struct HaloRen; +struct LampRen; +/** + * Takes uv coordinates (R.uv[], O.dxuv, O.dyuv), find texture colour + * at that spot (using imagewrap()). + * Result is kept in R.vcol (float vector 3) + */ +void render_realtime_texture(void); + +/** + * Do texture mapping for materials. Communicates with R.... variables. + */ +void do_material_tex(void); + +/* unsorted */ +int blend(struct Tex *tex, float *texvec); +int clouds(struct Tex *tex, float *texvec); +int cubemap(struct MTex *mtex, float x, float y, float z, float *adr1, float *adr2); +int cubemap_glob(struct MTex *mtex, float x, float y, float z, float *adr1, float *adr2); +int cubemap_ob(struct MTex *mtex, float x, float y, float z, float *adr1, float *adr2); +void do_2d_mapping(struct MTex *mtex, float *t, float *dxt, float *dyt); +void do_halo_tex(struct HaloRen *har, float xn, float yn, float *colf); +void do_lamp_tex(struct LampRen *la, float *lavec); +void do_sky_tex(void); +int magic(struct Tex *tex, float *texvec); +int marble(struct Tex *tex, float *texvec); +int multitex(struct Tex *tex, float *texvec, float *dxt, float *dyt); +int plugintex(struct Tex *tex, float *texvec, float *dxt, float *dyt); +int stucci(struct Tex *tex, float *texvec); +int texnoise(struct Tex *tex); +int wood(struct Tex *tex, float *texvec); + +#endif /* TEXTURE_EXT_H */ + + + + + + + + + + diff --git a/source/blender/render/intern/include/vanillaRenderPipe.h b/source/blender/render/intern/include/vanillaRenderPipe.h new file mode 100644 index 00000000000..4dfaa41e91d --- /dev/null +++ b/source/blender/render/intern/include/vanillaRenderPipe.h @@ -0,0 +1,49 @@ +/* + * 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); + + +#endif /* VANILLARENDERPIPE_EXT_H */ diff --git a/source/blender/render/intern/include/vanillaRenderPipe_int.h b/source/blender/render/intern/include/vanillaRenderPipe_int.h new file mode 100644 index 00000000000..024b82cc812 --- /dev/null +++ b/source/blender/render/intern/include/vanillaRenderPipe_int.h @@ -0,0 +1,191 @@ +/* + * vanillaRenderPipe_int.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_INT_H +#define VANILLARENDERPIPE_INT_H + +#include "vanillaRenderPipe_types.h" +#include "zbufferdatastruct_types.h" + +/** + * Z buffer initializer, for new pipeline. + * <LI> + * <IT> AColourBuffer : colour buffer for one line + * <IT> APixbufExt : pixel data buffer for one line, depth RE_ZBUFLEN + * </LI> + */ +void initRenderBuffers(int width); +/* void initRenderBuffers(void); */ + +/** + * Z buffer destructor, frees stuff from initZBuffers(). + */ +void freeRenderBuffers(void); + +/** + * Fill the accumulation buffer APixbufExt with face and halo indices. + * Note: Uses globals. + * @param y the line number to set + */ +void calcZBufLine(int y); + +/** + * Shade and render the pixels in this line, into AColourBuffer + * Note: Uses globals. + * @param y the line number to set + */ +void renderZBufLine(int y); + +/** + * Count and sort the list behind ap into buf. Sorts on min. distance. + * Low index <=> high z + */ +int countAndSortPixelFaces(int buf[RE_MAX_FACES_PER_PIXEL][5], + RE_APixstrExt *ap); + +/** + * Compose the conflict and colour stacks + * Note: Uses globals. + */ +int composeStack(int zrow[RE_MAX_FACES_PER_PIXEL][RE_PIXELFIELDSIZE], + struct RE_faceField* stack, int ptr, + int totvlak, float x, float y, int osaNr); +/** + * Integrate conflicting layers. + * Note: Uses globals. + */ +int resolveConflict(struct RE_faceField* stack, int ptr, float x, float y); + +/** + * Integrate the colour stack, defer conflicts. + * Note: Uses globals. + */ +void integrateStack(struct RE_faceField* stack, int ptr, + float x, float y, int osaNr); + +/** + * Calculate the view depth to this object on this location, with + * the current view parameters in R. + */ +int calcDepth(float x, float y, void *data, int type); + + + +/** + * Fills in distances of all faces in a z buffer, for given jitter settings. + */ +int fillZBufDistances(void); + +/** + * Fills in distances of faces in the z buffer. + * + * Halo z buffering ---------------------------------------------- + * + * A halo is treated here as a billboard: no z-extension, always + * oriented perpendicular to the viewer. The rest of the z-buffer + * stores face-numbers first, then calculates colours as the + * final image is rendered. We'll use the same approach here, + * which differs from the original method (which was add halos per + * scan line). This means that the z-buffer now also needs to + * store info about what sort of 'thing' the index refers to. + * + * Halo extension: + * h.maxy --------- + * | h.xs + h.rad + * | h.xs + * | h.xs - h.rad + * h.miny --------- + * + * These coordinates must be clipped to picture size. + * I'm not quite certain about halo numbering. + * + * Halos and jittering ------------------------------------------- + * + * Halos were not jittered previously. Now they are. I wonder + * whether this may have some adverse effects here. + + * @return 1 for succes, 0 if the operation was interrupted. + */ +int zBufferAllFaces(void); + +/** + * Fills in distances of halos in the z buffer. + * @return 1 for succes, 0 if the operation was interrupted. + */ +int zBufferAllHalos(void); + +/** + * New fill function for z buffer, for edge-only rendering. + */ +void zBufferFillEdge(float *vec1, float *vec2); + +/** + * New fill function for z buffer. + */ +void zBufferFillFace(float *v1, float *v2, float *v3); + +/** + * One more filler: fill in halo data in z buffer. + * Empty so far, but may receive content of halo loop. + */ +void zBufferFillHalo(void); + +/** + * Copy the colour buffer output to R.rectot, to line y. + */ +void transferColourBufferToOutput(int y); + +/** + * Set the colour buffer fields to zero. + */ +void eraseColBuf(RE_COLBUFTYPE *buf); + +/** + * Blend source over dest, and leave result in dest. 1 pixel. + */ +void blendOverFloat(int type, float* dest, float* source, void* data); + +/** + * Blend source over dest, and leave result in dest. 1 pixel into + * multiple bins. + */ +void blendOverFloatRow(int type, float* dest, float* source, + void* data, int mask, int osaNr) ; + +/** + * Do a post-process step on a finalized render image. + */ +void std_transFloatColV2CharColV( RE_COLBUFTYPE *buf, char *target); + +#endif /* VANILLARENDERPIPE_INT_H */ diff --git a/source/blender/render/intern/include/vanillaRenderPipe_types.h b/source/blender/render/intern/include/vanillaRenderPipe_types.h new file mode 100644 index 00000000000..90828ff62c3 --- /dev/null +++ b/source/blender/render/intern/include/vanillaRenderPipe_types.h @@ -0,0 +1,90 @@ +/* + * 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 500 /* 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/zbuf.h b/source/blender/render/intern/include/zbuf.h new file mode 100644 index 00000000000..fdfa5b19abe --- /dev/null +++ b/source/blender/render/intern/include/zbuf.h @@ -0,0 +1,180 @@ +/* + * zbuf_ext.h + * external interface for zbuf.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 ZBUF_H +#define ZBUF_H + +#ifdef __cplusplus +extern "C" { +#endif + +struct LampRen; +struct VlakRen; + +/*-----------------------------------------------------------*/ +/* 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(unsigned int *rect, int x, unsigned int y, unsigned 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(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 + */ +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 + */ +void zbufclip(float *f1, float *f2, float *f3, int c1, int c2, int c3); + +/** + * same, for edges + */ +void zbufclipwire(struct VlakRen *vlr); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/source/blender/render/intern/include/zbuf_int.h b/source/blender/render/intern/include/zbuf_int.h new file mode 100644 index 00000000000..1ea416a581f --- /dev/null +++ b/source/blender/render/intern/include/zbuf_int.h @@ -0,0 +1,203 @@ +/* + * zbuf_int.h + * internal interface for zbuf.h (ie. functions that are not used + * anywhere else) + * + * $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_INT_H +#define ZBUF_INT_H + +#include "render_types.h" +#include "zbuf_types.h" + + + +/** + * Convert a homogenous coordinate to a z buffer coordinate. The + * function makes use of Zmulx, Zmuly, the x and y scale factors for + * the screen, and Zjitx, Zjity, the pixel offset. (These are declared + * in render.c) The normalised z coordinate must fall on [0, 1]. + * @param zco [3, 4 floats] pointer to the resulting z buffer coordinate + * @param hoco [4 floats] pointer to the homogenous coordinate of the + * vertex in world space. + */ +void hoco_to_zco(float *zco, float *hoco); + +/** + * Fill the z buffer for alpha? + * + * This is one of the z buffer fill functions called in zbufclip() and + * zbufwireclip(). + * + * @param v1 [4 floats, world coordinates] first vertex + * @param v2 [4 floats, world coordinates] second vertex + * @param v3 [4 floats, world coordinates] third vertex + */ +void zbufinvulAc(float *v1, float *v2, float *v3); + +/** + * Fill the z buffer, but invert z order, and add the face index to + * the corresponing face buffer. + * + * This is one of the z buffer fill functions called in zbufclip() and + * zbufwireclip(). + * + * @param v1 [4 floats, world coordinates] first vertex + * @param v2 [4 floats, world coordinates] second vertex + * @param v3 [4 floats, world coordinates] third vertex + */ +void zbufinvulGLinv(float *v1, float *v2, float *v3); + +/** + * Fill the z buffer, and add the face index to + * the corresponing face buffer. Writes into R.rectz and R.rectot. It + * assumes that Zvlnr is set to the face index of the face under + * consideration. Zvlnr is written into R.rectot. R.rectz + * + * This is one of the z buffer fill functions called in zbufclip() and + * zbufwireclip(). + * + * @param v1 [4 floats, world coordinates] first vertex + * @param v2 [4 floats, world coordinates] second vertex + * @param v3 [4 floats, world coordinates] third vertex + */ +void zbufinvulGL(float *v1, float *v2, float *v3); + +/** + * Fill the z buffer. The face buffer is not operated on! + * + * This is one of the z buffer fill functions called in zbufclip() and + * zbufwireclip(). + * + * @param v1 [4 floats, world coordinates] first vertex + * @param v2 [4 floats, world coordinates] second vertex + * @param v3 [4 floats, world coordinates] third vertex + */ +void zbufinvulGL_onlyZ(float *v1, float *v2, float *v3); + +/** + * Prints 3 unlabelled floating point values to stdout. Used for diagnostics. + * @param v1 any float + * @param v2 any float + * @param v3 any float + */ +void print3floats(float *v1, float *v2, float *v3); + +/** + * Checks labda and uses this to make decision about clipping the line + * segment from v1 to v2. labda is the factor by which the vector is + * cut. ( calculate s + l * ( t - s )). The result is appended to the + * vertex list of this face. + * Note: uses globals. + * (arguments: one int, one pointer to int... why?) + * @param v1 start coordinate s + * @param v2 target coordinate t + * @param b1 + * @param b2 + * @param clve vertex vector. + */ +static void maakvertpira(float *v1, float *v2, int *b1, int b2, int *clve); + +/** + * Sets labda: flag, and parametrize the clipping of vertices in + * viewspace coordinates. labda = -1 means no clipping, labda in [0, + * 1] means a clipping. + * Note: uses globals. + * @param v1 start coordinate s + * @param v2 target coordinate t + * @param b1 + * @param b2 + * @param b3 + * @param a index for coordinate (x, y, or z) + */ +static void clipp(float *v1, float *v2, int b1, int *b2, int *b3, int a); + +/** + * Tests whether this coordinate is 'inside' or 'outside' of the view + * volume? By definition, this is in [0, 1]. + * @param p vertex z difference plus coordinate difference? + * @param q origin z plus r minus some coordinate? + * @param u1 [in/out] clip fraction for ? + * @param u2 [in/out] + * @return 0 if point is outside, or 1 if the point lies on the clip + * boundary + */ +static short cliptestf(float p, float q, float *u1, float *u2); + + +/* not documented yet */ +/* not sure if these should stay static... */ + +static int clipline(float *v1, float *v2); + +/** + * Provide book-keeping for the z buffer data lists. + */ +APixstr *addpsmainA(void); +void freepsA(void); +APixstr *addpsA(void); + +/** + * Fill function for the z buffer (fills lines) + */ +void zbuflineAc(float *vec1, float *vec2); +void zbufline(float *vec1, float *vec2); + + +/** + * Copy results from the solid face z buffering to the transparent + * buffer. + */ +void copyto_abufz(int sample); + +/** + * Do accumulation z buffering. + */ +void zbuffer_abuf(void); + +/** + * Shade this face at this location in SCS. + */ +void shadetrapixel(float x, float y, int vlak); + +/** + * Determine the distance to the camera of this halo, in ZCS. + */ +unsigned int calcHaloDist(HaloRen *har); + +#endif /* ZBUF_INT_H */ + + + + + diff --git a/source/blender/render/intern/include/zbuf_types.h b/source/blender/render/intern/include/zbuf_types.h new file mode 100644 index 00000000000..49960541fa0 --- /dev/null +++ b/source/blender/render/intern/include/zbuf_types.h @@ -0,0 +1,78 @@ +/* + * 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 new file mode 100644 index 00000000000..3e36066100c --- /dev/null +++ b/source/blender/render/intern/include/zbufferdatastruct.h @@ -0,0 +1,99 @@ +/* + * 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 opaque, */ + 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 new file mode 100644 index 00000000000..10e0db8a540 --- /dev/null +++ b/source/blender/render/intern/include/zbufferdatastruct_types.h @@ -0,0 +1,77 @@ +/* + * 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 */ +#define RE_NONE 0 +#define RE_POLY 1 +#define RE_HALO 2 +#define RE_SKY 4 + +/* 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 |