[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30919] branches/soc-2010-jwilkins/source/ blender: == Texture Overlay for Wrap Texture Mode ==
Jason Wilkins
Jason.A.Wilkins at gmail.com
Sat Jul 31 05:53:16 CEST 2010
Revision: 30919
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30919
Author: jwilkins
Date: 2010-07-31 05:52:50 +0200 (Sat, 31 Jul 2010)
Log Message:
-----------
== Texture Overlay for Wrap Texture Mode ==
* Wrap mode now has a texture overlay.
* Also, wrap texture mode has been enabled for all tools now, but it does not seem to be working properly for all of them as of yet.
Modified Paths:
--------------
branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_brush.h
branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_paint.h
branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
branches/soc-2010-jwilkins/source/blender/blenkernel/intern/paint.c
branches/soc-2010-jwilkins/source/blender/blenlib/BLI_pbvh.h
branches/soc-2010-jwilkins/source/blender/blenlib/intern/pbvh.c
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/sculpt.c
branches/soc-2010-jwilkins/source/blender/editors/space_view3d/view3d_draw.c
Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_brush.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_brush.h 2010-07-31 01:06:08 UTC (rev 30918)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_brush.h 2010-07-31 03:52:50 UTC (rev 30919)
@@ -93,22 +93,22 @@
/* unified strength and size */
-int brush_size(struct Brush *brush);
+int brush_size(const struct Brush *brush);
void brush_set_size(struct Brush *brush, int value);
-int brush_use_locked_size(struct Brush *brush);
+int brush_use_locked_size(const struct Brush *brush);
void brush_set_use_locked_size(struct Brush *brush, int value);
-int brush_use_alpha_pressure(struct Brush *brush);
+int brush_use_alpha_pressure(const struct Brush *brush);
void brush_set_use_alpha_pressure(struct Brush *brush, int value);
-int brush_use_size_pressure(struct Brush *brush);
+int brush_use_size_pressure(const struct Brush *brush);
void brush_set_use_size_pressure(struct Brush *brush, int value);
-float brush_unprojected_radius(struct Brush *brush);
+float brush_unprojected_radius(const struct Brush *brush);
void brush_set_unprojected_radius(struct Brush *brush, float value);
-float brush_alpha(struct Brush *brush);
+float brush_alpha(const struct Brush *brush);
void brush_set_alpha(struct Brush *brush, float value);
#endif
Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_paint.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_paint.h 2010-07-31 01:06:08 UTC (rev 30918)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/BKE_paint.h 2010-07-31 03:52:50 UTC (rev 30919)
@@ -50,7 +50,7 @@
void copy_paint(struct Paint *orig, struct Paint *new);
struct Paint *paint_get_active(struct Scene *sce);
-struct Brush *paint_brush(struct Paint *paint);
+struct Brush *paint_brush(const struct Paint *paint);
void paint_brush_set(struct Paint *paint, struct Brush *br);
void paint_brush_slot_add(struct Paint *p);
void paint_brush_slot_remove(struct Paint *p);
Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c 2010-07-31 01:06:08 UTC (rev 30918)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/brush.c 2010-07-31 03:52:50 UTC (rev 30919)
@@ -1281,7 +1281,7 @@
/* Unified Size and Strength */
-static void set_unified_settings(Brush *brush, short flag, int value)
+static void set_unified_settings(const Brush *brush, short flag, int value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1300,7 +1300,7 @@
}
}
-static short unified_settings(Brush *brush)
+static short unified_settings(const Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1318,7 +1318,7 @@
return 0;
}
-static void set_unified_size(Brush *brush, int value)
+static void set_unified_size(const Brush *brush, int value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1334,7 +1334,7 @@
}
}
-static int unified_size(Brush *brush)
+static int unified_size(const Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1352,7 +1352,7 @@
return 35; // XXX magic number
}
-static void set_unified_alpha(Brush *brush, float value)
+static void set_unified_alpha(const Brush *brush, float value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1368,7 +1368,7 @@
}
}
-static float unified_alpha(Brush *brush)
+static float unified_alpha(const Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1386,7 +1386,7 @@
return 0.5f; // XXX magic number
}
-static void set_unified_unprojected_radius(Brush *brush, float value)
+static void set_unified_unprojected_radius(const Brush *brush, float value)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1402,7 +1402,7 @@
}
}
-static float unified_unprojected_radius(Brush *brush)
+static float unified_unprojected_radius(const Brush *brush)
{
Scene *sce;
for (sce= G.main->scene.first; sce; sce= sce->id.next) {
@@ -1425,11 +1425,9 @@
set_unified_size(brush, size);
else
brush->size= size;
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
-int brush_size(Brush *brush)
+int brush_size(const Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? unified_size(brush) : brush->size;
}
@@ -1445,11 +1443,9 @@
else
brush->flag &= ~BRUSH_LOCK_SIZE;
}
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
-int brush_use_locked_size(Brush *brush)
+int brush_use_locked_size(const Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? (unified_settings(brush) & SCULPT_PAINT_UNIFIED_LOCK_BRUSH_SIZE) : (brush->flag & BRUSH_LOCK_SIZE);
}
@@ -1465,11 +1461,9 @@
else
brush->flag &= ~BRUSH_SIZE_PRESSURE;
}
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
-int brush_use_size_pressure(Brush *brush)
+int brush_use_size_pressure(const Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? (unified_settings(brush) & SCULPT_PAINT_UNIFIED_SIZE_PRESSURE) : (brush->flag & BRUSH_SIZE_PRESSURE);
}
@@ -1485,11 +1479,9 @@
else
brush->flag &= ~BRUSH_ALPHA_PRESSURE;
}
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
-int brush_use_alpha_pressure(Brush *brush)
+int brush_use_alpha_pressure(const Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? (unified_settings(brush) & SCULPT_PAINT_UNIFIED_ALPHA_PRESSURE) : (brush->flag & BRUSH_ALPHA_PRESSURE);
}
@@ -1500,11 +1492,9 @@
set_unified_unprojected_radius(brush, unprojected_radius);
else
brush->unprojected_radius= unprojected_radius;
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
-float brush_unprojected_radius(Brush *brush)
+float brush_unprojected_radius(const Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_SIZE) ? unified_unprojected_radius(brush) : brush->unprojected_radius;
}
@@ -1515,11 +1505,9 @@
set_unified_alpha(brush, alpha);
else
brush->alpha= alpha;
-
- //WM_main_add_notifier(NC_BRUSH|NA_EDITED, brush);
}
-float brush_alpha(Brush *brush)
+float brush_alpha(const Brush *brush)
{
return (unified_settings(brush) & SCULPT_PAINT_USE_UNIFIED_ALPHA) ? unified_alpha(brush) : brush->alpha;
}
Modified: branches/soc-2010-jwilkins/source/blender/blenkernel/intern/paint.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenkernel/intern/paint.c 2010-07-31 01:06:08 UTC (rev 30918)
+++ branches/soc-2010-jwilkins/source/blender/blenkernel/intern/paint.c 2010-07-31 03:52:50 UTC (rev 30919)
@@ -68,7 +68,7 @@
return NULL;
}
-Brush *paint_brush(Paint *p)
+Brush *paint_brush(const Paint *p)
{
return p && p->brushes ? p->brushes[p->active_brush_index] : NULL;
}
Modified: branches/soc-2010-jwilkins/source/blender/blenlib/BLI_pbvh.h
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenlib/BLI_pbvh.h 2010-07-31 01:06:08 UTC (rev 30918)
+++ branches/soc-2010-jwilkins/source/blender/blenlib/BLI_pbvh.h 2010-07-31 03:52:50 UTC (rev 30919)
@@ -242,6 +242,10 @@
PBVHProxyNode* BLI_pbvh_node_add_proxy(PBVH* bvh, PBVHNode* node);
void BLI_pbvh_gather_proxies(PBVH* pbvh, PBVHNode*** nodes, int* totnode);
+void BLI_pbvh_draw_nodes_in_sphere(PBVH *bvh, float location[3], float radius);
+void BLI_pbvh_gather_nodes_in_sphere(PBVH *bvh, float location[3], float radius, PBVHNode ***nodes, int *totnode);
+void BLI_pbvh_node_array_draw(PBVH *bvh, PBVHNode **nodes, int totnode);
+
//void BLI_pbvh_node_BB_reset(PBVHNode* node);
//void BLI_pbvh_node_BB_expand(PBVHNode* node, float co[3]);
Modified: branches/soc-2010-jwilkins/source/blender/blenlib/intern/pbvh.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/blenlib/intern/pbvh.c 2010-07-31 01:06:08 UTC (rev 30918)
+++ branches/soc-2010-jwilkins/source/blender/blenlib/intern/pbvh.c 2010-07-31 03:52:50 UTC (rev 30919)
@@ -1416,6 +1416,8 @@
glColor3f(1, 0, 0);
#endif
+ (void)data;
+
GPU_draw_buffers(node->draw_buffers);
}
@@ -1615,3 +1617,66 @@
*r_array= array;
*r_tot= tot;
}
+
+typedef struct {
+ float location[3];
+ float radius_squared;
+} SearchSphereData;
+
+/* Test AABB against sphere */
+static int search_sphere_cb(PBVHNode *node, void *data_v)
+{
+ SearchSphereData *data = data_v;
+ float *center = data->location, nearest[3];
+ float t[3], bb_min[3], bb_max[3];
+ int i;
+
+ BLI_pbvh_node_get_BB(node, bb_min, bb_max);
+
+ for(i = 0; i < 3; ++i) {
+ if(bb_min[i] > center[i])
+ nearest[i] = bb_min[i];
+ else if(bb_max[i] < center[i])
+ nearest[i] = bb_max[i];
+ else
+ nearest[i] = center[i];
+ }
+
+ sub_v3_v3v3(t, center, nearest);
+
+ return dot_v3v3(t, t) < data->radius_squared;
+}
+
+void BLI_pbvh_gather_nodes_in_sphere(PBVH *bvh, float location[3], float radius, PBVHNode ***nodes, int *totnode)
+{
+ SearchSphereData data;
+
+ copy_v3_v3(data.location, location);
+ data.radius_squared= radius*radius;
+
+ BLI_pbvh_search_gather(bvh, search_sphere_cb, &data, nodes, totnode);
+}
+
+void BLI_pbvh_node_array_draw(PBVH *bvh, PBVHNode **nodes, int totnode)
+{
+ int i;
+
+ pbvh_update_normals(bvh, nodes, totnode, NULL);
+ pbvh_update_draw_buffers(bvh, nodes, totnode, 1);
+
+ for (i= 0; i < totnode; i++)
+ BLI_pbvh_node_draw(nodes[i], 0);
+}
+
+void BLI_pbvh_draw_nodes_in_sphere(PBVH *bvh, float location[3], float radius)
+{
+ PBVHNode **nodes;
+ int totnode;
+
+ BLI_pbvh_gather_nodes_in_sphere(bvh, location, radius, &nodes, &totnode);
+
+ if (nodes) {
+ BLI_pbvh_node_array_draw(bvh, nodes, totnode);
+ MEM_freeN(nodes);
+ }
+}
Modified: branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c
===================================================================
--- branches/soc-2010-jwilkins/source/blender/editors/sculpt_paint/paint_stroke.c 2010-07-31 01:06:08 UTC (rev 30918)
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list