1 /* 2 * This program is free software; you can redistribute it and/or 3 * modify it under the terms of the GNU General Public License 4 * as published by the Free Software Foundation; either version 2 5 * of the License, or (at your option) any later version. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * along with this program; if not, write to the Free Software Foundation, 14 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 15 * 16 * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV. 17 * All rights reserved. 18 */ 19 20 /** \file 21 * \ingroup DNA 22 */ 23 24 #pragma once 25 26 #include "DNA_ID.h" 27 #include "DNA_defs.h" 28 #include "DNA_image_types.h" /* ImageUser */ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct AnimData; 35 struct ColorBand; 36 struct CurveMapping; 37 struct Image; 38 struct Ipo; 39 struct Object; 40 struct PreviewImage; 41 struct Tex; 42 43 typedef struct MTex { 44 45 short texco, mapto, maptoneg, blendtype; 46 struct Object *object; 47 struct Tex *tex; 48 /** MAX_CUSTOMDATA_LAYER_NAME. */ 49 char uvname[64]; 50 51 char projx, projy, projz, mapping; 52 char brush_map_mode, brush_angle_mode; 53 char _pad[2]; 54 float ofs[3], size[3], rot, random_angle; 55 56 char _pad0[2]; 57 short colormodel, pmapto, pmaptoneg; 58 short normapspace, which_output; 59 float r, g, b, k; 60 float def_var, rt; 61 62 /* common */ 63 float colfac, varfac; 64 65 /* material */ 66 float norfac, dispfac, warpfac; 67 float colspecfac, mirrfac, alphafac; 68 float difffac, specfac, emitfac, hardfac; 69 float raymirrfac, translfac, ambfac; 70 float colemitfac, colreflfac, coltransfac; 71 float densfac, scatterfac, reflfac; 72 73 /* particles */ 74 float timefac, lengthfac, clumpfac, dampfac; 75 float kinkfac, kinkampfac, roughfac, padensfac, gravityfac; 76 float lifefac, sizefac, ivelfac, fieldfac; 77 float twistfac; 78 79 /* light */ 80 float shadowfac; 81 82 /* world */ 83 float zenupfac, zendownfac, blendfac; 84 } MTex; 85 86 #ifndef DNA_USHORT_FIX 87 # define DNA_USHORT_FIX 88 /** 89 * \deprecated This typedef serves to avoid badly typed functions when 90 * \deprecated compiling while delivering a proper dna.c. Do not use 91 * \deprecated it in any case. 92 */ 93 typedef unsigned short dna_ushort_fix; 94 #endif 95 96 typedef struct CBData { 97 float r, g, b, a, pos; 98 int cur; 99 } CBData; 100 101 /* 32 = MAXCOLORBAND */ 102 /* note that this has to remain a single struct, for UserDef */ 103 typedef struct ColorBand { 104 short tot, cur; 105 char ipotype, ipotype_hue; 106 char color_mode; 107 char _pad[1]; 108 109 CBData data[32]; 110 } ColorBand; 111 112 typedef struct PointDensity { 113 short flag; 114 115 short falloff_type; 116 float falloff_softness; 117 float radius; 118 short source; 119 char _pad0[2]; 120 121 /** psys_color_source */ 122 short color_source; 123 short ob_color_source; 124 125 int totpoints; 126 127 /** for 'Object' or 'Particle system' type - source object */ 128 struct Object *object; 129 /** `index + 1` in ob.particlesystem, non-ID pointer not allowed */ 130 int psys; 131 /** cache points in worldspace, object space, ... ? */ 132 short psys_cache_space; 133 /** cache points in worldspace, object space, ... ? */ 134 short ob_cache_space; 135 /** vertex attribute layer for color source, MAX_CUSTOMDATA_LAYER_NAME */ 136 char vertex_attribute_name[64]; 137 138 /** The acceleration tree containing points. */ 139 void *point_tree; 140 /** Dynamically allocated extra for extra information, like particle age. */ 141 float *point_data; 142 143 float noise_size; 144 short noise_depth; 145 short noise_influence; 146 short noise_basis; 147 char _pad1[6]; 148 float noise_fac; 149 150 float speed_scale, falloff_speed_scale; 151 char _pad2[4]; 152 /** For time -> color */ 153 struct ColorBand *coba; 154 155 /** Falloff density curve. */ 156 struct CurveMapping *falloff_curve; 157 } PointDensity; 158 159 typedef struct Tex { 160 ID id; 161 /** Animation data (must be immediately after id for utilities to use it). */ 162 struct AnimData *adt; 163 164 float noisesize, turbul; 165 float bright, contrast, saturation, rfac, gfac, bfac; 166 float filtersize; 167 char _pad2[4]; 168 169 /* newnoise: musgrave parameters */ 170 float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain; 171 172 /* newnoise: distorted noise amount, musgrave & voronoi output scale */ 173 float dist_amount, ns_outscale; 174 175 /* newnoise: voronoi nearest neighbor weights, minkovsky exponent, 176 * distance metric & color type */ 177 float vn_w1; 178 float vn_w2; 179 float vn_w3; 180 float vn_w4; 181 float vn_mexp; 182 short vn_distm, vn_coltype; 183 184 /* noisedepth MUST be <= 30 else we get floating point exceptions */ 185 short noisedepth, noisetype; 186 187 /* newnoise: noisebasis type for clouds/marble/etc, noisebasis2 only used for distorted noise */ 188 short noisebasis, noisebasis2; 189 190 short imaflag, flag; 191 short type, stype; 192 193 float cropxmin, cropymin, cropxmax, cropymax; 194 int texfilter; 195 int afmax; /* anisotropic filter maximum value, ewa -> max eccentricity, feline -> max probes */ 196 short xrepeat, yrepeat; 197 short extend; 198 199 /* variables disabled, moved to struct iuser */ 200 short _pad0; 201 int len; 202 int frames, offset, sfra; 203 204 float checkerdist, nabla; 205 char _pad1[4]; 206 207 struct ImageUser iuser; 208 209 struct bNodeTree *nodetree; 210 /* old animation system, deprecated for 2.5 */ 211 struct Ipo *ipo DNA_DEPRECATED; 212 struct Image *ima; 213 struct ColorBand *coba; 214 struct PreviewImage *preview; 215 216 char use_nodes; 217 char _pad[7]; 218 219 } Tex; 220 221 /* used for mapping and texture nodes. note: rot is now in radians */ 222 223 typedef struct TexMapping { 224 float loc[3], rot[3], size[3]; 225 int flag; 226 char projx, projy, projz, mapping; 227 int type; 228 229 float mat[4][4]; 230 float min[3], max[3]; 231 struct Object *ob; 232 233 } TexMapping; 234 235 typedef struct ColorMapping { 236 struct ColorBand coba; 237 238 float bright, contrast, saturation; 239 int flag; 240 241 float blend_color[3]; 242 float blend_factor; 243 int blend_type; 244 char _pad[4]; 245 } ColorMapping; 246 247 /* texmap->flag */ 248 #define TEXMAP_CLIP_MIN 1 249 #define TEXMAP_CLIP_MAX 2 250 #define TEXMAP_UNIT_MATRIX 4 251 252 /* texmap->type */ 253 #define TEXMAP_TYPE_POINT 0 254 #define TEXMAP_TYPE_TEXTURE 1 255 #define TEXMAP_TYPE_VECTOR 2 256 #define TEXMAP_TYPE_NORMAL 3 257 258 /* colormap->flag */ 259 #define COLORMAP_USE_RAMP 1 260 261 /* **************** TEX ********************* */ 262 263 /* type */ 264 #define TEX_CLOUDS 1 265 #define TEX_WOOD 2 266 #define TEX_MARBLE 3 267 #define TEX_MAGIC 4 268 #define TEX_BLEND 5 269 #define TEX_STUCCI 6 270 #define TEX_NOISE 7 271 #define TEX_IMAGE 8 272 //#define TEX_PLUGIN 9 /* Deprecated */ 273 //#define TEX_ENVMAP 10 /* Deprecated */ 274 #define TEX_MUSGRAVE 11 275 #define TEX_VORONOI 12 276 #define TEX_DISTNOISE 13 277 //#define TEX_POINTDENSITY 14 /* Deprecated */ 278 //#define TEX_VOXELDATA 15 /* Deprecated */ 279 //#define TEX_OCEAN 16 /* Deprecated */ 280 281 /* musgrave stype */ 282 #define TEX_MFRACTAL 0 283 #define TEX_RIDGEDMF 1 284 #define TEX_HYBRIDMF 2 285 #define TEX_FBM 3 286 #define TEX_HTERRAIN 4 287 288 /* newnoise: noisebasis 1 & 2 */ 289 #define TEX_BLENDER 0 290 #define TEX_STDPERLIN 1 291 #define TEX_NEWPERLIN 2 292 #define TEX_VORONOI_F1 3 293 #define TEX_VORONOI_F2 4 294 #define TEX_VORONOI_F3 5 295 #define TEX_VORONOI_F4 6 296 #define TEX_VORONOI_F2F1 7 297 #define TEX_VORONOI_CRACKLE 8 298 #define TEX_CELLNOISE 14 299 300 /* newnoise: Voronoi distance metrics, vn_distm */ 301 #define TEX_DISTANCE 0 302 #define TEX_DISTANCE_SQUARED 1 303 #define TEX_MANHATTAN 2 304 #define TEX_CHEBYCHEV 3 305 #define TEX_MINKOVSKY_HALF 4 306 #define TEX_MINKOVSKY_FOUR 5 307 #define TEX_MINKOVSKY 6 308 309 /* imaflag */ 310 #define TEX_INTERPOL (1 << 0) 311 #define TEX_USEALPHA (1 << 1) 312 #define TEX_MIPMAP (1 << 2) 313 #define TEX_IMAROT (1 << 4) 314 #define TEX_CALCALPHA (1 << 5) 315 #define TEX_NORMALMAP (1 << 11) 316 #define TEX_GAUSS_MIP (1 << 12) 317 #define TEX_FILTER_MIN (1 << 13) 318 #define TEX_DERIVATIVEMAP (1 << 14) 319 320 /* texfilter */ 321 #define TXF_BOX 0 /* Blender's old texture filtering method. */ 322 #define TXF_EWA 1 323 #define TXF_FELINE 2 324 #define TXF_AREA 3 325 326 /* flag */ 327 #define TEX_COLORBAND (1 << 0) 328 #define TEX_FLIPBLEND (1 << 1) 329 #define TEX_NEGALPHA (1 << 2) 330 #define TEX_CHECKER_ODD (1 << 3) 331 #define TEX_CHECKER_EVEN (1 << 4) 332 #define TEX_PRV_ALPHA (1 << 5) 333 #define TEX_PRV_NOR (1 << 6) 334 #define TEX_REPEAT_XMIR (1 << 7) 335 #define TEX_REPEAT_YMIR (1 << 8) 336 #define TEX_FLAG_MASK \ 337 (TEX_COLORBAND | TEX_FLIPBLEND | TEX_NEGALPHA | TEX_CHECKER_ODD | TEX_CHECKER_EVEN | \ 338 TEX_PRV_ALPHA | TEX_PRV_NOR | TEX_REPEAT_XMIR | TEX_REPEAT_YMIR) 339 #define TEX_DS_EXPAND (1 << 9) 340 #define TEX_NO_CLAMP (1 << 10) 341 342 /* extend (starts with 1 because of backward comp.) */ 343 #define TEX_EXTEND 1 344 #define TEX_CLIP 2 345 #define TEX_REPEAT 3 346 #define TEX_CLIPCUBE 4 347 #define TEX_CHECKER 5 348 349 /* noisetype */ 350 #define TEX_NOISESOFT 0 351 #define TEX_NOISEPERL 1 352 353 /* tex->noisebasis2 in texture.c - wood waveforms */ 354 #define TEX_SIN 0 355 #define TEX_SAW 1 356 #define TEX_TRI 2 357 358 /* tex->stype in texture.c - wood types */ 359 #define TEX_BAND 0 360 #define TEX_RING 1 361 #define TEX_BANDNOISE 2 362 #define TEX_RINGNOISE 3 363 364 /* tex->stype in texture.c - cloud types */ 365 #define TEX_DEFAULT 0 366 #define TEX_COLOR 1 367 368 /* tex->stype in texture.c - marble types */ 369 #define TEX_SOFT 0 370 #define TEX_SHARP 1 371 #define TEX_SHARPER 2 372 373 /* tex->stype in texture.c - blend types */ 374 #define TEX_LIN 0 375 #define TEX_QUAD 1 376 #define TEX_EASE 2 377 #define TEX_DIAG 3 378 #define TEX_SPHERE 4 379 #define TEX_HALO 5 380 #define TEX_RAD 6 381 382 /* tex->stype in texture.c - stucci types */ 383 #define TEX_PLASTIC 0 384 #define TEX_WALLIN 1 385 #define TEX_WALLOUT 2 386 387 /* tex->stype in texture.c - voronoi types */ 388 #define TEX_INTENSITY 0 389 #define TEX_COL1 1 390 #define TEX_COL2 2 391 #define TEX_COL3 3 392 393 /* mtex->normapspace */ 394 #define MTEX_NSPACE_CAMERA 0 395 #define MTEX_NSPACE_WORLD 1 396 #define MTEX_NSPACE_OBJECT 2 397 #define MTEX_NSPACE_TANGENT 3 398 399 /* wrap */ 400 #define MTEX_FLAT 0 401 #define MTEX_CUBE 1 402 #define MTEX_TUBE 2 403 #define MTEX_SPHERE 3 404 405 /* return value */ 406 #define TEX_INT 0 407 #define TEX_RGB (1 << 0) 408 #define TEX_NOR (1 << 1) 409 410 /* pr_texture in material, world, light. */ 411 #define TEX_PR_TEXTURE 0 412 #define TEX_PR_OTHER 1 413 #define TEX_PR_BOTH 2 414 415 /* **************** MTEX ********************* */ 416 417 /* proj */ 418 #define PROJ_N 0 419 #define PROJ_X 1 420 #define PROJ_Y 2 421 #define PROJ_Z 3 422 423 /* blendtype */ 424 #define MTEX_BLEND 0 425 #define MTEX_MUL 1 426 #define MTEX_ADD 2 427 #define MTEX_SUB 3 428 #define MTEX_DIV 4 429 #define MTEX_DARK 5 430 #define MTEX_DIFF 6 431 #define MTEX_LIGHT 7 432 #define MTEX_SCREEN 8 433 #define MTEX_OVERLAY 9 434 #define MTEX_BLEND_HUE 10 435 #define MTEX_BLEND_SAT 11 436 #define MTEX_BLEND_VAL 12 437 #define MTEX_BLEND_COLOR 13 438 #define MTEX_SOFT_LIGHT 15 439 #define MTEX_LIN_LIGHT 16 440 441 /* brush_map_mode */ 442 #define MTEX_MAP_MODE_VIEW 0 443 #define MTEX_MAP_MODE_TILED 1 444 #define MTEX_MAP_MODE_3D 2 445 #define MTEX_MAP_MODE_AREA 3 446 #define MTEX_MAP_MODE_RANDOM 4 447 #define MTEX_MAP_MODE_STENCIL 5 448 449 /* brush_angle_mode */ 450 #define MTEX_ANGLE_RANDOM 1 451 #define MTEX_ANGLE_RAKE 2 452 453 /* **************** ColorBand ********************* */ 454 455 /* colormode */ 456 enum { 457 COLBAND_BLEND_RGB = 0, 458 COLBAND_BLEND_HSV = 1, 459 COLBAND_BLEND_HSL = 2, 460 }; 461 462 /* interpolation */ 463 enum { 464 COLBAND_INTERP_LINEAR = 0, 465 COLBAND_INTERP_EASE = 1, 466 COLBAND_INTERP_B_SPLINE = 2, 467 COLBAND_INTERP_CARDINAL = 3, 468 COLBAND_INTERP_CONSTANT = 4, 469 }; 470 471 /* color interpolation */ 472 enum { 473 COLBAND_HUE_NEAR = 0, 474 COLBAND_HUE_FAR = 1, 475 COLBAND_HUE_CW = 2, 476 COLBAND_HUE_CCW = 3, 477 }; 478 479 /* **************** PointDensity ********************* */ 480 481 /* source */ 482 #define TEX_PD_PSYS 0 483 #define TEX_PD_OBJECT 1 484 #define TEX_PD_FILE 2 485 486 /* falloff_type */ 487 #define TEX_PD_FALLOFF_STD 0 488 #define TEX_PD_FALLOFF_SMOOTH 1 489 #define TEX_PD_FALLOFF_SOFT 2 490 #define TEX_PD_FALLOFF_CONSTANT 3 491 #define TEX_PD_FALLOFF_ROOT 4 492 #define TEX_PD_FALLOFF_PARTICLE_AGE 5 493 #define TEX_PD_FALLOFF_PARTICLE_VEL 6 494 495 /* psys_cache_space */ 496 #define TEX_PD_OBJECTLOC 0 497 #define TEX_PD_OBJECTSPACE 1 498 #define TEX_PD_WORLDSPACE 2 499 500 /* flag */ 501 #define TEX_PD_TURBULENCE 1 502 #define TEX_PD_FALLOFF_CURVE 2 503 504 /* noise_influence */ 505 #define TEX_PD_NOISE_STATIC 0 506 /* #define TEX_PD_NOISE_VEL 1 */ /* Deprecated */ 507 /* #define TEX_PD_NOISE_AGE 2 */ /* Deprecated */ 508 /* #define TEX_PD_NOISE_TIME 3 */ /* Deprecated */ 509 510 /* color_source */ 511 enum { 512 TEX_PD_COLOR_CONSTANT = 0, 513 /* color_source: particles */ 514 TEX_PD_COLOR_PARTAGE = 1, 515 TEX_PD_COLOR_PARTSPEED = 2, 516 TEX_PD_COLOR_PARTVEL = 3, 517 /* color_source: vertices */ 518 TEX_PD_COLOR_VERTCOL = 1, 519 TEX_PD_COLOR_VERTWEIGHT = 2, 520 TEX_PD_COLOR_VERTNOR = 3, 521 }; 522 523 #define POINT_DATA_VEL 1 524 #define POINT_DATA_LIFE 2 525 #define POINT_DATA_COLOR 4 526 527 #ifdef __cplusplus 528 } 529 #endif 530