Blender V2.61 - r43446

DNA_texture_types.h

Go to the documentation of this file.
00001 /*
00002  * ***** BEGIN GPL LICENSE BLOCK *****
00003  *
00004  * This program is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU General Public License
00006  * as published by the Free Software Foundation; either version 2
00007  * of the License, or (at your option) any later version.
00008  *
00009  * This program is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  * GNU General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU General Public License
00015  * along with this program; if not, write to the Free Software Foundation,
00016  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
00017  *
00018  * The Original Code is Copyright (C) 2001-2002 by NaN Holding BV.
00019  * All rights reserved.
00020  *
00021  * The Original Code is: all of this file.
00022  *
00023  * Contributor(s): none yet.
00024  *
00025  * ***** END GPL LICENSE BLOCK *****
00026  */
00027 
00034 #ifndef DNA_TEXTURE_TYPES_H
00035 #define DNA_TEXTURE_TYPES_H
00036 
00037 #include "DNA_defs.h"
00038 #include "DNA_ID.h"
00039 #include "DNA_image_types.h" /* ImageUser */
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif
00044 
00045 struct AnimData;
00046 struct Ipo;
00047 struct PluginTex;
00048 struct ColorBand;
00049 struct EnvMap;
00050 struct Object;
00051 struct Tex;
00052 struct Image;
00053 struct PreviewImage;
00054 struct ImBuf;
00055 struct Ocean;
00056 struct CurveMapping;
00057 
00058 typedef struct MTex {
00059 
00060     short texco, mapto, maptoneg, blendtype;
00061     struct Object *object;
00062     struct Tex *tex;
00063     char uvname[64];    /* MAX_CUSTOMDATA_LAYER_NAME */
00064     
00065     char projx, projy, projz, mapping;
00066     float ofs[3], size[3], rot;
00067     
00068     short texflag, colormodel, pmapto, pmaptoneg;
00069     short normapspace, which_output;
00070     char brush_map_mode, pad[7];
00071     float r, g, b, k;
00072     float def_var, rt;
00073     
00074     /* common */
00075     float colfac, varfac;
00076     
00077     /* material */
00078     float norfac, dispfac, warpfac;
00079     float colspecfac, mirrfac, alphafac;
00080     float difffac, specfac, emitfac, hardfac;
00081     float raymirrfac, translfac, ambfac;
00082     float colemitfac, colreflfac, coltransfac;
00083     float densfac, scatterfac, reflfac;
00084 
00085     /* particles */
00086     float timefac, lengthfac, clumpfac, dampfac;
00087     float kinkfac, roughfac, padensfac, gravityfac;
00088     float lifefac, sizefac, ivelfac, fieldfac;
00089 
00090     /* lamp */
00091     float shadowfac;
00092 
00093     /* world */
00094     float zenupfac, zendownfac, blendfac;
00095 } MTex;
00096 
00097 #ifndef DNA_USHORT_FIX
00098 #define DNA_USHORT_FIX
00099 
00104 typedef unsigned short dna_ushort_fix;
00105 #endif
00106 
00107 typedef struct PluginTex {
00108     char name[160];
00109     void *handle;
00110     
00111     char *pname;
00112     char *stnames;
00113 
00114     int stypes;
00115     int vars;
00116     void *varstr;
00117     float *result;
00118     float *cfra;
00119     
00120     float data[32];
00121 
00122     int (*doit)(void);
00123     void (*instance_init)(void *);
00124 
00125     /* should be void (*)(unsigned short)... patched */ 
00126     void (*callback)(dna_ushort_fix);
00127     
00128     int version, pad;
00129 } PluginTex;
00130 
00131 typedef struct CBData {
00132     float r, g, b, a, pos;
00133     int cur;
00134 } CBData;
00135 
00136 /* 32 = MAXCOLORBAND */
00137 /* note that this has to remain a single struct, for UserDef */
00138 typedef struct ColorBand {
00139     short flag, tot, cur, ipotype;
00140     CBData data[32];
00141     
00142 } ColorBand;
00143 
00144 typedef struct EnvMap {
00145     struct Object *object;
00146     struct Image *ima;      /* type ENV_LOAD */
00147     struct ImBuf *cube[6];      /* these images are dynamic, not part of the main struct */
00148     float imat[4][4];
00149     float obimat[3][3];
00150     short type, stype;
00151     float clipsta, clipend;
00152     float viewscale;    /* viewscale is for planar envmaps to zoom in or out */
00153     unsigned int notlay;
00154     short cuberes, depth;
00155     int ok, lastframe;
00156     short recalc, lastsize;
00157 } EnvMap;
00158 
00159 typedef struct PointDensity {
00160     short flag;
00161 
00162     short falloff_type;
00163     float falloff_softness;
00164     float radius;
00165     short source;
00166     short color_source;
00167     int totpoints;
00168     
00169     int pdpad;
00170 
00171     struct Object *object;  /* for 'Object' or 'Particle system' type - source object */
00172     int psys;               /* index+1 in ob.particlesystem, non-ID pointer not allowed */
00173     short psys_cache_space;     /* cache points in worldspace, object space, ... ? */
00174     short ob_cache_space;       /* cache points in worldspace, object space, ... ? */
00175     
00176     void *point_tree;       /* the acceleration tree containing points */
00177     float *point_data;      /* dynamically allocated extra for extra information, like particle age */
00178     
00179     float noise_size;
00180     short noise_depth;
00181     short noise_influence;
00182     short noise_basis;
00183     short pdpad3[3];
00184     float noise_fac;
00185     
00186     float speed_scale, falloff_speed_scale, pdpad2;
00187     struct ColorBand *coba; /* for time -> color */
00188     
00189     struct CurveMapping *falloff_curve; /* falloff density curve */ 
00190 } PointDensity;
00191 
00192 typedef struct VoxelData {
00193     int resol[3];
00194     int interp_type;
00195     short file_format;
00196     short flag;
00197     short extend;
00198     short smoked_type;
00199     
00200     struct Object *object; /* for rendering smoke sims */
00201     float int_multiplier;   
00202     int still_frame;
00203     char source_path[240];  /* 240 = FILE_MAX */
00204 
00205     /* temporary data */
00206     float *dataset;
00207     int cachedframe;
00208     int ok;
00209     
00210 } VoxelData;
00211 
00212 typedef struct OceanTex {
00213     struct Object *object;
00214     char oceanmod[64];
00215     
00216     int output;
00217     int pad;
00218     
00219 } OceanTex;
00220     
00221 typedef struct Tex {
00222     ID id;
00223     struct AnimData *adt;   /* animation data (must be immediately after id for utilities to use it) */ 
00224     
00225     float noisesize, turbul;
00226     float bright, contrast, saturation, rfac, gfac, bfac;
00227     float filtersize, pad2;
00228 
00229     /* newnoise: musgrave parameters */
00230     float mg_H, mg_lacunarity, mg_octaves, mg_offset, mg_gain;
00231 
00232     /* newnoise: distorted noise amount, musgrave & voronoi ouput scale */
00233     float dist_amount, ns_outscale;
00234 
00235     /* newnoise: voronoi nearest neighbour weights, minkovsky exponent, distance metric & color type */
00236     float vn_w1;
00237     float vn_w2;
00238     float vn_w3;
00239     float vn_w4;
00240     float vn_mexp;
00241     short vn_distm, vn_coltype;
00242 
00243     short noisedepth, noisetype; /* noisedepth MUST be <= 30 else we get floating point exceptions */
00244 
00245     /* newnoise: noisebasis type for clouds/marble/etc, noisebasis2 only used for distorted noise */
00246     short noisebasis, noisebasis2;
00247 
00248     short imaflag, flag;
00249     short type, stype;
00250     
00251     float cropxmin, cropymin, cropxmax, cropymax;
00252     int texfilter;
00253     int afmax;  // anisotropic filter maximum value, ewa -> max eccentricity, feline -> max probes
00254     short xrepeat, yrepeat;
00255     short extend;
00256 
00257     /* variables disabled, moved to struct iuser */
00258     short fie_ima;
00259     int len;
00260     int frames, offset, sfra;
00261     
00262     float checkerdist, nabla;
00263     float pad1;
00264     
00265     struct ImageUser iuser;
00266     
00267     struct bNodeTree *nodetree;
00268     struct Ipo *ipo  DNA_DEPRECATED;  /* old animation system, deprecated for 2.5 */
00269     struct Image *ima;
00270     struct PluginTex *plugin;
00271     struct ColorBand *coba;
00272     struct EnvMap *env;
00273     struct PreviewImage * preview;
00274     struct PointDensity *pd;
00275     struct VoxelData *vd;
00276     struct OceanTex *ot;
00277     
00278     char use_nodes;
00279     char pad[7];
00280     
00281 } Tex;
00282 
00283 /* used for mapping and texture nodes. note: rot is now in radians */
00284 
00285 typedef struct TexMapping {
00286     float loc[3], rot[3], size[3];
00287     int flag;
00288     char projx, projy, projz, mapping;
00289     int pad;
00290     
00291     float mat[4][4];
00292     float min[3], max[3];
00293     struct Object *ob;
00294 
00295 } TexMapping;
00296 
00297 typedef struct ColorMapping {
00298     struct ColorBand coba;
00299 
00300     float bright, contrast, saturation;
00301     int flag;
00302 
00303     float blend_color[3];
00304     float blend_factor;
00305     int blend_type, pad[3];
00306 } ColorMapping;
00307 
00308 /* texmap->flag */
00309 #define TEXMAP_CLIP_MIN     1
00310 #define TEXMAP_CLIP_MAX     2
00311 #define TEXMAP_UNIT_MATRIX  4
00312 
00313 /* colormap->flag */
00314 #define COLORMAP_USE_RAMP 1
00315 
00316 /* **************** TEX ********************* */
00317 
00318 /* type */
00319 #define TEX_CLOUDS      1
00320 #define TEX_WOOD        2
00321 #define TEX_MARBLE      3
00322 #define TEX_MAGIC       4
00323 #define TEX_BLEND       5
00324 #define TEX_STUCCI      6
00325 #define TEX_NOISE       7
00326 #define TEX_IMAGE       8
00327 #define TEX_PLUGIN      9
00328 #define TEX_ENVMAP      10
00329 #define TEX_MUSGRAVE    11
00330 #define TEX_VORONOI     12
00331 #define TEX_DISTNOISE   13
00332 #define TEX_POINTDENSITY    14
00333 #define TEX_VOXELDATA       15
00334 #define TEX_OCEAN       16
00335 
00336 /* musgrave stype */
00337 #define TEX_MFRACTAL        0
00338 #define TEX_RIDGEDMF        1
00339 #define TEX_HYBRIDMF        2
00340 #define TEX_FBM             3
00341 #define TEX_HTERRAIN        4
00342 
00343 /* newnoise: noisebasis 1 & 2 */
00344 #define TEX_BLENDER         0
00345 #define TEX_STDPERLIN       1
00346 #define TEX_NEWPERLIN       2
00347 #define TEX_VORONOI_F1      3
00348 #define TEX_VORONOI_F2      4
00349 #define TEX_VORONOI_F3      5
00350 #define TEX_VORONOI_F4      6
00351 #define TEX_VORONOI_F2F1    7
00352 #define TEX_VORONOI_CRACKLE     8
00353 #define TEX_CELLNOISE       14
00354 
00355 /* newnoise: Voronoi distance metrics, vn_distm */
00356 #define TEX_DISTANCE        0
00357 #define TEX_DISTANCE_SQUARED        1
00358 #define TEX_MANHATTAN       2
00359 #define TEX_CHEBYCHEV       3
00360 #define TEX_MINKOVSKY_HALF      4
00361 #define TEX_MINKOVSKY_FOUR      5
00362 #define TEX_MINKOVSKY       6
00363 
00364 /* imaflag */
00365 #define TEX_INTERPOL    1
00366 #define TEX_USEALPHA    2
00367 #define TEX_MIPMAP      4
00368 #define TEX_IMAROT      16
00369 #define TEX_CALCALPHA   32
00370 #define TEX_NORMALMAP   2048
00371 #define TEX_GAUSS_MIP   4096
00372 #define TEX_FILTER_MIN  8192
00373 #define TEX_DERIVATIVEMAP   16384
00374 
00375 /* texfilter */
00376 // TXF_BOX -> blender's old texture filtering method
00377 #define TXF_BOX         0
00378 #define TXF_EWA         1
00379 #define TXF_FELINE      2
00380 #define TXF_AREA        3
00381 
00382 /* imaflag unused, only for version check */
00383 #define TEX_FIELDS_     8
00384 #define TEX_ANIMCYCLIC_ 64
00385 #define TEX_ANIM5_      128
00386 #define TEX_ANTIALI_    256
00387 #define TEX_ANTISCALE_  512
00388 #define TEX_STD_FIELD_  1024
00389 
00390 /* flag */
00391 #define TEX_COLORBAND       1
00392 #define TEX_FLIPBLEND       2
00393 #define TEX_NEGALPHA        4
00394 #define TEX_CHECKER_ODD     8
00395 #define TEX_CHECKER_EVEN    16
00396 #define TEX_PRV_ALPHA       32
00397 #define TEX_PRV_NOR         64
00398 #define TEX_REPEAT_XMIR     128
00399 #define TEX_REPEAT_YMIR     256
00400 #define TEX_FLAG_MASK       ( TEX_COLORBAND | TEX_FLIPBLEND | TEX_NEGALPHA | TEX_CHECKER_ODD | TEX_CHECKER_EVEN | TEX_PRV_ALPHA | TEX_PRV_NOR | TEX_REPEAT_XMIR | TEX_REPEAT_YMIR ) 
00401 #define TEX_DS_EXPAND       512
00402 
00403 /* extend (starts with 1 because of backward comp.) */
00404 #define TEX_EXTEND      1
00405 #define TEX_CLIP        2
00406 #define TEX_REPEAT      3
00407 #define TEX_CLIPCUBE    4
00408 #define TEX_CHECKER     5
00409 
00410 /* noisetype */
00411 #define TEX_NOISESOFT   0
00412 #define TEX_NOISEPERL   1
00413 
00414 /* tex->noisebasis2 in texture.c - wood waveforms */
00415 #define TEX_SIN         0
00416 #define TEX_SAW         1
00417 #define TEX_TRI         2
00418 
00419 /* tex->stype in texture.c - wood types */
00420 #define TEX_BAND        0
00421 #define TEX_RING        1
00422 #define TEX_BANDNOISE   2
00423 #define TEX_RINGNOISE   3
00424 
00425 /* tex->stype in texture.c - cloud types */
00426 #define TEX_DEFAULT     0
00427 #define TEX_COLOR       1
00428 
00429 /* tex->stype in texture.c - marble types */
00430 #define TEX_SOFT        0
00431 #define TEX_SHARP       1
00432 #define TEX_SHARPER     2
00433 
00434 /* tex->stype in texture.c - blend types */
00435 #define TEX_LIN         0
00436 #define TEX_QUAD        1
00437 #define TEX_EASE        2
00438 #define TEX_DIAG        3
00439 #define TEX_SPHERE      4
00440 #define TEX_HALO        5
00441 #define TEX_RAD         6
00442 
00443 /* tex->stype in texture.c - stucci types */
00444 #define TEX_PLASTIC     0
00445 #define TEX_WALLIN      1
00446 #define TEX_WALLOUT     2
00447 
00448 /* tex->stype in texture.c - voronoi types */
00449 #define TEX_INTENSITY   0
00450 #define TEX_COL1        1
00451 #define TEX_COL2        2
00452 #define TEX_COL3        3
00453 
00454 /* mtex->normapspace */
00455 #define MTEX_NSPACE_CAMERA  0
00456 #define MTEX_NSPACE_WORLD   1
00457 #define MTEX_NSPACE_OBJECT  2
00458 #define MTEX_NSPACE_TANGENT 3
00459 
00460 /* wrap */
00461 #define MTEX_FLAT       0
00462 #define MTEX_CUBE       1
00463 #define MTEX_TUBE       2
00464 #define MTEX_SPHERE     3
00465 
00466 /* return value */
00467 #define TEX_INT     0
00468 #define TEX_RGB     1
00469 #define TEX_NOR     2
00470 
00471 /* pr_texture in material, world, lamp, */
00472 #define TEX_PR_TEXTURE  0
00473 #define TEX_PR_OTHER    1
00474 #define TEX_PR_BOTH     2
00475 
00476 /* **************** MTEX ********************* */
00477 
00478 /* proj */
00479 #define PROJ_N          0
00480 #define PROJ_X          1
00481 #define PROJ_Y          2
00482 #define PROJ_Z          3
00483 
00484 /* texflag */
00485 #define MTEX_RGBTOINT       1
00486 #define MTEX_STENCIL        2
00487 #define MTEX_NEGATIVE       4
00488 #define MTEX_ALPHAMIX       8
00489 #define MTEX_VIEWSPACE      16
00490 #define MTEX_DUPLI_MAPTO    32
00491 #define MTEX_OB_DUPLI_ORIG  64
00492 #define MTEX_COMPAT_BUMP    128
00493 #define MTEX_3TAP_BUMP      256
00494 #define MTEX_5TAP_BUMP      512
00495 #define MTEX_BUMP_OBJECTSPACE   1024
00496 #define MTEX_BUMP_TEXTURESPACE  2048
00497 /* #define MTEX_BUMP_FLIPPED    4096 */ /* UNUSED */
00498 #define MTEX_BICUBIC_BUMP       8192
00499 
00500 /* blendtype */
00501 #define MTEX_BLEND      0
00502 #define MTEX_MUL        1
00503 #define MTEX_ADD        2
00504 #define MTEX_SUB        3
00505 #define MTEX_DIV        4
00506 #define MTEX_DARK       5
00507 #define MTEX_DIFF       6
00508 #define MTEX_LIGHT      7
00509 #define MTEX_SCREEN     8
00510 #define MTEX_OVERLAY    9
00511 #define MTEX_BLEND_HUE      10
00512 #define MTEX_BLEND_SAT      11
00513 #define MTEX_BLEND_VAL      12
00514 #define MTEX_BLEND_COLOR    13
00515 /* free for use */
00516 #define MTEX_SOFT_LIGHT     15 
00517 #define MTEX_LIN_LIGHT      16
00518 
00519 /* brush_map_mode */
00520 #define MTEX_MAP_MODE_FIXED    0
00521 #define MTEX_MAP_MODE_TILED    1
00522 #define MTEX_MAP_MODE_3D       2
00523 
00524 /* **************** EnvMap ********************* */
00525 
00526 /* type */
00527 #define ENV_CUBE    0
00528 #define ENV_PLANE   1
00529 #define ENV_SPHERE  2
00530 
00531 /* stype */
00532 #define ENV_STATIC  0
00533 #define ENV_ANIM    1
00534 #define ENV_LOAD    2
00535 
00536 /* ok */
00537 #define ENV_NORMAL  1
00538 #define ENV_OSA     2
00539 
00540 /* **************** PointDensity ********************* */
00541 
00542 /* source */
00543 #define TEX_PD_PSYS         0
00544 #define TEX_PD_OBJECT       1
00545 #define TEX_PD_FILE         2
00546 
00547 /* falloff_type */
00548 #define TEX_PD_FALLOFF_STD      0
00549 #define TEX_PD_FALLOFF_SMOOTH   1
00550 #define TEX_PD_FALLOFF_SOFT     2
00551 #define TEX_PD_FALLOFF_CONSTANT 3
00552 #define TEX_PD_FALLOFF_ROOT     4
00553 #define TEX_PD_FALLOFF_PARTICLE_AGE 5
00554 #define TEX_PD_FALLOFF_PARTICLE_VEL 6
00555 
00556 /* psys_cache_space */
00557 #define TEX_PD_OBJECTLOC    0
00558 #define TEX_PD_OBJECTSPACE  1
00559 #define TEX_PD_WORLDSPACE   2
00560 
00561 /* flag */
00562 #define TEX_PD_TURBULENCE       1
00563 #define TEX_PD_FALLOFF_CURVE    2
00564 
00565 /* noise_influence */
00566 #define TEX_PD_NOISE_STATIC     0
00567 #define TEX_PD_NOISE_VEL        1
00568 #define TEX_PD_NOISE_AGE        2
00569 #define TEX_PD_NOISE_TIME       3
00570 
00571 /* color_source */
00572 #define TEX_PD_COLOR_CONSTANT   0
00573 #define TEX_PD_COLOR_PARTAGE    1
00574 #define TEX_PD_COLOR_PARTSPEED  2
00575 #define TEX_PD_COLOR_PARTVEL    3
00576 
00577 #define POINT_DATA_VEL      1
00578 #define POINT_DATA_LIFE     2
00579 
00580 /******************** Voxel Data *****************************/
00581 /* flag */
00582 #define TEX_VD_STILL            1
00583 
00584 /* interpolation */
00585 #define TEX_VD_NEARESTNEIGHBOR      0
00586 #define TEX_VD_LINEAR               1
00587 #define TEX_VD_QUADRATIC        2
00588 #define TEX_VD_TRICUBIC_CATROM  3
00589 #define TEX_VD_TRICUBIC_BSPLINE 4
00590 #define TEX_VD_TRICUBIC_SLOW    5
00591 
00592 /* file format */
00593 #define TEX_VD_BLENDERVOXEL     0
00594 #define TEX_VD_RAW_8BIT         1
00595 #define TEX_VD_RAW_16BIT        2
00596 #define TEX_VD_IMAGE_SEQUENCE   3
00597 #define TEX_VD_SMOKE            4
00598 /* for voxels which use VoxelData->source_path */
00599 #define TEX_VD_IS_SOURCE_PATH(_format) (ELEM3(_format, TEX_VD_BLENDERVOXEL, TEX_VD_RAW_8BIT, TEX_VD_RAW_16BIT))
00600 
00601 /* smoke data types */
00602 #define TEX_VD_SMOKEDENSITY     0
00603 #define TEX_VD_SMOKEHEAT        1
00604 #define TEX_VD_SMOKEVEL         2
00605 
00606 /******************** Ocean *****************************/
00607 /* output */
00608 #define TEX_OCN_DISPLACEMENT    1
00609 #define TEX_OCN_FOAM            2
00610 #define TEX_OCN_JPLUS           3
00611 #define TEX_OCN_EMINUS          4   
00612 #define TEX_OCN_EPLUS           5
00613 
00614 /* flag */
00615 #define TEX_OCN_GENERATE_NORMALS    1   
00616 #define TEX_OCN_XZ              2   
00617     
00618 #ifdef __cplusplus
00619 }
00620 #endif
00621 
00622 #endif
00623