Blender  V3.3
texture.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #include <math.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 
13 #include "MEM_guardedalloc.h"
14 
15 #include "BLI_kdopbvh.h"
16 #include "BLI_listbase.h"
17 #include "BLI_math.h"
18 #include "BLI_math_color.h"
19 #include "BLI_utildefines.h"
20 
21 #include "BLT_translation.h"
22 
23 /* Allow using deprecated functionality for .blend file I/O. */
24 #define DNA_DEPRECATED_ALLOW
25 
26 #include "DNA_brush_types.h"
27 #include "DNA_color_types.h"
28 #include "DNA_defaults.h"
29 #include "DNA_key_types.h"
30 #include "DNA_linestyle_types.h"
31 #include "DNA_material_types.h"
32 #include "DNA_node_types.h"
33 #include "DNA_object_types.h"
34 #include "DNA_particle_types.h"
35 
36 #include "IMB_imbuf.h"
37 
38 #include "BKE_main.h"
39 
40 #include "BKE_anim_data.h"
41 #include "BKE_colorband.h"
42 #include "BKE_colortools.h"
43 #include "BKE_icons.h"
44 #include "BKE_idtype.h"
45 #include "BKE_image.h"
46 #include "BKE_key.h"
47 #include "BKE_lib_id.h"
48 #include "BKE_lib_query.h"
49 #include "BKE_material.h"
50 #include "BKE_node.h"
51 #include "BKE_scene.h"
52 #include "BKE_texture.h"
53 
54 #include "NOD_texture.h"
55 
56 #include "RE_texture.h"
57 
58 #include "BLO_read_write.h"
59 
60 static void texture_init_data(ID *id)
61 {
62  Tex *texture = (Tex *)id;
63 
65 
67 
68  BKE_imageuser_default(&texture->iuser);
69 }
70 
71 static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
72 {
73  Tex *texture_dst = (Tex *)id_dst;
74  const Tex *texture_src = (const Tex *)id_src;
75 
76  const bool is_localized = (flag & LIB_ID_CREATE_LOCAL) != 0;
77  /* We always need allocation of our private ID data. */
78  const int flag_private_id_data = flag & ~LIB_ID_CREATE_NO_ALLOCATE;
79 
80  if (!BKE_texture_is_image_user(texture_src)) {
81  texture_dst->ima = NULL;
82  }
83 
84  if (texture_dst->coba) {
85  texture_dst->coba = MEM_dupallocN(texture_dst->coba);
86  }
87  if (texture_src->nodetree) {
88  if (texture_src->nodetree->execdata) {
89  ntreeTexEndExecTree(texture_src->nodetree->execdata);
90  }
91 
92  if (is_localized) {
93  texture_dst->nodetree = ntreeLocalize(texture_src->nodetree);
94  }
95  else {
97  bmain, (ID *)texture_src->nodetree, (ID **)&texture_dst->nodetree, flag_private_id_data);
98  }
99  }
100 
101  if ((flag & LIB_ID_COPY_NO_PREVIEW) == 0) {
102  BKE_previewimg_id_copy(&texture_dst->id, &texture_src->id);
103  }
104  else {
105  texture_dst->preview = NULL;
106  }
107 }
108 
109 static void texture_free_data(ID *id)
110 {
111  Tex *texture = (Tex *)id;
112 
113  /* is no lib link block, but texture extension */
114  if (texture->nodetree) {
116  MEM_freeN(texture->nodetree);
117  texture->nodetree = NULL;
118  }
119 
120  MEM_SAFE_FREE(texture->coba);
121 
122  BKE_icon_id_delete((ID *)texture);
123  BKE_previewimg_free(&texture->preview);
124 }
125 
127 {
128  Tex *texture = (Tex *)id;
129  if (texture->nodetree) {
130  /* nodetree **are owned by IDs**, treat them as mere sub-data and not real ID! */
133  }
135 }
136 
137 static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
138 {
139  Tex *tex = (Tex *)id;
140 
141  /* write LibData */
142  BLO_write_id_struct(writer, Tex, id_address, &tex->id);
143  BKE_id_blend_write(writer, &tex->id);
144 
145  if (tex->adt) {
146  BKE_animdata_blend_write(writer, tex->adt);
147  }
148 
149  /* direct data */
150  if (tex->coba) {
151  BLO_write_struct(writer, ColorBand, tex->coba);
152  }
153 
154  /* nodetree is integral part of texture, no libdata */
155  if (tex->nodetree) {
157  ntreeBlendWrite(writer, tex->nodetree);
158  }
159 
161 }
162 
163 static void texture_blend_read_data(BlendDataReader *reader, ID *id)
164 {
165  Tex *tex = (Tex *)id;
166  BLO_read_data_address(reader, &tex->adt);
168 
169  BLO_read_data_address(reader, &tex->coba);
170 
171  BLO_read_data_address(reader, &tex->preview);
173 
174  tex->iuser.scene = NULL;
175 }
176 
177 static void texture_blend_read_lib(BlendLibReader *reader, ID *id)
178 {
179  Tex *tex = (Tex *)id;
180  BLO_read_id_address(reader, tex->id.lib, &tex->ima);
181  BLO_read_id_address(reader, tex->id.lib, &tex->ipo); /* XXX deprecated - old animation system */
182 }
183 
184 static void texture_blend_read_expand(BlendExpander *expander, ID *id)
185 {
186  Tex *tex = (Tex *)id;
187  BLO_expand(expander, tex->ima);
188  BLO_expand(expander, tex->ipo); /* XXX deprecated - old animation system */
189 }
190 
192  .id_code = ID_TE,
193  .id_filter = FILTER_ID_TE,
194  .main_listbase_index = INDEX_ID_TE,
195  .struct_size = sizeof(Tex),
196  .name = "Texture",
197  .name_plural = "textures",
198  .translation_context = BLT_I18NCONTEXT_ID_TEXTURE,
200  .asset_type_info = NULL,
201 
203  .copy_data = texture_copy_data,
204  .free_data = texture_free_data,
205  .make_local = NULL,
206  .foreach_id = texture_foreach_id,
207  .foreach_cache = NULL,
208  .foreach_path = NULL,
209  .owner_get = NULL,
210 
211  .blend_write = texture_blend_write,
212  .blend_read_data = texture_blend_read_data,
213  .blend_read_lib = texture_blend_read_lib,
214  .blend_read_expand = texture_blend_read_expand,
215 
216  .blend_read_undo_preserve = NULL,
217 
218  .lib_override_apply_post = NULL,
219 };
220 
222 {
225 }
226 
227 /* ****************** Mapping ******************* */
228 
230 {
231  TexMapping *texmap = MEM_callocN(sizeof(TexMapping), "TexMapping");
232 
234 
235  return texmap;
236 }
237 
239 {
240  memset(texmap, 0, sizeof(TexMapping));
241 
242  texmap->size[0] = texmap->size[1] = texmap->size[2] = 1.0f;
243  texmap->max[0] = texmap->max[1] = texmap->max[2] = 1.0f;
244  unit_m4(texmap->mat);
245 
246  texmap->projx = PROJ_X;
247  texmap->projy = PROJ_Y;
248  texmap->projz = PROJ_Z;
249  texmap->mapping = MTEX_FLAT;
250  texmap->type = type;
251 }
252 
254 {
255  float smat[4][4], rmat[4][4], tmat[4][4], proj[4][4], size[3];
256 
257  if (texmap->projx == PROJ_X && texmap->projy == PROJ_Y && texmap->projz == PROJ_Z &&
258  is_zero_v3(texmap->loc) && is_zero_v3(texmap->rot) && is_one_v3(texmap->size)) {
259  unit_m4(texmap->mat);
260 
261  texmap->flag |= TEXMAP_UNIT_MATRIX;
262  }
263  else {
264  /* axis projection */
265  zero_m4(proj);
266  proj[3][3] = 1.0f;
267 
268  if (texmap->projx != PROJ_N) {
269  proj[texmap->projx - 1][0] = 1.0f;
270  }
271  if (texmap->projy != PROJ_N) {
272  proj[texmap->projy - 1][1] = 1.0f;
273  }
274  if (texmap->projz != PROJ_N) {
275  proj[texmap->projz - 1][2] = 1.0f;
276  }
277 
278  /* scale */
279  copy_v3_v3(size, texmap->size);
280 
282  /* keep matrix invertible */
283  if (fabsf(size[0]) < 1e-5f) {
284  size[0] = signf(size[0]) * 1e-5f;
285  }
286  if (fabsf(size[1]) < 1e-5f) {
287  size[1] = signf(size[1]) * 1e-5f;
288  }
289  if (fabsf(size[2]) < 1e-5f) {
290  size[2] = signf(size[2]) * 1e-5f;
291  }
292  }
293 
294  size_to_mat4(smat, texmap->size);
295 
296  /* rotation */
297  eul_to_mat4(rmat, texmap->rot);
298 
299  /* translation */
300  unit_m4(tmat);
301  copy_v3_v3(tmat[3], texmap->loc);
302 
303  if (texmap->type == TEXMAP_TYPE_TEXTURE) {
304  /* to transform a texture, the inverse transform needs
305  * to be applied to the texture coordinate */
306  mul_m4_series(texmap->mat, tmat, rmat, smat);
307  invert_m4(texmap->mat);
308  }
309  else if (texmap->type == TEXMAP_TYPE_POINT) {
310  /* forward transform */
311  mul_m4_series(texmap->mat, tmat, rmat, smat);
312  }
313  else if (texmap->type == TEXMAP_TYPE_VECTOR) {
314  /* no translation for vectors */
315  mul_m4_m4m4(texmap->mat, rmat, smat);
316  }
317  else if (texmap->type == TEXMAP_TYPE_NORMAL) {
318  /* no translation for normals, and inverse transpose */
319  mul_m4_m4m4(texmap->mat, rmat, smat);
320  invert_m4(texmap->mat);
321  transpose_m4(texmap->mat);
322  }
323 
324  /* projection last */
325  mul_m4_m4m4(texmap->mat, texmap->mat, proj);
326 
327  texmap->flag &= ~TEXMAP_UNIT_MATRIX;
328  }
329 }
330 
332 {
333  ColorMapping *colormap = MEM_callocN(sizeof(ColorMapping), "ColorMapping");
334 
336 
337  return colormap;
338 }
339 
341 {
342  memset(colormap, 0, sizeof(ColorMapping));
343 
344  BKE_colorband_init(&colormap->coba, true);
345 
346  colormap->bright = 1.0;
347  colormap->contrast = 1.0;
348  colormap->saturation = 1.0;
349 
350  colormap->blend_color[0] = 0.8f;
351  colormap->blend_color[1] = 0.8f;
352  colormap->blend_color[2] = 0.8f;
353  colormap->blend_type = MA_RAMP_BLEND;
354  colormap->blend_factor = 0.0f;
355 }
356 
357 /* ******************* TEX ************************ */
358 
359 /* ------------------------------------------------------------------------- */
360 
362 {
364 }
365 
367 {
368  tex->type = type;
369 }
370 
371 /* ------------------------------------------------------------------------- */
372 
373 Tex *BKE_texture_add(Main *bmain, const char *name)
374 {
375  Tex *tex;
376 
377  tex = BKE_id_new(bmain, ID_TE, name);
378 
379  return tex;
380 }
381 
382 /* ------------------------------------------------------------------------- */
383 
385 {
386  memcpy(mtex, DNA_struct_default_get(MTex), sizeof(*mtex));
387 }
388 
389 /* ------------------------------------------------------------------------- */
390 
392 {
393  MTex *mtex;
394 
395  mtex = MEM_callocN(sizeof(MTex), "BKE_texture_mtex_add");
396 
398 
399  return mtex;
400 }
401 
403 {
404  MTex **mtex_ar;
405  short act;
406 
407  give_active_mtex(id, &mtex_ar, &act);
408 
409  if (mtex_ar == NULL) {
410  return NULL;
411  }
412 
413  if (slot == -1) {
414  /* find first free */
415  int i;
416  for (i = 0; i < MAX_MTEX; i++) {
417  if (!mtex_ar[i]) {
418  slot = i;
419  break;
420  }
421  }
422  if (slot == -1) {
423  return NULL;
424  }
425  }
426  else {
427  /* make sure slot is valid */
428  if (slot < 0 || slot >= MAX_MTEX) {
429  return NULL;
430  }
431  }
432 
433  if (mtex_ar[slot]) {
434  id_us_min((ID *)mtex_ar[slot]->tex);
435  MEM_freeN(mtex_ar[slot]);
436  mtex_ar[slot] = NULL;
437  }
438 
439  mtex_ar[slot] = BKE_texture_mtex_add();
440 
441  return mtex_ar[slot];
442 }
443 
444 /* ------------------------------------------------------------------------- */
445 
447 {
448  MTex *mtex = NULL;
449  Tex *tex = NULL;
450 
451  if (linestyle) {
452  mtex = linestyle->mtex[(int)(linestyle->texact)];
453  if (mtex) {
454  tex = mtex->tex;
455  }
456  }
457 
458  return tex;
459 }
460 
462 {
463  int act = linestyle->texact;
464 
465  if (linestyle->mtex[act] && linestyle->mtex[act]->tex) {
466  id_us_min(&linestyle->mtex[act]->tex->id);
467  }
468 
469  if (newtex) {
470  if (!linestyle->mtex[act]) {
472  linestyle->mtex[act]->texco = TEXCO_STROKE;
473  }
474 
475  linestyle->mtex[act]->tex = newtex;
476  id_us_plus(&newtex->id);
477  }
478  else {
480  }
481 }
482 
483 bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
484 {
485  switch (GS(id->name)) {
486  case ID_LS:
487  *mtex_ar = ((FreestyleLineStyle *)id)->mtex;
488  if (act) {
489  *act = (((FreestyleLineStyle *)id)->texact);
490  }
491  break;
492  case ID_PA:
493  *mtex_ar = ((ParticleSettings *)id)->mtex;
494  if (act) {
495  *act = (((ParticleSettings *)id)->texact);
496  }
497  break;
498  default:
499  *mtex_ar = NULL;
500  if (act) {
501  *act = 0;
502  }
503  return false;
504  }
505 
506  return true;
507 }
508 
509 void set_active_mtex(ID *id, short act)
510 {
511  if (act < 0) {
512  act = 0;
513  }
514  else if (act >= MAX_MTEX) {
515  act = MAX_MTEX - 1;
516  }
517 
518  switch (GS(id->name)) {
519  case ID_LS:
520  ((FreestyleLineStyle *)id)->texact = act;
521  break;
522  case ID_PA:
523  ((ParticleSettings *)id)->texact = act;
524  break;
525  default:
526  break;
527  }
528 }
529 
531 {
532  return br->mtex.tex;
533 }
534 
536 {
537  if (br->mtex.tex) {
538  id_us_min(&br->mtex.tex->id);
539  }
540 
541  if (newtex) {
542  br->mtex.tex = newtex;
543  id_us_plus(&newtex->id);
544  }
545 }
546 
548 {
549  MTex *mtex = NULL;
550  Tex *tex = NULL;
551 
552  if (!part) {
553  return NULL;
554  }
555 
556  mtex = part->mtex[(int)(part->texact)];
557  if (mtex) {
558  tex = mtex->tex;
559  }
560 
561  return tex;
562 }
563 
565 {
566  int act = part->texact;
567 
568  if (part->mtex[act] && part->mtex[act]->tex) {
569  id_us_min(&part->mtex[act]->tex->id);
570  }
571 
572  if (newtex) {
573  if (!part->mtex[act]) {
574  part->mtex[act] = BKE_texture_mtex_add();
575  part->mtex[act]->texco = TEXCO_ORCO;
576  part->mtex[act]->blendtype = MTEX_MUL;
577  }
578 
579  part->mtex[act]->tex = newtex;
580  id_us_plus(&newtex->id);
581  }
582  else {
583  MEM_SAFE_FREE(part->mtex[act]);
584  }
585 }
586 
587 /* ------------------------------------------------------------------------- */
588 
590 {
591  pd->flag = 0;
592  pd->radius = 0.3f;
594  pd->falloff_softness = 2.0;
595  pd->source = TEX_PD_PSYS;
596  pd->point_tree = NULL;
597  pd->point_data = NULL;
598  pd->noise_size = 0.5f;
599  pd->noise_depth = 1;
600  pd->noise_fac = 1.0f;
602  pd->coba = BKE_colorband_add(true);
603  pd->speed_scale = 1.0f;
604  pd->totpoints = 0;
605  pd->object = NULL;
606  pd->psys = 0;
608  pd->falloff_curve = BKE_curvemapping_add(1, 0, 0, 1, 1);
609 
613  &pd->falloff_curve->clipr,
614  pd->falloff_curve->preset,
617 }
618 
620 {
621  PointDensity *pd = MEM_callocN(sizeof(PointDensity), "pointdensity");
623  return pd;
624 }
625 
627 {
628  PointDensity *pdn;
629 
630  pdn = MEM_dupallocN(pd);
631  pdn->point_tree = NULL;
632  pdn->point_data = NULL;
633  if (pdn->coba) {
634  pdn->coba = MEM_dupallocN(pdn->coba);
635  }
636  pdn->falloff_curve = BKE_curvemapping_copy(pdn->falloff_curve); /* can be NULL */
637  return pdn;
638 }
639 
641 {
642  if (pd->point_tree) {
644  pd->point_tree = NULL;
645  }
647  MEM_SAFE_FREE(pd->coba);
648 
649  BKE_curvemapping_free(pd->falloff_curve); /* can be NULL */
650 }
651 
653 {
655  MEM_freeN(pd);
656 }
657 /* ------------------------------------------------------------------------- */
658 
659 bool BKE_texture_is_image_user(const struct Tex *tex)
660 {
661  switch (tex->type) {
662  case TEX_IMAGE: {
663  return true;
664  }
665  }
666 
667  return false;
668 }
669 
670 bool BKE_texture_dependsOnTime(const struct Tex *texture)
671 {
672  if (texture->ima && BKE_image_is_animated(texture->ima)) {
673  return true;
674  }
675  if (texture->adt) {
676  /* assume anything in adt means the texture is animated */
677  return true;
678  }
679  if (texture->type == TEX_NOISE) {
680  /* noise always varies with time */
681  return true;
682  }
683  return false;
684 }
685 
686 /* ------------------------------------------------------------------------- */
687 
689  Tex *texture,
690  const float *tex_co,
691  TexResult *texres,
692  struct ImagePool *pool,
693  bool use_color_management)
694 {
695  int result_type;
696  bool do_color_manage = false;
697 
698  if (scene && use_color_management) {
700  }
701 
702  /* no node textures for now */
703  result_type = multitex_ext_safe(texture, tex_co, texres, pool, do_color_manage, false);
704 
705  /* if the texture gave an RGB value, we assume it didn't give a valid
706  * intensity, since this is in the context of modifiers don't use perceptual color conversion.
707  * if the texture didn't give an RGB value, copy the intensity across
708  */
709  if (result_type & TEX_RGB) {
710  texres->tin = (1.0f / 3.0f) * (texres->trgba[0] + texres->trgba[1] + texres->trgba[2]);
711  }
712  else {
713  copy_v3_fl(texres->trgba, texres->tin);
714  }
715 }
716 
718  Tex *texture,
719  const float *tex_co,
720  TexResult *texres,
721  bool use_color_management)
722 {
723  BKE_texture_get_value_ex(scene, texture, tex_co, texres, NULL, use_color_management);
724 }
725 
727  bNodeTree *ntree,
728  struct ImagePool *pool)
729 {
731  if (node->type == SH_NODE_TEX_IMAGE && node->id != NULL) {
732  Image *image = (Image *)node->id;
734  }
735  else if (node->type == NODE_GROUP && node->id != NULL) {
736  /* TODO(sergey): Do we need to control recursion here? */
737  bNodeTree *nested_tree = (bNodeTree *)node->id;
738  texture_nodes_fetch_images_for_pool(texture, nested_tree, pool);
739  }
740  }
741 }
742 
744 {
745  if (texture->nodetree != NULL) {
747  }
748  else {
749  if (texture->type == TEX_IMAGE) {
750  if (texture->ima != NULL) {
751  BKE_image_pool_acquire_ibuf(texture->ima, &texture->iuser, pool);
752  }
753  }
754  }
755 }
void BKE_animdata_blend_read_data(struct BlendDataReader *reader, struct AnimData *adt)
Definition: anim_data.c:1443
void BKE_animdata_blend_write(struct BlendWriter *writer, struct AnimData *adt)
Definition: anim_data.c:1421
struct ColorBand * BKE_colorband_add(bool rangetype)
Definition: colorband.c:296
void BKE_colorband_init(struct ColorBand *coba, bool rangetype)
Definition: colorband.c:22
void BKE_curvemapping_changed(struct CurveMapping *cumap, bool rem_doubles)
Definition: colortools.c:855
struct CurveMapping * BKE_curvemapping_copy(const struct CurveMapping *cumap)
void BKE_curvemap_reset(struct CurveMap *cuma, const struct rctf *clipr, int preset, int slope)
void BKE_curvemapping_free(struct CurveMapping *cumap)
Definition: colortools.c:103
@ CURVEMAP_SLOPE_POSITIVE
struct CurveMapping * BKE_curvemapping_add(int tot, float minx, float miny, float maxx, float maxy)
Definition: colortools.c:72
void BKE_icon_id_delete(struct ID *id)
Definition: icons.cc:870
void BKE_previewimg_free(struct PreviewImage **prv)
Definition: icons.cc:283
void BKE_previewimg_id_copy(struct ID *new_id, const struct ID *old_id)
void BKE_previewimg_blend_read(struct BlendDataReader *reader, struct PreviewImage *prv)
Definition: icons.cc:615
void BKE_previewimg_blend_write(struct BlendWriter *writer, const struct PreviewImage *prv)
@ IDTYPE_FLAGS_APPEND_IS_REUSABLE
Definition: BKE_idtype.h:39
struct ImBuf * BKE_image_pool_acquire_ibuf(struct Image *ima, struct ImageUser *iuser, struct ImagePool *pool)
bool BKE_image_is_animated(struct Image *image)
void BKE_imageuser_default(struct ImageUser *iuser)
@ LIB_ID_CREATE_NO_ALLOCATE
Definition: BKE_lib_id.h:130
@ LIB_ID_COPY_NO_PREVIEW
Definition: BKE_lib_id.h:150
@ LIB_ID_CREATE_LOCAL
Definition: BKE_lib_id.h:139
struct ID * BKE_id_copy_ex(struct Main *bmain, const struct ID *id, struct ID **r_newid, int flag)
void id_us_min(struct ID *id)
Definition: lib_id.c:313
void id_us_plus(struct ID *id)
Definition: lib_id.c:305
void BKE_id_blend_write(struct BlendWriter *writer, struct ID *id)
Definition: lib_id.c:2008
void * BKE_id_new(struct Main *bmain, short type, const char *name)
Definition: lib_id.c:1159
#define BKE_LIB_FOREACHID_PROCESS_IDSUPER(_data, _id_super, _cb_flag)
#define BKE_LIB_FOREACHID_PROCESS_FUNCTION_CALL(_data, _func_call)
void BKE_library_foreach_ID_embedded(struct LibraryForeachIDData *data, struct ID **id_pp)
Definition: lib_query.c:147
@ IDWALK_CB_USER
Definition: BKE_lib_query.h:73
@ IDWALK_CB_NOP
Definition: BKE_lib_query.h:33
General operations, lookup, etc. for materials.
void ntreeBlendWrite(struct BlendWriter *writer, struct bNodeTree *ntree)
Definition: node.cc:519
void ntreeFreeEmbeddedTree(struct bNodeTree *ntree)
Definition: node.cc:3112
bool BKE_scene_check_color_management_enabled(const struct Scene *scene)
#define BLI_assert(a)
Definition: BLI_assert.h:46
void BLI_bvhtree_free(BVHTree *tree)
Definition: BLI_kdopbvh.c:926
#define LISTBASE_FOREACH(type, var, list)
Definition: BLI_listbase.h:336
MINLINE float signf(float f)
void zero_m4(float m[4][4])
Definition: math_matrix.c:28
void mul_m4_m4m4(float R[4][4], const float A[4][4], const float B[4][4])
Definition: math_matrix.c:259
bool invert_m4(float R[4][4])
Definition: math_matrix.c:1206
void unit_m4(float m[4][4])
Definition: rct.c:1090
void size_to_mat4(float R[4][4], const float size[3])
Definition: math_matrix.c:2111
#define mul_m4_series(...)
void transpose_m4(float R[4][4])
Definition: math_matrix.c:1377
void eul_to_mat4(float mat[4][4], const float eul[3])
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool is_one_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void copy_v3_fl(float r[3], float f)
#define UNUSED(x)
#define ELEM(...)
#define MEMCMP_STRUCT_AFTER_IS_ZERO(struct_var, member)
#define MEMCPY_STRUCT_AFTER(struct_dst, struct_src, member)
#define BLO_read_data_address(reader, ptr_p)
#define BLO_write_id_struct(writer, struct_name, id_address, id)
#define BLO_write_struct(writer, struct_name, data_ptr)
#define BLO_read_id_address(reader, lib, id_ptr_p)
#define BLO_expand(expander, id)
#define BLT_I18NCONTEXT_ID_TEXTURE
@ INDEX_ID_TE
Definition: DNA_ID.h:1011
#define FILTER_ID_TE
Definition: DNA_ID.h:922
@ ID_TE
Definition: DNA_ID_enums.h:52
@ ID_LS
Definition: DNA_ID_enums.h:75
@ ID_PA
Definition: DNA_ID_enums.h:70
@ CUMA_EXTEND_EXTRAPOLATE
@ CURVE_PRESET_LINE
#define DNA_struct_default_get(struct_name)
Definition: DNA_defaults.h:29
#define TEXCO_STROKE
#define TEXCO_ORCO
#define MA_RAMP_BLEND
Object is a sort of wrapper for general info.
#define MTEX_MUL
#define PROJ_Z
#define TEX_PD_NOISE_STATIC
#define TEX_PD_PSYS
#define TEXMAP_TYPE_NORMAL
#define TEXMAP_TYPE_VECTOR
#define PROJ_X
#define TEXMAP_TYPE_POINT
#define PROJ_N
#define TEXMAP_UNIT_MATRIX
#define TEX_RGB
#define TEX_PD_FALLOFF_STD
struct Tex Tex
#define MTEX_FLAT
#define TEX_PD_WORLDSPACE
#define TEXMAP_TYPE_TEXTURE
#define PROJ_Y
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
Read Guarded memory(de)allocation.
#define MEM_SAFE_FREE(v)
static void init_data(ModifierData *md)
NODE_GROUP
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture TEX_NOISE
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block TEX_IMAGE
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block SH_NODE_TEX_IMAGE
void ntreeTexEndExecTree(struct bNodeTreeExec *exec)
#define MAX_MTEX
Definition: Stroke.h:31
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
OperationNode * node
Scene scene
FreestyleLineStyle linestyle
depth_tx normal_tx diffuse_light_tx specular_light_tx volume_light_tx environment_tx ambient_occlusion_tx aov_value_tx in_weight_img image(1, GPU_R32F, Qualifier::WRITE, ImageType::FLOAT_2D_ARRAY, "out_weight_img") .image(3
bNodeTree * ntree
#define GS(x)
Definition: iris.c:225
void(* MEM_freeN)(void *vmemh)
Definition: mallocn.c:27
void *(* MEM_dupallocN)(const void *vmemh)
Definition: mallocn.c:28
void *(* MEM_callocN)(size_t len, const char *str)
Definition: mallocn.c:31
#define fabsf(x)
Definition: metal/compat.h:219
struct MTex mtex
struct ColorBand coba
float blend_color[3]
CurveMap cm[4]
struct MTex * mtex[18]
short id_code
Definition: BKE_idtype.h:114
Definition: DNA_ID.h:368
struct Library * lib
Definition: DNA_ID.h:372
char name[66]
Definition: DNA_ID.h:378
struct Scene * scene
short texco
short blendtype
struct Object * object
struct Tex * tex
Definition: BKE_main.h:121
struct MTex * mtex[18]
struct CurveMapping * falloff_curve
struct Object * object
struct ColorBand * coba
float mat[4][4]
float tin
Definition: RE_texture.h:86
float trgba[4]
Definition: RE_texture.h:87
struct AnimData * adt
struct PreviewImage * preview
struct ImageUser iuser
struct ColorBand * coba
short type
struct bNodeTree * nodetree
struct Image * ima
ListBase nodes
struct bNodeTreeExec * execdata
Tex * give_current_brush_texture(Brush *br)
Definition: texture.c:530
void BKE_texture_pointdensity_free(PointDensity *pd)
Definition: texture.c:652
PointDensity * BKE_texture_pointdensity_copy(const PointDensity *pd, const int UNUSED(flag))
Definition: texture.c:626
void BKE_texture_get_value(const Scene *scene, Tex *texture, const float *tex_co, TexResult *texres, bool use_color_management)
Definition: texture.c:717
void BKE_texture_get_value_ex(const Scene *scene, Tex *texture, const float *tex_co, TexResult *texres, struct ImagePool *pool, bool use_color_management)
Definition: texture.c:688
bool BKE_texture_dependsOnTime(const struct Tex *texture)
Definition: texture.c:670
static void texture_copy_data(Main *bmain, ID *id_dst, const ID *id_src, const int flag)
Definition: texture.c:71
Tex * give_current_particle_texture(ParticleSettings *part)
Definition: texture.c:547
void BKE_texture_type_set(Tex *tex, int type)
Definition: texture.c:366
void BKE_texture_mapping_default(TexMapping *texmap, int type)
Definition: texture.c:238
void set_current_particle_texture(ParticleSettings *part, Tex *newtex)
Definition: texture.c:564
static void texture_foreach_id(ID *id, LibraryForeachIDData *data)
Definition: texture.c:126
static void texture_init_data(ID *id)
Definition: texture.c:60
void set_current_brush_texture(Brush *br, Tex *newtex)
Definition: texture.c:535
void BKE_texture_colormapping_default(ColorMapping *colormap)
Definition: texture.c:340
IDTypeInfo IDType_ID_TE
Definition: texture.c:191
void BKE_texture_mtex_foreach_id(LibraryForeachIDData *data, MTex *mtex)
Definition: texture.c:221
void BKE_texture_fetch_images_for_pool(Tex *texture, struct ImagePool *pool)
Definition: texture.c:743
static void texture_blend_read_lib(BlendLibReader *reader, ID *id)
Definition: texture.c:177
void BKE_texture_mapping_init(TexMapping *texmap)
Definition: texture.c:253
void set_active_mtex(ID *id, short act)
Definition: texture.c:509
void set_current_linestyle_texture(FreestyleLineStyle *linestyle, Tex *newtex)
Definition: texture.c:461
bool give_active_mtex(ID *id, MTex ***mtex_ar, short *act)
Definition: texture.c:483
TexMapping * BKE_texture_mapping_add(int type)
Definition: texture.c:229
static void texture_blend_read_expand(BlendExpander *expander, ID *id)
Definition: texture.c:184
static void texture_nodes_fetch_images_for_pool(Tex *texture, bNodeTree *ntree, struct ImagePool *pool)
Definition: texture.c:726
MTex * BKE_texture_mtex_add(void)
Definition: texture.c:391
void BKE_texture_pointdensity_init_data(PointDensity *pd)
Definition: texture.c:589
static void texture_blend_write(BlendWriter *writer, ID *id, const void *id_address)
Definition: texture.c:137
void BKE_texture_pointdensity_free_data(PointDensity *pd)
Definition: texture.c:640
MTex * BKE_texture_mtex_add_id(ID *id, int slot)
Definition: texture.c:402
void BKE_texture_mtex_default(MTex *mtex)
Definition: texture.c:384
Tex * give_current_linestyle_texture(FreestyleLineStyle *linestyle)
Definition: texture.c:446
bool BKE_texture_is_image_user(const struct Tex *tex)
Definition: texture.c:659
static void texture_blend_read_data(BlendDataReader *reader, ID *id)
Definition: texture.c:163
static void texture_free_data(ID *id)
Definition: texture.c:109
PointDensity * BKE_texture_pointdensity_add(void)
Definition: texture.c:619
void BKE_texture_default(Tex *tex)
Definition: texture.c:361
ColorMapping * BKE_texture_colormapping_add(void)
Definition: texture.c:331
Tex * BKE_texture_add(Main *bmain, const char *name)
Definition: texture.c:373
int multitex_ext_safe(Tex *tex, const float texvec[3], TexResult *texres, struct ImagePool *pool, bool scene_color_manage, const bool skip_load_image)