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

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTon Roosendaal <ton@blender.org>2006-01-24 01:05:47 +0300
committerTon Roosendaal <ton@blender.org>2006-01-24 01:05:47 +0300
commit042d612df219c8f6a29afa235537380f227b5684 (patch)
tree310a2c859b99c559115bbcda0aa70f2543bf962c /source/blender/render/intern/include/zbuf.h
parent5668480c99001a617fd59a2383deb858195ffb26 (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/zbuf.h')
-rw-r--r--source/blender/render/intern/include/zbuf.h196
1 files changed, 49 insertions, 147 deletions
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