[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [50642] trunk/blender: remove unused parts of raskter module.
Campbell Barton
ideasman42 at gmail.com
Sun Sep 16 01:05:35 CEST 2012
Revision: 50642
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=50642
Author: campbellbarton
Date: 2012-09-15 23:05:34 +0000 (Sat, 15 Sep 2012)
Log Message:
-----------
remove unused parts of raskter module.
Modified Paths:
--------------
trunk/blender/intern/raskter/CMakeLists.txt
trunk/blender/intern/raskter/raskter.c
trunk/blender/intern/raskter/raskter.h
trunk/blender/source/blender/blenkernel/intern/tracking.c
Removed Paths:
-------------
trunk/blender/intern/raskter/raskter_kdtree.c
trunk/blender/intern/raskter/raskter_kdtree.h
trunk/blender/intern/raskter/raskter_mt.c
Modified: trunk/blender/intern/raskter/CMakeLists.txt
===================================================================
--- trunk/blender/intern/raskter/CMakeLists.txt 2012-09-15 18:08:51 UTC (rev 50641)
+++ trunk/blender/intern/raskter/CMakeLists.txt 2012-09-15 23:05:34 UTC (rev 50642)
@@ -33,11 +33,8 @@
set(SRC
raskter.c
- raskter_mt.c
- raskter_kdtree.c
raskter.h
- raskter_kdtree.h
)
blender_add_lib(bf_intern_raskter "${SRC}" "${INC}" "${INC_SYS}")
Modified: trunk/blender/intern/raskter/raskter.c
===================================================================
--- trunk/blender/intern/raskter/raskter.c 2012-09-15 18:08:51 UTC (rev 50641)
+++ trunk/blender/intern/raskter/raskter.c 2012-09-15 23:05:34 UTC (rev 50642)
@@ -30,23 +30,68 @@
#include <stdlib.h>
#include "raskter.h"
-//#define __PLX__FAKE_AA__
-//#define __PLX_KD_TREE__
-#ifdef __PLX_KD_TREE__
-#include "kdtree.h"
-#endif
+/* from BLI_utildefines.h */
+#define MIN2(x, y) ( (x) < (y) ? (x) : (y) )
+#define MAX2(x, y) ( (x) > (y) ? (x) : (y) )
+#define ABS(a) ( (a) < 0 ? (-(a)) : (a) )
-// this is needed for inlining behavior
-#if defined _MSC_VER
-# define DO_INLINE __inline
-#elif defined (__sun) || defined (__sun__)
-# define DO_INLINE
-#else
-# define DO_INLINE static inline
-#endif
+struct poly_vert {
+ int x;
+ int y;
+};
+struct scan_line {
+ int xstart;
+ int xend;
+};
+struct scan_line_batch {
+ int num;
+ int ystart;
+ struct scan_line *slines;
+};
+
+struct e_status {
+ int x;
+ int ybeg;
+ int xshift;
+ int xdir;
+ int drift;
+ int drift_inc;
+ int drift_dec;
+ int num;
+ struct e_status *e_next;
+};
+
+struct r_buffer_stats {
+ float *buf;
+ int sizex;
+ int sizey;
+ int ymin;
+ int ymax;
+ int xmin;
+ int xmax;
+};
+
+struct r_fill_context {
+ struct e_status *all_edges, *possible_edges;
+ struct r_buffer_stats rb;
+ struct scan_line *bounds;
+ void *kdo; //only used with kd tree
+ void *kdi; //only used with kd tree
+ int *bound_indexes;
+ int bounds_length;
+};
+
+struct layer_init_data {
+ struct poly_vert *imask;
+ struct poly_vert *omask;
+ struct scan_line *bounds;
+ int *bound_indexes;
+ int bounds_length;
+};
+
/*
* Sort all the edges of the input polygon by Y, then by X, of the "first" vertex encountered.
* This will ensure we can scan convert the entire poly in one pass.
@@ -55,7 +100,7 @@
* just the poly. Since the DEM code could end up being coupled with this, we'll keep it separate
* for now.
*/
-void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge) {
+static void preprocess_all_edges(struct r_fill_context *ctx, struct poly_vert *verts, int num_verts, struct e_status *open_edge) {
int i;
int xbeg;
int ybeg;
@@ -384,17 +429,12 @@
}
int PLX_raskterize(float(*base_verts)[2], int num_base_verts,
- float *buf, int buf_x, int buf_y, int do_mask_AA) {
- int subdiv_AA = (do_mask_AA != 0)? 0:0;
+ float *buf, int buf_x, int buf_y) {
int i; /* i: Loop counter. */
- int sAx;
- int sAy;
struct poly_vert *ply; /* ply: Pointer to a list of integer buffer-space vertex coordinates. */
struct r_fill_context ctx = {0};
const float buf_x_f = (float)(buf_x);
const float buf_y_f = (float)(buf_y);
- float div_offset=(1.0f / (float)(subdiv_AA));
- float div_offset_static = 0.5f * (float)(subdiv_AA) * div_offset;
/*
* Allocate enough memory for our poly_vert list. It'll be the size of the poly_vert
* data structure multiplied by the number of base_verts.
@@ -418,1115 +458,13 @@
* drawn will be 1.0f in value, there is no anti-aliasing.
*/
- if(!subdiv_AA) {
- for(i = 0; i < num_base_verts; i++) { /* Loop over all base_verts. */
- ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
- ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
- }
+ for(i = 0; i < num_base_verts; i++) { /* Loop over all base_verts. */
+ ply[i].x = (int)((base_verts[i][0] * buf_x_f) + 0.5f); /* Range expand normalized X to integer buffer-space X. */
+ ply[i].y = (int)((base_verts[i][1] * buf_y_f) + 0.5f); /* Range expand normalized Y to integer buffer-space Y. */
+ }
- i = rast_scan_fill(&ctx, ply, num_base_verts,1.0f); /* Call our rasterizer, passing in the integer coords for each vert. */
- } else {
- for(sAx=0; sAx < subdiv_AA; sAx++) {
- for(sAy=0; sAy < subdiv_AA; sAy++) {
- for(i=0; i < num_base_verts; i++) {
- ply[i].x = (int)((base_verts[i][0]*buf_x_f)+0.5f - div_offset_static + (div_offset*(float)(sAx)));
- ply[i].y = (int)((base_verts[i][1]*buf_y_f)+0.5f - div_offset_static + (div_offset*(float)(sAy)));
- }
- i = rast_scan_fill(&ctx, ply, num_base_verts,(1.0f / (float)(subdiv_AA*subdiv_AA)));
- }
- }
- }
+ i = rast_scan_fill(&ctx, ply, num_base_verts,1.0f); /* Call our rasterizer, passing in the integer coords for each vert. */
+
free(ply); /* Free the memory allocated for the integer coordinate table. */
return(i); /* Return the value returned by the rasterizer. */
}
-
-/*
- * This function clips drawing to the frame buffer. That clipping will likely be moved into the preprocessor
- * for speed, but waiting on final design choices for curve-data before eliminating data the DEM code will need
- * if it ends up being coupled with this function.
- */
-static int rast_scan_feather(struct r_fill_context *ctx,
- float(*base_verts_f)[2], int num_base_verts,
- struct poly_vert *feather_verts, float(*feather_verts_f)[2], int num_feather_verts) {
- int x_curr; /* current pixel position in X */
- int y_curr; /* current scan line being drawn */
- int yp; /* y-pixel's position in frame buffer */
- int swixd = 0; /* whether or not edges switched position in X */
- float *cpxl; /* pixel pointers... */
- float *mpxl;
- float *spxl;
- struct e_status *e_curr; /* edge pointers... */
- struct e_status *e_temp;
- struct e_status *edgbuf;
- struct e_status **edgec;
-
- /* from dem */
- int a; // a = temporary pixel index buffer loop counter
- float fsz; // size of the frame
- unsigned int rsl; // long used for finding fast 1.0/sqrt
- float rsf; // float used for finding fast 1.0/sqrt
- const float rsopf = 1.5f; // constant float used for finding fast 1.0/sqrt
-
- //unsigned int gradientFillOffset;
- float t;
- float ud; // ud = unscaled edge distance
- float dmin; // dmin = minimum edge distance
- float odist; // odist = current outer edge distance
- float idist; // idist = current inner edge distance
- float dx; // dx = X-delta (used for distance proportion calculation)
- float dy; // dy = Y-delta (used for distance proportion calculation)
- float xpxw = (1.0f / (float)(ctx->rb.sizex)); // xpxw = normalized pixel width
- float ypxh = (1.0f / (float)(ctx->rb.sizey)); // ypxh = normalized pixel height
-#ifdef __PLX_KD_TREE__
- void *res_kdi;
- void *res_kdo;
- float clup[2];
-#endif
-
- /*
- * If the number of verts specified to render as a polygon is less than 3,
- * return immediately. Obviously we cant render a poly with sides < 3. The
- * return for this we set to 1, simply so it can be distinguished from the
- * next place we could return,
- * which is a failure to allocate memory.
- */
- if(num_feather_verts < 3) {
- return(1);
- }
-
- /*
- * Try to allocate an edge buffer in memory. needs to be the size of the edge tracking data
- * multiplied by the number of edges, which is always equal to the number of verts in
- * a 2D polygon. Here we return 0 to indicate a memory allocation failure, as opposed to a 1 for
- * the preceeding error, which was a rasterization request on a 2D poly with less than
- * 3 sides.
- */
- if((edgbuf = (struct e_status *)(malloc(sizeof(struct e_status) * num_feather_verts))) == NULL) {
- return(0);
- }
-
- /*
- * Do some preprocessing on all edges. This constructs a table structure in memory of all
- * the edge properties and can "flip" some edges so sorting works correctly.
- */
- preprocess_all_edges(ctx, feather_verts, num_feather_verts, edgbuf);
-
- /* can happen with a zero area mask */
- if (ctx->all_edges == NULL) {
- free(edgbuf);
- return(1);
- }
-
- /*
- * Set the pointer for tracking the edges currently in processing to NULL to make sure
- * we don't get some crazy value after initialization.
- */
- ctx->possible_edges = NULL;
-
- /*
- * Loop through all scan lines to be drawn. Since we sorted by Y values during
- * preprocess_all_edges(), we can already exact values for the lowest and
- * highest Y values we could possibly need by induction. The preprocessing sorted
- * out edges by Y position, we can cycle the current edge being processed once
- * it runs out of Y pixels. When we have no more edges, meaning the current edge
- * is NULL after setting the "current" edge to be the previous current edge's
- * "next" edge in the Y sorted edge connection chain, we can stop looping Y values,
- * since we can't possibly have more scan lines if we ran out of edges. :)
- *
- * TODO: This clips Y to the frame buffer, which should be done in the preprocessor, but for now is done here.
- * Will get changed once DEM code gets in.
- */
- for(y_curr = ctx->all_edges->ybeg; (ctx->all_edges || ctx->possible_edges); y_curr++) {
-
- /*
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list