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:
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r--source/blender/draw/intern/draw_cache.c1146
1 files changed, 573 insertions, 573 deletions
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;