[Bf-blender-cvs] [980205b5390] greasepencil-object: Merge branch 'blender2.8' into greasepencil-object
Antonio Vazquez
noreply at git.blender.org
Tue Apr 11 21:34:10 CEST 2017
Commit: 980205b5390d718ca989f188951f7528bd59ebb9
Author: Antonio Vazquez
Date: Tue Apr 11 20:03:43 2017 +0200
Branches: greasepencil-object
https://developer.blender.org/rB980205b5390d718ca989f188951f7528bd59ebb9
Merge branch 'blender2.8' into greasepencil-object
===================================================================
===================================================================
diff --cc source/blender/draw/intern/draw_cache.c
index 168e8edef07,89ffa010145..7e2fbbc98af
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@@ -428,58 -440,32 +443,85 @@@ Batch *DRW_cache_single_line_endpoints_
return SHC.drw_line_endpoints;
}
++<<<<<<< HEAD
+/* Grease Pencil object */
+Batch *DRW_cache_gpencil_axes_get(void)
+{
+ if (!SHC.drw_gpencil_axes) {
+ int axis;
+ float v1[3] = { 0.0f, 0.0f, 0.0f };
+ float v2[3] = { 0.0f, 0.0f, 0.0f };
+
+ /* cube data */
+ const GLfloat verts[8][3] = {
+ { -0.25f, -0.25f, -0.25f },
+ { -0.25f, -0.25f, 0.25f },
+ { -0.25f, 0.25f, -0.25f },
+ { -0.25f, 0.25f, 0.25f },
+ { 0.25f, -0.25f, -0.25f },
+ { 0.25f, -0.25f, 0.25f },
+ { 0.25f, 0.25f, -0.25f },
+ { 0.25f, 0.25f, 0.25f }
+ };
+
+ const GLubyte indices[24] = { 0, 1, 1, 3, 3, 2, 2, 0, 0, 4, 4, 5, 5, 7, 7, 6, 6, 4, 1, 5, 3, 7, 2, 6 };
+
+ /* Position Only 3D format */
+ static VertexFormat format = { 0 };
+ static unsigned pos_id;
++=======
+ Batch *DRW_cache_screenspace_circle_get(void)
+ {
+ #define CIRCLE_RESOL 32
+ if (!SHC.drw_screenspace_circle) {
+ float v[3] = {0.0f, 0.0f, 0.0f};
+
+ /* Position Only 3D format */
+ static VertexFormat format = { 0 };
+ static unsigned int pos_id;
++>>>>>>> blender2.8
if (format.attrib_ct == 0) {
pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
}
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
++<<<<<<< HEAD
+ VertexBuffer_allocate_data(vbo, 30);
+
+ /* draw axis */
+ for (axis = 0; axis < 3; axis++) {
+ v1[axis] = 1.0f;
+ v2[axis] = -1.0f;
+
+ VertexBuffer_set_attrib(vbo, pos_id, axis * 2, v1);
+ VertexBuffer_set_attrib(vbo, pos_id, axis * 2 + 1, v2);
+
+ /* reset v1 & v2 to zero for next axis */
+ v1[axis] = v2[axis] = 0.0f;
+ }
+
+ /* draw cube */
+ for (int i = 0; i < 24; ++i) {
+ VertexBuffer_set_attrib(vbo, pos_id, i + 6, verts[indices[i]]);
+ }
+
+ SHC.drw_gpencil_axes = Batch_create(PRIM_LINES, vbo, NULL);
+ }
+ return SHC.drw_gpencil_axes;
++=======
+ VertexBuffer_allocate_data(vbo, CIRCLE_RESOL + 1);
+
+ for (int a = 0; a <= CIRCLE_RESOL; a++) {
+ v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
+ v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
+ VertexBuffer_set_attrib(vbo, pos_id, a, v);
+ }
+
+ SHC.drw_screenspace_circle = Batch_create(PRIM_LINE_STRIP, vbo, NULL);
+ }
+ return SHC.drw_screenspace_circle;
+ #undef CIRCLE_RESOL
++>>>>>>> blender2.8
}
/* Empties */
diff --cc source/blender/draw/intern/draw_cache.h
index c9c9f17586b,94d3f57a832..c45b76c6acf
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@@ -48,9 -49,13 +49,16 @@@ struct Batch *DRW_cache_empty_cone_get(
struct Batch *DRW_cache_arrows_get(void);
struct Batch *DRW_cache_axis_names_get(void);
+ /* Force Field */
+ struct Batch *DRW_cache_field_wind_get(void);
+ struct Batch *DRW_cache_field_force_get(void);
+ struct Batch *DRW_cache_field_vortex_get(void);
+ struct Batch *DRW_cache_field_tube_limit_get(void);
+ struct Batch *DRW_cache_field_cone_limit_get(void);
+
+/* Grease Pencil */
+struct Batch *DRW_cache_gpencil_axes_get(void);
+
/* Lamps */
struct Batch *DRW_cache_lamp_get(void);
struct Batch *DRW_cache_lamp_sunrays_get(void);
diff --cc source/blender/draw/modes/object_mode.c
index 4c7b85c31aa,52c88788557..a7623fe2542
--- a/source/blender/draw/modes/object_mode.c
+++ b/source/blender/draw/modes/object_mode.c
@@@ -114,9 -118,15 +118,18 @@@ typedef struct g_data
DRWShadingGroup *arrows;
DRWShadingGroup *axis_names;
+ /* Force Field */
+ DRWShadingGroup *field_wind;
+ DRWShadingGroup *field_force;
+ DRWShadingGroup *field_vortex;
+ DRWShadingGroup *field_curve_sta;
+ DRWShadingGroup *field_curve_end;
+ DRWShadingGroup *field_tube_limit;
+ DRWShadingGroup *field_cone_limit;
+
+ /* Grease Pencil */
+ DRWShadingGroup *gpencil_axes;
+
/* Speaker */
DRWShadingGroup *speaker;
@@@ -575,10 -587,19 +590,23 @@@ static void OBJECT_cache_init(void *ved
geom = DRW_cache_axis_names_get();
stl->g_data->axis_names = shgroup_instance_axis_names(psl->non_meshes, geom);
+ /* Force Field */
+ geom = DRW_cache_field_wind_get();
+ stl->g_data->field_wind = shgroup_instance_scaled(psl->non_meshes, geom);
+
+ geom = DRW_cache_field_force_get();
+ stl->g_data->field_force = shgroup_instance_screen_aligned(psl->non_meshes, geom);
+
+ geom = DRW_cache_field_vortex_get();
+ stl->g_data->field_vortex = shgroup_instance_scaled(psl->non_meshes, geom);
+
+ geom = DRW_cache_screenspace_circle_get();
+ stl->g_data->field_curve_sta = shgroup_instance_screen_aligned(psl->non_meshes, geom);
+
+ /* Grease Pencil */
+ geom = DRW_cache_gpencil_axes_get();
+ stl->g_data->gpencil_axes = shgroup_instance(psl->non_meshes, geom);
+
/* Speaker */
geom = DRW_cache_speaker_get();
stl->g_data->speaker = shgroup_instance(psl->non_meshes, geom);
@@@ -896,14 -941,105 +948,113 @@@ static void DRW_shgroup_empty(OBJECT_St
}
}
+ static void DRW_shgroup_forcefield(OBJECT_StorageList *stl, Object *ob, SceneLayer *sl)
+ {
+ int theme_id = DRW_object_wire_theme_get(ob, sl, NULL);
+ float *color = DRW_color_background_blend_get(theme_id);
+ PartDeflect *pd = ob->pd;
+ Curve *cu = (ob->type == OB_CURVE) ? ob->data : NULL;
+
+ /* TODO Move this to depsgraph */
+ float tmp[3];
+ copy_v3_fl(pd->drawvec1, ob->empty_drawsize);
+
+ switch (pd->forcefield) {
+ case PFIELD_WIND:
+ pd->drawvec1[2] = pd->f_strength;
+ break;
+ case PFIELD_VORTEX:
+ if (pd->f_strength < 0.0f) {
+ pd->drawvec1[1] = -pd->drawvec1[1];
+ }
+ break;
+ case PFIELD_GUIDE:
+ if (cu && (cu->flag & CU_PATH) && ob->curve_cache->path && ob->curve_cache->path->data) {
+ where_on_path(ob, 0.0f, pd->drawvec1, tmp, NULL, NULL, NULL);
+ where_on_path(ob, 1.0f, pd->drawvec2, tmp, NULL, NULL, NULL);
+ }
+ break;
+ }
+
+ if (pd->falloff == PFIELD_FALL_TUBE) {
+ pd->drawvec_falloff_max[0] = pd->drawvec_falloff_max[1] = (pd->flag & PFIELD_USEMAXR) ? pd->maxrad : 1.0f;
+ pd->drawvec_falloff_max[2] = (pd->flag & PFIELD_USEMAX) ? pd->maxdist : 0.0f;
+
+ pd->drawvec_falloff_min[0] = pd->drawvec_falloff_min[1] = (pd->flag & PFIELD_USEMINR) ? pd->minrad : 1.0f;
+ pd->drawvec_falloff_min[2] = (pd->flag & PFIELD_USEMIN) ? pd->mindist : 0.0f;
+ }
+ else if (pd->falloff == PFIELD_FALL_CONE) {
+ float radius, distance;
+
+ radius = DEG2RADF((pd->flag & PFIELD_USEMAXR) ? pd->maxrad : 1.0f);
+ distance = (pd->flag & PFIELD_USEMAX) ? pd->maxdist : 0.0f;
+ pd->drawvec_falloff_max[0] = pd->drawvec_falloff_max[1] = distance * sinf(radius);
+ pd->drawvec_falloff_max[2] = distance * cosf(radius);
+
+ radius = DEG2RADF((pd->flag & PFIELD_USEMINR) ? pd->minrad : 1.0f);
+ distance = (pd->flag & PFIELD_USEMIN) ? pd->mindist : 0.0f;
+
+ pd->drawvec_falloff_min[0] = pd->drawvec_falloff_min[1] = distance * sinf(radius);
+ pd->drawvec_falloff_min[2] = distance * cosf(radius);
+ }
+ /* End of things that should go to depthgraph */
+
+ switch (pd->forcefield) {
+ case PFIELD_WIND:
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_wind, color, &pd->drawvec1, ob->obmat);
+ break;
+ case PFIELD_FORCE:
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_force, color, &pd->drawvec1, ob->obmat);
+ break;
+ case PFIELD_VORTEX:
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_vortex, color, &pd->drawvec1, ob->obmat);
+ break;
+ case PFIELD_GUIDE:
+ if (cu && (cu->flag & CU_PATH) && ob->curve_cache->path && ob->curve_cache->path->data) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_curve_sta, color, &pd->f_strength, ob->obmat);
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_curve_end, color, &pd->f_strength, ob->obmat);
+ }
+ break;
+ }
+
+ if (pd->falloff == PFIELD_FALL_SPHERE) {
+ /* as last, guide curve alters it */
+ if ((pd->flag & PFIELD_USEMAX) != 0) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_curve_end, color, &pd->maxdist, ob->obmat);
+ }
+
+ if ((pd->flag & PFIELD_USEMIN) != 0) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_curve_end, color, &pd->mindist, ob->obmat);
+ }
+ }
+ else if (pd->falloff == PFIELD_FALL_TUBE) {
+ if (pd->flag & (PFIELD_USEMAX | PFIELD_USEMAXR)) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_tube_limit, color, &pd->drawvec_falloff_max, ob->obmat);
+ }
+
+ if (pd->flag & (PFIELD_USEMIN | PFIELD_USEMINR)) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_tube_limit, color, &pd->drawvec_falloff_min, ob->obmat);
+ }
+ }
+ else if (pd->falloff == PFIELD_FALL_CONE) {
+ if (pd->flag & (PFIELD_USEMAX | PFIELD_USEMAXR)) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_cone_limit, color, &pd->drawvec_falloff_max, ob->obmat);
+ }
+
+ if (pd->flag & (PFIELD_USEMIN | PFIELD_USEMINR)) {
+ DRW_shgroup_dynamic_call_add(stl->g_data->field_cone_limit, color, &pd->drawvec_falloff_min, ob->obmat);
+ }
+ }
+ }
+
+static void DRW_shgroup_gpencil(OBJECT_StorageList *stl, Object *ob, SceneLayer *sl)
+{
+ float *color;
+ DRW_object_wire_theme_get(ob, sl, &color);
+
+ DRW_shgroup_dynamic_call_add(stl->g_data->gpencil_axes, color, &ob->empty_drawsize, ob->obmat);
+}
+
static void DRW_shgroup_speaker(OBJECT_StorageList *stl, Object *ob, SceneLayer *sl)
{
float *color;
diff --cc source/blender/gpu/GPU_shader.h
index 2ca457775b6,6783dee7201..8d01bf80ff1
--- a/source/blender/gpu/GPU_shader.h
+++ b/source/blender/gpu/GPU_shader.h
@@@ -155,13 -155,12 +155,15 @@@ typedef enum GPUBuiltinShader
GPU_SHADER_DISTANCE_LINES,
/* axis name */
GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS,
+ GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED,
/* instance */
GPU_SHADER_INSTANCE_UNIFORM_COLOR,
- GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE,
+ GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE, /* Uniformly scaled */
+ GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE,
GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR,
+ /* grease pencil drawin
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list