diff options
author | YimingWu <xp8110@outlook.com> | 2020-02-01 05:25:32 +0300 |
---|---|---|
committer | YimingWu <xp8110@outlook.com> | 2020-02-01 05:25:32 +0300 |
commit | b47883a990ee68e659a8a8b44729be9b8e0d002f (patch) | |
tree | 24a7733807992fc84445d30b63deaedfe1ab40a1 /source/blender/draw/intern/draw_cache.c | |
parent | b5abbc40a07041af91dca5d0a4acd8e5f1518c91 (diff) | |
parent | d9ec25844b4ac3143775615469fe69b27105c108 (diff) |
Merge remote-tracking branch 'origin/master' into temp-lanpr-review
Diffstat (limited to 'source/blender/draw/intern/draw_cache.c')
-rw-r--r-- | source/blender/draw/intern/draw_cache.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_cache.c b/source/blender/draw/intern/draw_cache.c index 90b5e08f994..69135f8ade3 100644 --- a/source/blender/draw/intern/draw_cache.c +++ b/source/blender/draw/intern/draw_cache.c @@ -68,6 +68,12 @@ typedef struct Vert { int class; } Vert; +typedef struct VertShaded { + float pos[3]; + int class; + float nor[3]; +} VertShaded; + /* Batch's only (free'd as an array) */ static struct DRWShapeCache { GPUBatch *drw_procedural_verts; @@ -471,7 +477,7 @@ static void sphere_lat_lon_vert(GPUVertBuf *vbo, int *v_ofs, float lat, float lo float x = sinf(lat) * cosf(lon); float y = cosf(lat); float z = sinf(lat) * sinf(lon); - GPU_vertbuf_vert_set(vbo, *v_ofs, &(Vert){{x, y, z}, VCLASS_EMPTY_SCALED}); + GPU_vertbuf_vert_set(vbo, *v_ofs, &(VertShaded){{x, y, z}, VCLASS_EMPTY_SCALED, {x, y, z}}); (*v_ofs)++; } @@ -482,6 +488,8 @@ GPUBatch *DRW_cache_sphere_get(void) const int lon_res = 24; GPUVertFormat format = extra_vert_format(); + GPU_vertformat_attr_add(&format, "nor", GPU_COMP_F32, 3, GPU_FETCH_FLOAT); + GPUVertBuf *vbo = GPU_vertbuf_create_with_format(&format); int v_len = (lat_res - 1) * lon_res * 6; GPU_vertbuf_data_alloc(vbo, v_len); |