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