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/gpu/intern/gpu_batch_presets.c')
-rw-r--r--source/blender/gpu/intern/gpu_batch_presets.c76
1 files changed, 38 insertions, 38 deletions
diff --git a/source/blender/gpu/intern/gpu_batch_presets.c b/source/blender/gpu/intern/gpu_batch_presets.c
index fb696fd09a5..83287c57441 100644
--- a/source/blender/gpu/intern/gpu_batch_presets.c
+++ b/source/blender/gpu/intern/gpu_batch_presets.c
@@ -45,14 +45,14 @@
/* Struct to store 3D Batches and their format */
static struct {
struct {
- Gwn_Batch *sphere_high;
- Gwn_Batch *sphere_med;
- Gwn_Batch *sphere_low;
- Gwn_Batch *sphere_wire_low;
- Gwn_Batch *sphere_wire_med;
+ GPUBatch *sphere_high;
+ GPUBatch *sphere_med;
+ GPUBatch *sphere_low;
+ GPUBatch *sphere_wire_low;
+ GPUBatch *sphere_wire_med;
} batch;
- Gwn_VertFormat format;
+ GPUVertFormat format;
struct {
uint pos, nor;
@@ -66,28 +66,28 @@ static ListBase presets_list = {NULL, NULL};
/** \name 3D Primitives
* \{ */
-static Gwn_VertFormat *preset_3d_format(void)
+static GPUVertFormat *preset_3d_format(void)
{
if (g_presets_3d.format.attr_len == 0) {
- Gwn_VertFormat *format = &g_presets_3d.format;
- g_presets_3d.attr_id.pos = GWN_vertformat_attr_add(format, "pos", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
- g_presets_3d.attr_id.nor = GWN_vertformat_attr_add(format, "nor", GWN_COMP_F32, 3, GWN_FETCH_FLOAT);
+ GPUVertFormat *format = &g_presets_3d.format;
+ g_presets_3d.attr_id.pos = GPU_vertformat_attr_add(format, "pos", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
+ g_presets_3d.attr_id.nor = GPU_vertformat_attr_add(format, "nor", GPU_COMP_F32, 3, GPU_FETCH_FLOAT);
}
return &g_presets_3d.format;
}
static void batch_sphere_lat_lon_vert(
- Gwn_VertBufRaw *pos_step, Gwn_VertBufRaw *nor_step,
+ GPUVertBufRaw *pos_step, GPUVertBufRaw *nor_step,
float lat, float lon)
{
float pos[3];
pos[0] = sinf(lat) * cosf(lon);
pos[1] = cosf(lat);
pos[2] = sinf(lat) * sinf(lon);
- copy_v3_v3(GWN_vertbuf_raw_step(pos_step), pos);
- copy_v3_v3(GWN_vertbuf_raw_step(nor_step), pos);
+ copy_v3_v3(GPU_vertbuf_raw_step(pos_step), pos);
+ copy_v3_v3(GPU_vertbuf_raw_step(nor_step), pos);
}
-Gwn_Batch *GPU_batch_preset_sphere(int lod)
+GPUBatch *GPU_batch_preset_sphere(int lod)
{
BLI_assert(lod >= 0 && lod <= 2);
BLI_assert(BLI_thread_is_main());
@@ -103,7 +103,7 @@ Gwn_Batch *GPU_batch_preset_sphere(int lod)
}
}
-Gwn_Batch *GPU_batch_preset_sphere_wire(int lod)
+GPUBatch *GPU_batch_preset_sphere_wire(int lod)
{
BLI_assert(lod >= 0 && lod <= 1);
BLI_assert(BLI_thread_is_main());
@@ -123,19 +123,19 @@ Gwn_Batch *GPU_batch_preset_sphere_wire(int lod)
* \{ */
/* Replacement for gluSphere */
-Gwn_Batch *gpu_batch_sphere(int lat_res, int lon_res)
+GPUBatch *gpu_batch_sphere(int lat_res, int lon_res)
{
const float lon_inc = 2 * M_PI / lon_res;
const float lat_inc = M_PI / lat_res;
float lon, lat;
- Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(preset_3d_format());
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(preset_3d_format());
const uint vbo_len = (lat_res - 1) * lon_res * 6;
- GWN_vertbuf_data_alloc(vbo, vbo_len);
+ GPU_vertbuf_data_alloc(vbo, vbo_len);
- Gwn_VertBufRaw pos_step, nor_step;
- GWN_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.pos, &pos_step);
- GWN_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.nor, &nor_step);
+ GPUVertBufRaw pos_step, nor_step;
+ GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.pos, &pos_step);
+ GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.nor, &nor_step);
lon = 0.0f;
for (int i = 0; i < lon_res; i++, lon += lon_inc) {
@@ -155,25 +155,25 @@ Gwn_Batch *gpu_batch_sphere(int lat_res, int lon_res)
}
}
- BLI_assert(vbo_len == GWN_vertbuf_raw_used(&pos_step));
- BLI_assert(vbo_len == GWN_vertbuf_raw_used(&nor_step));
+ BLI_assert(vbo_len == GPU_vertbuf_raw_used(&pos_step));
+ BLI_assert(vbo_len == GPU_vertbuf_raw_used(&nor_step));
- return GWN_batch_create_ex(GWN_PRIM_TRIS, vbo, NULL, GWN_BATCH_OWNS_VBO);
+ return GPU_batch_create_ex(GPU_PRIM_TRIS, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
-static Gwn_Batch *batch_sphere_wire(int lat_res, int lon_res)
+static GPUBatch *batch_sphere_wire(int lat_res, int lon_res)
{
const float lon_inc = 2 * M_PI / lon_res;
const float lat_inc = M_PI / lat_res;
float lon, lat;
- Gwn_VertBuf *vbo = GWN_vertbuf_create_with_format(preset_3d_format());
+ GPUVertBuf *vbo = GPU_vertbuf_create_with_format(preset_3d_format());
const uint vbo_len = (lat_res * lon_res * 2) + ((lat_res - 1) * lon_res * 2);
- GWN_vertbuf_data_alloc(vbo, vbo_len);
+ GPU_vertbuf_data_alloc(vbo, vbo_len);
- Gwn_VertBufRaw pos_step, nor_step;
- GWN_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.pos, &pos_step);
- GWN_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.nor, &nor_step);
+ GPUVertBufRaw pos_step, nor_step;
+ GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.pos, &pos_step);
+ GPU_vertbuf_attr_get_raw_data(vbo, g_presets_3d.attr_id.nor, &nor_step);
lon = 0.0f;
for (int i = 0; i < lon_res; i++, lon += lon_inc) {
@@ -189,10 +189,10 @@ static Gwn_Batch *batch_sphere_wire(int lat_res, int lon_res)
}
}
- BLI_assert(vbo_len == GWN_vertbuf_raw_used(&pos_step));
- BLI_assert(vbo_len == GWN_vertbuf_raw_used(&nor_step));
+ BLI_assert(vbo_len == GPU_vertbuf_raw_used(&pos_step));
+ BLI_assert(vbo_len == GPU_vertbuf_raw_used(&nor_step));
- return GWN_batch_create_ex(GWN_PRIM_LINES, vbo, NULL, GWN_BATCH_OWNS_VBO);
+ return GPU_batch_create_ex(GPU_PRIM_LINES, vbo, NULL, GPU_BATCH_OWNS_VBO);
}
/** \} */
@@ -216,7 +216,7 @@ void gpu_batch_presets_init(void)
gpu_batch_presets_register(g_presets_3d.batch.sphere_wire_med);
}
-void gpu_batch_presets_register(Gwn_Batch *preset_batch)
+void gpu_batch_presets_register(GPUBatch *preset_batch)
{
BLI_addtail(&presets_list, BLI_genericNodeN(preset_batch));
}
@@ -227,8 +227,8 @@ void gpu_batch_presets_reset(void)
* This way they will draw correctly for each window. */
LinkData *link = presets_list.first;
for (link = presets_list.first; link; link = link->next) {
- Gwn_Batch *preset = link->data;
- gwn_batch_vao_cache_clear(preset);
+ GPUBatch *preset = link->data;
+ GPU_batch_vao_cache_clear(preset);
}
}
@@ -236,8 +236,8 @@ void gpu_batch_presets_exit(void)
{
LinkData *link;
while ((link = BLI_pophead(&presets_list))) {
- Gwn_Batch *preset = link->data;
- GWN_batch_discard(preset);
+ GPUBatch *preset = link->data;
+ GPU_batch_discard(preset);
MEM_freeN(link);
}
}