Blender V5.3
gpencil_draw_data.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2019 Blender Authors
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
8
9#include "DRW_render.hh"
10
11#include "DNA_light_types.h"
12#include "DNA_material_types.h"
13
14#include "BKE_colorband.hh"
15#include "BKE_image.hh"
16#include "BKE_image_gpu.hh"
17#include "BKE_material.hh"
18
19#include "BLI_math_color_c.hh"
20#include "BLI_math_matrix_c.hh"
21#include "BLI_math_vector_c.hh"
22#include "BLI_memblock.hh"
23
24#include "GPU_uniform_buffer.hh"
25
26#include "IMB_imbuf_types.hh"
27
29
30namespace blender::draw::gpencil {
31
32/* -------------------------------------------------------------------- */
35
37{
38 MaterialPool *matpool = static_cast<MaterialPool *>(BLI_memblock_alloc(inst->gp_material_pool));
39 matpool->next = nullptr;
40 matpool->used_count = 0;
41 if (matpool->ubo == nullptr) {
42 matpool->ubo = GPU_uniformbuf_create(sizeof(matpool->mat_data));
43 }
44 inst->last_material_pool = matpool;
45 return matpool;
46}
47
49{
50 ImageUser iuser = {nullptr};
51 gpu::Texture *gpu_tex = nullptr;
52
53 gpu_tex = BKE_image_acquire_gpu_texture(image, &iuser);
54 DRW_manager_get()->hold_texture(gpu_tex);
55 *r_alpha_premult = (gpu_tex) ? (image->alpha_mode == IMA_ALPHA_PREMUL) : false;
56
57 return gpu_tex;
58}
59
61{
62 gpu::Texture *gpu_tex = nullptr;
63
64 float *data;
65 int size;
66
68
69 for (const int i : IndexRange(size)) {
70 linearrgb_to_srgb_v4(&data[i * 4], &data[i * 4]);
71 }
72
73 gpu_tex = GPU_texture_create_2d("color_gradient",
74 size,
75 1,
76 1,
77 gpu::TextureFormat::SRGBA_8_8_8_8,
79 data);
80
81 DRW_manager_get()->hold_texture(gpu_tex);
82 MEM_delete(data);
83
84 return gpu_tex;
85}
86
87static void gpencil_uv_transform_get(const float ofs[2],
88 const float scale[2],
89 const float rotation,
90 float r_rot_scale[2][2],
91 float r_offset[2])
92{
93 /* OPTI this could use 3x2 matrices and reduce the number of operations drastically. */
94 float mat[4][4];
95 unit_m4(mat);
96 /* Offset to center. */
97 translate_m4(mat, 0.5f, 0.5f, 0.0f);
98 /* Reversed order. */
99 rescale_m4(mat, float3{1.0f / scale[0], 1.0f / scale[1], 0.0});
100 rotate_m4(mat, 'Z', -rotation);
101 translate_m4(mat, ofs[0], ofs[1], 0.0f);
102 /* Convert to 3x2 */
103 copy_v2_v2(r_rot_scale[0], mat[0]);
104 copy_v2_v2(r_rot_scale[1], mat[1]);
105 copy_v2_v2(r_offset, mat[3]);
106}
107
108static void gpencil_shade_color(float color[3])
109{
110 /* This is scene refereed color, not gamma corrected and not per perceptual.
111 * So we lower the threshold a bit. (1.0 / 3.0) */
112 if (color[0] + color[1] + color[2] > 1.1) {
113 add_v3_fl(color, -0.25f);
114 }
115 else {
116 add_v3_fl(color, 0.15f);
117 }
118 clamp_v3(color, 0.0f, 1.0f);
119}
120
121/* Apply all overrides from the solid viewport mode to the GPencil material. */
123 Instance *inst,
124 Object *ob,
125 int color_type,
126 MaterialGPencilStyle *gp_style,
127 const eV3DShadingLightingMode lighting_mode)
128{
129 static MaterialGPencilStyle gp_style_tmp;
130
131 switch (color_type) {
134 /* Random uses a random color by layer and this is done using the tint
135 * layer. A simple color by object, like meshes, is not practical in
136 * grease pencil. */
137 copy_v4_v4(gp_style_tmp.stroke_rgba, gp_style->stroke_rgba);
138 copy_v4_v4(gp_style_tmp.fill_rgba, gp_style->fill_rgba);
139 gp_style = &gp_style_tmp;
142 break;
144 gp_style_tmp = dna::shallow_copy(*gp_style);
145 gp_style = &gp_style_tmp;
146 if ((gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_TEXTURE) && (gp_style->sima)) {
147 copy_v4_fl(gp_style->stroke_rgba, 1.0f);
148 gp_style->mix_stroke_factor = 0.0f;
149 }
150
151 if ((gp_style->fill_style == GP_MATERIAL_FILL_STYLE_TEXTURE) && (gp_style->ima)) {
152 copy_v4_fl(gp_style->fill_rgba, 1.0f);
153 gp_style->mix_factor = 0.0f;
154 }
155 else if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_GRADIENT) {
156 /* gp_style->fill_rgba is needed for correct gradient. */
157 gp_style->mix_factor = 0.0f;
158 }
159 break;
161 gp_style = &gp_style_tmp;
164 copy_v3_v3(gp_style->fill_rgba, inst->v3d_single_color);
165 gp_style->fill_rgba[3] = 1.0f;
166 copy_v4_v4(gp_style->stroke_rgba, gp_style->fill_rgba);
167 if (lighting_mode != V3D_LIGHTING_FLAT) {
169 }
170 break;
172 gp_style = &gp_style_tmp;
175 copy_v4_v4(gp_style->fill_rgba, ob->color);
176 copy_v4_v4(gp_style->stroke_rgba, ob->color);
177 if (lighting_mode != V3D_LIGHTING_FLAT) {
179 }
180 break;
182 gp_style = &gp_style_tmp;
185 copy_v4_fl(gp_style->fill_rgba, 1.0f);
186 copy_v4_fl(gp_style->stroke_rgba, 1.0f);
187 break;
188 default:
189 break;
190 }
191 return gp_style;
192}
193
195 Object *ob,
196 int *ofs,
197 const bool is_vertex_mode)
198{
199 MaterialPool *matpool = inst->last_material_pool;
200
202
203 bool reuse_matpool = matpool && ((matpool->used_count + mat_len) <= GPENCIL_MATERIAL_BUFFER_LEN);
204
205 if (reuse_matpool) {
206 /* Share the matpool with other objects. Return offset to first material. */
207 *ofs = matpool->used_count;
208 }
209 else {
210 matpool = gpencil_material_pool_add(inst);
211 *ofs = 0;
212 }
213
214 /* Force vertex color in solid mode with vertex paint mode. Same behavior as meshes. */
215 int color_type = (inst->v3d_color_type != -1 && is_vertex_mode) ? V3D_SHADING_VERTEX_COLOR :
216 inst->v3d_color_type;
218 (inst->v3d != nullptr) ? eV3DShadingLightingMode(inst->v3d->shading.light) :
220
221 MaterialPool *pool = matpool;
222 for (int i = 0; i < mat_len; i++) {
223 if ((i > 0) && (pool->used_count == GPENCIL_MATERIAL_BUFFER_LEN)) {
224 pool->next = gpencil_material_pool_add(inst);
225 pool = pool->next;
226 }
227 int mat_id = pool->used_count++;
228
229 gpMaterial *mat_data = &pool->mat_data[mat_id];
231
232 if (gp_style->mode == GP_MATERIAL_MODE_LINE) {
233 mat_data->flag = 0;
234 }
235 else {
236 switch (gp_style->alignment_mode) {
239 break;
242 break;
244 default:
246 break;
247 }
248
249 if (gp_style->mode == GP_MATERIAL_MODE_DOT) {
250 mat_data->flag |= GP_STROKE_DOTS;
251 }
252
253 switch (gp_style->placement_mode) {
256 break;
259 break;
260 default:
263 break;
264 }
265 }
266
267 if ((gp_style->mode != GP_MATERIAL_MODE_LINE) ||
268 (gp_style->flag & GP_MATERIAL_DISABLE_STENCIL))
269 {
270 mat_data->flag |= GP_STROKE_OVERLAP;
271 }
272
273 /* Material with holdout. */
274 if (gp_style->flag & GP_MATERIAL_IS_STROKE_HOLDOUT) {
275 mat_data->flag |= GP_STROKE_HOLDOUT;
276 }
277 if (gp_style->flag & GP_MATERIAL_IS_FILL_HOLDOUT) {
278 mat_data->flag |= GP_FILL_HOLDOUT;
279 }
280
281 /* Dots or Squares rotation. */
282 mat_data->alignment_rot[0] = cosf(gp_style->alignment_rotation);
283 mat_data->alignment_rot[1] = sinf(gp_style->alignment_rotation);
284 if (gp_style->mode == GP_MATERIAL_MODE_LINE) {
285 /* Convert pixel size to stroke u, the factor of `500` is from legacy Grease Pencil. */
286 mat_data->stroke_u_scale = 500.0f / gp_style->texture_pixsize;
287 }
288 else {
289 switch (gp_style->placement_mode) {
291 /* The radius spacing is a percentage and inverse, so it as a factor of `100` */
292 mat_data->stroke_u_scale = 100.0f / gp_style->placement_radius_spacing;
293 /* Divide by two, to convert diameter to radius. */
294 mat_data->stroke_u_scale *= 0.5f;
295 break;
297 mat_data->stroke_u_scale = gp_style->placement_density;
298 break;
299 default:
301 mat_data->stroke_u_scale = gp_style->placement_count;
302 break;
303 }
304 }
305
307 mat_data->flag |= GP_DOTS_USE_RANDOMIZATION;
308
311 << 16;
312
314 mat_data->random_packed.y |= (unit_float_to_ushort_clamp(gp_style->random_hue_factor)) << 16;
315
318 << 16;
319
320 mat_data->random_packed.w = float_as_uint(gp_style->random_noise_scale);
321 }
322 else {
323 mat_data->random_packed = uint4(0);
324 }
325
326 gp_style = gpencil_viewport_material_overrides(inst, ob, color_type, gp_style, lighting_mode);
327
328 /* Stroke Style */
329 if ((gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_TEXTURE) && (gp_style->sima)) {
330 bool premul;
331 pool->tex_stroke[mat_id] = gpencil_image_texture_get(gp_style->sima, &premul);
332 mat_data->flag |= pool->tex_stroke[mat_id] ? GP_STROKE_TEXTURE_USE : GP_FLAG_NONE;
333 mat_data->flag |= premul ? GP_STROKE_TEXTURE_PREMUL : GP_FLAG_NONE;
334 copy_v4_v4(mat_data->stroke_color, gp_style->stroke_rgba);
335 mat_data->stroke_texture_mix = 1.0f - gp_style->mix_stroke_factor;
336 }
337 else /* if (gp_style->stroke_style == GP_MATERIAL_STROKE_STYLE_SOLID) */ {
338 pool->tex_stroke[mat_id] = nullptr;
339 mat_data->flag &= ~GP_STROKE_TEXTURE_USE;
340 copy_v4_v4(mat_data->stroke_color, gp_style->stroke_rgba);
341 mat_data->stroke_texture_mix = 0.0f;
342 }
343
344 /* Fill Style */
345 if ((gp_style->fill_style == GP_MATERIAL_FILL_STYLE_TEXTURE) && (gp_style->ima)) {
346 bool use_clip = (gp_style->flag & GP_MATERIAL_TEX_CLAMP) != 0;
347 bool premul;
348 pool->tex_fill[mat_id] = gpencil_image_texture_get(gp_style->ima, &premul);
349 mat_data->flag |= pool->tex_fill[mat_id] ? GP_FILL_TEXTURE_USE : GP_FLAG_NONE;
350 mat_data->flag |= premul ? GP_FILL_TEXTURE_PREMUL : GP_FLAG_NONE;
351 mat_data->flag |= use_clip ? GP_FILL_TEXTURE_CLIP : GP_FLAG_NONE;
353 gp_style->texture_scale,
354 gp_style->texture_angle,
355 reinterpret_cast<float (*)[2]>(&mat_data->fill_uv_rot_scale),
356 mat_data->fill_uv_offset);
357 copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
358 mat_data->fill_texture_mix = 1.0f - gp_style->mix_factor;
359 }
360 else if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_GRADIENT) {
361 bool use_radial = (gp_style->gradient_type == GP_MATERIAL_GRADIENT_RADIAL);
362 /* TODO: This creates a new texture even if the gradient has not changed. */
363 pool->tex_fill[mat_id] = gpencil_gradient_texture_create(gp_style->gradient);
364 mat_data->flag |= GP_FILL_GRADIENT_USE;
365 mat_data->flag |= use_radial ? GP_FILL_GRADIENT_RADIAL : GP_FLAG_NONE;
367 gp_style->texture_scale,
368 gp_style->texture_angle,
369 reinterpret_cast<float (*)[2]>(&mat_data->fill_uv_rot_scale),
370 mat_data->fill_uv_offset);
371
372 mat_data->fill_texture_mix = 1.0f;
373 }
374 else /* if (gp_style->fill_style == GP_MATERIAL_FILL_STYLE_SOLID) */ {
375 pool->tex_fill[mat_id] = nullptr;
376 copy_v4_v4(mat_data->fill_color, gp_style->fill_rgba);
377 mat_data->fill_texture_mix = 0.0f;
378 }
379 }
380
381 return matpool;
382}
383
385 int mat_id,
386 gpu::Texture **r_tex_stroke,
387 gpu::Texture **r_tex_fill,
388 gpu::UniformBuf **r_ubo_mat)
389{
390 MaterialPool *matpool = first_pool;
391 BLI_assert(mat_id >= 0);
392 int pool_id = mat_id / GPENCIL_MATERIAL_BUFFER_LEN;
393 for (int i = 0; i < pool_id; i++) {
394 matpool = matpool->next;
395 }
396 mat_id = mat_id % GPENCIL_MATERIAL_BUFFER_LEN;
397 *r_ubo_mat = matpool->ubo;
398 if (r_tex_fill) {
399 *r_tex_fill = matpool->tex_fill[mat_id];
400 }
401 if (r_tex_stroke) {
402 *r_tex_stroke = matpool->tex_stroke[mat_id];
403 }
404}
405
407
408/* -------------------------------------------------------------------- */
411
413{
414 LightPool *lightpool = static_cast<LightPool *>(BLI_memblock_alloc(inst->gp_light_pool));
415 lightpool->light_used = 0;
416 /* Tag light list end. */
417 lightpool->light_data[0].light_color[0] = -1.0;
418 if (lightpool->ubo == nullptr) {
419 lightpool->ubo = GPU_uniformbuf_create(sizeof(lightpool->light_data));
420 }
421 inst->last_light_pool = lightpool;
422 return lightpool;
423}
424
425void gpencil_light_ambient_add(LightPool *lightpool, const float color[3])
426{
427 if (lightpool->light_used >= GPENCIL_LIGHT_BUFFER_LEN) {
428 return;
429 }
430
431 gpLight *gp_light = &lightpool->light_data[lightpool->light_used];
432 gp_light->type = GP_LIGHT_TYPE_AMBIENT;
433 copy_v3_v3(gp_light->light_color, color);
434 lightpool->light_used++;
435
436 if (lightpool->light_used < GPENCIL_LIGHT_BUFFER_LEN) {
437 /* Tag light list end. */
438 gp_light[1].light_color[0] = -1.0f;
439 }
440}
441
442static float light_power_get(const Light *la)
443{
444 if (la->type == LA_AREA) {
445 return 1.0f / (4.0f * M_PI);
446 }
447 if (ELEM(la->type, LA_SPOT, LA_LOCAL)) {
448 return 1.0f / (4.0f * M_PI * M_PI);
449 }
450
451 return 1.0f / M_PI;
452}
453
455{
457
458 if (lightpool->light_used >= GPENCIL_LIGHT_BUFFER_LEN) {
459 return;
460 }
461
462 gpLight *gp_light = &lightpool->light_data[lightpool->light_used];
463 float (*mat)[4] = reinterpret_cast<float (*)[4]>(&gp_light->right);
464
465 if (light.type == LA_SPOT) {
466 copy_m4_m4(mat, ob->world_to_object().ptr());
467 gp_light->type = GP_LIGHT_TYPE_SPOT;
468 gp_light->spot_size = cosf(light.spotsize * 0.5f);
469 gp_light->spot_blend = (1.0f - gp_light->spot_size) * light.spotblend;
470 }
471 else if (light.type == LA_AREA) {
472 /* Simulate area lights using a spot light. */
473 normalize_m4_m4(mat, ob->object_to_world().ptr());
474 invert_m4(mat);
475 gp_light->type = GP_LIGHT_TYPE_SPOT;
476 gp_light->spot_size = cosf(M_PI_2);
477 gp_light->spot_blend = (1.0f - gp_light->spot_size) * 1.0f;
478 }
479 else if (light.type == LA_SUN) {
480 normalize_v3_v3(gp_light->forward, ob->object_to_world().ptr()[2]);
481 gp_light->type = GP_LIGHT_TYPE_SUN;
482 }
483 else {
484 gp_light->type = GP_LIGHT_TYPE_POINT;
485 }
486 copy_v4_v4(gp_light->position, ob->object_to_world().location());
487 copy_v3_v3(gp_light->light_color, &light.r);
488 mul_v3_fl(gp_light->light_color, light.energy * light_power_get(&light));
489
490 lightpool->light_used++;
491
492 if (lightpool->light_used < GPENCIL_LIGHT_BUFFER_LEN) {
493 /* Tag light list end. */
494 gp_light[1].light_color[0] = -1.0f;
495 }
496}
497
499{
500 LightPool *lightpool = inst->last_light_pool;
501
502 if (lightpool == nullptr) {
503 lightpool = gpencil_light_pool_add(inst);
504 }
505 /* TODO(fclem): Light linking. */
506 // gpencil_light_pool_populate(lightpool, ob);
507
508 return lightpool;
509}
510
512
513} // namespace blender::draw::gpencil
General operations, lookup, etc. for materials.
#define M_PI
#define GPU_uniformbuf_create(size)
#define ELEM(...)
constexpr IndexRange()=default
void hold_texture(gpu::Texture *texture)
#define GPENCIL_MATERIAL_BUFFER_LEN
#define GPENCIL_LIGHT_BUFFER_LEN
@ GP_DOTS_PLACEMENT_MODE_DENSITY
@ GP_FILL_TEXTURE_USE
@ GP_STROKE_HOLDOUT
@ GP_DOTS_USE_RANDOMIZATION
@ GP_STROKE_TEXTURE_PREMUL
@ GP_STROKE_ALIGNMENT_STROKE
@ GP_FILL_TEXTURE_PREMUL
@ GP_STROKE_TEXTURE_USE
@ GP_STROKE_ALIGNMENT_OBJECT
@ GP_FILL_GRADIENT_USE
@ GP_DOTS_PLACEMENT_MODE_COUNT
@ GP_FILL_TEXTURE_CLIP
@ GP_FILL_GRADIENT_RADIAL
@ GP_STROKE_OVERLAP
@ GP_FILL_HOLDOUT
@ GP_STROKE_ALIGNMENT_FIXED
@ GP_DOTS_PLACEMENT_MODE_RADIUS
@ GP_LIGHT_TYPE_AMBIENT
float3x3 scale(float3x3 mat, float2 scale)
internal::ShallowDataConstRef< T > shallow_copy(const T &other)
Definition DNA_defs.h:147
void gpencil_light_ambient_add(LightPool *lightpool, const float color[3])
static float light_power_get(const Light *la)
static void gpencil_shade_color(float color[3])
static gpu::Texture * gpencil_image_texture_get(blender::Image *image, bool *r_alpha_premult)
void gpencil_light_pool_populate(LightPool *lightpool, Object *ob)
LightPool * gpencil_light_pool_add(Instance *inst)
static MaterialGPencilStyle * gpencil_viewport_material_overrides(Instance *inst, Object *ob, int color_type, MaterialGPencilStyle *gp_style, const eV3DShadingLightingMode lighting_mode)
void gpencil_material_resources_get(MaterialPool *first_pool, int mat_id, gpu::Texture **r_tex_stroke, gpu::Texture **r_tex_fill, gpu::UniformBuf **r_ubo_mat)
static gpu::Texture * gpencil_gradient_texture_create(const ColorBand *coba)
static MaterialPool * gpencil_material_pool_add(Instance *inst)
static void gpencil_uv_transform_get(const float ofs[2], const float scale[2], const float rotation, float r_rot_scale[2][2], float r_offset[2])
LightPool * gpencil_light_pool_create(Instance *inst, Object *)
MaterialPool * gpencil_material_pool_create(Instance *inst, Object *ob, int *ofs, const bool is_vertex_mode)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
int BKE_object_material_used_with_fallback_eval(const Object &ob)
MINLINE void copy_v3_v3(float r[3], const float a[3])
@ GP_MATERIAL_PLACEMENT_RADIUS
@ GP_MATERIAL_PLACEMENT_COUNT
@ GP_MATERIAL_PLACEMENT_DENSITY
MINLINE void linearrgb_to_srgb_v4(float srgb[4], const float linear[4])
MINLINE void copy_v2_v2(float r[2], const float a[2])
VecBase< uint32_t, 4 > uint4
MINLINE void add_v3_fl(float r[3], float f)
MINLINE void copy_v4_fl(float r[4], float f)
void translate_m4(float mat[4][4], float Tx, float Ty, float Tz)
MINLINE unsigned int float_as_uint(float f)
@ GP_MATERIAL_DISABLE_STENCIL
@ GP_MATERIAL_USE_DOTS_RANDOMIZATION
@ GP_MATERIAL_IS_FILL_HOLDOUT
@ GP_MATERIAL_IS_STROKE_HOLDOUT
MINLINE void mul_v3_fl(float r[3], float f)
MaterialGPencilStyle * BKE_gpencil_material_settings(Object *ob, short act)
void BKE_colorband_evaluate_table_rgba(const ColorBand *coba, float **array, int *size)
Definition colorband.cc:562
@ GPU_TEXTURE_USAGE_SHADER_READ
T & DRW_object_get_data_for_drawing(const Object &object)
BMesh const char void * data
@ GP_MATERIAL_STROKE_STYLE_SOLID
@ GP_MATERIAL_STROKE_STYLE_TEXTURE
void unit_m4(float m[4][4])
@ V3D_SHADING_SINGLE_COLOR
@ V3D_SHADING_RANDOM_COLOR
@ V3D_SHADING_MATERIAL_COLOR
@ V3D_SHADING_VERTEX_COLOR
@ V3D_SHADING_TEXTURE_COLOR
@ V3D_SHADING_OBJECT_COLOR
void rotate_m4(float mat[4][4], char axis, float angle)
MINLINE unsigned short unit_float_to_ushort_clamp(float val)
void * BLI_memblock_alloc(BLI_memblock *mblk) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1)
MINLINE void clamp_v3(float vec[3], float min, float max)
void rescale_m4(float mat[4][4], const float scale[3])
draw::Manager * DRW_manager_get()
gpu::Texture * BKE_image_acquire_gpu_texture(Image *image, ImageUser *iuser)
Definition image_gpu.cc:732
MINLINE void copy_v4_v4(float r[4], const float a[4])
VecBase< float, 3 > float3
@ GP_MATERIAL_GRADIENT_RADIAL
gpu::Texture * GPU_texture_create_2d(const char *name, int width, int height, int mip_len, gpu::TextureFormat format, eGPUTextureUsage usage, const float *data)
@ GP_MATERIAL_FILL_STYLE_TEXTURE
@ GP_MATERIAL_FILL_STYLE_SOLID
@ GP_MATERIAL_FILL_STYLE_GRADIENT
#define sinf
#define cosf
KERNEL_FEATURE_LIGHT_PASSES KERNEL_FEATURE_PATH_GUIDING float
eMaterialGPencilStyle_StrokeStyle stroke_style
eMaterialGPencilStyle_GradientType gradient_type
eMaterialGPencilStyle_Flag flag
eMaterialGPencilStyle_FollowMode alignment_mode
eMaterialGPencilStyle_Mode mode
eMaterialGPencilPlacementMode placement_mode
eMaterialGPencilStyle_FillStyle fill_style
eV3DShadingLightingMode light
View3DShading shading
gpLight light_data[GPENCIL_LIGHT_BUFFER_LEN]
gpu::Texture * tex_fill[GPENCIL_MATERIAL_BUFFER_LEN]
gpu::Texture * tex_stroke[GPENCIL_MATERIAL_BUFFER_LEN]
gpMaterial mat_data[GPENCIL_MATERIAL_BUFFER_LEN]
packed_float3 position
enum gpLightType type
packed_float3 light_color
packed_float3 right
gpMaterialFlag flag