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:
authorMike Erwin <significant.bit@gmail.com>2017-04-06 07:59:04 +0300
committerMike Erwin <significant.bit@gmail.com>2017-04-06 08:18:12 +0300
commit0debbe2b7f7177678c9bce9046c1499b698ac969 (patch)
tree9a1fb242aae9be44b3479d2a747411b6e0c04822 /source/blender/editors/space_view3d
parentc2f5cd8f6454bf8256a39a5fc9cb075311e25c58 (diff)
Gawain: VertexFormat_add_attrib (function name change)
See intern/gawain for the API change. Other files are updated to use the new name. Also updated every call site to the recommended style: unsigned int foo = VertexFormat_add_attrib(format, "foo", COMP_ ... )
Diffstat (limited to 'source/blender/editors/space_view3d')
-rw-r--r--source/blender/editors/space_view3d/drawanimviz.c8
-rw-r--r--source/blender/editors/space_view3d/drawarmature.c34
-rw-r--r--source/blender/editors/space_view3d/drawobject.c149
-rw-r--r--source/blender/editors/space_view3d/drawsimdebug.c4
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c34
-rw-r--r--source/blender/editors/space_view3d/view3d_fly.c2
-rw-r--r--source/blender/editors/space_view3d/view3d_ruler.c6
-rw-r--r--source/blender/editors/space_view3d/view3d_walk.c2
8 files changed, 119 insertions, 120 deletions
diff --git a/source/blender/editors/space_view3d/drawanimviz.c b/source/blender/editors/space_view3d/drawanimviz.c
index 7ab2b4ec3a4..c241bbcd436 100644
--- a/source/blender/editors/space_view3d/drawanimviz.c
+++ b/source/blender/editors/space_view3d/drawanimviz.c
@@ -239,8 +239,8 @@ void draw_motion_path_instance(Scene *scene,
glLineWidth(mpath->line_thickness);
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
@@ -264,7 +264,7 @@ void draw_motion_path_instance(Scene *scene,
glLineWidth(old_width);
}
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -388,7 +388,7 @@ void draw_motion_path_instance(Scene *scene,
/* point must be bigger than line */
glPointSize(mpath->line_thickness + 3.0);
- pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(col);
diff --git a/source/blender/editors/space_view3d/drawarmature.c b/source/blender/editors/space_view3d/drawarmature.c
index f0c47ee2639..da32ca19ed5 100644
--- a/source/blender/editors/space_view3d/drawarmature.c
+++ b/source/blender/editors/space_view3d/drawarmature.c
@@ -371,8 +371,8 @@ static void drawsolidcube_size(float xsize, float ysize, float zsize)
unsigned int i = 0;
float n[3] = {0.0f};
/* Vertex format */
- unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int nor = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
/* Vertices */
VertexBuffer_init_with_format(&vbo, &format);
@@ -431,7 +431,7 @@ static void drawcube_size(float xsize, float ysize, float zsize)
if (format.attrib_ct == 0) {
/* Vertex format */
- unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
/* Elements */
ElementListBuilder_init(&elb, GL_LINES, 12, 8);
@@ -470,7 +470,7 @@ static void draw_bonevert(void)
if (format.attrib_ct == 0) {
/* Vertex format */
- unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
/* Vertices */
VertexBuffer_init_with_format(&vbo, &format);
@@ -583,7 +583,7 @@ static void draw_bone_octahedral(void)
if (format.attrib_ct == 0) {
/* Vertex format */
- unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
/* Elements */
ElementListBuilder_init(&elb, GL_LINES, 12, 6);
@@ -618,8 +618,8 @@ static void draw_bone_solid_octahedral(void)
if (format.attrib_ct == 0) {
unsigned int v_idx = 0;
/* Vertex format */
- unsigned int pos = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int nor = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
/* Vertices */
VertexBuffer_init_with_format(&vbo, &format);
@@ -811,7 +811,7 @@ static void draw_sphere_bone_dist(float smat[4][4], float imat[4][4], bPoseChann
cross_v3_v3v3(norvec, dirvec, imat[2]);
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immBegin(GL_TRIANGLE_STRIP, 66);
@@ -867,7 +867,7 @@ static void draw_sphere_bone_wire(float smat[4][4], float imat[4][4],
float *headvec, *tailvec, dirvec[3];
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -1108,8 +1108,8 @@ static void draw_sphere_bone(const short dt, int armflag, int boneflag, short co
glPolygonOffset(-1.0f, -1.0f);
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int nor = add_attrib(format, "nor", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int nor = VertexFormat_add_attrib(format, "nor", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_SIMPLE_LIGHTING);
immUniformColor4fv(fcolor);
@@ -1146,7 +1146,7 @@ static void draw_line_bone(int armflag, int boneflag, short constflag, unsigned
length = ebone->length;
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
gpuPushMatrix();
gpuScaleUniform(length);
@@ -1452,7 +1452,7 @@ static void draw_b_bone(const short dt, int armflag, int boneflag, short constfl
static void draw_wire_bone_segments(bPoseChannel *pchan, Mat4 *bbones, float length, int segments)
{
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(fcolor);
@@ -1633,7 +1633,7 @@ static void pchan_draw_IK_root_lines(bPoseChannel *pchan, short only_temp)
bPoseChannel *parchan;
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4fv(fcolor);
@@ -1792,7 +1792,7 @@ static void draw_pose_dofs(Object *ob)
Bone *bone;
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -2202,7 +2202,7 @@ static void draw_pose_bones(Scene *scene, SceneLayer *sl, View3D *v3d, ARegion *
*/
if ((do_dashed & DASH_HELP_LINES) && ((bone->flag & BONE_CONNECTED) == 0)) {
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -2502,7 +2502,7 @@ static void draw_ebones(View3D *v3d, ARegion *ar, Object *ob, const short dt)
/* offset to parent */
if (eBone->parent) {
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
GPU_select_load_id(-1); /* -1 here is OK! */
diff --git a/source/blender/editors/space_view3d/drawobject.c b/source/blender/editors/space_view3d/drawobject.c
index 19f8f6eae6f..726a67a5d74 100644
--- a/source/blender/editors/space_view3d/drawobject.c
+++ b/source/blender/editors/space_view3d/drawobject.c
@@ -539,7 +539,7 @@ void drawaxes(const float viewmat_local[4][4], float size, char drawtype, const
glLineWidth(1.0f);
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
if (color) {
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4ubv(color);
@@ -706,8 +706,8 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
}
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
- unsigned texCoord = add_attrib(format, "texCoord", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int texCoord = VertexFormat_add_attrib(format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_IMAGE_MODULATE_ALPHA);
immUniform1f("alpha", ob_alpha);
immUniform1i("image", 0); /* default GL_TEXTURE0 unit */
@@ -733,7 +733,7 @@ static void draw_empty_image(Object *ob, const short dflag, const unsigned char
/* Draw the image outline */
glLineWidth(1.5f);
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
const bool picking = dflag & DRAW_CONSTCOLOR;
if (picking) {
@@ -806,7 +806,7 @@ static void drawcentercircle(View3D *v3d, RegionView3D *UNUSED(rv3d), const floa
glEnable(GL_BLEND);
GPU_enable_program_point_size();
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_UNIFORM_SIZE_UNIFORM_COLOR_OUTLINE_AA);
immUniform1f("size", size);
@@ -1266,7 +1266,7 @@ void drawlamp(View3D *v3d, RegionView3D *rv3d, Base *base,
normalize_v3(imat[0]);
normalize_v3(imat[1]);
- const unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
/* lamp center */
copy_v3_v3(vec, ob->obmat[3]);
@@ -1816,7 +1816,7 @@ static void draw_viewport_object_reconstruction(
if (reconstruction->camnr >= 2) {
MovieReconstructedCamera *camera = reconstruction->cameras;
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_CAMERA_PATH);
@@ -2168,7 +2168,7 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
BKE_camera_view_frame_ex(scene, cam, cam->drawsize, is_view, scale,
asp, shift, &drawsize, vec);
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) {
immUniformColor3ubv(ob_wire_col);
@@ -2277,7 +2277,7 @@ void drawcamera(Scene *scene, View3D *v3d, RegionView3D *rv3d, Base *base,
void drawspeaker(const unsigned char ob_wire_col[3])
{
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -2442,10 +2442,10 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign
}
VertexFormat *format = immVertexFormat();
- unsigned int color, pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int color, pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
if (actdef_wcol) {
- color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT);
+ color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
}
else {
@@ -2499,8 +2499,8 @@ static void drawlattice(View3D *v3d, Object *ob, const short dflag, const unsign
if (v3d->zbuf) glDisable(GL_DEPTH_TEST);
VertexFormat *v_format = immVertexFormat();
- unsigned int v_pos = add_attrib(v_format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int v_color = add_attrib(v_format, "color", GL_FLOAT, 4, KEEP_FLOAT);
+ unsigned int v_pos = VertexFormat_add_attrib(v_format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int v_color = VertexFormat_add_attrib(v_format, "color", COMP_F32, 4, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_VARYING_COLOR);
@@ -2560,8 +2560,8 @@ static void drawSelectedVertices(DerivedMesh *dm, Mesh *me)
data.col[1] = sel_col;
data.col[2] = act_col;
- data.color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ data.color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
if (dm->getNumVerts(dm) == 0) return;
@@ -2632,7 +2632,7 @@ static void draw_dm_face_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
data.bm = em->bm;
data.normalsize = scene->toolsettings->normalsize;
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
calcDrawDMNormalScale(ob, &data);
@@ -2666,7 +2666,7 @@ static void draw_dm_face_centers(BMEditMesh *em, DerivedMesh *dm, bool select, c
drawBMSelect_userData data;
data.bm = em->bm;
data.select = select;
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
if (dm->getNumPolys(dm) == 0) return;
@@ -2718,7 +2718,7 @@ static void draw_dm_vert_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
data.bm = em->bm;
data.normalsize = scene->toolsettings->normalsize;
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
calcDrawDMNormalScale(ob, &data);
@@ -2779,8 +2779,8 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
data.sel = sel;
data.eve_act = eve_act;
data.bm = em->bm;
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- data.color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.color = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
/* Cache theme values */
UI_GetThemeColor4ubv(TH_EDITMESH_ACTIVE, data.th_editmesh_active);
@@ -2811,7 +2811,7 @@ static void draw_dm_verts(BMEditMesh *em, DerivedMesh *dm, const char sel, BMVer
data.cd_vskin_offset = CustomData_get_offset(&em->bm->vdata, CD_MVERT_SKIN);
if (data.cd_vskin_offset != -1) {
- data.pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor4ubv(data.th_skin_root);
@@ -3136,7 +3136,7 @@ static void draw_dm_loop_normals(BMEditMesh *em, Scene *scene, Object *ob, Deriv
data.bm = em->bm;
data.normalsize = scene->toolsettings->normalsize;
- data.pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ data.pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
if (dm->getNumLoops(dm) == 0) return;
@@ -3316,8 +3316,8 @@ static void draw_dm_bweights(BMEditMesh *em, Scene *scene, DerivedMesh *dm)
/* is that ever true? */
if (data.cd_layer_offset != -1) {
VertexFormat *format = immVertexFormat();
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
@@ -5114,7 +5114,7 @@ static bool draw_mesh_object_new(Scene *scene, SceneLayer *sl, ARegion *ar, View
static void drawDispListVerts(int dt, const void *data, unsigned int vert_ct, const unsigned char wire_col[3])
{
VertexFormat format = {0};
- unsigned int pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
VertexBuffer_allocate_data(vbo, vert_ct);
@@ -5142,9 +5142,9 @@ static void drawDispListElem(bool quads, bool UNUSED(smooth), const float *data,
const int *idx = elem;
unsigned int pos_id, nor_id;
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
if (ndata) {
- nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT);
+ nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
}
ElementListBuilder elb;
@@ -5586,9 +5586,9 @@ static void draw_vertex_array(int dt, const float *vert, const float *nor, const
{
VertexFormat format = {0};
unsigned int pos_id, nor_id, col_id;
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- if (nor) nor_id = add_attrib(&format, "nor", GL_FLOAT, 3, KEEP_FLOAT);
- if (color) col_id = add_attrib(&format, "color", GL_FLOAT, 3, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ if (nor) nor_id = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ if (color) col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, 3, KEEP_FLOAT);
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
VertexBuffer_allocate_data(vbo, vert_ct);
@@ -6114,7 +6114,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
}
else {
if ((draw_as == PART_DRAW_CIRC) || (part->draw & PART_DRAW_SIZE)) {
- pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
imm_cpack(0xFFFFFF);
}
@@ -6311,7 +6311,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
MVert *mvert = hair_dm->getVertArray(hair_dm);
int i;
- unsigned int pos_id = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3f(0.9f, 0.4f, 0.4f);
@@ -6351,7 +6351,7 @@ static void draw_new_particle_system(Scene *scene, View3D *v3d, RegionView3D *rv
int *res = clmd->hair_grid_res;
int i;
- unsigned int pos_id = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos_id = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (select)
immUniformThemeColor(TH_ACTIVE);
@@ -6584,8 +6584,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
col_comp = ((point->flag & PEP_HIDE) || timed) ? 4 : 3;
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- col_id = add_attrib(&format, "color", GL_FLOAT, col_comp, KEEP_FLOAT);
+ pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, col_comp, KEEP_FLOAT);
VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
VertexBuffer_allocate_data(vbo, path->segments + 1);
@@ -6635,9 +6635,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
int totkeys_visible = 0;
VertexFormat format = {0};
- unsigned int pos_id, col_id;
- pos_id = add_attrib(&format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- col_id = add_attrib(&format, "color", GL_FLOAT, (timed ? 4 : 3), KEEP_FLOAT);
+ unsigned int pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int col_id = VertexFormat_add_attrib(&format, "color", COMP_F32, (timed ? 4 : 3), KEEP_FLOAT);
for (i = 0, point = edit->points; i < totpoint; i++, point++)
if (!(point->flag & PEP_HIDE))
@@ -6702,8 +6701,8 @@ static void draw_ptcache_edit(Scene *scene, View3D *v3d, PTCacheEdit *edit)
}
else if (pset->selectmode == SCE_SELECT_END) {
VertexFormat *format = immVertexFormat();
- unsigned int pos_id = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int col_id = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos_id = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int col_id = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
immBeginAtMost(GL_POINTS, totpoint);
for (i = 0, point = edit->points; i < totpoint; i++, point++) {
@@ -6738,8 +6737,8 @@ static void ob_draw_RE_motion(float com[3], float rotscale[3][3], float itw, flo
float th = ith * drw_size;
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 4, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
immBegin(GL_LINES, 30);
@@ -6890,8 +6889,8 @@ static void drawhandlesN(Nurb *nu, const char sel, const bool hide_handles)
}
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
glLineWidth(1.0f);
@@ -6945,7 +6944,7 @@ static void drawhandlesN_active(Nurb *nu)
if (nu->hide) return;
if (nu->type == CU_BEZIER && nu->pntsu > 0) {
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE_SPLINE);
glLineWidth(2.0f);
@@ -6989,8 +6988,8 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve
if (count == 0) return;
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned color = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
unsigned char vert_color[3];
@@ -7063,7 +7062,7 @@ static void drawvertsN(const Nurb *nurb, const bool hide_handles, const void *ve
static void editnurb_draw_active_poly(Nurb *nu)
{
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE_SPLINE);
@@ -7090,7 +7089,7 @@ static void editnurb_draw_active_nurbs(Nurb *nu)
{
if (nu->pntsv > 0) {
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_ACTIVE_SPLINE);
@@ -7158,7 +7157,7 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
}
format = immVertexFormat();
- pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
glLineWidth(1.0f);
@@ -7188,8 +7187,8 @@ static void draw_editnurb_splines(Object *ob, Nurb *nurb, const bool sel)
}
format = immVertexFormat();
- pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
// just quick guesstimate of how many verts to draw
@@ -7323,7 +7322,7 @@ static void draw_editnurb(
BevList *bl;
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(TH_WIRE_EDIT);
@@ -7391,7 +7390,7 @@ static void draw_editnurb(
static void draw_editfont_textcurs(RegionView3D *rv3d, float textcurs[4][2])
{
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
ED_view3d_polygon_offset(rv3d, -1.0);
set_inverted_drawing(1);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -7429,7 +7428,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
}
if (cu->linewidth != 0.0f) {
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
immUniformThemeColor(TH_WIRE_EDIT);
copy_v3_v3(vec1, ob->orig);
@@ -7450,7 +7449,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
setlinestyle(3);
for (int i = 0; i < cu->totbox; i++) {
if (cu->tb[i].w != 0.0f) {
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformThemeColor(i == (cu->actbox - 1) ? TH_ACTIVE : TH_WIRE);
vec1[0] = cu->xof + cu->tb[i].x;
@@ -7477,7 +7476,7 @@ static void draw_editfont(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3
const int seltot = selend - selstart;
float selboxw;
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
imm_cpack(0xffffff);
set_inverted_drawing(1);
@@ -7775,7 +7774,7 @@ static bool drawmball(Scene *scene, SceneLayer *sl, View3D *v3d, RegionView3D *r
glLineWidth(1.0f);
- const int unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
while (ml) {
@@ -7831,7 +7830,7 @@ static void draw_forcefield(Object *ob, RegionView3D *rv3d,
normalize_v3(imat[1]);
#endif
- const int unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ const unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3fv(draw_color);
@@ -8033,7 +8032,7 @@ static void imm_draw_bb(BoundBox *bb, char type, bool around_origin, const unsig
gpuPushMatrix();
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8111,7 +8110,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col
if (type == OB_BOUND_BOX) {
float vec[8][3], size[3];
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8134,7 +8133,7 @@ void draw_bounding_volume(Object *ob, char type, const unsigned char ob_wire_col
}
else {
if (type == OB_BOUND_BOX) {
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8178,7 +8177,7 @@ static void drawtexspace(Object *ob, const unsigned char ob_wire_col[3])
setlinestyle(2);
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
if (ob_wire_col) {
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
@@ -8318,7 +8317,7 @@ static void draw_rigid_body_pivot(bRigidBodyJointConstraint *data,
const char *axis_str[3] = {"px", "py", "pz"};
float mat[4][4];
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8465,7 +8464,7 @@ void draw_rigidbody_shape(Object *ob, const unsigned char ob_wire_col[4])
case RB_SHAPE_BOX:
BKE_boundbox_calc_size_aabb(bb, size);
- pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -8929,7 +8928,7 @@ afterdraw:
if (!render_override) {
BoundBox bb;
float p0[3], p1[3];
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
if (ob_wire_col) immUniformColor3ubv(ob_wire_col);
@@ -9067,7 +9066,7 @@ afterdraw:
{
float imat[4][4], vec[3] = {0.0f, 0.0f, 0.0f};
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
invert_m4_m4(imat, rv3d->viewmatob);
@@ -9122,7 +9121,7 @@ afterdraw:
if ((base->sx != IS_CLIPPED) &&
(U.obcenter_dia != 0.0))
{
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_POINT_FIXED_SIZE_UNIFORM_COLOR);
/* TODO: short term, use DEPTH_ONLY shader or set appropriate color */
/* TODO: long term, solve picking & selection problem better */
@@ -9151,7 +9150,7 @@ afterdraw:
ListBase *list;
RigidBodyCon *rbc = ob->rigidbody_constraint;
- unsigned int pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_UNIFORM_COLOR);
immUniformColor3ubv(ob_wire_col);
@@ -9337,8 +9336,8 @@ static void bbs_obmode_mesh_verts(Object *ob, DerivedMesh *dm, int offset)
if (dm->getNumVerts(dm) == 0) return;
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
@@ -9370,8 +9369,8 @@ static void bbs_mesh_verts(BMEditMesh *em, DerivedMesh *dm, int offset)
data.bm = em->bm;
data.offset = offset;
VertexFormat *format = immVertexFormat();
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
@@ -9460,8 +9459,8 @@ static void bbs_mesh_solid_EM(BMEditMesh *em, Scene *scene, View3D *v3d,
drawBMOffset_userData data; /* don't use offset */
data.bm = em->bm;
VertexFormat *format = immVertexFormat();
- data.pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- data.col = add_attrib(format, "color", GL_UNSIGNED_BYTE, 3, NORMALIZE_INT_TO_FLOAT);
+ data.pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ data.col = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
diff --git a/source/blender/editors/space_view3d/drawsimdebug.c b/source/blender/editors/space_view3d/drawsimdebug.c
index 5984633112d..da39a81a4d8 100644
--- a/source/blender/editors/space_view3d/drawsimdebug.c
+++ b/source/blender/editors/space_view3d/drawsimdebug.c
@@ -49,8 +49,8 @@
static void draw_sim_debug_elements(SimDebugData *debug_data, float imat[4][4])
{
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 3, KEEP_FLOAT);
- unsigned int color = add_attrib(format, "color", GL_FLOAT, 3, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_F32, 3, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index a2b59e9021d..27db505951b 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -523,7 +523,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
y2i = (int)(y2 + (1.0f - 0.0001f));
/* use the same program for everything */
- unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
/* passepartout, specified in camera edit buttons */
@@ -724,7 +724,7 @@ static void drawviewborder(Scene *scene, ARegion *ar, View3D *v3d)
static void drawrenderborder(ARegion *ar, View3D *v3d)
{
/* use the same program for everything */
- unsigned pos = add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
glLineWidth(1.0f);
@@ -813,8 +813,8 @@ static void view3d_draw_background_gradient(void)
/* TODO: finish 2D API & draw background with that */
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
unsigned char col_hi[3], col_lo[3];
immBindBuiltinProgram(GPU_SHADER_2D_SMOOTH_COLOR);
@@ -1107,8 +1107,8 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
#endif
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
@@ -1283,8 +1283,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3];
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
@@ -1371,8 +1371,8 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit, bool wr
/* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
immBegin(GL_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
@@ -1527,8 +1527,8 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
glLineWidth(1.0f);
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int color = add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
@@ -1553,7 +1553,7 @@ static void drawcursor(Scene *scene, ARegion *ar, View3D *v3d)
immUnbindProgram();
VertexFormat_clear(format);
- pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
@@ -1612,8 +1612,8 @@ static void draw_view_axis(RegionView3D *rv3d, rcti *rect)
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned col = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
immBegin(GL_LINES, 6);
@@ -1656,8 +1656,8 @@ static void draw_rotation_guide(RegionView3D *rv3d)
glDepthMask(GL_FALSE); /* don't overwrite zbuf */
VertexFormat *format = immVertexFormat();
- unsigned pos = add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
- unsigned col = add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ unsigned int col = VertexFormat_add_attrib(format, "color", COMP_U8, 4, NORMALIZE_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_3D_SMOOTH_COLOR);
diff --git a/source/blender/editors/space_view3d/view3d_fly.c b/source/blender/editors/space_view3d/view3d_fly.c
index 328e0b03bb8..c324cb7b251 100644
--- a/source/blender/editors/space_view3d/view3d_fly.c
+++ b/source/blender/editors/space_view3d/view3d_fly.c
@@ -260,7 +260,7 @@ static void drawFlyPixel(const struct bContext *UNUSED(C), ARegion *UNUSED(ar),
y2 = yoff + 0.55f * fly->height;
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
diff --git a/source/blender/editors/space_view3d/view3d_ruler.c b/source/blender/editors/space_view3d/view3d_ruler.c
index 414687636b0..c0618cf2c6d 100644
--- a/source/blender/editors/space_view3d/view3d_ruler.c
+++ b/source/blender/editors/space_view3d/view3d_ruler.c
@@ -460,7 +460,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
glEnable(GL_BLEND);
if (ruler_item->flag & RULERITEM_USE_ANGLE) {
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
imm_cpack(is_act ? color_act : color_base);
@@ -602,7 +602,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
}
}
else {
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
imm_cpack(is_act ? color_act : color_base);
@@ -705,7 +705,7 @@ static void ruler_info_draw_pixel(const struct bContext *C, ARegion *ar, void *a
float co_ss[3];
ED_view3d_project_float_global(ar, ruler_item->co[ruler_item->co_index], co_ss, V3D_PROJ_TEST_NOP);
- unsigned pos = add_attrib(immVertexFormat(), "pos", GL_FLOAT, 2, KEEP_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(immVertexFormat(), "pos", COMP_F32, 2, KEEP_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);
imm_cpack(color_act);
diff --git a/source/blender/editors/space_view3d/view3d_walk.c b/source/blender/editors/space_view3d/view3d_walk.c
index 8390d56c610..48c16de4dbe 100644
--- a/source/blender/editors/space_view3d/view3d_walk.c
+++ b/source/blender/editors/space_view3d/view3d_walk.c
@@ -341,7 +341,7 @@ static void drawWalkPixel(const struct bContext *UNUSED(C), ARegion *ar, void *a
}
VertexFormat *format = immVertexFormat();
- unsigned int pos = add_attrib(format, "pos", GL_INT, 2, CONVERT_INT_TO_FLOAT);
+ unsigned int pos = VertexFormat_add_attrib(format, "pos", COMP_I32, 2, CONVERT_INT_TO_FLOAT);
immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR);