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:
authorCampbell Barton <ideasman42@gmail.com>2017-06-19 13:18:04 +0300
committerCampbell Barton <ideasman42@gmail.com>2017-06-19 13:18:04 +0300
commitb4d053efc75424fca4b413ac1bc7a7e826fac629 (patch)
tree80647d9ca9109e997fce9911f202f98d7f8577d4 /source/blender/draw/intern
parent349946bd010b1112b13c8594aabfb318c330bc0d (diff)
Gawain API naming refactor
Use consistent prefix for gawain API names as well as some abbreviations to avoid over-long names, see: D2678
Diffstat (limited to 'source/blender/draw/intern')
-rw-r--r--source/blender/draw/intern/DRW_render.h14
-rw-r--r--source/blender/draw/intern/draw_armature.c28
-rw-r--r--source/blender/draw/intern/draw_cache.c1146
-rw-r--r--source/blender/draw/intern/draw_cache.h164
-rw-r--r--source/blender/draw/intern/draw_cache_impl.h70
-rw-r--r--source/blender/draw/intern/draw_cache_impl_curve.c216
-rw-r--r--source/blender/draw/intern/draw_cache_impl_displist.c28
-rw-r--r--source/blender/draw/intern/draw_cache_impl_lattice.c76
-rw-r--r--source/blender/draw/intern/draw_cache_impl_mesh.c822
-rw-r--r--source/blender/draw/intern/draw_cache_impl_particles.c100
-rw-r--r--source/blender/draw/intern/draw_common.c24
-rw-r--r--source/blender/draw/intern/draw_common.h28
-rw-r--r--source/blender/draw/intern/draw_manager.c70
-rw-r--r--source/blender/draw/intern/draw_view.c46
14 files changed, 1416 insertions, 1416 deletions
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 3ea46531379..7c47f47100b 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -60,7 +60,7 @@ struct GPUMaterial;
struct GPUTexture;
struct GPUUniformBuffer;
struct Object;
-struct Batch;
+struct Gwn_Batch;
struct DefaultFramebufferList;
struct DefaultTextureList;
struct DRWTextStore;
@@ -262,22 +262,22 @@ typedef enum {
DRWShadingGroup *DRW_shgroup_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_material_create(struct GPUMaterial *material, DRWPass *pass);
-DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, struct Batch *geom);
-DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, struct Batch *geom);
+DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, struct Gwn_Batch *geom);
+DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, struct Gwn_Batch *geom);
DRWShadingGroup *DRW_shgroup_point_batch_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_line_batch_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_empty_tri_batch_create(struct GPUShader *shader, DRWPass *pass, int size);
typedef void (DRWCallGenerateFn)(
DRWShadingGroup *shgroup,
- void (*draw_fn)(DRWShadingGroup *shgroup, struct Batch *geom),
+ void (*draw_fn)(DRWShadingGroup *shgroup, struct Gwn_Batch *geom),
void *user_data);
-void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Batch *instances);
+void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Gwn_Batch *instances);
void DRW_shgroup_free(struct DRWShadingGroup *shgroup);
-void DRW_shgroup_call_add(DRWShadingGroup *shgroup, struct Batch *geom, float (*obmat)[4]);
-void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, struct Batch *geom, struct Object *ob);
+void DRW_shgroup_call_add(DRWShadingGroup *shgroup, struct Gwn_Batch *geom, float (*obmat)[4]);
+void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, struct Gwn_Batch *geom, struct Object *ob);
void DRW_shgroup_call_sculpt_add(DRWShadingGroup *shgroup, struct Object *ob, float (*obmat)[4]);
void DRW_shgroup_call_generate_add(
DRWShadingGroup *shgroup, DRWCallGenerateFn *geometry_fn, void *user_data, float (*obmat)[4]);
diff --git a/source/blender/draw/intern/draw_armature.c b/source/blender/draw/intern/draw_armature.c
index 47af8a3c8a4..e31fbeb054c 100644
--- a/source/blender/draw/intern/draw_armature.c
+++ b/source/blender/draw/intern/draw_armature.c
@@ -101,7 +101,7 @@ static struct {
static void DRW_shgroup_bone_octahedral_solid(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_octahedral_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_octahedral_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_octahedral_get();
g_data.bone_octahedral_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -111,7 +111,7 @@ static void DRW_shgroup_bone_octahedral_solid(const float (*bone_mat)[4], const
static void DRW_shgroup_bone_octahedral_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_octahedral_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_octahedral_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_octahedral_wire_outline_get();
g_data.bone_octahedral_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -122,7 +122,7 @@ static void DRW_shgroup_bone_octahedral_wire(const float (*bone_mat)[4], const f
static void DRW_shgroup_bone_box_solid(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_box_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_box_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_box_get();
g_data.bone_box_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -132,7 +132,7 @@ static void DRW_shgroup_bone_box_solid(const float (*bone_mat)[4], const float c
static void DRW_shgroup_bone_box_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_box_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_box_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_box_wire_outline_get();
g_data.bone_box_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -143,7 +143,7 @@ static void DRW_shgroup_bone_box_wire(const float (*bone_mat)[4], const float co
static void DRW_shgroup_bone_wire_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_wire_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_wire_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_wire_wire_outline_get();
g_data.bone_wire_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -157,7 +157,7 @@ static void DRW_shgroup_bone_envelope_distance(
{
if (g_data.pass_bone_envelope != NULL) {
if (g_data.bone_envelope_distance == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_distance_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_distance_outline_get();
/* Note: bone_wire draw pass is not really working, think we need another one here? */
g_data.bone_envelope_distance = shgroup_instance_bone_envelope_wire(g_data.pass_bone_envelope, geom, g_data.ob->obmat);
}
@@ -171,7 +171,7 @@ static void DRW_shgroup_bone_envelope_solid(
const float *radius_head, const float *radius_tail)
{
if (g_data.bone_envelope_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_solid_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_solid_get();
g_data.bone_envelope_solid = shgroup_instance_bone_envelope_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -183,7 +183,7 @@ static void DRW_shgroup_bone_envelope_wire(
const float *radius_head, const float *radius_tail, const float *distance)
{
if (g_data.bone_envelope_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_wire_outline_get();
g_data.bone_envelope_wire = shgroup_instance_bone_envelope_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -195,7 +195,7 @@ static void DRW_shgroup_bone_envelope_head_wire(
const float *radius_head, const float *radius_tail, const float *distance)
{
if (g_data.bone_envelope_head_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_envelope_head_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_envelope_head_wire_outline_get();
g_data.bone_envelope_head_wire = shgroup_instance_bone_envelope_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -207,7 +207,7 @@ static void DRW_shgroup_bone_envelope_head_wire(
static void DRW_shgroup_bone_custom_solid(const float (*bone_mat)[4], const float color[4], Object *custom)
{
/* grr, not re-using instances! */
- struct Batch *geom = DRW_cache_object_surface_get(custom);
+ struct Gwn_Batch *geom = DRW_cache_object_surface_get(custom);
if (geom) {
DRWShadingGroup *shgrp_geom_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
DRW_shgroup_call_dynamic_add(shgrp_geom_solid, bone_mat, color);
@@ -217,7 +217,7 @@ static void DRW_shgroup_bone_custom_solid(const float (*bone_mat)[4], const floa
static void DRW_shgroup_bone_custom_wire(const float (*bone_mat)[4], const float color[4], Object *custom)
{
/* grr, not re-using instances! */
- struct Batch *geom = DRW_cache_object_wire_outline_get(custom);
+ struct Gwn_Batch *geom = DRW_cache_object_wire_outline_get(custom);
if (geom) {
DRWShadingGroup *shgrp_geom_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
DRW_shgroup_call_dynamic_add(shgrp_geom_wire, bone_mat, color);
@@ -228,7 +228,7 @@ static void DRW_shgroup_bone_custom_wire(const float (*bone_mat)[4], const float
static void DRW_shgroup_bone_point_solid(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_point_solid == NULL) {
- struct Batch *geom = DRW_cache_bone_point_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_point_get();
g_data.bone_point_solid = shgroup_instance_objspace_solid(g_data.pass_bone_solid, geom, g_data.ob->obmat);
}
@@ -238,7 +238,7 @@ static void DRW_shgroup_bone_point_solid(const float (*bone_mat)[4], const float
static void DRW_shgroup_bone_point_wire(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_point_wire == NULL) {
- struct Batch *geom = DRW_cache_bone_point_wire_outline_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_point_wire_outline_get();
g_data.bone_point_wire = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
@@ -249,7 +249,7 @@ static void DRW_shgroup_bone_point_wire(const float (*bone_mat)[4], const float
static void DRW_shgroup_bone_axes(const float (*bone_mat)[4], const float color[4])
{
if (g_data.bone_axes == NULL) {
- struct Batch *geom = DRW_cache_bone_arrows_get();
+ struct Gwn_Batch *geom = DRW_cache_bone_arrows_get();
g_data.bone_axes = shgroup_instance_objspace_wire(g_data.pass_bone_wire, geom, g_data.ob->obmat);
}
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c
index 41541252bea..4dfb9f960c2 100644
--- a/source/blender/draw/intern/draw_cache.c
+++ b/source/blender/draw/intern/draw_cache.c
@@ -39,53 +39,53 @@
#include "draw_cache_impl.h"
static struct DRWShapeCache {
- Batch *drw_single_vertice;
- Batch *drw_fullscreen_quad;
- Batch *drw_screenspace_circle;
- Batch *drw_plain_axes;
- Batch *drw_single_arrow;
- Batch *drw_cube;
- Batch *drw_circle;
- Batch *drw_square;
- Batch *drw_line;
- Batch *drw_line_endpoints;
- Batch *drw_empty_sphere;
- Batch *drw_empty_cone;
- Batch *drw_arrows;
- Batch *drw_axis_names;
- Batch *drw_image_plane;
- Batch *drw_image_plane_wire;
- Batch *drw_field_wind;
- Batch *drw_field_force;
- Batch *drw_field_vortex;
- Batch *drw_field_tube_limit;
- Batch *drw_field_cone_limit;
- Batch *drw_lamp;
- Batch *drw_lamp_sunrays;
- Batch *drw_lamp_area;
- Batch *drw_lamp_hemi;
- Batch *drw_lamp_spot;
- Batch *drw_lamp_spot_square;
- Batch *drw_speaker;
- Batch *drw_lightprobe;
- Batch *drw_bone_octahedral;
- Batch *drw_bone_octahedral_wire;
- Batch *drw_bone_box;
- Batch *drw_bone_box_wire;
- Batch *drw_bone_wire_wire;
- Batch *drw_bone_envelope;
- Batch *drw_bone_envelope_distance;
- Batch *drw_bone_envelope_wire;
- Batch *drw_bone_envelope_head_wire;
- Batch *drw_bone_point;
- Batch *drw_bone_point_wire;
- Batch *drw_bone_arrows;
- Batch *drw_camera;
- Batch *drw_camera_tria;
- Batch *drw_camera_focus;
- Batch *drw_particle_cross;
- Batch *drw_particle_circle;
- Batch *drw_particle_axis;
+ Gwn_Batch *drw_single_vertice;
+ Gwn_Batch *drw_fullscreen_quad;
+ Gwn_Batch *drw_screenspace_circle;
+ Gwn_Batch *drw_plain_axes;
+ Gwn_Batch *drw_single_arrow;
+ Gwn_Batch *drw_cube;
+ Gwn_Batch *drw_circle;
+ Gwn_Batch *drw_square;
+ Gwn_Batch *drw_line;
+ Gwn_Batch *drw_line_endpoints;
+ Gwn_Batch *drw_empty_sphere;
+ Gwn_Batch *drw_empty_cone;
+ Gwn_Batch *drw_arrows;
+ Gwn_Batch *drw_axis_names;
+ Gwn_Batch *drw_image_plane;
+ Gwn_Batch *drw_image_plane_wire;
+ Gwn_Batch *drw_field_wind;
+ Gwn_Batch *drw_field_force;
+ Gwn_Batch *drw_field_vortex;
+ Gwn_Batch *drw_field_tube_limit;
+ Gwn_Batch *drw_field_cone_limit;
+ Gwn_Batch *drw_lamp;
+ Gwn_Batch *drw_lamp_sunrays;
+ Gwn_Batch *drw_lamp_area;
+ Gwn_Batch *drw_lamp_hemi;
+ Gwn_Batch *drw_lamp_spot;
+ Gwn_Batch *drw_lamp_spot_square;
+ Gwn_Batch *drw_speaker;
+ Gwn_Batch *drw_lightprobe;
+ Gwn_Batch *drw_bone_octahedral;
+ Gwn_Batch *drw_bone_octahedral_wire;
+ Gwn_Batch *drw_bone_box;
+ Gwn_Batch *drw_bone_box_wire;
+ Gwn_Batch *drw_bone_wire_wire;
+ Gwn_Batch *drw_bone_envelope;
+ Gwn_Batch *drw_bone_envelope_distance;
+ Gwn_Batch *drw_bone_envelope_wire;
+ Gwn_Batch *drw_bone_envelope_head_wire;
+ Gwn_Batch *drw_bone_point;
+ Gwn_Batch *drw_bone_point_wire;
+ Gwn_Batch *drw_bone_arrows;
+ Gwn_Batch *drw_camera;
+ Gwn_Batch *drw_camera_tria;
+ Gwn_Batch *drw_camera_focus;
+ Gwn_Batch *drw_particle_cross;
+ Gwn_Batch *drw_particle_circle;
+ Gwn_Batch *drw_particle_axis;
} SHC = {NULL};
void DRW_shape_cache_free(void)
@@ -145,21 +145,21 @@ void DRW_shape_cache_free(void)
* \{ */
static void add_fancy_edge(
- VertexBuffer *vbo, unsigned int pos_id, unsigned int n1_id, unsigned int n2_id,
+ Gwn_VertBuf *vbo, unsigned int pos_id, unsigned int n1_id, unsigned int n2_id,
unsigned int *v_idx, const float co1[3], const float co2[3],
const float n1[3], const float n2[3])
{
- VertexBuffer_set_attrib(vbo, n1_id, *v_idx, n1);
- VertexBuffer_set_attrib(vbo, n2_id, *v_idx, n2);
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, co1);
+ GWN_vertbuf_attr_set(vbo, n1_id, *v_idx, n1);
+ GWN_vertbuf_attr_set(vbo, n2_id, *v_idx, n2);
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++, co1);
- VertexBuffer_set_attrib(vbo, n1_id, *v_idx, n1);
- VertexBuffer_set_attrib(vbo, n2_id, *v_idx, n2);
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, co2);
+ GWN_vertbuf_attr_set(vbo, n1_id, *v_idx, n1);
+ GWN_vertbuf_attr_set(vbo, n2_id, *v_idx, n2);
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++, co2);
}
static void add_lat_lon_vert(
- VertexBuffer *vbo, unsigned int pos_id, unsigned int nor_id,
+ Gwn_VertBuf *vbo, unsigned int pos_id, unsigned int nor_id,
unsigned int *v_idx, const float rad, const float lat, const float lon)
{
float pos[3], nor[3];
@@ -168,22 +168,22 @@ static void add_lat_lon_vert(
nor[2] = sinf(lat) * sinf(lon);
mul_v3_v3fl(pos, nor, rad);
- VertexBuffer_set_attrib(vbo, nor_id, *v_idx, nor);
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++, pos);
+ GWN_vertbuf_attr_set(vbo, nor_id, *v_idx, nor);
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++, pos);
}
-static VertexBuffer *fill_arrows_vbo(const float scale)
+static Gwn_VertBuf *fill_arrows_vbo(const float scale)
{
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Line */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6 * 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6 * 3);
float v1[3] = {0.0, 0.0, 0.0};
float v2[3] = {0.0, 0.0, 0.0};
@@ -195,21 +195,21 @@ static VertexBuffer *fill_arrows_vbo(const float scale)
v2[axis] = 1.0f;
mul_v3_v3fl(vtmp1, v1, scale);
mul_v3_v3fl(vtmp2, v2, scale);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 0, vtmp1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 1, vtmp2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 0, vtmp1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 1, vtmp2);
v1[axis] = 0.85f;
v1[arrow_axis] = -0.08f;
mul_v3_v3fl(vtmp1, v1, scale);
mul_v3_v3fl(vtmp2, v2, scale);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 2, vtmp1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 3, vtmp2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 2, vtmp1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 3, vtmp2);
v1[arrow_axis] = 0.08f;
mul_v3_v3fl(vtmp1, v1, scale);
mul_v3_v3fl(vtmp2, v2, scale);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 4, vtmp1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 6 + 5, vtmp2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 4, vtmp1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 6 + 5, vtmp2);
/* reset v1 & v2 to zero */
v1[arrow_axis] = v1[axis] = v2[axis] = 0.0f;
@@ -218,18 +218,18 @@ static VertexBuffer *fill_arrows_vbo(const float scale)
return vbo;
}
-static VertexBuffer *sphere_wire_vbo(const float rad)
+static Gwn_VertBuf *sphere_wire_vbo(const float rad)
{
#define NSEGMENTS 32
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 2 * 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 2 * 3);
/* a single ring of vertices */
float p[NSEGMENTS][2];
@@ -254,7 +254,7 @@ static VertexBuffer *sphere_wire_vbo(const float rad)
else
v[0] = 0.0f, v[1] = cv[0], v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 2 + j + (NSEGMENTS * 2 * axis), v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 2 + j + (NSEGMENTS * 2 * axis), v);
}
}
}
@@ -264,7 +264,7 @@ static VertexBuffer *sphere_wire_vbo(const float rad)
}
/* Quads */
-Batch *DRW_cache_fullscreen_quad_get(void)
+Gwn_Batch *DRW_cache_fullscreen_quad_get(void)
{
if (!SHC.drw_fullscreen_quad) {
/* Use a triangle instead of a real quad */
@@ -273,28 +273,28 @@ Batch *DRW_cache_fullscreen_quad_get(void)
float uvs[3][2] = {{ 0.0f, 0.0f}, { 2.0f, 0.0f}, { 0.0f, 2.0f}};
/* Position Only 2D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, uvs; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
- attr_id.uvs = VertexFormat_add_attrib(&format, "uvs", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ attr_id.uvs = GWN_vertformat_attr_add(&format, "uvs", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 3);
for (int i = 0; i < 3; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, pos[i]);
- VertexBuffer_set_attrib(vbo, attr_id.uvs, i, uvs[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, pos[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.uvs, i, uvs[i]);
}
- SHC.drw_fullscreen_quad = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_fullscreen_quad = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_fullscreen_quad;
}
/* Sphere */
-Batch *DRW_cache_sphere_get(void)
+Gwn_Batch *DRW_cache_sphere_get(void)
{
return Batch_get_sphere(2);
}
@@ -306,7 +306,7 @@ Batch *DRW_cache_sphere_get(void)
/** \name Common
* \{ */
-Batch *DRW_cache_cube_get(void)
+Gwn_Batch *DRW_cache_cube_get(void)
{
if (!SHC.drw_cube) {
const GLfloat verts[8][3] = {
@@ -323,59 +323,59 @@ Batch *DRW_cache_cube_get(void)
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 Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 24);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 24);
for (int i = 0; i < 24; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, verts[indices[i]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, verts[indices[i]]);
}
- SHC.drw_cube = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_cube = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_cube;
}
-Batch *DRW_cache_circle_get(void)
+Gwn_Batch *DRW_cache_circle_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_circle) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2);
for (int a = 0; a < CIRCLE_RESOL; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v);
}
- SHC.drw_circle = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_circle = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_circle;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_square_get(void)
+Gwn_Batch *DRW_cache_square_get(void)
{
if (!SHC.drw_square) {
float p[4][3] = {{ 1.0f, 0.0f, 1.0f},
@@ -384,26 +384,26 @@ Batch *DRW_cache_square_get(void)
{-1.0f, 0.0f, 1.0f}};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 8);
for (int i = 0; i < 4; i++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 2, p[i % 4]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 2 + 1, p[(i+1) % 4]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 2, p[i % 4]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 2 + 1, p[(i+1) % 4]);
}
- SHC.drw_square = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_square = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_square;
}
-Batch *DRW_cache_single_line_get(void)
+Gwn_Batch *DRW_cache_single_line_get(void)
{
/* Z axis line */
if (!SHC.drw_line) {
@@ -411,24 +411,24 @@ Batch *DRW_cache_single_line_get(void)
float v2[3] = {0.0f, 0.0f, 1.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v2);
- SHC.drw_line = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_line = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_line;
}
-Batch *DRW_cache_single_line_endpoints_get(void)
+Gwn_Batch *DRW_cache_single_line_endpoints_get(void)
{
/* Z axis line */
if (!SHC.drw_line_endpoints) {
@@ -436,46 +436,46 @@ Batch *DRW_cache_single_line_endpoints_get(void)
float v2[3] = {0.0f, 0.0f, 1.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v2);
- SHC.drw_line_endpoints = Batch_create(PRIM_POINTS, vbo, NULL);
+ SHC.drw_line_endpoints = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
return SHC.drw_line_endpoints;
}
-Batch *DRW_cache_screenspace_circle_get(void)
+Gwn_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 Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL + 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(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, attr_id.pos, a, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a, v);
}
- SHC.drw_screenspace_circle = Batch_create(PRIM_LINE_STRIP, vbo, NULL);
+ SHC.drw_screenspace_circle = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL);
}
return SHC.drw_screenspace_circle;
#undef CIRCLE_RESOL
@@ -488,7 +488,7 @@ Batch *DRW_cache_screenspace_circle_get(void)
/** \name Common Object API
* \{ */
-Batch *DRW_cache_object_wire_outline_get(Object *ob)
+Gwn_Batch *DRW_cache_object_wire_outline_get(Object *ob)
{
switch (ob->type) {
case OB_MESH:
@@ -500,7 +500,7 @@ Batch *DRW_cache_object_wire_outline_get(Object *ob)
}
}
-Batch *DRW_cache_object_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_object_surface_get(Object *ob)
{
switch (ob->type) {
case OB_MESH:
@@ -516,7 +516,7 @@ Batch *DRW_cache_object_surface_get(Object *ob)
}
}
-Batch **DRW_cache_object_surface_material_get(struct Object *ob)
+Gwn_Batch **DRW_cache_object_surface_material_get(struct Object *ob)
{
switch (ob->type) {
case OB_MESH:
@@ -534,7 +534,7 @@ Batch **DRW_cache_object_surface_material_get(struct Object *ob)
/** \name Empties
* \{ */
-Batch *DRW_cache_plain_axes_get(void)
+Gwn_Batch *DRW_cache_plain_axes_get(void)
{
if (!SHC.drw_plain_axes) {
int axis;
@@ -542,46 +542,46 @@ Batch *DRW_cache_plain_axes_get(void)
float v2[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
for (axis = 0; axis < 3; axis++) {
v1[axis] = 1.0f;
v2[axis] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 2, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, axis * 2 + 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, axis * 2 + 1, v2);
/* reset v1 & v2 to zero for next axis */
v1[axis] = v2[axis] = 0.0f;
}
- SHC.drw_plain_axes = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_plain_axes = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_plain_axes;
}
-Batch *DRW_cache_single_arrow_get(void)
+Gwn_Batch *DRW_cache_single_arrow_get(void)
{
if (!SHC.drw_single_arrow) {
float v1[3] = {0.0f, 0.0f, 1.0f}, v2[3], v3[3];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Square Pyramid */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 12);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 12);
v2[0] = 0.035f; v2[1] = 0.035f;
v3[0] = -0.035f; v3[1] = 0.035f;
@@ -597,26 +597,26 @@ Batch *DRW_cache_single_arrow_get(void)
v3[0] = -v3[0];
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, sides * 3 + 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, sides * 3 + 1, v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, sides * 3 + 2, v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, sides * 3 + 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, sides * 3 + 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, sides * 3 + 2, v3);
}
- SHC.drw_single_arrow = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_single_arrow = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_single_arrow;
}
-Batch *DRW_cache_empty_sphere_get(void)
+Gwn_Batch *DRW_cache_empty_sphere_get(void)
{
if (!SHC.drw_empty_sphere) {
- VertexBuffer *vbo = sphere_wire_vbo(1.0f);
- SHC.drw_empty_sphere = Batch_create(PRIM_LINES, vbo, NULL);
+ Gwn_VertBuf *vbo = sphere_wire_vbo(1.0f);
+ SHC.drw_empty_sphere = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_empty_sphere;
}
-Batch *DRW_cache_empty_cone_get(void)
+Gwn_Batch *DRW_cache_empty_cone_get(void)
{
#define NSEGMENTS 8
if (!SHC.drw_empty_cone) {
@@ -629,14 +629,14 @@ Batch *DRW_cache_empty_cone_get(void)
}
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 4);
for (int i = 0; i < NSEGMENTS; ++i) {
float cv[2], v[3];
@@ -645,152 +645,152 @@ Batch *DRW_cache_empty_cone_get(void)
/* cone sides */
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4, v);
v[0] = 0.0f, v[1] = 2.0f, v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 1, v);
/* end ring */
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 2, v);
cv[0] = p[(i + 1) % NSEGMENTS][0];
cv[1] = p[(i + 1) % NSEGMENTS][1];
v[0] = cv[0], v[1] = 0.0f, v[2] = cv[1];
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 3, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 3, v);
}
- SHC.drw_empty_cone = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_empty_cone = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_empty_cone;
#undef NSEGMENTS
}
-Batch *DRW_cache_arrows_get(void)
+Gwn_Batch *DRW_cache_arrows_get(void)
{
if (!SHC.drw_arrows) {
- VertexBuffer *vbo = fill_arrows_vbo(1.0f);
+ Gwn_VertBuf *vbo = fill_arrows_vbo(1.0f);
- SHC.drw_arrows = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_arrows = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_arrows;
}
-Batch *DRW_cache_axis_names_get(void)
+Gwn_Batch *DRW_cache_axis_names_get(void)
{
if (!SHC.drw_axis_names) {
const float size = 0.1f;
float v1[3], v2[3];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* Using 3rd component as axis indicator */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Line */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 14);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 14);
/* X */
copy_v3_fl3(v1, -size, size, 0.0f);
copy_v3_fl3(v2, size, -size, 0.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v2);
copy_v3_fl3(v1, size, size, 0.0f);
copy_v3_fl3(v2, -size, -size, 0.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 3, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 3, v2);
/* Y */
copy_v3_fl3(v1, -size + 0.25f * size, size, 1.0f);
copy_v3_fl3(v2, 0.0f, 0.0f, 1.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 4, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 5, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 4, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 5, v2);
copy_v3_fl3(v1, size - 0.25f * size, size, 1.0f);
copy_v3_fl3(v2, -size + 0.25f * size, -size, 1.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 6, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 7, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 6, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 7, v2);
/* Z */
copy_v3_fl3(v1, -size, size, 2.0f);
copy_v3_fl3(v2, size, size, 2.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 8, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 9, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 8, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 9, v2);
copy_v3_fl3(v1, size, size, 2.0f);
copy_v3_fl3(v2, -size, -size, 2.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 10, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 11, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 10, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 11, v2);
copy_v3_fl3(v1, -size, -size, 2.0f);
copy_v3_fl3(v2, size, -size, 2.0f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 12, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 13, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 12, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 13, v2);
- SHC.drw_axis_names = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_axis_names = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_axis_names;
}
-Batch *DRW_cache_image_plane_get(void)
+Gwn_Batch *DRW_cache_image_plane_get(void)
{
if (!SHC.drw_image_plane) {
const float quad[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, texCoords; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
- attr_id.texCoords = VertexFormat_add_attrib(&format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ attr_id.texCoords = GWN_vertformat_attr_add(&format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
for (uint j = 0; j < 4; j++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, j, quad[j]);
- VertexBuffer_set_attrib(vbo, attr_id.texCoords, j, quad[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, j, quad[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.texCoords, j, quad[j]);
}
- SHC.drw_image_plane = Batch_create(PRIM_TRIANGLE_FAN, vbo, NULL);
+ SHC.drw_image_plane = GWN_batch_create(GWN_PRIM_TRI_FAN, vbo, NULL);
}
return SHC.drw_image_plane;
}
-Batch *DRW_cache_image_plane_wire_get(void)
+Gwn_Batch *DRW_cache_image_plane_wire_get(void)
{
if (!SHC.drw_image_plane_wire) {
const float quad[4][2] = {{0, 0}, {1, 0}, {1, 1}, {0, 1}};
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
for (uint j = 0; j < 4; j++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, j, quad[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, j, quad[j]);
}
- SHC.drw_image_plane_wire = Batch_create(PRIM_LINE_LOOP, vbo, NULL);
+ SHC.drw_image_plane_wire = GWN_batch_create(GWN_PRIM_LINE_LOOP, vbo, NULL);
}
return SHC.drw_image_plane_wire;
}
/* Force Field */
-Batch *DRW_cache_field_wind_get(void)
+Gwn_Batch *DRW_cache_field_wind_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_wind) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 4);
for (int i = 0; i < 4; i++) {
float z = 0.05f * (float)i;
@@ -798,36 +798,36 @@ Batch *DRW_cache_field_wind_get(void)
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
}
}
- SHC.drw_field_wind = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_wind = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_wind;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_field_force_get(void)
+Gwn_Batch *DRW_cache_field_force_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_force) {
float v[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 3);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 3);
for (int i = 0; i < 3; i++) {
float radius = 1.0f + 0.5f * (float)i;
@@ -835,22 +835,22 @@ Batch *DRW_cache_field_force_get(void)
v[0] = radius * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = radius * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2, v);
v[0] = radius * sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = radius * cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * CIRCLE_RESOL * 2 + a * 2 + 1, v);
}
}
- SHC.drw_field_force = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_force = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_force;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_field_vortex_get(void)
+Gwn_Batch *DRW_cache_field_vortex_get(void)
{
#define SPIRAL_RESOL 32
if (!SHC.drw_field_vortex) {
@@ -858,36 +858,36 @@ Batch *DRW_cache_field_vortex_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, SPIRAL_RESOL * 2 + 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, SPIRAL_RESOL * 2 + 1);
for (int a = SPIRAL_RESOL; a > -1; a--) {
v[0] = sinf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
v[1] = cosf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
for (int a = 1; a <= SPIRAL_RESOL; a++) {
v[0] = -sinf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
v[1] = -cosf((2.0f * M_PI * a) / ((float)SPIRAL_RESOL)) * (a / (float)SPIRAL_RESOL);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
- SHC.drw_field_vortex = Batch_create(PRIM_LINE_STRIP, vbo, NULL);
+ SHC.drw_field_vortex = GWN_batch_create(GWN_PRIM_LINE_STRIP, vbo, NULL);
}
return SHC.drw_field_vortex;
#undef SPIRAL_RESOL
}
-Batch *DRW_cache_field_tube_limit_get(void)
+Gwn_Batch *DRW_cache_field_tube_limit_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_tube_limit) {
@@ -895,14 +895,14 @@ Batch *DRW_cache_field_tube_limit_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 2 + 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 2 + 8);
/* Caps */
for (int i = 0; i < 2; i++) {
@@ -911,12 +911,12 @@ Batch *DRW_cache_field_tube_limit_get(void)
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
/* Side Edges */
@@ -926,17 +926,17 @@ Batch *DRW_cache_field_tube_limit_get(void)
v[0] = sinf((2.0f * M_PI * a) / 4.0f);
v[1] = cosf((2.0f * M_PI * a) / 4.0f);
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
- SHC.drw_field_tube_limit = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_tube_limit = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_tube_limit;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_field_cone_limit_get(void)
+Gwn_Batch *DRW_cache_field_cone_limit_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_field_cone_limit) {
@@ -944,14 +944,14 @@ Batch *DRW_cache_field_cone_limit_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 2 + 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 2 + 8);
/* Caps */
for (int i = 0; i < 2; i++) {
@@ -960,12 +960,12 @@ Batch *DRW_cache_field_cone_limit_get(void)
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
/* Side Edges */
@@ -975,11 +975,11 @@ Batch *DRW_cache_field_cone_limit_get(void)
v[0] = z * sinf((2.0f * M_PI * a) / 4.0f);
v[1] = z * cosf((2.0f * M_PI * a) / 4.0f);
v[2] = z;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
}
- SHC.drw_field_cone_limit = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_field_cone_limit = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_field_cone_limit;
#undef CIRCLE_RESOL
@@ -992,52 +992,52 @@ Batch *DRW_cache_field_cone_limit_get(void)
/** \name Lamps
* \{ */
-Batch *DRW_cache_lamp_get(void)
+Gwn_Batch *DRW_cache_lamp_get(void)
{
#define NSEGMENTS 8
if (!SHC.drw_lamp) {
float v[2];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 2);
for (int a = 0; a < NSEGMENTS; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)NSEGMENTS));
v[1] = cosf((2.0f * M_PI * a) / ((float)NSEGMENTS));
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)NSEGMENTS));
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)NSEGMENTS));
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v);
}
- SHC.drw_lamp = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp;
#undef NSEGMENTS
}
-Batch *DRW_cache_lamp_sunrays_get(void)
+Gwn_Batch *DRW_cache_lamp_sunrays_get(void)
{
if (!SHC.drw_lamp_sunrays) {
float v[2], v1[2], v2[2];
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 16);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 16);
for (int a = 0; a < 8; a++) {
v[0] = sinf((2.0f * M_PI * a) / 8.0f);
@@ -1046,50 +1046,50 @@ Batch *DRW_cache_lamp_sunrays_get(void)
mul_v2_v2fl(v1, v, 1.2f);
mul_v2_v2fl(v2, v, 2.5f);
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, a * 2 + 1, v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, a * 2 + 1, v2);
}
- SHC.drw_lamp_sunrays = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_sunrays = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_sunrays;
}
-Batch *DRW_cache_lamp_area_get(void)
+Gwn_Batch *DRW_cache_lamp_area_get(void)
{
if (!SHC.drw_lamp_area) {
float v1[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 8);
v1[0] = v1[1] = 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
v1[0] = -0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 1, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 1, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2, v1);
v1[1] = -0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 3, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 4, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 3, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 4, v1);
v1[0] = 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 5, v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 6, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 5, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 6, v1);
v1[1] = 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 7, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 7, v1);
- SHC.drw_lamp_area = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_area = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_area;
}
-Batch *DRW_cache_lamp_hemi_get(void)
+Gwn_Batch *DRW_cache_lamp_hemi_get(void)
{
#define CIRCLE_RESOL 32
if (!SHC.drw_lamp_hemi) {
@@ -1097,26 +1097,26 @@ Batch *DRW_cache_lamp_hemi_get(void)
int vidx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 * 2 - 6 * 2 * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 * 2 - 6 * 2 * 2);
/* XZ plane */
for (int a = 3; a < CIRCLE_RESOL / 2 - 3; a++) {
v[0] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL) - M_PI / 2);
v[2] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL) - M_PI / 2) - 1.0f;
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
v[0] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL) - M_PI / 2);
v[2] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL) - M_PI / 2) - 1.0f;
v[1] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
/* XY plane */
@@ -1124,12 +1124,12 @@ Batch *DRW_cache_lamp_hemi_get(void)
v[2] = sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL)) - 1.0f;
v[1] = cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[0] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
v[2] = sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL)) - 1.0f;
v[1] = cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[0] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
/* YZ plane full circle */
@@ -1138,22 +1138,22 @@ Batch *DRW_cache_lamp_hemi_get(void)
for (int a = 0; a < CIRCLE_RESOL; a++) {
v[1] = rad * sinf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
v[0] = rad * cosf((2.0f * M_PI * a) / ((float)CIRCLE_RESOL));
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
v[1] = rad * sinf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
v[0] = rad * cosf((2.0f * M_PI * (a + 1)) / ((float)CIRCLE_RESOL));
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
- SHC.drw_lamp_hemi = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_hemi = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_hemi;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_lamp_spot_get(void)
+Gwn_Batch *DRW_cache_lamp_spot_get(void)
{
#define NSEGMENTS 32
if (!SHC.drw_lamp_spot) {
@@ -1175,16 +1175,16 @@ Batch *DRW_cache_lamp_spot_get(void)
}
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, NSEGMENTS * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, NSEGMENTS * 4);
for (int i = 0; i < NSEGMENTS; ++i) {
float cv[2], v[3];
@@ -1193,36 +1193,36 @@ Batch *DRW_cache_lamp_spot_get(void)
/* cone sides */
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4, v);
v[0] = 0.0f, v[1] = 0.0f, v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 1, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 1, v);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4 + 1, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4, n[(i+1) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4 + 1, n[(i+1) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 1, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4, n[(i+1) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 1, n[(i+1) % NSEGMENTS]);
/* end ring */
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 2, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 2, v);
cv[0] = p[(i + 1) % NSEGMENTS][0];
cv[1] = p[(i + 1) % NSEGMENTS][1];
v[0] = cv[0], v[1] = cv[1], v[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, i * 4 + 3, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i * 4 + 3, v);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4 + 2, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n1, i * 4 + 3, n[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4 + 2, neg[(i) % NSEGMENTS]);
- VertexBuffer_set_attrib(vbo, attr_id.n2, i * 4 + 3, neg[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 2, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, i * 4 + 3, n[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 2, neg[(i) % NSEGMENTS]);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, i * 4 + 3, neg[(i) % NSEGMENTS]);
}
- SHC.drw_lamp_spot = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_spot = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_spot;
#undef NSEGMENTS
}
-Batch *DRW_cache_lamp_spot_square_get(void)
+Gwn_Batch *DRW_cache_lamp_spot_square_get(void)
{
if (!SHC.drw_lamp_spot_square) {
float p[5][3] = {{ 0.0f, 0.0f, 0.0f},
@@ -1234,25 +1234,25 @@ Batch *DRW_cache_lamp_spot_square_get(void)
unsigned int v_idx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 16);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 16);
/* piramid sides */
for (int i = 1; i <= 4; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[(i % 4)+1]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, p[((i+1) % 4)+1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[(i % 4)+1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, p[((i+1) % 4)+1]);
}
- SHC.drw_lamp_spot_square = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lamp_spot_square = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lamp_spot_square;
}
@@ -1264,7 +1264,7 @@ Batch *DRW_cache_lamp_spot_square_get(void)
/** \name Speaker
* \{ */
-Batch *DRW_cache_speaker_get(void)
+Gwn_Batch *DRW_cache_speaker_get(void)
{
if (!SHC.drw_speaker) {
float v[3];
@@ -1272,30 +1272,30 @@ Batch *DRW_cache_speaker_get(void)
int vidx = 0;
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 3 * segments * 2 + 4 * 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 3 * segments * 2 + 4 * 4);
for (int j = 0; j < 3; j++) {
float z = 0.25f * j - 0.125f;
float r = (j == 0 ? 0.5f : 0.25f);
copy_v3_fl3(v, r, 0.0f, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
for (int i = 1; i < segments; i++) {
float x = cosf(2.f * (float)M_PI * i / segments) * r;
float y = sinf(2.f * (float)M_PI * i / segments) * r;
copy_v3_fl3(v, x, y, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
copy_v3_fl3(v, r, 0.0f, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
for (int j = 0; j < 4; j++) {
@@ -1309,14 +1309,14 @@ Batch *DRW_cache_speaker_get(void)
float z = 0.25f * i - 0.125f;
copy_v3_fl3(v, x, y, z);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
if (i == 1) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, v);
}
}
}
- SHC.drw_speaker = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_speaker = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_speaker;
}
@@ -1328,7 +1328,7 @@ Batch *DRW_cache_speaker_get(void)
/** \name Probe
* \{ */
-Batch *DRW_cache_lightprobe_get(void)
+Gwn_Batch *DRW_cache_lightprobe_get(void)
{
#define CIRCLE_RESOL 16
if (!SHC.drw_lightprobe) {
@@ -1337,39 +1337,39 @@ Batch *DRW_cache_lightprobe_get(void)
/* TODO something nicer than just a circle */
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 + 8);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 + 8);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
for (int a = 1; 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, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
if ((a % 2 == 0) && (a % 4 != 0)) {
v[0] *= 0.5f;
v[1] *= 0.5f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] *= 3.0f;
v[1] *= 3.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
v[0] /= 1.5f;
v[1] /= 1.5f;
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
}
v[0] = 0.0f;
v[1] = 1.0f;
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, v);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, v);
- SHC.drw_lightprobe = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_lightprobe = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_lightprobe;
#undef CIRCLE_RESOL
@@ -1429,52 +1429,52 @@ static const float bone_octahedral_solid_normals[8][3] = {
{ 0.00000000f, 0.11043154f, 0.99388373f}
};
-Batch *DRW_cache_bone_octahedral_get(void)
+Gwn_Batch *DRW_cache_bone_octahedral_get(void)
{
if (!SHC.drw_bone_octahedral) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 24);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 24);
for (int i = 0; i < 8; i++) {
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][0]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][1]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_octahedral_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_octahedral_verts[bone_octahedral_solid_tris[i][2]]);
}
- SHC.drw_bone_octahedral = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_octahedral = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_octahedral;
}
-Batch *DRW_cache_bone_octahedral_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_octahedral_wire_outline_get(void)
{
if (!SHC.drw_bone_octahedral_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 12 * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 12 * 2);
for (int i = 0; i < 12; i++) {
const float *co1 = bone_octahedral_verts[bone_octahedral_wire[i * 2]];
@@ -1484,7 +1484,7 @@ Batch *DRW_cache_bone_octahedral_wire_outline_get(void)
add_fancy_edge(vbo, attr_id.pos, attr_id.n1, attr_id.n2, &v_idx, co1, co2, n1, n2);
}
- SHC.drw_bone_octahedral_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_octahedral_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_octahedral_wire;
}
@@ -1557,50 +1557,50 @@ static const float bone_box_solid_normals[12][3] = {
{ 0.0f, 1.0f, 0.0f},
};
-Batch *DRW_cache_bone_box_get(void)
+Gwn_Batch *DRW_cache_bone_box_get(void)
{
if (!SHC.drw_bone_box) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 36);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 36);
for (int i = 0; i < 12; i++) {
for (int j = 0; j < 3; j++) {
- VertexBuffer_set_attrib(vbo, attr_id.nor, v_idx, bone_box_solid_normals[i]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, bone_box_verts[bone_box_solid_tris[i][j]]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, v_idx, bone_box_solid_normals[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, bone_box_verts[bone_box_solid_tris[i][j]]);
}
}
- SHC.drw_bone_box = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_box = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_box;
}
-Batch *DRW_cache_bone_box_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_box_wire_outline_get(void)
{
if (!SHC.drw_bone_box_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 12 * 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 12 * 2);
for (int i = 0; i < 12; i++) {
const float *co1 = bone_box_verts[bone_box_wire[i * 2]];
@@ -1610,35 +1610,35 @@ Batch *DRW_cache_bone_box_wire_outline_get(void)
add_fancy_edge(vbo, attr_id.pos, attr_id.n1, attr_id.n2, &v_idx, co1, co2, n1, n2);
}
- SHC.drw_bone_box_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_box_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_box_wire;
}
-Batch *DRW_cache_bone_wire_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_wire_wire_outline_get(void)
{
if (!SHC.drw_bone_wire_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_F32, 3, KEEP_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 2);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 2);
const float co1[3] = {0.0f, 0.0f, 0.0f};
const float co2[3] = {0.0f, 1.0f, 0.0f};
const float n[3] = {1.0f, 0.0f, 0.0f};
add_fancy_edge(vbo, attr_id.pos, attr_id.n1, attr_id.n2, &v_idx, co1, co2, n, n);
- SHC.drw_bone_wire_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_wire_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_wire_wire;
}
@@ -1654,25 +1654,25 @@ static void benv_lat_lon_to_co(const float lat, const float lon, float r_nor[3])
r_nor[2] = sinf(lat) * sinf(lon);
}
-static void benv_add_tri(VertexBuffer *vbo, uint pos_id, uint *v_idx, float *co1, float *co2, float *co3)
+static void benv_add_tri(Gwn_VertBuf *vbo, uint pos_id, uint *v_idx, float *co1, float *co2, float *co3)
{
/* Given tri and its seven other mirrors along X/Y/Z axes. */
for (int x = -1; x <= 1; x += 2) {
for (int y = -1; y <= 1; y += 2) {
const float head_tail = (y == -1) ? 0.0f : 1.0f;
for (int z = -1; z <= 1; z += 2) {
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++,
- (const float[4]){co1[0] * x, co1[1] * y, co1[2] * z, head_tail});
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++,
- (const float[4]){co2[0] * x, co2[1] * y, co2[2] * z, head_tail});
- VertexBuffer_set_attrib(vbo, pos_id, (*v_idx)++,
- (const float[4]){co3[0] * x, co3[1] * y, co3[2] * z, head_tail});
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++,
+ (const float[4]){co1[0] * x, co1[1] * y, co1[2] * z, head_tail});
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++,
+ (const float[4]){co2[0] * x, co2[1] * y, co2[2] * z, head_tail});
+ GWN_vertbuf_attr_set(vbo, pos_id, (*v_idx)++,
+ (const float[4]){co3[0] * x, co3[1] * y, co3[2] * z, head_tail});
}
}
}
}
-Batch *DRW_cache_bone_envelope_solid_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_solid_get(void)
{
#define CIRCLE_RESOL 32 /* Must be multiple of 4 */
if (!SHC.drw_bone_envelope) {
@@ -1682,15 +1682,15 @@ Batch *DRW_cache_bone_envelope_solid_get(void)
const float lat_inc = M_PI_2 / lat_res;
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, lat_res * lon_res * 8 * 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, lat_res * lon_res * 8 * 6);
float lon = 0.0f;
for (int i = 0; i < lon_res; i++, lon += lon_inc) {
@@ -1713,44 +1713,44 @@ Batch *DRW_cache_bone_envelope_solid_get(void)
/* We need to add 'cylinder' part between the equators (along XZ plane). */
for (int x = -1; x <= 1; x += 2) {
for (int z = -1; z <= 1; z += 2) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co4[0] * x, co4[1], co4[2] * z, 0.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
-
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++,
- (const float[4]){co3[0] * x, co3[1], co3[2] * z, 1.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co4[0] * x, co4[1], co4[2] * z, 0.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
+
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co3[0] * x, co3[1], co3[2] * z, 0.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co4[0] * x, co4[1], co4[2] * z, 1.0f});
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++,
+ (const float[4]){co3[0] * x, co3[1], co3[2] * z, 1.0f});
}
}
}
- SHC.drw_bone_envelope = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_envelope = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_envelope;
}
-Batch *DRW_cache_bone_envelope_distance_outline_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_distance_outline_get(void)
{
#define CIRCLE_RESOL 32 /* Must be multiple of 2 */
if (!SHC.drw_bone_envelope_distance) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL * 2 + 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL * 2 + 6);
/* Encoded triangle strip, vertex shader gives them final correct value. */
for (int i = 0; i < CIRCLE_RESOL + 1; i++) {
@@ -1761,15 +1761,15 @@ Batch *DRW_cache_bone_envelope_distance_outline_get(void)
const float y = -sinf(alpha);
/* { X, Y, head/tail, inner/outer border } */
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 1.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, head_tail, 1.0f});
if (is_headtail_transition) {
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 1.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){x, y, 1.0f - head_tail, 1.0f});
}
}
- SHC.drw_bone_envelope_distance = Batch_create(PRIM_TRIANGLE_STRIP, vbo, NULL);
+ SHC.drw_bone_envelope_distance = GWN_batch_create(GWN_PRIM_TRI_STRIP, vbo, NULL);
}
return SHC.drw_bone_envelope_distance;
#undef CIRCLE_RESOL
@@ -1777,51 +1777,51 @@ Batch *DRW_cache_bone_envelope_distance_outline_get(void)
/* Bone body. */
-Batch *DRW_cache_bone_envelope_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_wire_outline_get(void)
{
if (!SHC.drw_bone_envelope_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 4);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 4);
/* Two lines between head and tail circles. */
/* Encoded lines, vertex shader gives them final correct value. */
/* { X, Y, head/tail, inner/outer border } */
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 0.0f, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 1.0f, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 0.0f, 0.0f});
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 1.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 0.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){ 1.0f, 0.0f, 1.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 0.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){-1.0f, 0.0f, 1.0f, 0.0f});
- SHC.drw_bone_envelope_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_bone_envelope_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_envelope_wire;
}
/* Bone head and tail. */
-Batch *DRW_cache_bone_envelope_head_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_envelope_head_wire_outline_get(void)
{
#define CIRCLE_RESOL 32 /* Must be multiple of 2 */
if (!SHC.drw_bone_envelope_head_wire) {
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned int pos_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 4, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL);
/* Encoded lines, vertex shader gives them final correct value. */
/* Only head circle (tail is drawn in disp_tail_mat space as a head one by draw_armature.c's draw_point()). */
@@ -1831,17 +1831,17 @@ Batch *DRW_cache_bone_envelope_head_wire_outline_get(void)
const float y = -sinf(alpha);
/* { X, Y, head/tail, inner/outer border } */
- VertexBuffer_set_attrib(vbo, pos_id, v_idx++, (const float[4]){ x, y, 0.0f, 0.0f});
+ GWN_vertbuf_attr_set(vbo, pos_id, v_idx++, (const float[4]){ x, y, 0.0f, 0.0f});
}
- SHC.drw_bone_envelope_head_wire = Batch_create(PRIM_LINE_LOOP, vbo, NULL);
+ SHC.drw_bone_envelope_head_wire = GWN_batch_create(GWN_PRIM_LINE_LOOP, vbo, NULL);
}
return SHC.drw_bone_envelope_head_wire;
#undef CIRCLE_RESOL
}
-Batch *DRW_cache_bone_point_get(void)
+Gwn_Batch *DRW_cache_bone_point_get(void)
{
if (!SHC.drw_bone_point) {
const int lon_res = 16;
@@ -1851,16 +1851,16 @@ Batch *DRW_cache_bone_point_get(void)
const float lat_inc = M_PI / lat_res;
unsigned int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, (lat_res - 1) * lon_res * 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, (lat_res - 1) * lon_res * 6);
float lon = 0.0f;
for (int i = 0; i < lon_res; i++, lon += lon_inc) {
@@ -1880,25 +1880,25 @@ Batch *DRW_cache_bone_point_get(void)
}
}
- SHC.drw_bone_point = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_bone_point = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_bone_point;
}
-Batch *DRW_cache_bone_point_wire_outline_get(void)
+Gwn_Batch *DRW_cache_bone_point_wire_outline_get(void)
{
if (!SHC.drw_bone_point_wire) {
- VertexBuffer *vbo = sphere_wire_vbo(0.05f);
- SHC.drw_bone_point_wire = Batch_create(PRIM_LINES, vbo, NULL);
+ Gwn_VertBuf *vbo = sphere_wire_vbo(0.05f);
+ SHC.drw_bone_point_wire = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_point_wire;
}
-Batch *DRW_cache_bone_arrows_get(void)
+Gwn_Batch *DRW_cache_bone_arrows_get(void)
{
if (!SHC.drw_bone_arrows) {
- VertexBuffer *vbo = fill_arrows_vbo(0.25f);
- SHC.drw_bone_arrows = Batch_create(PRIM_LINES, vbo, NULL);
+ Gwn_VertBuf *vbo = fill_arrows_vbo(0.25f);
+ SHC.drw_bone_arrows = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_bone_arrows;
}
@@ -1910,7 +1910,7 @@ Batch *DRW_cache_bone_arrows_get(void)
/** \name Camera
* \{ */
-Batch *DRW_cache_camera_get(void)
+Gwn_Batch *DRW_cache_camera_get(void)
{
if (!SHC.drw_camera) {
float v0 = 0.0f; /* Center point */
@@ -1923,60 +1923,60 @@ Batch *DRW_cache_camera_get(void)
float v7 = 7.0f; /* tria + Y */
int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* use x coordinate to identify the vertex
* the vertex shader take care to place it
* appropriatelly */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 1, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 22);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 22);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v3);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v0);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v4);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v0);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v4);
/* camera frame */
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v3);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v3);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v4);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v3);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v4);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v4);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v4);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v1);
/* tria */
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v5);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v6);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v5);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v6);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v6);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v7);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v6);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v7);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v7);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v5);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v7);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v5);
- SHC.drw_camera = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_camera = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_camera;
}
-Batch *DRW_cache_camera_tria_get(void)
+Gwn_Batch *DRW_cache_camera_tria_get(void)
{
if (!SHC.drw_camera_tria) {
float v5 = 5.0f; /* tria + X */
@@ -1984,25 +1984,25 @@ Batch *DRW_cache_camera_tria_get(void)
float v7 = 7.0f; /* tria + Y */
int v_idx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* use x coordinate to identify the vertex
* the vertex shader take care to place it
* appropriatelly */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 1, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
}
/* Vertices */
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
/* tria */
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v5);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v6);
- VertexBuffer_set_attrib(vbo, attr_id.pos, v_idx++, &v7);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v5);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v6);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, v_idx++, &v7);
- SHC.drw_camera_tria = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ SHC.drw_camera_tria = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return SHC.drw_camera_tria;
}
@@ -2015,24 +2015,24 @@ Batch *DRW_cache_camera_tria_get(void)
* \{ */
/* Object Center */
-Batch *DRW_cache_single_vert_get(void)
+Gwn_Batch *DRW_cache_single_vert_get(void)
{
if (!SHC.drw_single_vertice) {
float v1[3] = {0.0f, 0.0f, 0.0f};
/* Position Only 3D format */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 1);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 1);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 0, v1);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 0, v1);
- SHC.drw_single_vertice = Batch_create(PRIM_POINTS, vbo, NULL);
+ SHC.drw_single_vertice = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
return SHC.drw_single_vertice;
}
@@ -2044,7 +2044,7 @@ Batch *DRW_cache_single_vert_get(void)
/** \name Meshes
* \{ */
-Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
Mesh *me = ob->data;
@@ -2053,7 +2053,7 @@ Batch *DRW_cache_mesh_surface_overlay_get(Object *ob)
void DRW_cache_mesh_wire_overlay_get(
Object *ob,
- Batch **r_tris, Batch **r_ledges, Batch **r_lverts)
+ Gwn_Batch **r_tris, Gwn_Batch **r_ledges, Gwn_Batch **r_lverts)
{
BLI_assert(ob->type == OB_MESH);
@@ -2066,7 +2066,7 @@ void DRW_cache_mesh_wire_overlay_get(
void DRW_cache_mesh_normals_overlay_get(
Object *ob,
- Batch **r_tris, Batch **r_ledges, Batch **r_lverts)
+ Gwn_Batch **r_tris, Gwn_Batch **r_ledges, Gwn_Batch **r_lverts)
{
BLI_assert(ob->type == OB_MESH);
@@ -2077,7 +2077,7 @@ void DRW_cache_mesh_normals_overlay_get(
*r_lverts = DRW_mesh_batch_cache_get_overlay_loose_verts(me);
}
-Batch *DRW_cache_face_centers_get(Object *ob)
+Gwn_Batch *DRW_cache_face_centers_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2086,7 +2086,7 @@ Batch *DRW_cache_face_centers_get(Object *ob)
return DRW_mesh_batch_cache_get_overlay_facedots(me);
}
-Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2094,7 +2094,7 @@ Batch *DRW_cache_mesh_wire_outline_get(Object *ob)
return DRW_mesh_batch_cache_get_fancy_edges(me);
}
-Batch *DRW_cache_mesh_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2102,7 +2102,7 @@ Batch *DRW_cache_mesh_surface_get(Object *ob)
return DRW_mesh_batch_cache_get_triangles_with_normals(me);
}
-Batch *DRW_cache_mesh_surface_weights_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_weights_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2110,7 +2110,7 @@ Batch *DRW_cache_mesh_surface_weights_get(Object *ob)
return DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(me, ob->actdef - 1);
}
-Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2119,7 +2119,7 @@ Batch *DRW_cache_mesh_surface_vert_colors_get(Object *ob)
}
/* Return list of batches */
-Batch **DRW_cache_mesh_surface_shaded_get(Object *ob)
+Gwn_Batch **DRW_cache_mesh_surface_shaded_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2128,7 +2128,7 @@ Batch **DRW_cache_mesh_surface_shaded_get(Object *ob)
}
/* Return list of batches */
-Batch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
+Gwn_Batch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2136,7 +2136,7 @@ Batch **DRW_cache_mesh_surface_texpaint_get(Object *ob)
return DRW_mesh_batch_cache_get_surface_texpaint(me);
}
-Batch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2144,7 +2144,7 @@ Batch *DRW_cache_mesh_surface_texpaint_single_get(Object *ob)
return DRW_mesh_batch_cache_get_surface_texpaint_single(me);
}
-Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2152,7 +2152,7 @@ Batch *DRW_cache_mesh_surface_verts_get(Object *ob)
return DRW_mesh_batch_cache_get_points_with_normals(me);
}
-Batch *DRW_cache_mesh_edges_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_edges_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2160,7 +2160,7 @@ Batch *DRW_cache_mesh_edges_get(Object *ob)
return DRW_mesh_batch_cache_get_all_edges(me);
}
-Batch *DRW_cache_mesh_verts_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_verts_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2168,7 +2168,7 @@ Batch *DRW_cache_mesh_verts_get(Object *ob)
return DRW_mesh_batch_cache_get_all_verts(me);
}
-Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool use_sel)
+Gwn_Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool use_sel)
{
BLI_assert(ob->type == OB_MESH);
@@ -2176,7 +2176,7 @@ Batch *DRW_cache_mesh_edges_paint_overlay_get(Object *ob, bool use_wire, bool us
return DRW_mesh_batch_cache_get_weight_overlay_edges(me, use_wire, use_sel);
}
-Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2184,7 +2184,7 @@ Batch *DRW_cache_mesh_faces_weight_overlay_get(Object *ob)
return DRW_mesh_batch_cache_get_weight_overlay_faces(me);
}
-Batch *DRW_cache_mesh_verts_weight_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_mesh_verts_weight_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_MESH);
@@ -2199,7 +2199,7 @@ Batch *DRW_cache_mesh_verts_weight_overlay_get(Object *ob)
/** \name Curve
* \{ */
-Batch *DRW_cache_curve_edge_wire_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_edge_wire_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2207,7 +2207,7 @@ Batch *DRW_cache_curve_edge_wire_get(Object *ob)
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
}
-Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
+Gwn_Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2215,7 +2215,7 @@ Batch *DRW_cache_curve_edge_normal_get(Object *ob, float normal_size)
return DRW_curve_batch_cache_get_normal_edge(cu, ob->curve_cache, normal_size);
}
-Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2223,7 +2223,7 @@ Batch *DRW_cache_curve_edge_overlay_get(Object *ob)
return DRW_curve_batch_cache_get_overlay_edges(cu);
}
-Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2231,7 +2231,7 @@ Batch *DRW_cache_curve_vert_overlay_get(Object *ob)
return DRW_curve_batch_cache_get_overlay_verts(cu);
}
-Batch *DRW_cache_curve_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_curve_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_CURVE);
@@ -2246,7 +2246,7 @@ Batch *DRW_cache_curve_surface_get(Object *ob)
/** \name Font
* \{ */
-Batch *DRW_cache_text_edge_wire_get(Object *ob)
+Gwn_Batch *DRW_cache_text_edge_wire_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
@@ -2254,7 +2254,7 @@ Batch *DRW_cache_text_edge_wire_get(Object *ob)
return DRW_curve_batch_cache_get_wire_edge(cu, ob->curve_cache);
}
-Batch *DRW_cache_text_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_text_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
@@ -2264,14 +2264,14 @@ Batch *DRW_cache_text_surface_get(Object *ob)
return DRW_curve_batch_cache_get_triangles_with_normals(cu, ob->curve_cache);
}
-Batch *DRW_cache_text_cursor_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_text_cursor_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
return DRW_curve_batch_cache_get_overlay_cursor(cu);
}
-Batch *DRW_cache_text_select_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_text_select_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_FONT);
struct Curve *cu = ob->data;
@@ -2285,7 +2285,7 @@ Batch *DRW_cache_text_select_overlay_get(Object *ob)
/** \name Surface
* \{ */
-Batch *DRW_cache_surf_surface_get(Object *ob)
+Gwn_Batch *DRW_cache_surf_surface_get(Object *ob)
{
BLI_assert(ob->type == OB_SURF);
@@ -2300,7 +2300,7 @@ Batch *DRW_cache_surf_surface_get(Object *ob)
/** \name Lattice
* \{ */
-Batch *DRW_cache_lattice_verts_get(Object *ob)
+Gwn_Batch *DRW_cache_lattice_verts_get(Object *ob)
{
BLI_assert(ob->type == OB_LATTICE);
@@ -2308,7 +2308,7 @@ Batch *DRW_cache_lattice_verts_get(Object *ob)
return DRW_lattice_batch_cache_get_all_verts(lt);
}
-Batch *DRW_cache_lattice_wire_get(Object *ob)
+Gwn_Batch *DRW_cache_lattice_wire_get(Object *ob)
{
BLI_assert(ob->type == OB_LATTICE);
@@ -2316,7 +2316,7 @@ Batch *DRW_cache_lattice_wire_get(Object *ob)
return DRW_lattice_batch_cache_get_all_edges(lt);
}
-Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
+Gwn_Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
{
BLI_assert(ob->type == OB_LATTICE);
@@ -2331,110 +2331,110 @@ Batch *DRW_cache_lattice_vert_overlay_get(Object *ob)
/** \name Particles
* \{ */
-Batch *DRW_cache_particles_get_hair(ParticleSystem *psys)
+Gwn_Batch *DRW_cache_particles_get_hair(ParticleSystem *psys)
{
return DRW_particles_batch_cache_get_hair(psys);
}
-Batch *DRW_cache_particles_get_dots(ParticleSystem *psys)
+Gwn_Batch *DRW_cache_particles_get_dots(ParticleSystem *psys)
{
return DRW_particles_batch_cache_get_dots(psys);
}
-Batch *DRW_cache_particles_get_prim(int type)
+Gwn_Batch *DRW_cache_particles_get_prim(int type)
{
switch (type) {
case PART_DRAW_CROSS:
if (!SHC.drw_particle_cross) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, axis_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "inst_pos", COMP_F32, 3, KEEP_FLOAT);
- axis_id = VertexFormat_add_attrib(&format, "axis", COMP_I32, 1, KEEP_INT);
+ pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
/* X axis */
float co[3] = {-1.0f, 0.0f, 0.0f};
int axis = -1;
- VertexBuffer_set_attrib(vbo, pos_id, 0, co);
- VertexBuffer_set_attrib(vbo, axis_id, 0, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 0, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 0, &axis);
co[0] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 1, co);
- VertexBuffer_set_attrib(vbo, axis_id, 1, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 1, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 1, &axis);
/* Y axis */
co[0] = 0.0f;
co[1] = -1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 2, co);
- VertexBuffer_set_attrib(vbo, axis_id, 2, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 2, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 2, &axis);
co[1] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 3, co);
- VertexBuffer_set_attrib(vbo, axis_id, 3, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 3, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 3, &axis);
/* Z axis */
co[1] = 0.0f;
co[2] = -1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 4, co);
- VertexBuffer_set_attrib(vbo, axis_id, 4, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 4, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 4, &axis);
co[2] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 5, co);
- VertexBuffer_set_attrib(vbo, axis_id, 5, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 5, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 5, &axis);
- SHC.drw_particle_cross = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_particle_cross = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_particle_cross;
case PART_DRAW_AXIS:
if (!SHC.drw_particle_axis) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, axis_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "inst_pos", COMP_F32, 3, KEEP_FLOAT);
- axis_id = VertexFormat_add_attrib(&format, "axis", COMP_I32, 1, KEEP_INT);
+ pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, 6);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, 6);
/* X axis */
float co[3] = {0.0f, 0.0f, 0.0f};
int axis = 0;
- VertexBuffer_set_attrib(vbo, pos_id, 0, co);
- VertexBuffer_set_attrib(vbo, axis_id, 0, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 0, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 0, &axis);
co[0] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 1, co);
- VertexBuffer_set_attrib(vbo, axis_id, 1, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 1, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 1, &axis);
/* Y axis */
co[0] = 0.0f;
axis = 1;
- VertexBuffer_set_attrib(vbo, pos_id, 2, co);
- VertexBuffer_set_attrib(vbo, axis_id, 2, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 2, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 2, &axis);
co[1] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 3, co);
- VertexBuffer_set_attrib(vbo, axis_id, 3, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 3, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 3, &axis);
/* Z axis */
co[1] = 0.0f;
axis = 2;
- VertexBuffer_set_attrib(vbo, pos_id, 4, co);
- VertexBuffer_set_attrib(vbo, axis_id, 4, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 4, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 4, &axis);
co[2] = 1.0f;
- VertexBuffer_set_attrib(vbo, pos_id, 5, co);
- VertexBuffer_set_attrib(vbo, axis_id, 5, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, 5, co);
+ GWN_vertbuf_attr_set(vbo, axis_id, 5, &axis);
- SHC.drw_particle_axis = Batch_create(PRIM_LINES, vbo, NULL);
+ SHC.drw_particle_axis = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
return SHC.drw_particle_axis;
@@ -2444,26 +2444,26 @@ Batch *DRW_cache_particles_get_prim(int type)
float v[3] = {0.0f, 0.0f, 0.0f};
int axis = -1;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, axis_id;
if (format.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format, "inst_pos", COMP_F32, 3, KEEP_FLOAT);
- axis_id = VertexFormat_add_attrib(&format, "axis", COMP_I32, 1, KEEP_INT);
+ pos_id = GWN_vertformat_attr_add(&format, "inst_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ axis_id = GWN_vertformat_attr_add(&format, "axis", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, CIRCLE_RESOL);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, CIRCLE_RESOL);
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));
v[2] = 0.0f;
- VertexBuffer_set_attrib(vbo, pos_id, a, v);
- VertexBuffer_set_attrib(vbo, axis_id, a, &axis);
+ GWN_vertbuf_attr_set(vbo, pos_id, a, v);
+ GWN_vertbuf_attr_set(vbo, axis_id, a, &axis);
}
- SHC.drw_particle_circle = Batch_create(PRIM_LINE_LOOP, vbo, NULL);
+ SHC.drw_particle_circle = GWN_batch_create(GWN_PRIM_LINE_LOOP, vbo, NULL);
}
return SHC.drw_particle_circle;
diff --git a/source/blender/draw/intern/draw_cache.h b/source/blender/draw/intern/draw_cache.h
index f28eca46099..a4fac3fe71f 100644
--- a/source/blender/draw/intern/draw_cache.h
+++ b/source/blender/draw/intern/draw_cache.h
@@ -26,126 +26,126 @@
#ifndef __DRAW_CACHE_H__
#define __DRAW_CACHE_H__
-struct Batch;
+struct Gwn_Batch;
struct Object;
void DRW_shape_cache_free(void);
/* Common Shapes */
-struct Batch *DRW_cache_fullscreen_quad_get(void);
-struct Batch *DRW_cache_sphere_get(void);
-struct Batch *DRW_cache_single_vert_get(void);
-struct Batch *DRW_cache_single_line_get(void);
-struct Batch *DRW_cache_single_line_endpoints_get(void);
-struct Batch *DRW_cache_screenspace_circle_get(void);
+struct Gwn_Batch *DRW_cache_fullscreen_quad_get(void);
+struct Gwn_Batch *DRW_cache_sphere_get(void);
+struct Gwn_Batch *DRW_cache_single_vert_get(void);
+struct Gwn_Batch *DRW_cache_single_line_get(void);
+struct Gwn_Batch *DRW_cache_single_line_endpoints_get(void);
+struct Gwn_Batch *DRW_cache_screenspace_circle_get(void);
/* Common Object */
-struct Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
-struct Batch *DRW_cache_object_surface_get(struct Object *ob);
-struct Batch **DRW_cache_object_surface_material_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_object_wire_outline_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_object_surface_get(struct Object *ob);
+struct Gwn_Batch **DRW_cache_object_surface_material_get(struct Object *ob);
/* Empties */
-struct Batch *DRW_cache_plain_axes_get(void);
-struct Batch *DRW_cache_single_arrow_get(void);
-struct Batch *DRW_cache_cube_get(void);
-struct Batch *DRW_cache_circle_get(void);
-struct Batch *DRW_cache_square_get(void);
-struct Batch *DRW_cache_empty_sphere_get(void);
-struct Batch *DRW_cache_empty_cone_get(void);
-struct Batch *DRW_cache_arrows_get(void);
-struct Batch *DRW_cache_axis_names_get(void);
-struct Batch *DRW_cache_image_plane_get(void);
-struct Batch *DRW_cache_image_plane_wire_get(void);
+struct Gwn_Batch *DRW_cache_plain_axes_get(void);
+struct Gwn_Batch *DRW_cache_single_arrow_get(void);
+struct Gwn_Batch *DRW_cache_cube_get(void);
+struct Gwn_Batch *DRW_cache_circle_get(void);
+struct Gwn_Batch *DRW_cache_square_get(void);
+struct Gwn_Batch *DRW_cache_empty_sphere_get(void);
+struct Gwn_Batch *DRW_cache_empty_cone_get(void);
+struct Gwn_Batch *DRW_cache_arrows_get(void);
+struct Gwn_Batch *DRW_cache_axis_names_get(void);
+struct Gwn_Batch *DRW_cache_image_plane_get(void);
+struct Gwn_Batch *DRW_cache_image_plane_wire_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);
+struct Gwn_Batch *DRW_cache_field_wind_get(void);
+struct Gwn_Batch *DRW_cache_field_force_get(void);
+struct Gwn_Batch *DRW_cache_field_vortex_get(void);
+struct Gwn_Batch *DRW_cache_field_tube_limit_get(void);
+struct Gwn_Batch *DRW_cache_field_cone_limit_get(void);
/* Lamps */
-struct Batch *DRW_cache_lamp_get(void);
-struct Batch *DRW_cache_lamp_sunrays_get(void);
-struct Batch *DRW_cache_lamp_area_get(void);
-struct Batch *DRW_cache_lamp_hemi_get(void);
-struct Batch *DRW_cache_lamp_spot_get(void);
-struct Batch *DRW_cache_lamp_spot_square_get(void);
+struct Gwn_Batch *DRW_cache_lamp_get(void);
+struct Gwn_Batch *DRW_cache_lamp_sunrays_get(void);
+struct Gwn_Batch *DRW_cache_lamp_area_get(void);
+struct Gwn_Batch *DRW_cache_lamp_hemi_get(void);
+struct Gwn_Batch *DRW_cache_lamp_spot_get(void);
+struct Gwn_Batch *DRW_cache_lamp_spot_square_get(void);
/* Camera */
-struct Batch *DRW_cache_camera_get(void);
-struct Batch *DRW_cache_camera_tria_get(void);
+struct Gwn_Batch *DRW_cache_camera_get(void);
+struct Gwn_Batch *DRW_cache_camera_tria_get(void);
/* Speaker */
-struct Batch *DRW_cache_speaker_get(void);
+struct Gwn_Batch *DRW_cache_speaker_get(void);
/* Probe */
-struct Batch *DRW_cache_lightprobe_get(void);
+struct Gwn_Batch *DRW_cache_lightprobe_get(void);
/* Bones */
-struct Batch *DRW_cache_bone_octahedral_get(void);
-struct Batch *DRW_cache_bone_octahedral_wire_outline_get(void);
-struct Batch *DRW_cache_bone_box_get(void);
-struct Batch *DRW_cache_bone_box_wire_outline_get(void);
-struct Batch *DRW_cache_bone_wire_wire_outline_get(void);
-struct Batch *DRW_cache_bone_envelope_solid_get(void);
-struct Batch *DRW_cache_bone_envelope_distance_outline_get(void);
-struct Batch *DRW_cache_bone_envelope_wire_outline_get(void);
-struct Batch *DRW_cache_bone_envelope_head_wire_outline_get(void);
-struct Batch *DRW_cache_bone_point_get(void);
-struct Batch *DRW_cache_bone_point_wire_outline_get(void);
-struct Batch *DRW_cache_bone_arrows_get(void);
+struct Gwn_Batch *DRW_cache_bone_octahedral_get(void);
+struct Gwn_Batch *DRW_cache_bone_octahedral_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_box_get(void);
+struct Gwn_Batch *DRW_cache_bone_box_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_wire_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_solid_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_distance_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_envelope_head_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_point_get(void);
+struct Gwn_Batch *DRW_cache_bone_point_wire_outline_get(void);
+struct Gwn_Batch *DRW_cache_bone_arrows_get(void);
/* Meshes */
-struct Batch *DRW_cache_mesh_surface_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_overlay_get(struct Object *ob);
void DRW_cache_mesh_wire_overlay_get(
struct Object *ob,
- struct Batch **r_tris, struct Batch **r_ledges, struct Batch **r_lverts);
+ struct Gwn_Batch **r_tris, struct Gwn_Batch **r_ledges, struct Gwn_Batch **r_lverts);
void DRW_cache_mesh_normals_overlay_get(
struct Object *ob,
- struct Batch **r_tris, struct Batch **r_ledges, struct Batch **r_lverts);
-struct Batch *DRW_cache_face_centers_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_wire_outline_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_vert_colors_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_edges_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_verts_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_edges_paint_overlay_get(struct Object *ob, bool use_wire, bool use_sel);
-struct Batch *DRW_cache_mesh_faces_weight_overlay_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_verts_weight_overlay_get(struct Object *ob);
-struct Batch **DRW_cache_mesh_surface_shaded_get(struct Object *ob);
-struct Batch **DRW_cache_mesh_surface_texpaint_get(struct Object *ob);
-struct Batch *DRW_cache_mesh_surface_texpaint_single_get(struct Object *ob);
+ struct Gwn_Batch **r_tris, struct Gwn_Batch **r_ledges, struct Gwn_Batch **r_lverts);
+struct Gwn_Batch *DRW_cache_face_centers_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_wire_outline_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_weights_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_vert_colors_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_edges_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_edges_paint_overlay_get(struct Object *ob, bool use_wire, bool use_sel);
+struct Gwn_Batch *DRW_cache_mesh_faces_weight_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_verts_weight_overlay_get(struct Object *ob);
+struct Gwn_Batch **DRW_cache_mesh_surface_shaded_get(struct Object *ob);
+struct Gwn_Batch **DRW_cache_mesh_surface_texpaint_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_mesh_surface_texpaint_single_get(struct Object *ob);
/* Curve */
-struct Batch *DRW_cache_curve_surface_get(struct Object *ob);
-struct Batch *DRW_cache_curve_surface_verts_get(struct Object *ob);
-struct Batch *DRW_cache_curve_edge_wire_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_surface_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_edge_wire_get(struct Object *ob);
/* edit-mode */
-struct Batch *DRW_cache_curve_edge_normal_get(struct Object *ob, float normal_size);
-struct Batch *DRW_cache_curve_edge_overlay_get(struct Object *ob);
-struct Batch *DRW_cache_curve_vert_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_edge_normal_get(struct Object *ob, float normal_size);
+struct Gwn_Batch *DRW_cache_curve_edge_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_curve_vert_overlay_get(struct Object *ob);
/* Font */
-struct Batch *DRW_cache_text_edge_wire_get(struct Object *ob);
-struct Batch *DRW_cache_text_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_edge_wire_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_surface_get(struct Object *ob);
/* edit-mode */
-struct Batch *DRW_cache_text_cursor_overlay_get(struct Object *ob);
-struct Batch *DRW_cache_text_select_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_cursor_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_text_select_overlay_get(struct Object *ob);
/* Surface */
-struct Batch *DRW_cache_surf_surface_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_surf_surface_get(struct Object *ob);
/* Lattice */
-struct Batch *DRW_cache_lattice_verts_get(struct Object *ob);
-struct Batch *DRW_cache_lattice_wire_get(struct Object *ob);
-struct Batch *DRW_cache_lattice_vert_overlay_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_lattice_verts_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_lattice_wire_get(struct Object *ob);
+struct Gwn_Batch *DRW_cache_lattice_vert_overlay_get(struct Object *ob);
/* Particles */
-struct Batch *DRW_cache_particles_get_hair(struct ParticleSystem *psys);
-struct Batch *DRW_cache_particles_get_dots(struct ParticleSystem *psys);
-struct Batch *DRW_cache_particles_get_prim(int type);
+struct Gwn_Batch *DRW_cache_particles_get_hair(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_cache_particles_get_dots(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_cache_particles_get_prim(int type);
#endif /* __DRAW_CACHE_H__ */
diff --git a/source/blender/draw/intern/draw_cache_impl.h b/source/blender/draw/intern/draw_cache_impl.h
index bfb61199674..066ca9f60e0 100644
--- a/source/blender/draw/intern/draw_cache_impl.h
+++ b/source/blender/draw/intern/draw_cache_impl.h
@@ -26,7 +26,7 @@
#ifndef __DRAW_CACHE_IMPL_H__
#define __DRAW_CACHE_IMPL_H__
-struct Batch;
+struct Gwn_Batch;
struct ListBase;
struct CurveCache;
struct ParticleSystem;
@@ -49,52 +49,52 @@ void DRW_particle_batch_cache_dirty(struct ParticleSystem *psys, int mode);
void DRW_particle_batch_cache_free(struct ParticleSystem *psys);
/* Curve */
-struct Batch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
-struct Batch *DRW_curve_batch_cache_get_normal_edge(
+struct Gwn_Batch *DRW_curve_batch_cache_get_wire_edge(struct Curve *cu, struct CurveCache *ob_curve_cache);
+struct Gwn_Batch *DRW_curve_batch_cache_get_normal_edge(
struct Curve *cu, struct CurveCache *ob_curve_cache, float normal_size);
-struct Batch *DRW_curve_batch_cache_get_overlay_edges(struct Curve *cu);
-struct Batch *DRW_curve_batch_cache_get_overlay_verts(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_edges(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_verts(struct Curve *cu);
-struct Batch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache);
+struct Gwn_Batch *DRW_curve_batch_cache_get_triangles_with_normals(struct Curve *cu, struct CurveCache *ob_curve_cache);
/* Curve (Font) */
-struct Batch *DRW_curve_batch_cache_get_overlay_cursor(struct Curve *cu);
-struct Batch *DRW_curve_batch_cache_get_overlay_select(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_cursor(struct Curve *cu);
+struct Gwn_Batch *DRW_curve_batch_cache_get_overlay_select(struct Curve *cu);
/* DispList */
-struct Batch *BLI_displist_batch_calc_surface(struct ListBase *lb);
+struct Gwn_Batch *BLI_displist_batch_calc_surface(struct ListBase *lb);
/* Lattice */
-struct Batch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt);
-struct Batch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
-struct Batch *DRW_lattice_batch_cache_get_overlay_verts(struct Lattice *lt);
+struct Gwn_Batch *DRW_lattice_batch_cache_get_all_edges(struct Lattice *lt);
+struct Gwn_Batch *DRW_lattice_batch_cache_get_all_verts(struct Lattice *lt);
+struct Gwn_Batch *DRW_lattice_batch_cache_get_overlay_verts(struct Lattice *lt);
/* Mesh */
-struct Batch **DRW_mesh_batch_cache_get_surface_shaded(struct Mesh *me);
-struct Batch **DRW_mesh_batch_cache_get_surface_texpaint(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(struct Mesh *me, bool use_wire, bool use_sel);
-struct Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_all_triangles(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(struct Mesh *me, int defgroup);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide);
-struct Batch *DRW_mesh_batch_cache_get_points_with_normals(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_fancy_edges(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_triangles(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(struct Mesh *me);
-struct Batch *DRW_mesh_batch_cache_get_overlay_facedots(struct Mesh *me);
+struct Gwn_Batch **DRW_mesh_batch_cache_get_surface_shaded(struct Mesh *me);
+struct Gwn_Batch **DRW_mesh_batch_cache_get_surface_texpaint(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(struct Mesh *me, bool use_wire, bool use_sel);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_all_edges(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_all_triangles(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(struct Mesh *me, int defgroup);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_points_with_normals(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_all_verts(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(struct Mesh *me);
+struct Gwn_Batch *DRW_mesh_batch_cache_get_overlay_facedots(struct Mesh *me);
/* Particles */
-struct Batch *DRW_particles_batch_cache_get_hair(struct ParticleSystem *psys);
-struct Batch *DRW_particles_batch_cache_get_dots(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_particles_batch_cache_get_hair(struct ParticleSystem *psys);
+struct Gwn_Batch *DRW_particles_batch_cache_get_dots(struct ParticleSystem *psys);
#endif /* __DRAW_CACHE_IMPL_H__ */
diff --git a/source/blender/draw/intern/draw_cache_impl_curve.c b/source/blender/draw/intern/draw_cache_impl_curve.c
index 3fbee0d7c2a..9ff9fab4c64 100644
--- a/source/blender/draw/intern/draw_cache_impl_curve.c
+++ b/source/blender/draw/intern/draw_cache_impl_curve.c
@@ -284,39 +284,39 @@ enum {
};
/* ---------------------------------------------------------------------- */
-/* Curve Batch Cache */
+/* Curve Gwn_Batch Cache */
typedef struct CurveBatchCache {
/* center-line */
struct {
- VertexBuffer *verts;
- VertexBuffer *edges;
- Batch *batch;
- ElementList *elem;
+ Gwn_VertBuf *verts;
+ Gwn_VertBuf *edges;
+ Gwn_Batch *batch;
+ Gwn_IndexBuf *elem;
} wire;
/* normals */
struct {
- VertexBuffer *verts;
- VertexBuffer *edges;
- Batch *batch;
- ElementList *elem;
+ Gwn_VertBuf *verts;
+ Gwn_VertBuf *edges;
+ Gwn_Batch *batch;
+ Gwn_IndexBuf *elem;
} normal;
/* control handles and vertices */
struct {
- Batch *edges;
- Batch *verts;
+ Gwn_Batch *edges;
+ Gwn_Batch *verts;
} overlay;
struct {
- Batch *batch;
+ Gwn_Batch *batch;
} surface;
/* 3d text */
struct {
- Batch *select;
- Batch *cursor;
+ Gwn_Batch *select;
+ Gwn_Batch *cursor;
} text;
/* settings to determine if cache is invalid */
@@ -330,7 +330,7 @@ typedef struct CurveBatchCache {
bool is_editmode;
} CurveBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool curve_batch_cache_valid(Curve *cu)
{
@@ -453,9 +453,9 @@ static void curve_batch_cache_clear(Curve *cu)
cache->wire.elem = NULL;
}
else {
- VERTEXBUFFER_DISCARD_SAFE(cache->wire.verts);
- VERTEXBUFFER_DISCARD_SAFE(cache->wire.edges);
- ELEMENTLIST_DISCARD_SAFE(cache->wire.elem);
+ GWN_VERTBUF_DISCARD_SAFE(cache->wire.verts);
+ GWN_VERTBUF_DISCARD_SAFE(cache->wire.edges);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->wire.elem);
}
if (cache->normal.batch) {
@@ -465,9 +465,9 @@ static void curve_batch_cache_clear(Curve *cu)
cache->normal.elem = NULL;
}
else {
- VERTEXBUFFER_DISCARD_SAFE(cache->normal.verts);
- VERTEXBUFFER_DISCARD_SAFE(cache->normal.edges);
- ELEMENTLIST_DISCARD_SAFE(cache->normal.elem);
+ GWN_VERTBUF_DISCARD_SAFE(cache->normal.verts);
+ GWN_VERTBUF_DISCARD_SAFE(cache->normal.edges);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->normal.elem);
}
/* 3d text */
@@ -486,30 +486,30 @@ void DRW_curve_batch_cache_free(Curve *cu)
/** \name Private Curve Cache API
* \{ */
-/* Batch cache usage. */
-static VertexBuffer *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, CurveBatchCache *cache)
+/* Gwn_Batch cache usage. */
+static Gwn_VertBuf *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_WIRE);
BLI_assert(rdata->ob_curve_cache != NULL);
if (cache->wire.verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int vert_len = curve_render_data_wire_verts_len_get(rdata);
- VertexBuffer *vbo = cache->wire.verts = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_len);
+ Gwn_VertBuf *vbo = cache->wire.verts = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_len);
int vbo_len_used = 0;
for (const BevList *bl = rdata->ob_curve_cache->bev.first; bl; bl = bl->next) {
if (bl->nr > 0) {
const int i_end = vbo_len_used + bl->nr;
for (const BevPoint *bevp = bl->bevpoints; vbo_len_used < i_end; vbo_len_used++, bevp++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bevp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bevp->vec);
}
}
}
@@ -519,7 +519,7 @@ static VertexBuffer *curve_batch_cache_get_wire_verts(CurveRenderData *rdata, Cu
return cache->wire.verts;
}
-static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_IndexBuf *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_WIRE);
BLI_assert(rdata->ob_curve_cache != NULL);
@@ -529,8 +529,8 @@ static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, Cur
const int edge_len = curve_render_data_wire_edges_len_get(rdata);
int edge_len_used = 0;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
int i = 0;
for (const BevList *bl = rdata->ob_curve_cache->bev.first; bl; bl = bl->next) {
@@ -546,7 +546,7 @@ static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, Cur
i += 1;
}
for (; i < i_end; i_prev = i++) {
- add_line_vertices(&elb, i_prev, i);
+ GWN_indexbuf_add_line_verts(&elb, i_prev, i);
edge_len_used += 1;
}
}
@@ -559,30 +559,30 @@ static ElementList *curve_batch_cache_get_wire_edges(CurveRenderData *rdata, Cur
BLI_assert(edge_len_used == edge_len);
}
- cache->wire.elem = ElementList_build(&elb);
+ cache->wire.elem = GWN_indexbuf_build(&elb);
}
return cache->wire.elem;
}
-static VertexBuffer *curve_batch_cache_get_normal_verts(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_VertBuf *curve_batch_cache_get_normal_verts(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_NORMAL);
BLI_assert(rdata->ob_curve_cache != NULL);
if (cache->normal.verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int normal_len = curve_render_data_normal_len_get(rdata);
const int vert_len = normal_len * 3;
- VertexBuffer *vbo = cache->normal.verts = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_len);
+ Gwn_VertBuf *vbo = cache->normal.verts = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_len);
int vbo_len_used = 0;
const BevList *bl;
@@ -614,9 +614,9 @@ static VertexBuffer *curve_batch_cache_get_normal_verts(CurveRenderData *rdata,
add_v3_v3(vec_a, bevp->vec);
add_v3_v3(vec_b, bevp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, vec_a);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, bevp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, vec_b);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, vec_a);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, bevp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, vec_b);
bevp += skip + 1;
nr -= skip;
@@ -628,7 +628,7 @@ static VertexBuffer *curve_batch_cache_get_normal_verts(CurveRenderData *rdata,
return cache->normal.verts;
}
-static ElementList *curve_batch_cache_get_normal_edges(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_IndexBuf *curve_batch_cache_get_normal_edges(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_NORMAL);
BLI_assert(rdata->ob_curve_cache != NULL);
@@ -638,19 +638,19 @@ static ElementList *curve_batch_cache_get_normal_edges(CurveRenderData *rdata, C
const int vert_len = normal_len * 3;
const int edge_len = normal_len * 2;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
int vbo_len_used = 0;
for (int i = 0; i < normal_len; i++) {
- add_line_vertices(&elb, vbo_len_used + 0, vbo_len_used + 1);
- add_line_vertices(&elb, vbo_len_used + 1, vbo_len_used + 2);
+ GWN_indexbuf_add_line_verts(&elb, vbo_len_used + 0, vbo_len_used + 1);
+ GWN_indexbuf_add_line_verts(&elb, vbo_len_used + 1, vbo_len_used + 2);
vbo_len_used += 3;
}
BLI_assert(vbo_len_used == vert_len);
- cache->normal.elem = ElementList_build(&elb);
+ cache->normal.elem = GWN_indexbuf_build(&elb);
}
return cache->normal.elem;
@@ -665,18 +665,18 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
CurveRenderData *rdata = curve_render_data_create(cu, NULL, options);
if (cache->overlay.verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = curve_render_data_overlay_verts_len_get(rdata);
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
int i = 0;
for (Nurb *nu = rdata->nurbs->first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -689,16 +689,16 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
if (rdata->hide_handles) {
vflag = (bezt->f2 & SELECT) ?
(is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
else {
for (int j = 0; j < 3; j++) {
vflag = ((&bezt->f1)[j] & SELECT) ?
(is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[j]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[j]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
}
@@ -713,8 +713,8 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
const bool is_active = (i == rdata->actvert);
char vflag;
vflag = (bp->f1 & SELECT) ? (is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
i += 1;
@@ -723,29 +723,29 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
i += nu->pntsu;
}
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->overlay.verts = Batch_create(PRIM_POINTS, vbo, NULL);
+ cache->overlay.verts = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
if ((cache->overlay.edges == NULL) && (rdata->hide_handles == false)) {
/* Note: we could reference indices to vertices (above) */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int edge_len = curve_render_data_overlay_edges_len_get(rdata);
const int vbo_len_capacity = edge_len * 2;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
int i = 0;
for (Nurb *nu = rdata->nurbs->first; nu; nu = nu->next) {
if (nu->bezt) {
@@ -756,22 +756,22 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
char vflag;
vflag = (bezt->f1 & SELECT) ? (is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[0]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
/* same vertex twice, only check different selection */
for (int j = 0; j < 2; j++) {
vflag = ((j ? bezt->f3 : bezt->f1) & SELECT) ?
(is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
vflag = (bezt->f3 & SELECT) ? (is_active ? VFLAG_VERTEX_ACTIVE : VFLAG_VERTEX_SELECTED) : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bezt->vec[2]);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bezt->vec[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
i += 1;
@@ -783,11 +783,11 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
if ((bp_prev->hide == false) && (bp_curr->hide == false)) {
char vflag;
vflag = ((bp_prev->f1 & SELECT) && (bp_curr->f1 & SELECT)) ? VFLAG_VERTEX_SELECTED : 0;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bp_prev->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bp_prev->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, bp_curr->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, vbo_len_used, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, bp_curr->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vbo_len_used, &vflag);
vbo_len_used += 1;
}
@@ -795,16 +795,16 @@ static void curve_batch_cache_create_overlay_batches(Curve *cu)
}
}
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->overlay.edges = Batch_create(PRIM_LINES, vbo, NULL);
+ cache->overlay.edges = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
}
curve_render_data_free(rdata);
}
-static Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_SURFACE);
if (cache->surface.batch == NULL) {
@@ -822,21 +822,21 @@ static Batch *curve_batch_cache_get_pos_and_normals(CurveRenderData *rdata, Curv
* \{ */
-static Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_TEXT_SELECT);
if (cache->text.select == NULL) {
EditFont *ef = rdata->text.edit_font;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = ef->selboxes_len * 6;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
float box[4][3];
@@ -883,37 +883,37 @@ static Batch *curve_batch_cache_get_overlay_select(CurveRenderData *rdata, Curve
add_v2_v2(box[3], &sb->x);
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[1]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[2]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[2]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used++, box[3]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used++, box[3]);
}
BLI_assert(vbo_len_used == vbo_len_capacity);
- cache->text.select = Batch_create(PRIM_TRIANGLES, vbo, NULL);
+ cache->text.select = GWN_batch_create(GWN_PRIM_TRIS, vbo, NULL);
}
return cache->text.select;
}
-static Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, CurveBatchCache *cache)
+static Gwn_Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, CurveBatchCache *cache)
{
BLI_assert(rdata->types & CU_DATATYPE_TEXT_SELECT);
if (cache->text.cursor == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = 4;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < 4; i++) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, rdata->text.edit_font->textcurs[i]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, rdata->text.edit_font->textcurs[i]);
}
- cache->text.cursor = Batch_create(PRIM_TRIANGLE_FAN, vbo, NULL);
+ cache->text.cursor = GWN_batch_create(GWN_PRIM_TRI_FAN, vbo, NULL);
}
return cache->text.cursor;
}
@@ -925,7 +925,7 @@ static Batch *curve_batch_cache_get_overlay_cursor(CurveRenderData *rdata, Curve
/** \name Public Object/Curve API
* \{ */
-Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache)
+Gwn_Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -933,8 +933,8 @@ Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache
/* create batch from Curve */
CurveRenderData *rdata = curve_render_data_create(cu, ob_curve_cache, CU_DATATYPE_WIRE);
- cache->wire.batch = Batch_create(
- PRIM_LINES,
+ cache->wire.batch = GWN_batch_create(
+ GWN_PRIM_LINES,
curve_batch_cache_get_wire_verts(rdata, cache),
curve_batch_cache_get_wire_edges(rdata, cache));
@@ -943,7 +943,7 @@ Batch *DRW_curve_batch_cache_get_wire_edge(Curve *cu, CurveCache *ob_curve_cache
return cache->wire.batch;
}
-Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cache, float normal_size)
+Gwn_Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cache, float normal_size)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -959,8 +959,8 @@ Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cac
/* create batch from Curve */
CurveRenderData *rdata = curve_render_data_create(cu, ob_curve_cache, CU_DATATYPE_NORMAL);
- cache->normal.batch = Batch_create(
- PRIM_LINES,
+ cache->normal.batch = GWN_batch_create(
+ GWN_PRIM_LINES,
curve_batch_cache_get_normal_verts(rdata, cache),
curve_batch_cache_get_normal_edges(rdata, cache));
@@ -970,7 +970,7 @@ Batch *DRW_curve_batch_cache_get_normal_edge(Curve *cu, CurveCache *ob_curve_cac
return cache->normal.batch;
}
-Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -981,7 +981,7 @@ Batch *DRW_curve_batch_cache_get_overlay_edges(Curve *cu)
return cache->overlay.edges;
}
-Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -992,7 +992,7 @@ Batch *DRW_curve_batch_cache_get_overlay_verts(Curve *cu)
return cache->overlay.verts;
}
-Batch *DRW_curve_batch_cache_get_triangles_with_normals(
+Gwn_Batch *DRW_curve_batch_cache_get_triangles_with_normals(
struct Curve *cu, struct CurveCache *ob_curve_cache)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -1014,7 +1014,7 @@ Batch *DRW_curve_batch_cache_get_triangles_with_normals(
/** \name Public Object/Font API
* \{ */
-Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
@@ -1029,7 +1029,7 @@ Batch *DRW_curve_batch_cache_get_overlay_select(Curve *cu)
return cache->text.select;
}
-Batch *DRW_curve_batch_cache_get_overlay_cursor(Curve *cu)
+Gwn_Batch *DRW_curve_batch_cache_get_overlay_cursor(Curve *cu)
{
CurveBatchCache *cache = curve_batch_cache_get(cu);
diff --git a/source/blender/draw/intern/draw_cache_impl_displist.c b/source/blender/draw/intern/draw_cache_impl_displist.c
index 9e93409c24d..fd36b7ad4a3 100644
--- a/source/blender/draw/intern/draw_cache_impl_displist.c
+++ b/source/blender/draw/intern/draw_cache_impl_displist.c
@@ -86,27 +86,27 @@ static int curve_render_surface_tri_len_get(const ListBase *lb)
return tri_len;
}
-Batch *BLI_displist_batch_calc_surface(ListBase *lb)
+Gwn_Batch *BLI_displist_batch_calc_surface(ListBase *lb)
{
const int tri_len = curve_render_surface_tri_len_get(lb);
if (tri_len == 0) {
return NULL;
}
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int vert_len = curve_render_surface_vert_len_get(lb);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
{
const int vbo_len_capacity = vert_len;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
BKE_displist_normals_add(lb);
@@ -117,9 +117,9 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
const float *fp_no = dl->nors;
const int vbo_end = vbo_len_used + dl_vert_len(dl);
while (vbo_len_used < vbo_end) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, vbo_len_used, fp_co);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vbo_len_used, fp_co);
if (fp_no) {
- VertexBuffer_set_attrib(vbo, attr_id.nor, vbo_len_used, fp_no);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, vbo_len_used, fp_no);
if (ndata_is_single == false) {
fp_no += 3;
}
@@ -132,8 +132,8 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
}
{
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tri_len, vert_len);
int ofs = 0;
int tri_len_used = 0;
@@ -143,7 +143,7 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
const int *idx = dl->index;
const int i_end = dl->parts;
for (int i = 0; i < i_end; i++) {
- add_triangle_vertices(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
tri_len_used += 1;
idx += 3;
}
@@ -152,9 +152,9 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
const int *idx = dl->index;
const int i_end = dl->totindex;
for (int i = 0; i < i_end; i++) {
- add_triangle_vertices(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0] + ofs, idx[1] + ofs, idx[2] + ofs);
tri_len_used += 1;
- add_triangle_vertices(&elb, idx[0] + ofs, idx[2] + ofs, idx[3] + ofs);
+ GWN_indexbuf_add_tri_verts(&elb, idx[0] + ofs, idx[2] + ofs, idx[3] + ofs);
tri_len_used += 1;
idx += 4;
}
@@ -163,6 +163,6 @@ Batch *BLI_displist_batch_calc_surface(ListBase *lb)
}
}
- return Batch_create(PRIM_TRIANGLES, vbo, ElementList_build(&elb));
+ return GWN_batch_create(GWN_PRIM_TRIS, vbo, GWN_indexbuf_build(&elb));
}
}
diff --git a/source/blender/draw/intern/draw_cache_impl_lattice.c b/source/blender/draw/intern/draw_cache_impl_lattice.c
index e5d8a6c9301..dfba2aedcda 100644
--- a/source/blender/draw/intern/draw_cache_impl_lattice.c
+++ b/source/blender/draw/intern/draw_cache_impl_lattice.c
@@ -215,16 +215,16 @@ enum {
};
/* ---------------------------------------------------------------------- */
-/* Lattice Batch Cache */
+/* Lattice Gwn_Batch Cache */
typedef struct LatticeBatchCache {
- VertexBuffer *pos;
- ElementList *edges;
+ Gwn_VertBuf *pos;
+ Gwn_IndexBuf *edges;
- Batch *all_verts;
- Batch *all_edges;
+ Gwn_Batch *all_verts;
+ Gwn_Batch *all_edges;
- Batch *overlay_verts;
+ Gwn_Batch *overlay_verts;
/* settings to determine if cache is invalid */
bool is_dirty;
@@ -237,7 +237,7 @@ typedef struct LatticeBatchCache {
bool is_editmode;
} LatticeBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool lattice_batch_cache_valid(Lattice *lt)
{
@@ -326,12 +326,12 @@ static void lattice_batch_cache_clear(Lattice *lt)
return;
}
- BATCH_DISCARD_SAFE(cache->all_verts);
- BATCH_DISCARD_SAFE(cache->all_edges);
+ GWN_BATCH_DISCARD_SAFE(cache->all_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->all_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_verts);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->edges);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->edges);
}
void DRW_lattice_batch_cache_free(Lattice *lt)
@@ -340,33 +340,33 @@ void DRW_lattice_batch_cache_free(Lattice *lt)
MEM_SAFE_FREE(lt->batch_cache);
}
-/* Batch cache usage. */
-static VertexBuffer *lattice_batch_cache_get_pos(LatticeRenderData *rdata, LatticeBatchCache *cache)
+/* Gwn_Batch cache usage. */
+static Gwn_VertBuf *lattice_batch_cache_get_pos(LatticeRenderData *rdata, LatticeBatchCache *cache)
{
BLI_assert(rdata->types & LR_DATATYPE_VERT);
if (cache->pos == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int vert_len = lattice_render_data_verts_len_get(rdata);
- cache->pos = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(cache->pos, vert_len);
+ cache->pos = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(cache->pos, vert_len);
for (int i = 0; i < vert_len; ++i) {
const BPoint *bp = lattice_render_data_vert_bpoint(rdata, i);
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, i, bp->vec);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, i, bp->vec);
}
}
return cache->pos;
}
-static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, LatticeBatchCache *cache)
+static Gwn_IndexBuf *lattice_batch_cache_get_edges(LatticeRenderData *rdata, LatticeBatchCache *cache)
{
BLI_assert(rdata->types & (LR_DATATYPE_VERT | LR_DATATYPE_EDGE));
@@ -375,8 +375,8 @@ static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, Latt
const int edge_len = lattice_render_data_edges_len_get(rdata);
int edge_len_real = 0;
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
#define LATT_INDEX(u, v, w) \
((((w) * rdata->dims.v_len + (v)) * rdata->dims.u_len) + (u))
@@ -389,17 +389,17 @@ static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, Latt
int uxt = (u == 0 || u == rdata->dims.u_len - 1);
if (w && ((uxt || vxt) || !rdata->show_only_outside)) {
- add_line_vertices(&elb, LATT_INDEX(u, v, w - 1), LATT_INDEX(u, v, w));
+ GWN_indexbuf_add_line_verts(&elb, LATT_INDEX(u, v, w - 1), LATT_INDEX(u, v, w));
BLI_assert(edge_len_real <= edge_len);
edge_len_real++;
}
if (v && ((uxt || wxt) || !rdata->show_only_outside)) {
- add_line_vertices(&elb, LATT_INDEX(u, v - 1, w), LATT_INDEX(u, v, w));
+ GWN_indexbuf_add_line_verts(&elb, LATT_INDEX(u, v - 1, w), LATT_INDEX(u, v, w));
BLI_assert(edge_len_real <= edge_len);
edge_len_real++;
}
if (u && ((vxt || wxt) || !rdata->show_only_outside)) {
- add_line_vertices(&elb, LATT_INDEX(u - 1, v, w), LATT_INDEX(u, v, w));
+ GWN_indexbuf_add_line_verts(&elb, LATT_INDEX(u - 1, v, w), LATT_INDEX(u, v, w));
BLI_assert(edge_len_real <= edge_len);
edge_len_real++;
}
@@ -416,7 +416,7 @@ static ElementList *lattice_batch_cache_get_edges(LatticeRenderData *rdata, Latt
BLI_assert(edge_len_real == edge_len);
}
- cache->edges = ElementList_build(&elb);
+ cache->edges = GWN_indexbuf_build(&elb);
}
return cache->edges;
@@ -431,18 +431,18 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt)
LatticeRenderData *rdata = lattice_render_data_create(lt, options);
if (cache->overlay_verts == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
const int vert_len = lattice_render_data_verts_len_get(rdata);
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vert_len);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vert_len);
for (int i = 0; i < vert_len; ++i) {
const BPoint *bp = lattice_render_data_vert_bpoint(rdata, i);
@@ -456,17 +456,17 @@ static void lattice_batch_cache_create_overlay_batches(Lattice *lt)
}
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, bp->vec);
- VertexBuffer_set_attrib(vbo, attr_id.data, i, &vflag);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, bp->vec);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, i, &vflag);
}
- cache->overlay_verts = Batch_create(PRIM_POINTS, vbo, NULL);
+ cache->overlay_verts = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
}
lattice_render_data_free(rdata);
}
-Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
+Gwn_Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
@@ -474,7 +474,7 @@ Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
/* create batch from Lattice */
LatticeRenderData *rdata = lattice_render_data_create(lt, LR_DATATYPE_VERT | LR_DATATYPE_EDGE);
- cache->all_edges = Batch_create(PRIM_LINES, lattice_batch_cache_get_pos(rdata, cache),
+ cache->all_edges = GWN_batch_create(GWN_PRIM_LINES, lattice_batch_cache_get_pos(rdata, cache),
lattice_batch_cache_get_edges(rdata, cache));
lattice_render_data_free(rdata);
@@ -483,14 +483,14 @@ Batch *DRW_lattice_batch_cache_get_all_edges(Lattice *lt)
return cache->all_edges;
}
-Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
+Gwn_Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
if (cache->all_verts == NULL) {
LatticeRenderData *rdata = lattice_render_data_create(lt, LR_DATATYPE_VERT);
- cache->all_verts = Batch_create(PRIM_POINTS, lattice_batch_cache_get_pos(rdata, cache), NULL);
+ cache->all_verts = GWN_batch_create(GWN_PRIM_POINTS, lattice_batch_cache_get_pos(rdata, cache), NULL);
lattice_render_data_free(rdata);
}
@@ -498,7 +498,7 @@ Batch *DRW_lattice_batch_cache_get_all_verts(Lattice *lt)
return cache->all_verts;
}
-Batch *DRW_lattice_batch_cache_get_overlay_verts(Lattice *lt)
+Gwn_Batch *DRW_lattice_batch_cache_get_overlay_verts(Lattice *lt)
{
LatticeBatchCache *cache = lattice_batch_cache_get(lt);
diff --git a/source/blender/draw/intern/draw_cache_impl_mesh.c b/source/blender/draw/intern/draw_cache_impl_mesh.c
index 012f840d51b..524ee22f577 100644
--- a/source/blender/draw/intern/draw_cache_impl_mesh.c
+++ b/source/blender/draw/intern/draw_cache_impl_mesh.c
@@ -1219,7 +1219,7 @@ static unsigned char mesh_render_data_vertex_flag(MeshRenderData *rdata, const B
}
static void add_overlay_tri(
- MeshRenderData *rdata, VertexBuffer *vbo_pos, VertexBuffer *vbo_nor, VertexBuffer *vbo_data,
+ MeshRenderData *rdata, Gwn_VertBuf *vbo_pos, Gwn_VertBuf *vbo_nor, Gwn_VertBuf *vbo_data,
const unsigned int pos_id, const unsigned int vnor_id, const unsigned int lnor_id, const unsigned int data_id,
const BMLoop **bm_looptri, const int base_vert_idx)
{
@@ -1229,7 +1229,7 @@ static void add_overlay_tri(
if (vbo_pos) {
for (uint i = 0; i < 3; i++) {
const float *pos = bm_looptri[i]->v->co;
- VertexBuffer_set_attrib(vbo_pos, pos_id, base_vert_idx + i, pos);
+ GWN_vertbuf_attr_set(vbo_pos, pos_id, base_vert_idx + i, pos);
}
}
@@ -1238,8 +1238,8 @@ static void add_overlay_tri(
PackedNormal lnor = convert_i10_v3(bm_looptri[0]->f->no);
for (uint i = 0; i < 3; i++) {
PackedNormal vnor = convert_i10_v3(bm_looptri[i]->v->no);
- VertexBuffer_set_attrib(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
- VertexBuffer_set_attrib(vbo_nor, lnor_id, base_vert_idx + i, &lnor);
+ GWN_vertbuf_attr_set(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
+ GWN_vertbuf_attr_set(vbo_nor, lnor_id, base_vert_idx + i, &lnor);
}
}
@@ -1253,7 +1253,7 @@ static void add_overlay_tri(
mesh_render_data_edge_flag(rdata, bm_looptri[i_next]->e, &eattr);
}
eattr.v_flag = fflag | vflag;
- VertexBuffer_set_attrib(vbo_data, data_id, base_vert_idx + i, &eattr);
+ GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
i_prev = i;
i = i_next;
@@ -1262,21 +1262,21 @@ static void add_overlay_tri(
}
static void add_overlay_loose_edge(
- MeshRenderData *rdata, VertexBuffer *vbo_pos, VertexBuffer *vbo_nor, VertexBuffer *vbo_data,
+ MeshRenderData *rdata, Gwn_VertBuf *vbo_pos, Gwn_VertBuf *vbo_nor, Gwn_VertBuf *vbo_data,
const unsigned int pos_id, const unsigned int vnor_id, const unsigned int data_id,
const BMEdge *eed, const int base_vert_idx)
{
if (vbo_pos) {
for (int i = 0; i < 2; ++i) {
const float *pos = (&eed->v1)[i]->co;
- VertexBuffer_set_attrib(vbo_pos, pos_id, base_vert_idx + i, pos);
+ GWN_vertbuf_attr_set(vbo_pos, pos_id, base_vert_idx + i, pos);
}
}
if (vbo_nor) {
for (int i = 0; i < 2; ++i) {
PackedNormal vnor = convert_i10_v3((&eed->v1)[i]->no);
- VertexBuffer_set_attrib(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
+ GWN_vertbuf_attr_set(vbo_nor, vnor_id, base_vert_idx + i, &vnor);
}
}
@@ -1285,30 +1285,30 @@ static void add_overlay_loose_edge(
mesh_render_data_edge_flag(rdata, eed, &eattr);
for (int i = 0; i < 2; ++i) {
eattr.v_flag = mesh_render_data_vertex_flag(rdata, (&eed->v1)[i]);
- VertexBuffer_set_attrib(vbo_data, data_id, base_vert_idx + i, &eattr);
+ GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx + i, &eattr);
}
}
}
static void add_overlay_loose_vert(
- MeshRenderData *rdata, VertexBuffer *vbo_pos, VertexBuffer *vbo_nor, VertexBuffer *vbo_data,
+ MeshRenderData *rdata, Gwn_VertBuf *vbo_pos, Gwn_VertBuf *vbo_nor, Gwn_VertBuf *vbo_data,
const unsigned int pos_id, const unsigned int vnor_id, const unsigned int data_id,
const BMVert *eve, const int base_vert_idx)
{
if (vbo_pos) {
const float *pos = eve->co;
- VertexBuffer_set_attrib(vbo_pos, pos_id, base_vert_idx, pos);
+ GWN_vertbuf_attr_set(vbo_pos, pos_id, base_vert_idx, pos);
}
if (vbo_nor) {
PackedNormal vnor = convert_i10_v3(eve->no);
- VertexBuffer_set_attrib(vbo_nor, vnor_id, base_vert_idx, &vnor);
+ GWN_vertbuf_attr_set(vbo_nor, vnor_id, base_vert_idx, &vnor);
}
if (vbo_data) {
unsigned char vflag[4] = {0, 0, 0, 0};
vflag[0] = mesh_render_data_vertex_flag(rdata, eve);
- VertexBuffer_set_attrib(vbo_data, data_id, base_vert_idx, vflag);
+ GWN_vertbuf_attr_set(vbo_data, data_id, base_vert_idx, vflag);
}
}
@@ -1317,78 +1317,78 @@ static void add_overlay_loose_vert(
/* ---------------------------------------------------------------------- */
-/** \name Mesh Batch Cache
+/** \name Mesh Gwn_Batch Cache
* \{ */
typedef struct MeshBatchCache {
- VertexBuffer *pos_in_order;
- VertexBuffer *nor_in_order;
- ElementList *edges_in_order;
- ElementList *triangles_in_order;
- ElementList *overlay_triangles_vpaint;
-
- Batch *all_verts;
- Batch *all_edges;
- Batch *all_triangles;
-
- VertexBuffer *pos_with_normals;
- VertexBuffer *pos_with_normals_visible_only; /* for paint modes with vert/face hide support. */
- VertexBuffer *tri_aligned_weights;
- VertexBuffer *tri_aligned_vert_colors;
- VertexBuffer *tri_aligned_select_id;
- VertexBuffer *tri_aligned_uv; /* Active UV layer (mloopuv) */
- VertexBuffer *edge_pos_with_select_bool;
- VertexBuffer *pos_with_select_bool;
- Batch *triangles_with_normals;
+ Gwn_VertBuf *pos_in_order;
+ Gwn_VertBuf *nor_in_order;
+ Gwn_IndexBuf *edges_in_order;
+ Gwn_IndexBuf *triangles_in_order;
+ Gwn_IndexBuf *overlay_triangles_vpaint;
+
+ Gwn_Batch *all_verts;
+ Gwn_Batch *all_edges;
+ Gwn_Batch *all_triangles;
+
+ Gwn_VertBuf *pos_with_normals;
+ Gwn_VertBuf *pos_with_normals_visible_only; /* for paint modes with vert/face hide support. */
+ Gwn_VertBuf *tri_aligned_weights;
+ Gwn_VertBuf *tri_aligned_vert_colors;
+ Gwn_VertBuf *tri_aligned_select_id;
+ Gwn_VertBuf *tri_aligned_uv; /* Active UV layer (mloopuv) */
+ Gwn_VertBuf *edge_pos_with_select_bool;
+ Gwn_VertBuf *pos_with_select_bool;
+ Gwn_Batch *triangles_with_normals;
/* Skip hidden (depending on paint select mode),
* 'pos_with_normals' or 'pos_with_normals_visible_only'. */
- Batch *triangles_with_weights;
- Batch *triangles_with_vert_colors;
+ Gwn_Batch *triangles_with_weights;
+ Gwn_Batch *triangles_with_vert_colors;
/* Always skip hidden */
- Batch *triangles_with_select_id;
+ Gwn_Batch *triangles_with_select_id;
- Batch *points_with_normals;
- Batch *fancy_edges; /* owns its vertex buffer (not shared) */
+ Gwn_Batch *points_with_normals;
+ Gwn_Batch *fancy_edges; /* owns its vertex buffer (not shared) */
/* Maybe have shaded_triangles_data split into pos_nor and uv_tangent
* to minimise data transfer for skinned mesh. */
- VertexFormat shaded_triangles_format;
- VertexBuffer *shaded_triangles_data;
- ElementList **shaded_triangles_in_order;
- Batch **shaded_triangles;
+ Gwn_VertFormat shaded_triangles_format;
+ Gwn_VertBuf *shaded_triangles_data;
+ Gwn_IndexBuf **shaded_triangles_in_order;
+ Gwn_Batch **shaded_triangles;
/* Texture Paint.*/
/* per-texture batch */
- Batch **texpaint_triangles;
- Batch *texpaint_triangles_single;
+ Gwn_Batch **texpaint_triangles;
+ Gwn_Batch *texpaint_triangles_single;
/* Edit Cage Mesh buffers */
- VertexBuffer *ed_tri_pos;
- VertexBuffer *ed_tri_nor; /* LoopNor, VertNor */
- VertexBuffer *ed_tri_data;
+ Gwn_VertBuf *ed_tri_pos;
+ Gwn_VertBuf *ed_tri_nor; /* LoopNor, VertNor */
+ Gwn_VertBuf *ed_tri_data;
- VertexBuffer *ed_ledge_pos;
- VertexBuffer *ed_ledge_nor; /* VertNor */
- VertexBuffer *ed_ledge_data;
+ Gwn_VertBuf *ed_ledge_pos;
+ Gwn_VertBuf *ed_ledge_nor; /* VertNor */
+ Gwn_VertBuf *ed_ledge_data;
- VertexBuffer *ed_lvert_pos;
- VertexBuffer *ed_lvert_nor; /* VertNor */
- VertexBuffer *ed_lvert_data;
+ Gwn_VertBuf *ed_lvert_pos;
+ Gwn_VertBuf *ed_lvert_nor; /* VertNor */
+ Gwn_VertBuf *ed_lvert_data;
- VertexBuffer *ed_fcenter_pos;
- VertexBuffer *ed_fcenter_nor;
+ Gwn_VertBuf *ed_fcenter_pos;
+ Gwn_VertBuf *ed_fcenter_nor;
- Batch *overlay_triangles;
- Batch *overlay_triangles_nor; /* PRIM_POINTS */
- Batch *overlay_loose_edges;
- Batch *overlay_loose_edges_nor; /* PRIM_POINTS */
- Batch *overlay_loose_verts;
- Batch *overlay_facedots;
+ Gwn_Batch *overlay_triangles;
+ Gwn_Batch *overlay_triangles_nor; /* GWN_PRIM_POINTS */
+ Gwn_Batch *overlay_loose_edges;
+ Gwn_Batch *overlay_loose_edges_nor; /* GWN_PRIM_POINTS */
+ Gwn_Batch *overlay_loose_verts;
+ Gwn_Batch *overlay_facedots;
- Batch *overlay_weight_faces;
- Batch *overlay_weight_verts;
- Batch *overlay_paint_edges;
+ Gwn_Batch *overlay_weight_faces;
+ Gwn_Batch *overlay_weight_verts;
+ Gwn_Batch *overlay_paint_edges;
/* settings to determine if cache is invalid */
bool is_dirty;
@@ -1401,7 +1401,7 @@ typedef struct MeshBatchCache {
bool is_editmode;
} MeshBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool mesh_batch_cache_valid(Mesh *me)
{
@@ -1490,13 +1490,13 @@ void DRW_mesh_batch_cache_dirty(Mesh *me, int mode)
cache->is_dirty = true;
break;
case BKE_MESH_BATCH_DIRTY_SELECT:
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_fcenter_nor); /* Contains select flag */
- BATCH_DISCARD_SAFE(cache->overlay_triangles);
- BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
- BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_nor); /* Contains select flag */
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_triangles);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_facedots);
break;
@@ -1515,61 +1515,61 @@ static void mesh_batch_cache_clear(Mesh *me)
return;
}
- BATCH_DISCARD_SAFE(cache->all_verts);
- BATCH_DISCARD_SAFE(cache->all_edges);
- BATCH_DISCARD_SAFE(cache->all_triangles);
-
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_in_order);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_with_select_bool);
- ELEMENTLIST_DISCARD_SAFE(cache->edges_in_order);
- ELEMENTLIST_DISCARD_SAFE(cache->triangles_in_order);
- ELEMENTLIST_DISCARD_SAFE(cache->overlay_triangles_vpaint);
-
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_nor);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_tri_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_nor);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_ledge_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_nor);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_lvert_data);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_fcenter_pos);
- VERTEXBUFFER_DISCARD_SAFE(cache->ed_fcenter_nor);
- BATCH_DISCARD_SAFE(cache->overlay_triangles);
- BATCH_DISCARD_SAFE(cache->overlay_triangles_nor);
- BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
- BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
- BATCH_DISCARD_SAFE(cache->overlay_loose_edges_nor);
-
- BATCH_DISCARD_SAFE(cache->overlay_weight_faces);
- BATCH_DISCARD_SAFE(cache->overlay_weight_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->all_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->all_edges);
+ GWN_BATCH_DISCARD_SAFE(cache->all_triangles);
+
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_in_order);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_with_select_bool);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->edges_in_order);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->triangles_in_order);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->overlay_triangles_vpaint);
+
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_nor);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_tri_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_nor);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_ledge_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_nor);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_lvert_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_pos);
+ GWN_VERTBUF_DISCARD_SAFE(cache->ed_fcenter_nor);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_triangles);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_triangles_nor);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_verts);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_edges);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_loose_edges_nor);
+
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_weight_faces);
+ GWN_BATCH_DISCARD_SAFE(cache->overlay_weight_verts);
BATCH_DISCARD_ALL_SAFE(cache->overlay_paint_edges);
BATCH_DISCARD_ALL_SAFE(cache->overlay_facedots);
- BATCH_DISCARD_SAFE(cache->triangles_with_normals);
- BATCH_DISCARD_SAFE(cache->points_with_normals);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_with_normals);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos_with_normals_visible_only);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_vert_colors);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_weights);
- BATCH_DISCARD_SAFE(cache->triangles_with_weights);
- BATCH_DISCARD_SAFE(cache->triangles_with_vert_colors);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_select_id);
- VERTEXBUFFER_DISCARD_SAFE(cache->tri_aligned_uv);
- BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_normals);
+ GWN_BATCH_DISCARD_SAFE(cache->points_with_normals);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_with_normals);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos_with_normals_visible_only);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_vert_colors);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_weights);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_weights);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_vert_colors);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_select_id);
+ GWN_VERTBUF_DISCARD_SAFE(cache->tri_aligned_uv);
+ GWN_BATCH_DISCARD_SAFE(cache->triangles_with_select_id);
BATCH_DISCARD_ALL_SAFE(cache->fancy_edges);
- VERTEXBUFFER_DISCARD_SAFE(cache->shaded_triangles_data);
+ GWN_VERTBUF_DISCARD_SAFE(cache->shaded_triangles_data);
if (cache->shaded_triangles_in_order) {
for (int i = 0; i < cache->mat_len; ++i) {
- ELEMENTLIST_DISCARD_SAFE(cache->shaded_triangles_in_order[i]);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->shaded_triangles_in_order[i]);
}
}
if (cache->shaded_triangles) {
for (int i = 0; i < cache->mat_len; ++i) {
- BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
+ GWN_BATCH_DISCARD_SAFE(cache->shaded_triangles[i]);
}
}
@@ -1578,12 +1578,12 @@ static void mesh_batch_cache_clear(Mesh *me)
if (cache->texpaint_triangles) {
for (int i = 0; i < cache->mat_len; ++i) {
- BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
+ GWN_BATCH_DISCARD_SAFE(cache->texpaint_triangles[i]);
}
}
MEM_SAFE_FREE(cache->texpaint_triangles);
- BATCH_DISCARD_SAFE(cache->texpaint_triangles_single);
+ GWN_BATCH_DISCARD_SAFE(cache->texpaint_triangles_single);
}
@@ -1593,9 +1593,9 @@ void DRW_mesh_batch_cache_free(Mesh *me)
MEM_SAFE_FREE(me->batch_cache);
}
-/* Batch cache usage. */
+/* Gwn_Batch cache usage. */
-static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata, MeshBatchCache *cache)
+static Gwn_VertBuf *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
#define USE_COMP_MESH_DATA
@@ -1608,9 +1608,9 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
return NULL;
}
- VertexFormat *format = &cache->shaded_triangles_format;
+ Gwn_VertFormat *format = &cache->shaded_triangles_format;
- VertexFormat_clear(format);
+ GWN_vertformat_clear(format);
/* initialize vertex format */
unsigned int *uv_id = MEM_mallocN(sizeof(*uv_id) * rdata->cd.layers.uv_len, "UV attrib format");
@@ -1621,17 +1621,17 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
/* UV */
attrib_name = mesh_render_data_uv_layer_uuid_get(rdata, i);
#if defined(USE_COMP_MESH_DATA) && 0 /* these are clamped. Maybe use them as an option in the future */
- uv_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_I16, 2, NORMALIZE_INT_TO_FLOAT);
+ uv_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_I16, 2, GWN_FETCH_INT_TO_FLOAT_UNIT);
#else
- uv_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_F32, 2, KEEP_FLOAT);
+ uv_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
#endif
/* Auto Name */
attrib_name = mesh_render_data_uv_auto_layer_uuid_get(rdata, i);
- VertexFormat_add_alias(format, attrib_name);
+ GWN_vertformat_alias_add(format, attrib_name);
if (i == rdata->cd.layers.uv_active) {
- VertexFormat_add_alias(format, "u");
+ GWN_vertformat_alias_add(format, "u");
}
/* Tangent */
@@ -1640,40 +1640,40 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
* That may cause some problem but I could not make it to fail (fclem) */
#ifdef USE_COMP_MESH_DATA
/* Tangents need more precision than 10_10_10 */
- tangent_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
+ tangent_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
#else
- tangent_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_F32, 3, KEEP_FLOAT);
+ tangent_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
#endif
if (i == rdata->cd.layers.uv_active) {
- VertexFormat_add_alias(format, "t");
+ GWN_vertformat_alias_add(format, "t");
}
}
for (int i = 0; i < rdata->cd.layers.vcol_len; i++) {
attrib_name = mesh_render_data_vcol_layer_uuid_get(rdata, i);
- vcol_id[i] = VertexFormat_add_attrib(format, attrib_name, COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ vcol_id[i] = GWN_vertformat_attr_add(format, attrib_name, GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
/* Auto layer */
if (rdata->cd.layers.auto_vcol[i]) {
attrib_name = mesh_render_data_vcol_auto_layer_uuid_get(rdata, i);
- VertexFormat_add_alias(format, attrib_name);
+ GWN_vertformat_alias_add(format, attrib_name);
}
if (i == rdata->cd.layers.vcol_active) {
- VertexFormat_add_alias(format, "c");
+ GWN_vertformat_alias_add(format, "c");
}
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->shaded_triangles_data = VertexBuffer_create_with_format(format);
+ Gwn_VertBuf *vbo = cache->shaded_triangles_data = GWN_vertbuf_create_with_format(format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
- /* TODO deduplicate all verts and make use of ElementList in
+ /* TODO deduplicate all verts and make use of Gwn_IndexBuf in
* mesh_batch_cache_get_triangles_in_order_split_by_material. */
for (int i = 0; i < tri_len; i++) {
float *tri_uvs[3], *tri_tans[3];
@@ -1694,9 +1694,9 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
#else
float **s_uvs = tri_uvs;
#endif
- VertexBuffer_set_attrib(vbo, uv_id[j], vidx + 0, s_uvs[0]);
- VertexBuffer_set_attrib(vbo, uv_id[j], vidx + 1, s_uvs[1]);
- VertexBuffer_set_attrib(vbo, uv_id[j], vidx + 2, s_uvs[2]);
+ GWN_vertbuf_attr_set(vbo, uv_id[j], vidx + 0, s_uvs[0]);
+ GWN_vertbuf_attr_set(vbo, uv_id[j], vidx + 1, s_uvs[1]);
+ GWN_vertbuf_attr_set(vbo, uv_id[j], vidx + 2, s_uvs[2]);
/* Tangent */
mesh_render_data_looptri_tans_get(rdata, i, j, &tri_tans);
@@ -1709,17 +1709,17 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
#else
float **s_tan = tri_tans;
#endif
- VertexBuffer_set_attrib(vbo, tangent_id[j], vidx + 0, s_tan[0]);
- VertexBuffer_set_attrib(vbo, tangent_id[j], vidx + 1, s_tan[1]);
- VertexBuffer_set_attrib(vbo, tangent_id[j], vidx + 2, s_tan[2]);
+ GWN_vertbuf_attr_set(vbo, tangent_id[j], vidx + 0, s_tan[0]);
+ GWN_vertbuf_attr_set(vbo, tangent_id[j], vidx + 1, s_tan[1]);
+ GWN_vertbuf_attr_set(vbo, tangent_id[j], vidx + 2, s_tan[2]);
}
/* VCOLs */
for (int j = 0; j < rdata->cd.layers.vcol_len; j++) {
mesh_render_data_looptri_cols_get(rdata, i, j, &tri_cols);
- VertexBuffer_set_attrib(vbo, vcol_id[j], vidx + 0, tri_cols[0]);
- VertexBuffer_set_attrib(vbo, vcol_id[j], vidx + 1, tri_cols[1]);
- VertexBuffer_set_attrib(vbo, vcol_id[j], vidx + 2, tri_cols[2]);
+ GWN_vertbuf_attr_set(vbo, vcol_id[j], vidx + 0, tri_cols[0]);
+ GWN_vertbuf_attr_set(vbo, vcol_id[j], vidx + 1, tri_cols[1]);
+ GWN_vertbuf_attr_set(vbo, vcol_id[j], vidx + 2, tri_cols[2]);
}
vidx += 3;
@@ -1728,7 +1728,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
vbo_len_used = vidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
MEM_freeN(uv_id);
@@ -1741,7 +1741,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_shading_data(MeshRenderData *rdata
return cache->shaded_triangles_data;
}
-static VertexBuffer *mesh_batch_cache_get_tri_uv_active(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_uv_active(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPUV));
@@ -1750,27 +1750,27 @@ static VertexBuffer *mesh_batch_cache_get_tri_uv_active(
if (cache->tri_aligned_uv == NULL) {
unsigned int vidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint uv; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.uv = VertexFormat_add_attrib(&format, "uv", COMP_F32, 2, KEEP_FLOAT);
+ attr_id.uv = GWN_vertformat_attr_add(&format, "uv", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_uv = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_uv = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
const MLoopUV *mloopuv = rdata->mloopuv;
for (int i = 0; i < tri_len; i++) {
const MLoopTri *mlt = &rdata->mlooptri[i];
- VertexBuffer_set_attrib(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[0]].uv);
- VertexBuffer_set_attrib(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[1]].uv);
- VertexBuffer_set_attrib(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[2]].uv);
+ GWN_vertbuf_attr_set(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[0]].uv);
+ GWN_vertbuf_attr_set(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[1]].uv);
+ GWN_vertbuf_attr_set(vbo, attr_id.uv, vidx++, mloopuv[mlt->tri[2]].uv);
}
vbo_len_used = vidx;
@@ -1780,29 +1780,29 @@ static VertexBuffer *mesh_batch_cache_get_tri_uv_active(
return cache->tri_aligned_uv;
}
-static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_ex(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals_ex(
MeshRenderData *rdata, const bool use_hide,
- VertexBuffer **r_vbo)
+ Gwn_VertBuf **r_vbo)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY));
if (*r_vbo == NULL) {
unsigned int vidx = 0, nidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = *r_vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = *r_vbo = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < tri_len; i++) {
float *tri_vert_cos[3];
@@ -1820,41 +1820,41 @@ static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_ex(
};
PackedNormal *snor[3] = { &snor_pack[0], &snor_pack[1], &snor_pack[2] };
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor[0]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor[1]);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor[2]);
}
else {
PackedNormal snor_pack = convert_i10_s3(tri_nor);
PackedNormal *snor = &snor_pack;
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor);
- VertexBuffer_set_attrib(vbo, attr_id.nor, nidx++, snor);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, nidx++, snor);
}
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, tri_vert_cos[0]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, tri_vert_cos[1]);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, tri_vert_cos[2]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, tri_vert_cos[0]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, tri_vert_cos[1]);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, tri_vert_cos[2]);
}
}
vbo_len_used = vidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return *r_vbo;
}
-static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals(
MeshRenderData *rdata, MeshBatchCache *cache)
{
return mesh_batch_cache_get_tri_pos_and_normals_ex(
rdata, false,
&cache->pos_with_normals);
}
-static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_visible_only(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_pos_and_normals_visible_only(
MeshRenderData *rdata, MeshBatchCache *cache)
{
return mesh_batch_cache_get_tri_pos_and_normals_ex(
@@ -1862,7 +1862,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_pos_and_normals_visible_only(
&cache->pos_with_normals_visible_only);
}
-static VertexBuffer *mesh_batch_cache_get_tri_weights(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_weights(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide, int defgroup)
{
BLI_assert(
@@ -1872,19 +1872,19 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
if (cache->tri_aligned_weights == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint col; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.col = VertexFormat_add_attrib(&format, "color", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_weights = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_weights = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
mesh_render_data_ensure_vert_weight_color(rdata, defgroup);
const float (*vert_weight_color)[3] = rdata->vert_weight_color;
@@ -1896,7 +1896,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const int v_index = BM_elem_index_get(ltri[tri_corner]->v);
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
}
}
}
@@ -1907,7 +1907,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
if (!(use_hide && (rdata->mpoly[mlt->poly].flag & ME_HIDE))) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const uint v_index = rdata->mloop[mlt->tri[tri_corner]].v;
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_weight_color[v_index]);
}
}
}
@@ -1915,14 +1915,14 @@ static VertexBuffer *mesh_batch_cache_get_tri_weights(
vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->tri_aligned_weights;
}
-static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_vert_colors(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide)
{
BLI_assert(
@@ -1932,18 +1932,18 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
if (cache->tri_aligned_vert_colors == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint col; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.col = VertexFormat_add_attrib(&format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_vert_colors = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_vert_colors = GWN_vertbuf_create_with_format(&format);
const uint vbo_len_capacity = tri_len * 3;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
mesh_render_data_ensure_vert_color(rdata);
const char (*vert_color)[3] = rdata->vert_color;
@@ -1955,7 +1955,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const int l_index = BM_elem_index_get(ltri[tri_corner]);
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_color[l_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_color[l_index]);
}
}
}
@@ -1966,7 +1966,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
if (!(use_hide && (rdata->mpoly[mlt->poly].flag & ME_HIDE))) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
const uint l_index = mlt->tri[tri_corner];
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, vert_color[l_index]);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, vert_color[l_index]);
}
}
}
@@ -1974,14 +1974,14 @@ static VertexBuffer *mesh_batch_cache_get_tri_vert_colors(
const uint vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->tri_aligned_vert_colors;
}
-static VertexBuffer *mesh_batch_cache_get_tri_select_id(
+static Gwn_VertBuf *mesh_batch_cache_get_tri_select_id(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_hide)
{
BLI_assert(
@@ -1991,19 +1991,19 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
if (cache->tri_aligned_select_id == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint col; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.col = VertexFormat_add_attrib(&format, "color", COMP_I32, 1, KEEP_INT);
+ attr_id.col = GWN_vertformat_attr_add(&format, "color", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- VertexBuffer *vbo = cache->tri_aligned_select_id = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->tri_aligned_select_id = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = tri_len * 3;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
if (rdata->edit_bmesh) {
for (int i = 0; i < tri_len; i++) {
@@ -2014,7 +2014,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
int select_id;
GPU_select_index_get(poly_index + 1, &select_id);
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, &select_id);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
}
}
}
@@ -2027,7 +2027,7 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
int select_id;
GPU_select_index_get(poly_index + 1, &select_id);
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- VertexBuffer_set_attrib(vbo, attr_id.col, cidx++, &select_id);
+ GWN_vertbuf_attr_set(vbo, attr_id.col, cidx++, &select_id);
}
}
}
@@ -2035,29 +2035,29 @@ static VertexBuffer *mesh_batch_cache_get_tri_select_id(
vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->tri_aligned_select_id;
}
-static VertexBuffer *mesh_batch_cache_get_vert_pos_and_nor_in_order(
+static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_and_nor_in_order(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
if (cache->pos_in_order == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, nor; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.nor = VertexFormat_add_attrib(&format, "nor", COMP_I16, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.nor = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_I16, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
- VertexBuffer *vbo = cache->pos_in_order = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->pos_in_order = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = mesh_render_data_verts_len_get(rdata);
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
if (rdata->edit_bmesh) {
BMesh *bm = rdata->edit_bmesh->bm;
@@ -2069,15 +2069,15 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_and_nor_in_order(
static short no_short[3];
normal_float_to_short_v3(no_short, eve->no);
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, eve->co);
- VertexBuffer_set_attrib(vbo, attr_id.nor, i, no_short);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, eve->co);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, i, no_short);
}
BLI_assert(i == vbo_len_capacity);
}
else {
for (int i = 0; i < vbo_len_capacity; ++i) {
- VertexBuffer_set_attrib(vbo, attr_id.pos, i, rdata->mvert[i].co);
- VertexBuffer_set_attrib(vbo, attr_id.nor, i, rdata->mvert[i].no);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, i, rdata->mvert[i].co);
+ GWN_vertbuf_attr_set(vbo, attr_id.nor, i, rdata->mvert[i].no);
}
}
}
@@ -2085,26 +2085,26 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_and_nor_in_order(
return cache->pos_in_order;
}
-static VertexFormat *edit_mesh_overlay_pos_format(unsigned int *r_pos_id)
+static Gwn_VertFormat *edit_mesh_overlay_pos_format(unsigned int *r_pos_id)
{
- static VertexFormat format_pos = { 0 };
+ static Gwn_VertFormat format_pos = { 0 };
static unsigned pos_id;
if (format_pos.attrib_ct == 0) {
- pos_id = VertexFormat_add_attrib(&format_pos, "pos", COMP_F32, 3, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format_pos, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
}
*r_pos_id = pos_id;
return &format_pos;
}
-static VertexFormat *edit_mesh_overlay_nor_format(unsigned int *r_vnor_id, unsigned int *r_lnor_id)
+static Gwn_VertFormat *edit_mesh_overlay_nor_format(unsigned int *r_vnor_id, unsigned int *r_lnor_id)
{
- static VertexFormat format_nor = { 0 };
- static VertexFormat format_nor_loop = { 0 };
+ static Gwn_VertFormat format_nor = { 0 };
+ static Gwn_VertFormat format_nor_loop = { 0 };
static unsigned vnor_id, vnor_loop_id, lnor_id;
if (format_nor.attrib_ct == 0) {
- vnor_id = VertexFormat_add_attrib(&format_nor, "vnor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- vnor_loop_id = VertexFormat_add_attrib(&format_nor_loop, "vnor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- lnor_id = VertexFormat_add_attrib(&format_nor_loop, "lnor", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ vnor_id = GWN_vertformat_attr_add(&format_nor, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ vnor_loop_id = GWN_vertformat_attr_add(&format_nor_loop, "vnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ lnor_id = GWN_vertformat_attr_add(&format_nor_loop, "lnor", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
if (r_lnor_id) {
*r_vnor_id = vnor_loop_id;
@@ -2117,12 +2117,12 @@ static VertexFormat *edit_mesh_overlay_nor_format(unsigned int *r_vnor_id, unsig
}
}
-static VertexFormat *edit_mesh_overlay_data_format(unsigned int *r_data_id)
+static Gwn_VertFormat *edit_mesh_overlay_data_format(unsigned int *r_data_id)
{
- static VertexFormat format_flag = { 0 };
+ static Gwn_VertFormat format_flag = { 0 };
static unsigned data_id;
if (format_flag.attrib_ct == 0) {
- data_id = VertexFormat_add_attrib(&format_flag, "data", COMP_U8, 4, KEEP_INT);
+ data_id = GWN_vertformat_attr_add(&format_flag, "data", GWN_COMP_U8, 4, GWN_FETCH_INT);
}
*r_data_id = data_id;
return &format_flag;
@@ -2139,28 +2139,28 @@ static void mesh_batch_cache_create_overlay_tri_buffers(
int vbo_len_used = 0;
/* Positions */
- VertexBuffer *vbo_pos = NULL;
+ Gwn_VertBuf *vbo_pos = NULL;
static struct { uint pos, vnor, lnor, data; } attr_id;
if (cache->ed_tri_pos == NULL) {
vbo_pos = cache->ed_tri_pos =
- VertexBuffer_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
- VertexBuffer_allocate_data(vbo_pos, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
+ GWN_vertbuf_data_alloc(vbo_pos, vbo_len_capacity);
}
/* Normals */
- VertexBuffer *vbo_nor = NULL;
+ Gwn_VertBuf *vbo_nor = NULL;
if (cache->ed_tri_nor == NULL) {
vbo_nor = cache->ed_tri_nor =
- VertexBuffer_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, &attr_id.lnor));
- VertexBuffer_allocate_data(vbo_nor, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, &attr_id.lnor));
+ GWN_vertbuf_data_alloc(vbo_nor, vbo_len_capacity);
}
/* Data */
- VertexBuffer *vbo_data = NULL;
+ Gwn_VertBuf *vbo_data = NULL;
if (cache->ed_tri_data == NULL) {
vbo_data = cache->ed_tri_data =
- VertexBuffer_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
- VertexBuffer_allocate_data(vbo_data, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
+ GWN_vertbuf_data_alloc(vbo_data, vbo_len_capacity);
}
for (int i = 0; i < tri_len; i++) {
@@ -2178,13 +2178,13 @@ static void mesh_batch_cache_create_overlay_tri_buffers(
/* Finish */
if (vbo_len_used != vbo_len_capacity) {
if (vbo_pos != NULL) {
- VertexBuffer_resize_data(vbo_pos, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_pos, vbo_len_used);
}
if (vbo_nor != NULL) {
- VertexBuffer_resize_data(vbo_nor, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_nor, vbo_len_used);
}
if (vbo_data != NULL) {
- VertexBuffer_resize_data(vbo_data, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_data, vbo_len_used);
}
}
}
@@ -2200,28 +2200,28 @@ static void mesh_batch_cache_create_overlay_ledge_buffers(
int vbo_len_used = 0;
/* Positions */
- VertexBuffer *vbo_pos = NULL;
+ Gwn_VertBuf *vbo_pos = NULL;
static struct { uint pos, vnor, data; } attr_id;
if (cache->ed_ledge_pos == NULL) {
vbo_pos = cache->ed_ledge_pos =
- VertexBuffer_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
- VertexBuffer_allocate_data(vbo_pos, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
+ GWN_vertbuf_data_alloc(vbo_pos, vbo_len_capacity);
}
/* Normals */
- VertexBuffer *vbo_nor = NULL;
+ Gwn_VertBuf *vbo_nor = NULL;
if (cache->ed_ledge_nor == NULL) {
vbo_nor = cache->ed_ledge_nor =
- VertexBuffer_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
- VertexBuffer_allocate_data(vbo_nor, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
+ GWN_vertbuf_data_alloc(vbo_nor, vbo_len_capacity);
}
/* Data */
- VertexBuffer *vbo_data = NULL;
+ Gwn_VertBuf *vbo_data = NULL;
if (cache->ed_ledge_data == NULL) {
vbo_data = cache->ed_ledge_data =
- VertexBuffer_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
- VertexBuffer_allocate_data(vbo_data, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
+ GWN_vertbuf_data_alloc(vbo_data, vbo_len_capacity);
}
if (rdata->edit_bmesh) {
@@ -2241,13 +2241,13 @@ static void mesh_batch_cache_create_overlay_ledge_buffers(
/* Finish */
if (vbo_len_used != vbo_len_capacity) {
if (vbo_pos != NULL) {
- VertexBuffer_resize_data(vbo_pos, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_pos, vbo_len_used);
}
if (vbo_nor != NULL) {
- VertexBuffer_resize_data(vbo_nor, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_nor, vbo_len_used);
}
if (vbo_data != NULL) {
- VertexBuffer_resize_data(vbo_data, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_data, vbo_len_used);
}
}
}
@@ -2266,27 +2266,27 @@ static void mesh_batch_cache_create_overlay_lvert_buffers(
static struct { uint pos, vnor, data; } attr_id;
/* Positions */
- VertexBuffer *vbo_pos = NULL;
+ Gwn_VertBuf *vbo_pos = NULL;
if (cache->ed_lvert_pos == NULL) {
vbo_pos = cache->ed_lvert_pos =
- VertexBuffer_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
- VertexBuffer_allocate_data(vbo_pos, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_pos_format(&attr_id.pos));
+ GWN_vertbuf_data_alloc(vbo_pos, vbo_len_capacity);
}
/* Normals */
- VertexBuffer *vbo_nor = NULL;
+ Gwn_VertBuf *vbo_nor = NULL;
if (cache->ed_lvert_nor == NULL) {
vbo_nor = cache->ed_lvert_nor =
- VertexBuffer_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
- VertexBuffer_allocate_data(vbo_nor, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_nor_format(&attr_id.vnor, NULL));
+ GWN_vertbuf_data_alloc(vbo_nor, vbo_len_capacity);
}
/* Data */
- VertexBuffer *vbo_data = NULL;
+ Gwn_VertBuf *vbo_data = NULL;
if (cache->ed_lvert_data == NULL) {
vbo_data = cache->ed_lvert_data =
- VertexBuffer_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
- VertexBuffer_allocate_data(vbo_data, vbo_len_capacity);
+ GWN_vertbuf_create_with_format(edit_mesh_overlay_data_format(&attr_id.data));
+ GWN_vertbuf_data_alloc(vbo_data, vbo_len_capacity);
}
for (uint i = 0; i < lvert_len; i++) {
@@ -2301,19 +2301,19 @@ static void mesh_batch_cache_create_overlay_lvert_buffers(
/* Finish */
if (vbo_len_used != vbo_len_capacity) {
if (vbo_pos != NULL) {
- VertexBuffer_resize_data(vbo_pos, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_pos, vbo_len_used);
}
if (vbo_nor != NULL) {
- VertexBuffer_resize_data(vbo_nor, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_nor, vbo_len_used);
}
if (vbo_data != NULL) {
- VertexBuffer_resize_data(vbo_data, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo_data, vbo_len_used);
}
}
}
/* Position */
-static VertexBuffer *mesh_batch_cache_get_edit_tri_pos(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_tri_pos(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2325,7 +2325,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_tri_pos(
return cache->ed_tri_pos;
}
-static VertexBuffer *mesh_batch_cache_get_edit_ledge_pos(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_ledge_pos(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2337,7 +2337,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_ledge_pos(
return cache->ed_ledge_pos;
}
-static VertexBuffer *mesh_batch_cache_get_edit_lvert_pos(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_lvert_pos(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2350,7 +2350,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_lvert_pos(
}
/* Normal */
-static VertexBuffer *mesh_batch_cache_get_edit_tri_nor(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_tri_nor(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2362,7 +2362,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_tri_nor(
return cache->ed_tri_nor;
}
-static VertexBuffer *mesh_batch_cache_get_edit_ledge_nor(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_ledge_nor(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2374,7 +2374,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_ledge_nor(
return cache->ed_ledge_nor;
}
-static VertexBuffer *mesh_batch_cache_get_edit_lvert_nor(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_lvert_nor(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2387,7 +2387,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_lvert_nor(
}
/* Data */
-static VertexBuffer *mesh_batch_cache_get_edit_tri_data(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_tri_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2399,7 +2399,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_tri_data(
return cache->ed_tri_data;
}
-static VertexBuffer *mesh_batch_cache_get_edit_ledge_data(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_ledge_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2411,7 +2411,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_ledge_data(
return cache->ed_ledge_data;
}
-static VertexBuffer *mesh_batch_cache_get_edit_lvert_data(
+static Gwn_VertBuf *mesh_batch_cache_get_edit_lvert_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & MR_DATATYPE_VERT);
@@ -2423,7 +2423,7 @@ static VertexBuffer *mesh_batch_cache_get_edit_lvert_data(
return cache->ed_lvert_data;
}
-static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
+static Gwn_IndexBuf *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE));
@@ -2431,8 +2431,8 @@ static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, M
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int edge_len = mesh_render_data_edges_len_get(rdata);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, edge_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, edge_len, vert_len);
BLI_assert(rdata->types & MR_DATATYPE_EDGE);
@@ -2442,23 +2442,23 @@ static ElementList *mesh_batch_cache_get_edges_in_order(MeshRenderData *rdata, M
BMEdge *eed;
BM_ITER_MESH(eed, &eiter, bm, BM_EDGES_OF_MESH) {
if (!BM_elem_flag_test(eed, BM_ELEM_HIDDEN)) {
- add_line_vertices(&elb, BM_elem_index_get(eed->v1), BM_elem_index_get(eed->v2));
+ GWN_indexbuf_add_line_verts(&elb, BM_elem_index_get(eed->v1), BM_elem_index_get(eed->v2));
}
}
}
else {
const MEdge *ed = rdata->medge;
for (int i = 0; i < edge_len; i++, ed++) {
- add_line_vertices(&elb, ed->v1, ed->v2);
+ GWN_indexbuf_add_line_verts(&elb, ed->v1, ed->v2);
}
}
- cache->edges_in_order = ElementList_build(&elb);
+ cache->edges_in_order = GWN_indexbuf_build(&elb);
}
return cache->edges_in_order;
}
-static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
+static Gwn_IndexBuf *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI));
@@ -2466,15 +2466,15 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdat
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tri_len, vert_len);
if (rdata->edit_bmesh) {
for (int i = 0; i < tri_len; ++i) {
const BMLoop **ltri = (const BMLoop **)rdata->edit_bmesh->looptris[i];
if (!BM_elem_flag_test(ltri[0]->f, BM_ELEM_HIDDEN)) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- add_generic_vertex(&elb, BM_elem_index_get(ltri[tri_corner]->v));
+ GWN_indexbuf_add_generic_vert(&elb, BM_elem_index_get(ltri[tri_corner]->v));
}
}
}
@@ -2483,17 +2483,17 @@ static ElementList *mesh_batch_cache_get_triangles_in_order(MeshRenderData *rdat
for (int i = 0; i < tri_len; ++i) {
const MLoopTri *mlt = &rdata->mlooptri[i];
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- add_generic_vertex(&elb, mlt->tri[tri_corner]);
+ GWN_indexbuf_add_generic_vert(&elb, mlt->tri[tri_corner]);
}
}
}
- cache->triangles_in_order = ElementList_build(&elb);
+ cache->triangles_in_order = GWN_indexbuf_build(&elb);
}
return cache->triangles_in_order;
}
-static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
+static Gwn_IndexBuf **mesh_batch_cache_get_triangles_in_order_split_by_material(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_POLY));
@@ -2505,7 +2505,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
int *mat_tri_len = MEM_callocN(sizeof(*mat_tri_len) * mat_len, __func__);
cache->shaded_triangles_in_order = MEM_callocN(sizeof(*cache->shaded_triangles) * mat_len, __func__);
- ElementListBuilder *elb = MEM_callocN(sizeof(*elb) * mat_len, __func__);
+ Gwn_IndexBufBuilder *elb = MEM_callocN(sizeof(*elb) * mat_len, __func__);
/* Note that polygons (not triangles) are used here.
* This OK because result is _guaranteed_ to be the same. */
@@ -2531,7 +2531,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
/* Init ELBs. */
for (int i = 0; i < mat_len; ++i) {
- ElementListBuilder_init(&elb[i], PRIM_TRIANGLES, mat_tri_len[i], tri_len * 3);
+ GWN_indexbuf_init(&elb[i], GWN_PRIM_TRIS, mat_tri_len[i], tri_len * 3);
}
/* Populate ELBs. */
@@ -2545,7 +2545,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
if (!BM_elem_flag_test(efa, BM_ELEM_HIDDEN)) {
const short ma_id = efa->mat_nr < mat_len ? efa->mat_nr : 0;
for (int j = 2; j < efa->len; j++) {
- add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
+ GWN_indexbuf_add_tri_verts(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
nidx += 3;
}
}
@@ -2556,7 +2556,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
const MPoly *mp = &rdata->mpoly[i]; ;
const short ma_id = mp->mat_nr < mat_len ? mp->mat_nr : 0;
for (int j = 2; j < mp->totloop; j++) {
- add_triangle_vertices(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
+ GWN_indexbuf_add_tri_verts(&elb[ma_id], nidx + 0, nidx + 1, nidx + 2);
nidx += 3;
}
}
@@ -2564,7 +2564,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
/* Build ELBs. */
for (int i = 0; i < mat_len; ++i) {
- cache->shaded_triangles_in_order[i] = ElementList_build(&elb[i]);
+ cache->shaded_triangles_in_order[i] = GWN_indexbuf_build(&elb[i]);
}
MEM_freeN(mat_tri_len);
@@ -2574,7 +2574,7 @@ static ElementList **mesh_batch_cache_get_triangles_in_order_split_by_material(
return cache->shaded_triangles_in_order;
}
-static VertexBuffer *mesh_batch_cache_get_edge_pos_with_sel(
+static Gwn_VertBuf *mesh_batch_cache_get_edge_pos_with_sel(
MeshRenderData *rdata, MeshBatchCache *cache, bool use_wire, bool use_select_bool)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP));
@@ -2583,20 +2583,20 @@ static VertexBuffer *mesh_batch_cache_get_edge_pos_with_sel(
if (!cache->edge_pos_with_select_bool) {
unsigned int vidx = 0, cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, sel; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.sel = VertexFormat_add_attrib(&format, "select", COMP_U8, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.sel = GWN_vertformat_attr_add(&format, "select", GWN_COMP_U8, 1, GWN_FETCH_INT);
}
const int edge_len = mesh_render_data_edges_len_get(rdata);
- VertexBuffer *vbo = cache->edge_pos_with_select_bool = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->edge_pos_with_select_bool = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = edge_len * 2;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
if (use_select_bool) {
mesh_render_data_ensure_edge_select_bool(rdata, use_wire);
@@ -2617,23 +2617,23 @@ static VertexBuffer *mesh_batch_cache_get_edge_pos_with_sel(
continue;
}
- VertexBuffer_set_attrib(vbo, attr_id.sel, cidx++, &edge_vert_sel);
- VertexBuffer_set_attrib(vbo, attr_id.sel, cidx++, &edge_vert_sel);
+ GWN_vertbuf_attr_set(vbo, attr_id.sel, cidx++, &edge_vert_sel);
+ GWN_vertbuf_attr_set(vbo, attr_id.sel, cidx++, &edge_vert_sel);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v1].co);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v2].co);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v1].co);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx++, rdata->mvert[ed->v2].co);
}
vbo_len_used = vidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
return cache->edge_pos_with_select_bool;
}
-static ElementList *mesh_batch_cache_get_tri_overlay_weight_faces(
+static Gwn_IndexBuf *mesh_batch_cache_get_tri_overlay_weight_faces(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI));
@@ -2642,18 +2642,18 @@ static ElementList *mesh_batch_cache_get_tri_overlay_weight_faces(
const int vert_len = mesh_render_data_verts_len_get(rdata);
const int tri_len = mesh_render_data_looptri_len_get(rdata);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_TRIANGLES, tri_len, vert_len);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_TRIS, tri_len, vert_len);
for (int i = 0; i < tri_len; ++i) {
const MLoopTri *mlt = &rdata->mlooptri[i];
if (!(rdata->mpoly[mlt->poly].flag & (ME_FACE_SEL | ME_HIDE))) {
for (uint tri_corner = 0; tri_corner < 3; tri_corner++) {
- add_generic_vertex(&elb, rdata->mloop[mlt->tri[tri_corner]].v);
+ GWN_indexbuf_add_generic_vert(&elb, rdata->mloop[mlt->tri[tri_corner]].v);
}
}
}
- cache->overlay_triangles_vpaint = ElementList_build(&elb);
+ cache->overlay_triangles_vpaint = GWN_indexbuf_build(&elb);
}
return cache->overlay_triangles_vpaint;
@@ -2662,7 +2662,7 @@ static ElementList *mesh_batch_cache_get_tri_overlay_weight_faces(
/**
* Non-edit mode vertices (only used for weight-paint mode).
*/
-static VertexBuffer *mesh_batch_cache_get_vert_pos_with_overlay_data(
+static Gwn_VertBuf *mesh_batch_cache_get_vert_pos_with_overlay_data(
MeshRenderData *rdata, MeshBatchCache *cache)
{
BLI_assert(rdata->types & (MR_DATATYPE_VERT));
@@ -2671,29 +2671,29 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_with_overlay_data(
if (cache->pos_with_select_bool == NULL) {
unsigned int cidx = 0;
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint data; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.data = VertexFormat_add_attrib(&format, "data", COMP_I8, 1, KEEP_INT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "data", GWN_COMP_I8, 1, GWN_FETCH_INT);
}
const int vert_len = mesh_render_data_verts_len_get(rdata);
- VertexBuffer *vbo = cache->pos_with_select_bool = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = cache->pos_with_select_bool = GWN_vertbuf_create_with_format(&format);
const int vbo_len_capacity = vert_len;
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < vert_len; i++) {
const MVert *mv = &rdata->mvert[i];
const char data = mv->flag & (SELECT | ME_HIDE);
- VertexBuffer_set_attrib(vbo, attr_id.data, cidx++, &data);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, cidx++, &data);
}
vbo_len_used = cidx;
if (vbo_len_capacity != vbo_len_used) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
}
@@ -2708,7 +2708,7 @@ static VertexBuffer *mesh_batch_cache_get_vert_pos_with_overlay_data(
/** \name Public API
* \{ */
-Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2717,8 +2717,8 @@ Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_EDGE;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->all_edges = Batch_create(
- PRIM_LINES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
+ cache->all_edges = GWN_batch_create(
+ GWN_PRIM_LINES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
mesh_batch_cache_get_edges_in_order(rdata, cache));
mesh_render_data_free(rdata);
@@ -2727,7 +2727,7 @@ Batch *DRW_mesh_batch_cache_get_all_edges(Mesh *me)
return cache->all_edges;
}
-Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2736,8 +2736,8 @@ Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->all_triangles = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
+ cache->all_triangles = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
mesh_batch_cache_get_triangles_in_order(rdata, cache));
mesh_render_data_free(rdata);
@@ -2746,7 +2746,7 @@ Batch *DRW_mesh_batch_cache_get_all_triangles(Mesh *me)
return cache->all_triangles;
}
-Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2754,8 +2754,8 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_normals = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
+ cache->triangles_with_normals = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
mesh_render_data_free(rdata);
}
@@ -2763,7 +2763,7 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals(Mesh *me)
return cache->triangles_with_normals;
}
-Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int defgroup)
+Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int defgroup)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2773,14 +2773,14 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int
MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_DVERT;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_weights = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_weights(rdata, cache, use_hide, defgroup), NULL);
+ cache->triangles_with_weights = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_weights(rdata, cache, use_hide, defgroup), NULL);
- VertexBuffer *vbo_tris = use_hide ?
+ Gwn_VertBuf *vbo_tris = use_hide ?
mesh_batch_cache_get_tri_pos_and_normals_visible_only(rdata, cache) :
mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- Batch_add_VertexBuffer(cache->triangles_with_weights, vbo_tris);
+ GWN_batch_vertbuf_add(cache->triangles_with_weights, vbo_tris);
mesh_render_data_free(rdata);
}
@@ -2788,7 +2788,7 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_weights(Mesh *me, int
return cache->triangles_with_weights;
}
-Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2798,13 +2798,13 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPCOL;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_vert_colors = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_vert_colors(rdata, cache, use_hide), NULL);
+ cache->triangles_with_vert_colors = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_vert_colors(rdata, cache, use_hide), NULL);
- VertexBuffer *vbo_tris = use_hide ?
+ Gwn_VertBuf *vbo_tris = use_hide ?
mesh_batch_cache_get_tri_pos_and_normals_visible_only(rdata, cache) :
mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- Batch_add_VertexBuffer(cache->triangles_with_vert_colors, vbo_tris);
+ GWN_batch_vertbuf_add(cache->triangles_with_vert_colors, vbo_tris);
mesh_render_data_free(rdata);
}
@@ -2813,7 +2813,7 @@ Batch *DRW_mesh_batch_cache_get_triangles_with_normals_and_vert_colors(Mesh *me)
}
-struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide)
+struct Gwn_Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me, bool use_hide)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2822,13 +2822,13 @@ struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me,
MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->triangles_with_select_id = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_tri_select_id(rdata, cache, use_hide), NULL);
+ cache->triangles_with_select_id = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_tri_select_id(rdata, cache, use_hide), NULL);
- VertexBuffer *vbo_tris = use_hide ?
+ Gwn_VertBuf *vbo_tris = use_hide ?
mesh_batch_cache_get_tri_pos_and_normals_visible_only(rdata, cache) :
mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- Batch_add_VertexBuffer(cache->triangles_with_select_id, vbo_tris);
+ GWN_batch_vertbuf_add(cache->triangles_with_select_id, vbo_tris);
mesh_render_data_free(rdata);
}
@@ -2836,7 +2836,7 @@ struct Batch *DRW_mesh_batch_cache_get_triangles_with_select_id(struct Mesh *me,
return cache->triangles_with_select_id;
}
-Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2844,8 +2844,8 @@ Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOP | MR_DATATYPE_POLY;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->points_with_normals = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
+ cache->points_with_normals = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_tri_pos_and_normals(rdata, cache), NULL);
mesh_render_data_free(rdata);
}
@@ -2853,7 +2853,7 @@ Batch *DRW_mesh_batch_cache_get_points_with_normals(Mesh *me)
return cache->points_with_normals;
}
-Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2861,8 +2861,8 @@ Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
/* create batch from DM */
MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT);
- cache->all_verts = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
+ cache->all_verts = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
mesh_render_data_free(rdata);
}
@@ -2870,21 +2870,21 @@ Batch *DRW_mesh_batch_cache_get_all_verts(Mesh *me)
return cache->all_verts;
}
-Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
if (cache->fancy_edges == NULL) {
/* create batch from DM */
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, n1, n2; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- attr_id.n1 = VertexFormat_add_attrib(&format, "N1", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
- attr_id.n2 = VertexFormat_add_attrib(&format, "N2", COMP_I10, 3, NORMALIZE_INT_TO_FLOAT);
+ attr_id.n1 = GWN_vertformat_attr_add(&format, "N1", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ attr_id.n2 = GWN_vertformat_attr_add(&format, "N2", GWN_COMP_I10, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
MeshRenderData *rdata = mesh_render_data_create(
me, MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
@@ -2893,7 +2893,7 @@ Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
const int vbo_len_capacity = edge_len * 2; /* these are PRIM_LINE verts, not mesh verts */
int vbo_len_used = 0;
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < edge_len; ++i) {
float *vcos1, *vcos2;
float *pnor1 = NULL, *pnor2 = NULL;
@@ -2912,22 +2912,22 @@ Batch *DRW_mesh_batch_cache_get_fancy_edges(Mesh *me)
const PackedNormal *n1 = &n1value;
const PackedNormal *n2 = &n2value;
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2 * i, vcos1);
- VertexBuffer_set_attrib(vbo, attr_id.n1, 2 * i, n1);
- VertexBuffer_set_attrib(vbo, attr_id.n2, 2 * i, n2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2 * i, vcos1);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, 2 * i, n1);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, 2 * i, n2);
- VertexBuffer_set_attrib(vbo, attr_id.pos, 2 * i + 1, vcos2);
- VertexBuffer_set_attrib(vbo, attr_id.n1, 2 * i + 1, n1);
- VertexBuffer_set_attrib(vbo, attr_id.n2, 2 * i + 1, n2);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, 2 * i + 1, vcos2);
+ GWN_vertbuf_attr_set(vbo, attr_id.n1, 2 * i + 1, n1);
+ GWN_vertbuf_attr_set(vbo, attr_id.n2, 2 * i + 1, n2);
vbo_len_used += 2;
}
}
if (vbo_len_used != vbo_len_capacity) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->fancy_edges = Batch_create(PRIM_LINES, vbo, NULL);
+ cache->fancy_edges = GWN_batch_create(GWN_PRIM_LINES, vbo, NULL);
mesh_render_data_free(rdata);
}
@@ -2948,42 +2948,42 @@ static void mesh_batch_cache_create_overlay_batches(Mesh *me)
MeshRenderData *rdata = mesh_render_data_create(me, options);
if (cache->overlay_triangles == NULL) {
- cache->overlay_triangles = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
- Batch_add_VertexBuffer(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_data(rdata, cache));
+ cache->overlay_triangles = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
+ GWN_batch_vertbuf_add(cache->overlay_triangles, mesh_batch_cache_get_edit_tri_data(rdata, cache));
}
if (cache->overlay_loose_edges == NULL) {
- cache->overlay_loose_edges = Batch_create(
- PRIM_LINES, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
- Batch_add_VertexBuffer(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_data(rdata, cache));
+ cache->overlay_loose_edges = GWN_batch_create(
+ GWN_PRIM_LINES, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
+ GWN_batch_vertbuf_add(cache->overlay_loose_edges, mesh_batch_cache_get_edit_ledge_data(rdata, cache));
}
if (cache->overlay_loose_verts == NULL) {
- cache->overlay_loose_verts = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_edit_lvert_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_nor(rdata, cache));
- Batch_add_VertexBuffer(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_data(rdata, cache));
+ cache->overlay_loose_verts = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_edit_lvert_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_nor(rdata, cache));
+ GWN_batch_vertbuf_add(cache->overlay_loose_verts, mesh_batch_cache_get_edit_lvert_data(rdata, cache));
}
if (cache->overlay_triangles_nor == NULL) {
- cache->overlay_triangles_nor = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_triangles_nor, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
+ cache->overlay_triangles_nor = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_edit_tri_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_triangles_nor, mesh_batch_cache_get_edit_tri_nor(rdata, cache));
}
if (cache->overlay_loose_edges_nor == NULL) {
- cache->overlay_loose_edges_nor = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
- Batch_add_VertexBuffer(cache->overlay_loose_edges_nor, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
+ cache->overlay_loose_edges_nor = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_edit_ledge_pos(rdata, cache), NULL);
+ GWN_batch_vertbuf_add(cache->overlay_loose_edges_nor, mesh_batch_cache_get_edit_ledge_nor(rdata, cache));
}
mesh_render_data_free(rdata);
}
-Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -2994,7 +2994,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_triangles(Mesh *me)
return cache->overlay_triangles;
}
-Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3005,7 +3005,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_loose_edges(Mesh *me)
return cache->overlay_loose_edges;
}
-Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3016,7 +3016,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_loose_verts(Mesh *me)
return cache->overlay_loose_verts;
}
-Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3027,7 +3027,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_triangles_nor(Mesh *me)
return cache->overlay_triangles_nor;
}
-Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3038,25 +3038,25 @@ Batch *DRW_mesh_batch_cache_get_overlay_loose_edges_nor(Mesh *me)
return cache->overlay_loose_edges_nor;
}
-Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
if (cache->overlay_facedots == NULL) {
MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY);
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, data; } attr_id;
if (format.attrib_ct == 0) {
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.data = VertexFormat_add_attrib(&format, "norAndFlag", COMP_I10, 4, NORMALIZE_INT_TO_FLOAT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.data = GWN_vertformat_attr_add(&format, "norAndFlag", GWN_COMP_I10, 4, GWN_FETCH_INT_TO_FLOAT_UNIT);
}
const int vbo_len_capacity = mesh_render_data_polys_len_get(rdata);
int vidx = 0;
- VertexBuffer *vbo = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(vbo, vbo_len_capacity);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(vbo, vbo_len_capacity);
for (int i = 0; i < vbo_len_capacity; ++i) {
float pcenter[3], pnor[3];
bool selected = false;
@@ -3066,9 +3066,9 @@ Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
PackedNormal nor = { .x = 0, .y = 0, .z = -511 };
nor = convert_i10_v3(pnor);
nor.w = selected ? 1 : 0;
- VertexBuffer_set_attrib(vbo, attr_id.data, vidx, &nor);
+ GWN_vertbuf_attr_set(vbo, attr_id.data, vidx, &nor);
- VertexBuffer_set_attrib(vbo, attr_id.pos, vidx, pcenter);
+ GWN_vertbuf_attr_set(vbo, attr_id.pos, vidx, pcenter);
vidx += 1;
@@ -3076,10 +3076,10 @@ Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
}
const int vbo_len_used = vidx;
if (vbo_len_used != vbo_len_capacity) {
- VertexBuffer_resize_data(vbo, vbo_len_used);
+ GWN_vertbuf_data_resize(vbo, vbo_len_used);
}
- cache->overlay_facedots = Batch_create(PRIM_POINTS, vbo, NULL);
+ cache->overlay_facedots = GWN_batch_create(GWN_PRIM_POINTS, vbo, NULL);
mesh_render_data_free(rdata);
}
@@ -3087,7 +3087,7 @@ Batch *DRW_mesh_batch_cache_get_overlay_facedots(Mesh *me)
return cache->overlay_facedots;
}
-Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
+Gwn_Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3102,15 +3102,15 @@ Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
cache->shaded_triangles = MEM_callocN(sizeof(*cache->shaded_triangles) * mat_len, __func__);
- ElementList **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
+ Gwn_IndexBuf **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
- VertexBuffer *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
+ Gwn_VertBuf *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
for (int i = 0; i < mat_len; ++i) {
- cache->shaded_triangles[i] = Batch_create(
- PRIM_TRIANGLES, vbo, el[i]);
- VertexBuffer *vbo_shading = mesh_batch_cache_get_tri_shading_data(rdata, cache);
+ cache->shaded_triangles[i] = GWN_batch_create(
+ GWN_PRIM_TRIS, vbo, el[i]);
+ Gwn_VertBuf *vbo_shading = mesh_batch_cache_get_tri_shading_data(rdata, cache);
if (vbo_shading) {
- Batch_add_VertexBuffer(cache->shaded_triangles[i], vbo_shading);
+ GWN_batch_vertbuf_add(cache->shaded_triangles[i], vbo_shading);
}
}
@@ -3121,7 +3121,7 @@ Batch **DRW_mesh_batch_cache_get_surface_shaded(Mesh *me)
return cache->shaded_triangles;
}
-Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
+Gwn_Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3135,15 +3135,15 @@ Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
cache->texpaint_triangles = MEM_callocN(sizeof(*cache->texpaint_triangles) * mat_len, __func__);
- ElementList **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
+ Gwn_IndexBuf **el = mesh_batch_cache_get_triangles_in_order_split_by_material(rdata, cache);
- VertexBuffer *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
+ Gwn_VertBuf *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
for (int i = 0; i < mat_len; ++i) {
- cache->texpaint_triangles[i] = Batch_create(
- PRIM_TRIANGLES, vbo, el[i]);
- VertexBuffer *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
+ cache->texpaint_triangles[i] = GWN_batch_create(
+ GWN_PRIM_TRIS, vbo, el[i]);
+ Gwn_VertBuf *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
if (vbo_uv) {
- Batch_add_VertexBuffer(cache->texpaint_triangles[i], vbo_uv);
+ GWN_batch_vertbuf_add(cache->texpaint_triangles[i], vbo_uv);
}
}
mesh_render_data_free(rdata);
@@ -3152,7 +3152,7 @@ Batch **DRW_mesh_batch_cache_get_surface_texpaint(Mesh *me)
return cache->texpaint_triangles;
}
-Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3162,20 +3162,20 @@ Batch *DRW_mesh_batch_cache_get_surface_texpaint_single(Mesh *me)
MR_DATATYPE_VERT | MR_DATATYPE_LOOP | MR_DATATYPE_POLY | MR_DATATYPE_LOOPTRI | MR_DATATYPE_LOOPUV;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- VertexBuffer *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
+ Gwn_VertBuf *vbo = mesh_batch_cache_get_tri_pos_and_normals(rdata, cache);
- cache->texpaint_triangles_single = Batch_create(
- PRIM_TRIANGLES, vbo, NULL);
- VertexBuffer *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
+ cache->texpaint_triangles_single = GWN_batch_create(
+ GWN_PRIM_TRIS, vbo, NULL);
+ Gwn_VertBuf *vbo_uv = mesh_batch_cache_get_tri_uv_active(rdata, cache);
if (vbo_uv) {
- Batch_add_VertexBuffer(cache->texpaint_triangles_single, vbo_uv);
+ GWN_batch_vertbuf_add(cache->texpaint_triangles_single, vbo_uv);
}
mesh_render_data_free(rdata);
}
return cache->texpaint_triangles_single;
}
-Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bool use_sel)
+Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bool use_sel)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3184,8 +3184,8 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bo
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_EDGE | MR_DATATYPE_POLY | MR_DATATYPE_LOOP;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->overlay_paint_edges = Batch_create(
- PRIM_LINES, mesh_batch_cache_get_edge_pos_with_sel(rdata, cache, use_wire, use_sel), NULL);
+ cache->overlay_paint_edges = GWN_batch_create(
+ GWN_PRIM_LINES, mesh_batch_cache_get_edge_pos_with_sel(rdata, cache, use_wire, use_sel), NULL);
mesh_render_data_free(rdata);
}
@@ -3193,7 +3193,7 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_edges(Mesh *me, bool use_wire, bo
return cache->overlay_paint_edges;
}
-Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3202,8 +3202,8 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
const int datatype = MR_DATATYPE_VERT | MR_DATATYPE_POLY | MR_DATATYPE_LOOP | MR_DATATYPE_LOOPTRI;
MeshRenderData *rdata = mesh_render_data_create(me, datatype);
- cache->overlay_weight_faces = Batch_create(
- PRIM_TRIANGLES, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
+ cache->overlay_weight_faces = GWN_batch_create(
+ GWN_PRIM_TRIS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache),
mesh_batch_cache_get_tri_overlay_weight_faces(rdata, cache));
mesh_render_data_free(rdata);
@@ -3212,7 +3212,7 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_faces(Mesh *me)
return cache->overlay_weight_faces;
}
-Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(Mesh *me)
+Gwn_Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(Mesh *me)
{
MeshBatchCache *cache = mesh_batch_cache_get(me);
@@ -3220,10 +3220,10 @@ Batch *DRW_mesh_batch_cache_get_weight_overlay_verts(Mesh *me)
/* create batch from Mesh */
MeshRenderData *rdata = mesh_render_data_create(me, MR_DATATYPE_VERT);
- cache->overlay_weight_verts = Batch_create(
- PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
+ cache->overlay_weight_verts = GWN_batch_create(
+ GWN_PRIM_POINTS, mesh_batch_cache_get_vert_pos_and_nor_in_order(rdata, cache), NULL);
- Batch_add_VertexBuffer(
+ GWN_batch_vertbuf_add(
cache->overlay_weight_verts,
mesh_batch_cache_get_vert_pos_with_overlay_data(rdata, cache));
mesh_render_data_free(rdata);
diff --git a/source/blender/draw/intern/draw_cache_impl_particles.c b/source/blender/draw/intern/draw_cache_impl_particles.c
index febba333a2b..6b15bd673c9 100644
--- a/source/blender/draw/intern/draw_cache_impl_particles.c
+++ b/source/blender/draw/intern/draw_cache_impl_particles.c
@@ -45,13 +45,13 @@
static void particle_batch_cache_clear(ParticleSystem *psys);
/* ---------------------------------------------------------------------- */
-/* Particle Batch Cache */
+/* Particle Gwn_Batch Cache */
typedef struct ParticleBatchCache {
- VertexBuffer *pos;
- ElementList *segments;
+ Gwn_VertBuf *pos;
+ Gwn_IndexBuf *segments;
- Batch *hairs;
+ Gwn_Batch *hairs;
int segment_count;
int point_count;
@@ -60,7 +60,7 @@ typedef struct ParticleBatchCache {
bool is_dirty;
} ParticleBatchCache;
-/* Batch cache management. */
+/* Gwn_Batch cache management. */
static bool particle_batch_cache_valid(ParticleSystem *psys)
{
@@ -125,10 +125,10 @@ static void particle_batch_cache_clear(ParticleSystem *psys)
return;
}
- BATCH_DISCARD_SAFE(cache->hairs);
+ GWN_BATCH_DISCARD_SAFE(cache->hairs);
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->segments);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->segments);
}
void DRW_particle_batch_cache_free(ParticleSystem *psys)
@@ -169,29 +169,29 @@ static void ensure_seg_pt_count(ParticleSystem *psys, ParticleBatchCache *cache)
}
}
-/* Batch cache usage. */
+/* Gwn_Batch cache usage. */
static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, ParticleBatchCache *cache)
{
if (cache->pos == NULL || cache->segments == NULL) {
int curr_point = 0;
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->segments);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->segments);
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static struct { uint pos, tan, ind; } attr_id;
if (format.attrib_ct == 0) {
/* initialize vertex format */
- attr_id.pos = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- attr_id.tan = VertexFormat_add_attrib(&format, "nor", COMP_F32, 3, KEEP_FLOAT);
- attr_id.ind = VertexFormat_add_attrib(&format, "ind", COMP_I32, 1, KEEP_INT);
+ attr_id.pos = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.tan = GWN_vertformat_attr_add(&format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ attr_id.ind = GWN_vertformat_attr_add(&format, "ind", GWN_COMP_I32, 1, GWN_FETCH_INT);
}
- cache->pos = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(cache->pos, cache->point_count);
+ cache->pos = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(cache->pos, cache->point_count);
- ElementListBuilder elb;
- ElementListBuilder_init(&elb, PRIM_LINES, cache->segment_count, cache->point_count);
+ Gwn_IndexBufBuilder elb;
+ GWN_indexbuf_init(&elb, GWN_PRIM_LINES, cache->segment_count, cache->point_count);
if (psys->pathcache && (!psys->childcache || (psys->part->draw & PART_DRAW_PARENT))) {
for (int i = 0; i < psys->totpart; i++) {
@@ -208,20 +208,20 @@ static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, Partic
sub_v3_v3v3(tangent, path[j + 1].co, path[j - 1].co);
}
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[j].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &i);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[j].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &i);
- add_line_vertices(&elb, curr_point, curr_point + 1);
+ GWN_indexbuf_add_line_verts(&elb, curr_point, curr_point + 1);
curr_point++;
}
sub_v3_v3v3(tangent, path[path->segments].co, path[path->segments - 1].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &i);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &i);
curr_point++;
}
@@ -244,50 +244,50 @@ static void particle_batch_cache_ensure_pos_and_seg(ParticleSystem *psys, Partic
sub_v3_v3v3(tangent, path[j + 1].co, path[j - 1].co);
}
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[j].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &x);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[j].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &x);
- add_line_vertices(&elb, curr_point, curr_point + 1);
+ GWN_indexbuf_add_line_verts(&elb, curr_point, curr_point + 1);
curr_point++;
}
sub_v3_v3v3(tangent, path[path->segments].co, path[path->segments - 1].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
- VertexBuffer_set_attrib(cache->pos, attr_id.tan, curr_point, tangent);
- VertexBuffer_set_attrib(cache->pos, attr_id.ind, curr_point, &x);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.pos, curr_point, path[path->segments].co);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.tan, curr_point, tangent);
+ GWN_vertbuf_attr_set(cache->pos, attr_id.ind, curr_point, &x);
curr_point++;
}
}
}
- cache->segments = ElementList_build(&elb);
+ cache->segments = GWN_indexbuf_build(&elb);
}
}
static void particle_batch_cache_ensure_pos(ParticleSystem *psys, ParticleBatchCache *cache)
{
if (cache->pos == NULL) {
- static VertexFormat format = { 0 };
+ static Gwn_VertFormat format = { 0 };
static unsigned pos_id, rot_id, val_id;
int i, curr_point;
ParticleData *pa;
- VERTEXBUFFER_DISCARD_SAFE(cache->pos);
- ELEMENTLIST_DISCARD_SAFE(cache->segments);
+ GWN_VERTBUF_DISCARD_SAFE(cache->pos);
+ GWN_INDEXBUF_DISCARD_SAFE(cache->segments);
if (format.attrib_ct == 0) {
/* initialize vertex format */
- pos_id = VertexFormat_add_attrib(&format, "pos", COMP_F32, 3, KEEP_FLOAT);
- rot_id = VertexFormat_add_attrib(&format, "rot", COMP_F32, 4, KEEP_FLOAT);
- val_id = VertexFormat_add_attrib(&format, "val", COMP_F32, 1, KEEP_FLOAT);
+ pos_id = GWN_vertformat_attr_add(&format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ rot_id = GWN_vertformat_attr_add(&format, "rot", GWN_COMP_F32, 4, GWN_FETCH_FLOAT);
+ val_id = GWN_vertformat_attr_add(&format, "val", GWN_COMP_F32, 1, GWN_FETCH_FLOAT);
}
- cache->pos = VertexBuffer_create_with_format(&format);
- VertexBuffer_allocate_data(cache->pos, psys->totpart);
+ cache->pos = GWN_vertbuf_create_with_format(&format);
+ GWN_vertbuf_data_alloc(cache->pos, psys->totpart);
for (curr_point = 0, i = 0, pa = psys->particles; i < psys->totpart; i++, pa++) {
if (pa->state.time >= pa->time && pa->state.time < pa->dietime &&
@@ -295,8 +295,8 @@ static void particle_batch_cache_ensure_pos(ParticleSystem *psys, ParticleBatchC
{
float val;
- VertexBuffer_set_attrib(cache->pos, pos_id, curr_point, pa->state.co);
- VertexBuffer_set_attrib(cache->pos, rot_id, curr_point, pa->state.rot);
+ GWN_vertbuf_attr_set(cache->pos, pos_id, curr_point, pa->state.co);
+ GWN_vertbuf_attr_set(cache->pos, rot_id, curr_point, pa->state.rot);
switch (psys->part->draw_col) {
case PART_DRAW_COL_VEL:
@@ -310,38 +310,38 @@ static void particle_batch_cache_ensure_pos(ParticleSystem *psys, ParticleBatchC
break;
}
- VertexBuffer_set_attrib(cache->pos, val_id, curr_point, &val);
+ GWN_vertbuf_attr_set(cache->pos, val_id, curr_point, &val);
curr_point++;
}
}
if (curr_point != psys->totpart) {
- VertexBuffer_resize_data(cache->pos, curr_point);
+ GWN_vertbuf_data_resize(cache->pos, curr_point);
}
}
}
-Batch *DRW_particles_batch_cache_get_hair(ParticleSystem *psys)
+Gwn_Batch *DRW_particles_batch_cache_get_hair(ParticleSystem *psys)
{
ParticleBatchCache *cache = particle_batch_cache_get(psys);
if (cache->hairs == NULL) {
ensure_seg_pt_count(psys, cache);
particle_batch_cache_ensure_pos_and_seg(psys, cache);
- cache->hairs = Batch_create(PRIM_LINES, cache->pos, cache->segments);
+ cache->hairs = GWN_batch_create(GWN_PRIM_LINES, cache->pos, cache->segments);
}
return cache->hairs;
}
-Batch *DRW_particles_batch_cache_get_dots(ParticleSystem *psys)
+Gwn_Batch *DRW_particles_batch_cache_get_dots(ParticleSystem *psys)
{
ParticleBatchCache *cache = particle_batch_cache_get(psys);
if (cache->hairs == NULL) {
particle_batch_cache_ensure_pos(psys, cache);
- cache->hairs = Batch_create(PRIM_POINTS, cache->pos, NULL);
+ cache->hairs = GWN_batch_create(GWN_PRIM_POINTS, cache->pos, NULL);
}
return cache->hairs;
diff --git a/source/blender/draw/intern/draw_common.c b/source/blender/draw/intern/draw_common.c
index f8040f28f53..c3d95d700a0 100644
--- a/source/blender/draw/intern/draw_common.c
+++ b/source/blender/draw/intern/draw_common.c
@@ -184,7 +184,7 @@ DRWShadingGroup *shgroup_groundpoints_uniform_color(DRWPass *pass, float color[4
return grp;
}
-DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct Batch *geom, float *size)
+DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct Gwn_Batch *geom, float *size)
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR);
@@ -199,7 +199,7 @@ DRWShadingGroup *shgroup_instance_screenspace(DRWPass *pass, struct Batch *geom,
return grp;
}
-DRWShadingGroup *shgroup_instance_objspace_solid(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_objspace_solid(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
static float light[3] = {0.0f, 0.0f, 1.0f};
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_OBJECTSPACE_SIMPLE_LIGHTING_VARIYING_COLOR);
@@ -213,7 +213,7 @@ DRWShadingGroup *shgroup_instance_objspace_solid(DRWPass *pass, struct Batch *ge
return grp;
}
-DRWShadingGroup *shgroup_instance_objspace_wire(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_objspace_wire(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_OBJECTSPACE_VARIYING_COLOR);
@@ -225,7 +225,7 @@ DRWShadingGroup *shgroup_instance_objspace_wire(DRWPass *pass, struct Batch *geo
return grp;
}
-DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED);
@@ -238,7 +238,7 @@ DRWShadingGroup *shgroup_instance_screen_aligned(DRWPass *pass, struct Batch *ge
return grp;
}
-DRWShadingGroup *shgroup_instance_axis_names(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance_axis_names(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_SCREEN_ALIGNED_AXIS);
@@ -251,7 +251,7 @@ DRWShadingGroup *shgroup_instance_axis_names(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SCALE);
@@ -263,7 +263,7 @@ DRWShadingGroup *shgroup_instance_scaled(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_VARIYING_COLOR_VARIYING_SIZE);
@@ -275,7 +275,7 @@ DRWShadingGroup *shgroup_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_CAMERA);
@@ -289,7 +289,7 @@ DRWShadingGroup *shgroup_camera_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_DISTANCE_LINES);
static float point_size = 4.0f;
@@ -304,7 +304,7 @@ DRWShadingGroup *shgroup_distance_lines_instance(DRWPass *pass, struct Batch *ge
return grp;
}
-DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom)
+DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Gwn_Batch *geom)
{
GPUShader *sh_inst = GPU_shader_get_builtin_shader(GPU_SHADER_INSTANCE_EDGES_VARIYING_COLOR);
static bool True = true;
@@ -320,7 +320,7 @@ DRWShadingGroup *shgroup_spot_instance(DRWPass *pass, struct Batch *geom)
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_WIRE);
@@ -335,7 +335,7 @@ DRWShadingGroup *shgroup_instance_bone_envelope_wire(DRWPass *pass, struct Batch
return grp;
}
-DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, struct Batch *geom, float (*obmat)[4])
+DRWShadingGroup *shgroup_instance_bone_envelope_solid(DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4])
{
static float light[3] = {0.0f, 0.0f, 1.0f};
GPUShader *sh = GPU_shader_get_builtin_shader(GPU_SHADER_3D_INSTANCE_BONE_ENVELOPE_SOLID);
diff --git a/source/blender/draw/intern/draw_common.h b/source/blender/draw/intern/draw_common.h
index 2c597a175ff..a6c9b24af7d 100644
--- a/source/blender/draw/intern/draw_common.h
+++ b/source/blender/draw/intern/draw_common.h
@@ -28,7 +28,7 @@
struct DRWPass;
struct DRWShadingGroup;
-struct Batch;
+struct Gwn_Batch;
struct Object;
struct SceneLayer;
@@ -91,19 +91,19 @@ struct DRWShadingGroup *shgroup_dynlines_uniform_color(struct DRWPass *pass, flo
struct DRWShadingGroup *shgroup_dynpoints_uniform_color(struct DRWPass *pass, float color[4], float *size);
struct DRWShadingGroup *shgroup_groundlines_uniform_color(struct DRWPass *pass, float color[4]);
struct DRWShadingGroup *shgroup_groundpoints_uniform_color(struct DRWPass *pass, float color[4]);
-struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct Batch *geom, float *size);
-struct DRWShadingGroup *shgroup_instance_objspace_solid(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
-struct DRWShadingGroup *shgroup_instance_objspace_wire(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
-struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_axis_names(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_image_plane(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Batch *geom);
-struct DRWShadingGroup *shgroup_instance_bone_envelope_wire(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
-struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, struct Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_screenspace(struct DRWPass *pass, struct Gwn_Batch *geom, float *size);
+struct DRWShadingGroup *shgroup_instance_objspace_solid(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_objspace_wire(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_screen_aligned(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_axis_names(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_image_plane(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_scaled(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_camera_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_distance_lines_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_spot_instance(struct DRWPass *pass, struct Gwn_Batch *geom);
+struct DRWShadingGroup *shgroup_instance_bone_envelope_wire(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
+struct DRWShadingGroup *shgroup_instance_bone_envelope_solid(struct DRWPass *pass, struct Gwn_Batch *geom, float (*obmat)[4]);
int DRW_object_wire_theme_get(struct Object *ob, struct SceneLayer *sl, float **r_color);
float *DRW_color_background_blend_get(int theme_id);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index f1a870992dc..bebb9fce590 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -181,10 +181,10 @@ struct DRWInterface {
/* UBO */
int ubo_bind; /* next ubo binding point */
/* Dynamic batch */
- Batch *instance_batch; /* contains instances attributes */
+ Gwn_Batch *instance_batch; /* contains instances attributes */
GLuint instance_vbo; /* same as instance_batch but generated from DRWCalls */
int instance_count;
- VertexFormat vbo_format;
+ Gwn_VertFormat vbo_format;
};
struct DRWPass {
@@ -211,7 +211,7 @@ typedef struct DRWCall {
DRWCallHeader head;
float obmat[4][4];
- Batch *geometry;
+ Gwn_Batch *geometry;
Object *ob; /* Optional */
ID *ob_data; /* Optional. */
@@ -241,8 +241,8 @@ struct DRWShadingGroup {
DRWState state_extra; /* State changes for this batch only (or'd with the pass's state) */
int type;
- Batch *instance_geom; /* Geometry to instance */
- Batch *batch_geom; /* Result of call batching */
+ Gwn_Batch *instance_geom; /* Geometry to instance */
+ Gwn_Batch *batch_geom; /* Result of call batching */
#ifdef USE_GPU_SELECT
/* backlink to pass we're in */
@@ -600,7 +600,7 @@ static DRWInterface *DRW_interface_create(GPUShader *shader)
interface->tex_bind = GPU_max_textures() - 1;
interface->ubo_bind = GPU_max_ubo_binds() - 1;
- memset(&interface->vbo_format, 0, sizeof(VertexFormat));
+ memset(&interface->vbo_format, 0, sizeof(Gwn_VertFormat));
BLI_listbase_clear(&interface->uniforms);
BLI_listbase_clear(&interface->attribs);
@@ -773,7 +773,7 @@ DRWShadingGroup *DRW_shgroup_material_create(struct GPUMaterial *material, DRWPa
return grp;
}
-DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, Batch *geom)
+DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *material, DRWPass *pass, Gwn_Batch *geom)
{
DRWShadingGroup *shgroup = DRW_shgroup_material_create(material, pass);
@@ -785,7 +785,7 @@ DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *materi
return shgroup;
}
-DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, Batch *geom)
+DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, Gwn_Batch *geom)
{
DRWShadingGroup *shgroup = DRW_shgroup_create(shader, pass);
@@ -846,7 +846,7 @@ void DRW_shgroup_free(struct DRWShadingGroup *shgroup)
BATCH_DISCARD_ALL_SAFE(shgroup->batch_geom);
}
-void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Batch *instances)
+void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Gwn_Batch *instances)
{
BLI_assert(shgroup->type == DRW_SHG_INSTANCE);
BLI_assert(shgroup->interface->instance_batch == NULL);
@@ -854,7 +854,7 @@ void DRW_shgroup_instance_batch(DRWShadingGroup *shgroup, struct Batch *instance
shgroup->interface->instance_batch = instances;
}
-void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Batch *geom, float (*obmat)[4])
+void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, float (*obmat)[4])
{
BLI_assert(geom != NULL);
@@ -874,7 +874,7 @@ void DRW_shgroup_call_add(DRWShadingGroup *shgroup, Batch *geom, float (*obmat)[
BLI_addtail(&shgroup->calls, call);
}
-void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, Batch *geom, Object *ob)
+void DRW_shgroup_call_object_add(DRWShadingGroup *shgroup, Gwn_Batch *geom, Object *ob)
{
BLI_assert(geom != NULL);
@@ -918,7 +918,7 @@ void DRW_shgroup_call_generate_add(
static void sculpt_draw_cb(
DRWShadingGroup *shgroup,
- void (*draw_fn)(DRWShadingGroup *shgroup, Batch *geom),
+ void (*draw_fn)(DRWShadingGroup *shgroup, Gwn_Batch *geom),
void *user_data)
{
Object *ob = user_data;
@@ -927,7 +927,7 @@ static void sculpt_draw_cb(
if (pbvh) {
BKE_pbvh_draw_cb(
pbvh, NULL, NULL, false,
- (void (*)(void *, Batch *))draw_fn, shgroup);
+ (void (*)(void *, Gwn_Batch *))draw_fn, shgroup);
}
}
@@ -1106,8 +1106,8 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup)
DRWInterface *interface = shgroup->interface;
int nbr = interface->instance_count;
- PrimitiveType type = (shgroup->type == DRW_SHG_POINT_BATCH) ? PRIM_POINTS :
- (shgroup->type == DRW_SHG_TRIANGLE_BATCH) ? PRIM_TRIANGLES : PRIM_LINES;
+ Gwn_PrimType type = (shgroup->type == DRW_SHG_POINT_BATCH) ? GWN_PRIM_POINTS :
+ (shgroup->type == DRW_SHG_TRIANGLE_BATCH) ? GWN_PRIM_TRIS : GWN_PRIM_LINES;
if (nbr == 0)
return;
@@ -1117,12 +1117,12 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup)
for (DRWAttrib *attrib = interface->attribs.first; attrib; attrib = attrib->next) {
BLI_assert(attrib->size <= 4); /* matrices have no place here for now */
if (attrib->type == DRW_ATTRIB_FLOAT) {
- attrib->format_id = VertexFormat_add_attrib(
- &interface->vbo_format, attrib->name, COMP_F32, attrib->size, KEEP_FLOAT);
+ attrib->format_id = GWN_vertformat_attr_add(
+ &interface->vbo_format, attrib->name, GWN_COMP_F32, attrib->size, GWN_FETCH_FLOAT);
}
else if (attrib->type == DRW_ATTRIB_INT) {
- attrib->format_id = VertexFormat_add_attrib(
- &interface->vbo_format, attrib->name, COMP_I8, attrib->size, KEEP_INT);
+ attrib->format_id = GWN_vertformat_attr_add(
+ &interface->vbo_format, attrib->name, GWN_COMP_I8, attrib->size, GWN_FETCH_INT);
}
else {
BLI_assert(false);
@@ -1130,22 +1130,22 @@ static void shgroup_dynamic_batch(DRWShadingGroup *shgroup)
}
}
- VertexBuffer *vbo = VertexBuffer_create_with_format(&interface->vbo_format);
- VertexBuffer_allocate_data(vbo, nbr);
+ Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(&interface->vbo_format);
+ GWN_vertbuf_data_alloc(vbo, nbr);
int j = 0;
for (DRWCallDynamic *call = shgroup->calls.first; call; call = call->head.next, j++) {
int i = 0;
for (DRWAttrib *attrib = interface->attribs.first; attrib; attrib = attrib->next, i++) {
- VertexBuffer_set_attrib(vbo, attrib->format_id, j, call->data[i]);
+ GWN_vertbuf_attr_set(vbo, attrib->format_id, j, call->data[i]);
}
}
/* TODO make the batch dynamic instead of freeing it every times */
if (shgroup->batch_geom)
- Batch_discard_all(shgroup->batch_geom);
+ GWN_batch_discard_all(shgroup->batch_geom);
- shgroup->batch_geom = Batch_create(type, vbo, NULL);
+ shgroup->batch_geom = GWN_batch_create(type, vbo, NULL);
}
static void shgroup_dynamic_instance(DRWShadingGroup *shgroup)
@@ -1630,24 +1630,24 @@ static void draw_geometry_prepare(
GPU_shader_uniform_vector(shgroup->shader, interface->clipplanes, 4, DST.num_clip_planes, (float *)DST.clip_planes_eq);
}
-static void draw_geometry_execute(DRWShadingGroup *shgroup, Batch *geom)
+static void draw_geometry_execute(DRWShadingGroup *shgroup, Gwn_Batch *geom)
{
DRWInterface *interface = shgroup->interface;
/* step 2 : bind vertex array & draw */
- Batch_set_program(geom, GPU_shader_get_program(shgroup->shader), GPU_shader_get_interface(shgroup->shader));
+ GWN_batch_program_set(geom, GPU_shader_get_program(shgroup->shader), GPU_shader_get_interface(shgroup->shader));
if (interface->instance_batch) {
- Batch_draw_stupid_instanced_with_batch(geom, interface->instance_batch);
+ GWN_batch_draw_stupid_instanced_with_batch(geom, interface->instance_batch);
}
else if (interface->instance_vbo) {
- Batch_draw_stupid_instanced(geom, interface->instance_vbo, interface->instance_count, interface->attribs_count,
+ GWN_batch_draw_stupid_instanced(geom, interface->instance_vbo, interface->instance_count, interface->attribs_count,
interface->attribs_stride, interface->attribs_size, interface->attribs_loc);
}
else {
- Batch_draw_stupid(geom);
+ GWN_batch_draw_stupid(geom);
}
}
-static void draw_geometry(DRWShadingGroup *shgroup, Batch *geom, const float (*obmat)[4], ID *ob_data)
+static void draw_geometry(DRWShadingGroup *shgroup, Gwn_Batch *geom, const float (*obmat)[4], ID *ob_data)
{
float *texcoloc = NULL;
float *texcosize = NULL;
@@ -2143,9 +2143,9 @@ void DRW_transform_to_display(GPUTexture *tex)
{
DRW_state_set(DRW_STATE_WRITE_COLOR);
- VertexFormat *vert_format = immVertexFormat();
- unsigned int pos = VertexFormat_add_attrib(vert_format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned int texco = VertexFormat_add_attrib(vert_format, "texCoord", COMP_F32, 2, KEEP_FLOAT);
+ Gwn_VertFormat *vert_format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(vert_format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int texco = GWN_vertformat_attr_add(vert_format, "texCoord", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
const float dither = 1.0f;
@@ -2167,7 +2167,7 @@ void DRW_transform_to_display(GPUTexture *tex)
immUniformMatrix4fv("ModelViewProjectionMatrix", mat);
/* Full screen triangle */
- immBegin(PRIM_TRIANGLES, 3);
+ immBegin(GWN_PRIM_TRIS, 3);
immAttrib2f(texco, 0.0f, 0.0f);
immVertex2f(pos, -1.0f, -1.0f);
@@ -2889,7 +2889,7 @@ static void DRW_debug_gpu_stats(void)
/* Memory Stats */
unsigned int tex_mem = GPU_texture_memory_usage_get();
- unsigned int vbo_mem = VertexBuffer_get_memory_usage();
+ unsigned int vbo_mem = GWN_vertbuf_get_memory_usage();
sprintf(pass_name, "GPU Memory");
draw_stat(&rect, 0, v, pass_name, sizeof(pass_name));
diff --git a/source/blender/draw/intern/draw_view.c b/source/blender/draw/intern/draw_view.c
index b4d0a9309dd..6d7fcc61702 100644
--- a/source/blender/draw/intern/draw_view.c
+++ b/source/blender/draw/intern/draw_view.c
@@ -211,9 +211,9 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
glDepthMask(GL_FALSE); /* disable write in zbuffer */
#endif
- VertexFormat *format = immVertexFormat();
- 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);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_2D_FLAT_COLOR);
@@ -250,7 +250,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if (gridline_ct == 0)
goto drawgrid_cleanup; /* nothing to draw */
- immBegin(PRIM_LINES, gridline_ct * 2);
+ immBegin(GWN_PRIM_LINES, gridline_ct * 2);
}
float blend_fac = 1.0f - ((GRID_MIN_PX_F * 2.0f) / (float)dx_scalar);
@@ -303,7 +303,7 @@ static void drawgrid(UnitSettings *unit, ARegion *ar, View3D *v3d, const char **
if (gridline_ct == 0)
goto drawgrid_cleanup; /* nothing to draw */
- immBegin(PRIM_LINES, gridline_ct * 2);
+ immBegin(GWN_PRIM_LINES, gridline_ct * 2);
if (grids_to_draw == 2) {
UI_GetThemeColorBlend3ubv(TH_HIGH_GRAD, TH_GRID, dx / (GRID_MIN_PX_D * 6.0), col2);
@@ -378,13 +378,13 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
unsigned char col_bg[3], col_grid_emphasise[3], col_grid_light[3];
- VertexFormat *format = immVertexFormat();
- 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);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, vertex_ct);
+ immBegin(GWN_PRIM_LINES, vertex_ct);
/* draw normal grid lines */
UI_GetColorPtrShade3ubv(col_grid, col_grid_light, 10);
@@ -466,12 +466,12 @@ static void drawfloor(Scene *scene, View3D *v3d, const char **grid_unit)
if (show_axis_x || show_axis_y || show_axis_z) {
/* draw axis lines -- sometimes grid floor is off, other times we still need to draw the Z axis */
- VertexFormat *format = immVertexFormat();
- 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);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
immBindBuiltinProgram(GPU_SHADER_3D_FLAT_COLOR);
- immBegin(PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
+ immBegin(GWN_PRIM_LINES, (show_axis_x + show_axis_y + show_axis_z) * 2);
if (show_axis_x) {
UI_make_axis_color(col_grid, col_axis, 'X');
@@ -570,9 +570,9 @@ void DRW_draw_background(void)
/* Gradient background Color */
glDisable(GL_DEPTH_TEST);
- VertexFormat *format = immVertexFormat();
- unsigned pos = VertexFormat_add_attrib(format, "pos", COMP_F32, 2, KEEP_FLOAT);
- unsigned color = VertexFormat_add_attrib(format, "color", COMP_U8, 3, NORMALIZE_INT_TO_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
unsigned char col_hi[3], col_lo[3];
gpuPushMatrix();
@@ -584,7 +584,7 @@ void DRW_draw_background(void)
UI_GetThemeColor3ubv(TH_LOW_GRAD, col_lo);
UI_GetThemeColor3ubv(TH_HIGH_GRAD, col_hi);
- immBegin(PRIM_TRIANGLE_FAN, 4);
+ immBegin(GWN_PRIM_TRI_FAN, 4);
immAttrib3ubv(color, col_lo);
immVertex2f(pos, -1.0f, -1.0f);
immVertex2f(pos, 1.0f, -1.0f);
@@ -662,10 +662,10 @@ void DRW_draw_cursor(void)
const float f10 = 0.5f;
const float f20 = 1.0f;
- VertexFormat *format = immVertexFormat();
- 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 int wpos = VertexFormat_add_attrib(format, "world_pos", COMP_F32, 3, KEEP_FLOAT);
+ Gwn_VertFormat *format = immVertexFormat();
+ unsigned int pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 2, GWN_FETCH_FLOAT);
+ unsigned int color = GWN_vertformat_attr_add(format, "color", GWN_COMP_U8, 3, GWN_FETCH_INT_TO_FLOAT_UNIT);
+ unsigned int wpos = GWN_vertformat_attr_add(format, "world_pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
/* XXX Using instance shader without instance */
immBindBuiltinProgram(GPU_SHADER_3D_SCREENSPACE_VARIYING_COLOR);
@@ -676,7 +676,7 @@ void DRW_draw_cursor(void)
const int segments = 16;
- immBegin(PRIM_LINE_LOOP, segments);
+ immBegin(GWN_PRIM_LINE_LOOP, segments);
immAttrib3fv(wpos, co);
for (int i = 0; i < segments; ++i) {
@@ -695,7 +695,7 @@ void DRW_draw_cursor(void)
UI_GetThemeColor3ubv(TH_VIEW_OVERLAY, crosshair_color);
- immBegin(PRIM_LINES, 8);
+ immBegin(GWN_PRIM_LINES, 8);
immAttrib3ubv(color, crosshair_color);
immAttrib3fv(wpos, co);