Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions | Variables

dynamicpaint.c File Reference

#include "MEM_guardedalloc.h"
#include <math.h>
#include <stdio.h>
#include "BLI_blenlib.h"
#include "BLI_math.h"
#include "BLI_kdtree.h"
#include "BLI_threads.h"
#include "BLI_utildefines.h"
#include "DNA_anim_types.h"
#include "DNA_constraint_types.h"
#include "DNA_dynamicpaint_types.h"
#include "DNA_group_types.h"
#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_modifier_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "DNA_space_types.h"
#include "DNA_texture_types.h"
#include "BKE_animsys.h"
#include "BKE_bvhutils.h"
#include "BKE_blender.h"
#include "BKE_cdderivedmesh.h"
#include "BKE_constraint.h"
#include "BKE_context.h"
#include "BKE_customdata.h"
#include "BKE_colortools.h"
#include "BKE_deform.h"
#include "BKE_depsgraph.h"
#include "BKE_DerivedMesh.h"
#include "BKE_dynamicpaint.h"
#include "BKE_effect.h"
#include "BKE_global.h"
#include "BKE_image.h"
#include "BKE_main.h"
#include "BKE_material.h"
#include "BKE_modifier.h"
#include "BKE_object.h"
#include "BKE_particle.h"
#include "BKE_pointcache.h"
#include "BKE_scene.h"
#include "BKE_texture.h"
#include "RNA_access.h"
#include "RNA_define.h"
#include "RNA_enum_types.h"
#include "IMB_imbuf_types.h"
#include "IMB_imbuf.h"
#include "RE_render_ext.h"
#include "RE_shader_ext.h"

Go to the source code of this file.

Classes

struct  Bounds2D
struct  Bounds3D
struct  VolumeGrid
struct  Vec3f
struct  BakeNeighPoint
struct  PaintBakeNormal
struct  PaintBakeData
struct  PaintUVPoint
struct  ImgSeqFormatData
struct  EffVelPoint
struct  PaintAdjData
struct  BrushMaterials

Defines

#define UPDATE_PARENTS   (1<<0)
#define UPDATE_MESH   (1<<1)
#define UPDATE_EVERYTHING   (UPDATE_PARENTS|UPDATE_MESH)
#define BRUSH_USES_VELOCITY   (1<<0)
#define HIT_VOLUME   1
#define HIT_PROXIMITY   2
#define EFF_MOVEMENT_PER_FRAME   0.05f
#define WAVE_TIME_FAC   (1.0f/24.f)
#define CANVAS_REL_SIZE   5.0f
#define MIN_WETNESS   0.001f
#define MAX_WETNESS   5.0f
#define VALUE_DISSOLVE(VALUE, TIME, SCALE, LOG)   (VALUE) = (LOG) ? (VALUE) * (pow(MIN_WETNESS,1.0f/(1.2f*((float)(TIME))/(SCALE)))) : (VALUE) - 1.0f/(TIME)*(SCALE)
#define ADJ_ON_MESH_EDGE   (1<<0)

Typedefs

typedef struct Bounds2D Bounds2D
typedef struct Bounds3D Bounds3D
typedef struct VolumeGrid VolumeGrid
typedef struct Vec3f Vec3f
typedef struct BakeNeighPoint BakeNeighPoint
typedef struct PaintBakeNormal PaintBakeNormal
typedef struct PaintBakeData PaintBakeData
typedef struct PaintUVPoint PaintUVPoint
typedef struct ImgSeqFormatData ImgSeqFormatData
typedef struct EffVelPoint EffVelPoint
typedef struct PaintAdjData PaintAdjData
typedef struct BrushMaterials BrushMaterials

Functions

static int setError (DynamicPaintCanvasSettings *canvas, const char *string)
static int dynamicPaint_surfaceNumOfPoints (DynamicPaintSurface *surface)
int dynamicPaint_surfaceHasColorPreview (DynamicPaintSurface *surface)
struct DynamicPaintSurfaceget_activeSurface (DynamicPaintCanvasSettings *canvas)
void dynamicPaint_resetPreview (DynamicPaintCanvasSettings *canvas)
static void dynamicPaint_setPreview (DynamicPaintSurface *t_surface)
int dynamicPaint_outputLayerExists (struct DynamicPaintSurface *surface, Object *ob, int output)
static int surface_duplicateOutputExists (void *arg, const char *name)
static void surface_setUniqueOutputName (DynamicPaintSurface *surface, char *basename, int output)
static int surface_duplicateNameExists (void *arg, const char *name)
void dynamicPaintSurface_setUniqueName (DynamicPaintSurface *surface, const char *basename)
void dynamicPaintSurface_updateType (struct DynamicPaintSurface *surface)
static int surface_totalSamples (DynamicPaintSurface *surface)
static void blendColors (float t_color[3], float t_alpha, float s_color[3], float s_alpha, float result[4])
static float mixColors (float a_color[3], float a_weight, float b_color[3], float b_weight, float ratio)
static void object_cacheIgnoreClear (Object *ob, int state)
static void subframe_updateObject (Scene *scene, Object *ob, int flags, float frame)
static void scene_setSubframe (Scene *scene, float subframe)
static int surface_getBrushFlags (DynamicPaintSurface *surface, Scene *scene)
static int brush_usesMaterial (DynamicPaintBrushSettings *brush, Scene *scene)
static int boundsIntersect (Bounds3D *b1, Bounds3D *b2)
static int boundsIntersectDist (Bounds3D *b1, Bounds3D *b2, float dist)
static int boundIntersectPoint (Bounds3D *b, float point[3], float radius)
static void boundInsert (Bounds3D *b, float point[3])
float getSurfaceDimension (PaintSurfaceData *sData)
static void freeGrid (PaintSurfaceData *data)
static void surfaceGenerateGrid (struct DynamicPaintSurface *surface)
void dynamicPaint_freeBrush (struct DynamicPaintModifierData *pmd)
static void dynamicPaint_freeAdjData (PaintSurfaceData *data)
static void free_bakeData (PaintSurfaceData *data)
void surface_freeUnusedData (DynamicPaintSurface *surface)
void dynamicPaint_freeSurfaceData (DynamicPaintSurface *surface)
void dynamicPaint_freeSurface (DynamicPaintSurface *surface)
void dynamicPaint_freeCanvas (DynamicPaintModifierData *pmd)
void dynamicPaint_Modifier_free (struct DynamicPaintModifierData *pmd)
struct DynamicPaintSurfacedynamicPaint_createNewSurface (DynamicPaintCanvasSettings *canvas, Scene *scene)
int dynamicPaint_createType (struct DynamicPaintModifierData *pmd, int type, struct Scene *scene)
void dynamicPaint_Modifier_copy (struct DynamicPaintModifierData *pmd, struct DynamicPaintModifierData *tpmd)
static void dynamicPaint_allocateSurfaceType (DynamicPaintSurface *surface)
static int surface_usesAdjDistance (DynamicPaintSurface *surface)
static int surface_usesAdjData (DynamicPaintSurface *surface)
static void dynamicPaint_initAdjacencyData (DynamicPaintSurface *surface, int force_init)
void dynamicPaint_setInitialColor (DynamicPaintSurface *surface)
void dynamicPaint_clearSurface (DynamicPaintSurface *surface)
int dynamicPaint_resetSurface (DynamicPaintSurface *surface)
static int dynamicPaint_checkSurfaceData (DynamicPaintSurface *surface)
static void dynamicPaint_applySurfaceDisplace (DynamicPaintSurface *surface, DerivedMesh *result)
static struct DerivedMeshdynamicPaint_Modifier_apply (DynamicPaintModifierData *pmd, Object *ob, DerivedMesh *dm)
void dynamicPaint_cacheUpdateFrames (DynamicPaintSurface *surface)
void canvas_copyDerivedMesh (DynamicPaintCanvasSettings *canvas, DerivedMesh *dm)
static void dynamicPaint_frameUpdate (DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm)
struct DerivedMeshdynamicPaint_Modifier_do (DynamicPaintModifierData *pmd, Scene *scene, Object *ob, DerivedMesh *dm)
static int dynamicPaint_findNeighbourPixel (PaintUVPoint *tempPoints, DerivedMesh *dm, const char *uvname, int w, int h, int px, int py, int n_index)
int dynamicPaint_createUVSurface (DynamicPaintSurface *surface)
void dynamicPaint_outputSurfaceImage (DynamicPaintSurface *surface, char *filename, short output_layer)
static void dynamicPaint_updateBrushMaterials (Object *brushOb, Material *ui_mat, Scene *scene, BrushMaterials *bMats)
static void dynamicPaint_freeBrushMaterials (BrushMaterials *bMats)
void dynamicPaint_doMaterialTex (BrushMaterials *bMats, float color[3], float *alpha, Object *brushOb, const float volume_co[3], const float surface_co[3], int faceIndex, short isQuad, DerivedMesh *orcoDm)
static void mesh_faces_spherecast_dp (void *userdata, int index, const BVHTreeRay *ray, BVHTreeRayHit *hit)
static void mesh_faces_nearest_point_dp (void *userdata, int index, const float *co, BVHTreeNearest *nearest)
static void dynamicPaint_mixPaintColors (DynamicPaintSurface *surface, int index, int paintFlags, float *paintColor, float *paintAlpha, float *paintWetness, float *timescale)
static void dynamicPaint_mixWaveHeight (PaintWavePoint *wPoint, DynamicPaintBrushSettings *brush, float isect_height)
static void dynamicPaint_updatePointData (DynamicPaintSurface *surface, unsigned int index, DynamicPaintBrushSettings *brush, float paint[3], float influence, float depth, float vel_factor, float timescale)
static int meshBrush_boundsIntersect (Bounds3D *b1, Bounds3D *b2, DynamicPaintBrushSettings *brush, float brush_radius)
static void dynamicPaint_brushMeshCalculateVelocity (Scene *scene, Object *ob, DynamicPaintBrushSettings *brush, Vec3f **brushVel, float timescale)
static void dynamicPaint_brushObjectCalculateVelocity (Scene *scene, Object *ob, Vec3f *brushVel, float timescale)
static int dynamicPaint_paintMesh (DynamicPaintSurface *surface, DynamicPaintBrushSettings *brush, Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale)
static int dynamicPaint_paintParticles (DynamicPaintSurface *surface, ParticleSystem *psys, DynamicPaintBrushSettings *brush, float timescale)
static int dynamicPaint_paintSinglePoint (DynamicPaintSurface *surface, float *pointCoord, DynamicPaintBrushSettings *brush, Object *brushOb, BrushMaterials *bMats, Scene *scene, float timescale)
static void dynamicPaint_prepareNeighbourData (DynamicPaintSurface *surface, int force_init)
void surface_determineForceTargetPoints (PaintSurfaceData *sData, int index, float force[3], float closest_d[2], int closest_id[2])
static void dynamicPaint_doSmudge (DynamicPaintSurface *surface, DynamicPaintBrushSettings *brush, float timescale)
static int dynamicPaint_prepareEffectStep (DynamicPaintSurface *surface, Scene *scene, Object *ob, float **force, float timescale)
static void dynamicPaint_doEffectStep (DynamicPaintSurface *surface, float *force, PaintPoint *prevPoint, float timescale, float steps)
void dynamicPaint_doWaveStep (DynamicPaintSurface *surface, float timescale)
static void dynamicPaint_surfacePreStep (DynamicPaintSurface *surface, float timescale)
static int dynamicPaint_surfaceHasMoved (DynamicPaintSurface *surface, Object *ob)
static int surface_needsVelocityData (DynamicPaintSurface *surface, Scene *scene)
static int surface_needsAccelerationData (DynamicPaintSurface *surface)
static int dynamicPaint_generateBakeData (DynamicPaintSurface *surface, Scene *scene, Object *ob)
static int dynamicPaint_doStep (Scene *scene, Object *ob, DynamicPaintSurface *surface, float timescale, float subframe)
int dynamicPaint_calculateFrame (DynamicPaintSurface *surface, Scene *scene, Object *cObject, int frame)

Variables

static float gaussianFactors [5]
static float gaussianTotal = 3.309425f
static int neighX [8] = {1,1,0,-1,-1,-1, 0, 1}
static int neighY [8] = {0,1,1, 1, 0,-1,-1,-1}

Define Documentation

#define ADJ_ON_MESH_EDGE   (1<<0)

Definition at line 198 of file dynamicpaint.c.

Referenced by dynamicPaint_doWaveStep(), and dynamicPaint_initAdjacencyData().

#define BRUSH_USES_VELOCITY   (1<<0)

Definition at line 96 of file dynamicpaint.c.

Referenced by surface_getBrushFlags(), and surface_needsVelocityData().

#define CANVAS_REL_SIZE   5.0f
#define EFF_MOVEMENT_PER_FRAME   0.05f

Definition at line 101 of file dynamicpaint.c.

Referenced by dynamicPaint_doEffectStep(), and dynamicPaint_prepareEffectStep().

#define HIT_PROXIMITY   2

Definition at line 99 of file dynamicpaint.c.

Referenced by dynamicPaint_paintMesh().

#define HIT_VOLUME   1

Definition at line 98 of file dynamicpaint.c.

Referenced by dynamicPaint_paintMesh().

#define MAX_WETNESS   5.0f

Definition at line 107 of file dynamicpaint.c.

Referenced by dynamicPaint_doEffectStep().

#define MIN_WETNESS   0.001f
#define UPDATE_EVERYTHING   (UPDATE_PARENTS|UPDATE_MESH)

Definition at line 94 of file dynamicpaint.c.

Referenced by dynamicPaint_brushMeshCalculateVelocity(), and dynamicPaint_doStep().

#define UPDATE_MESH   (1<<1)

Definition at line 93 of file dynamicpaint.c.

Referenced by subframe_updateObject().

#define UPDATE_PARENTS   (1<<0)
#define VALUE_DISSOLVE (   VALUE,
  TIME,
  SCALE,
  LOG 
)    (VALUE) = (LOG) ? (VALUE) * (pow(MIN_WETNESS,1.0f/(1.2f*((float)(TIME))/(SCALE)))) : (VALUE) - 1.0f/(TIME)*(SCALE)

Definition at line 109 of file dynamicpaint.c.

Referenced by dynamicPaint_surfacePreStep().

#define WAVE_TIME_FAC   (1.0f/24.f)

Definition at line 103 of file dynamicpaint.c.

Referenced by dynamicPaint_doWaveStep().


Typedef Documentation

typedef struct Bounds2D Bounds2D
typedef struct Bounds3D Bounds3D
typedef struct EffVelPoint EffVelPoint
typedef struct PaintAdjData PaintAdjData
typedef struct PaintBakeData PaintBakeData
typedef struct PaintUVPoint PaintUVPoint
typedef struct Vec3f Vec3f
typedef struct VolumeGrid VolumeGrid

Function Documentation

static void blendColors ( float  t_color[3],
float  t_alpha,
float  s_color[3],
float  s_alpha,
float  result[4] 
) [static]
static void boundInsert ( Bounds3D b,
float  point[3] 
) [static]
static int boundIntersectPoint ( Bounds3D b,
float  point[3],
float  radius 
) [static]

Definition at line 611 of file dynamicpaint.c.

References i, Bounds3D::max, Bounds3D::min, and Bounds3D::valid.

Referenced by dynamicPaint_paintParticles().

static int boundsIntersect ( Bounds3D b1,
Bounds3D b2 
) [static]

Definition at line 591 of file dynamicpaint.c.

References i, Bounds3D::max, Bounds3D::min, and Bounds3D::valid.

Referenced by meshBrush_boundsIntersect().

static int boundsIntersectDist ( Bounds3D b1,
Bounds3D b2,
float  dist 
) [static]
static int brush_usesMaterial ( DynamicPaintBrushSettings brush,
Scene scene 
) [static]
void canvas_copyDerivedMesh ( DynamicPaintCanvasSettings canvas,
DerivedMesh dm 
)
static void dynamicPaint_allocateSurfaceType ( DynamicPaintSurface surface) [static]
static void dynamicPaint_applySurfaceDisplace ( DynamicPaintSurface surface,
DerivedMesh result 
) [static]
static void dynamicPaint_brushMeshCalculateVelocity ( Scene scene,
Object ob,
DynamicPaintBrushSettings brush,
Vec3f **  brushVel,
float  timescale 
) [static]
static void dynamicPaint_brushObjectCalculateVelocity ( Scene scene,
Object ob,
Vec3f brushVel,
float  timescale 
) [static]
void dynamicPaint_cacheUpdateFrames ( DynamicPaintSurface surface)
int dynamicPaint_calculateFrame ( DynamicPaintSurface surface,
Scene scene,
Object cObject,
int  frame 
)
static int dynamicPaint_checkSurfaceData ( DynamicPaintSurface surface) [static]
void dynamicPaint_clearSurface ( DynamicPaintSurface surface)
struct DynamicPaintSurface* dynamicPaint_createNewSurface ( DynamicPaintCanvasSettings canvas,
Scene scene 
) [read]

Definition at line 969 of file dynamicpaint.c.

References BKE_add_effector_weights(), BKE_ptcache_add(), BLI_addtail(), DynamicPaintSurface::canvas, DynamicPaintSurface::color_dry_threshold, DynamicPaintSurface::color_spread_speed, DynamicPaintSurface::depth_clamp, DynamicPaintSurface::disp_factor, DynamicPaintSurface::disp_type, DynamicPaintSurface::diss_speed, DynamicPaintSurface::dry_speed, dynamicPaintSurface_setUniqueName(), dynamicPaintSurface_updateType(), DynamicPaintSurface::effect, DynamicPaintSurface::effect_ui, DynamicPaintSurface::effector_weights, RenderData::efra, DynamicPaintSurface::end_frame, PointCache::flag, DynamicPaintSurface::flags, DynamicPaintSurface::format, DynamicPaintSurface::image_fileformat, DynamicPaintSurface::image_output_path, DynamicPaintSurface::image_resolution, DynamicPaintSurface::influence_scale, DynamicPaintSurface::init_color, MEM_callocN(), MOD_DPAINT_ACTIVE, MOD_DPAINT_ANTIALIAS, MOD_DPAINT_DISP_DISPLACE, MOD_DPAINT_DISSOLVE_LOG, MOD_DPAINT_DRY_LOG, MOD_DPAINT_IMGFORMAT_PNG, MOD_DPAINT_MULALPHA, MOD_DPAINT_OUT1, MOD_DPAINT_PREVIEW, MOD_DPAINT_SURFACE_F_VERTEX, MOD_DPAINT_SURFACE_T_PAINT, MOD_DPAINT_USE_DRYING, modifier_path_init(), NULL, DynamicPaintSurface::pointcache, PTCACHE_DISK_CACHE, DynamicPaintSurface::ptcaches, Scene::r, DynamicPaintSurface::radius_scale, RenderData::sfra, DynamicPaintSurface::shrink_speed, DynamicPaintSurface::spread_speed, DynamicPaintSurface::start_frame, PointCache::step, DynamicPaintSurface::substeps, DynamicPaintCanvasSettings::surfaces, DynamicPaintSurface::type, DynamicPaintSurface::wave_damping, DynamicPaintSurface::wave_speed, DynamicPaintSurface::wave_spring, and DynamicPaintSurface::wave_timescale.

Referenced by dynamicPaint_createType(), and surface_slot_add_exec().

int dynamicPaint_createType ( struct DynamicPaintModifierData pmd,
int  type,
struct Scene scene 
)
int dynamicPaint_createUVSurface ( DynamicPaintSurface surface)
static void dynamicPaint_doEffectStep ( DynamicPaintSurface surface,
float *  force,
PaintPoint prevPoint,
float  timescale,
float  steps 
) [static]
void dynamicPaint_doMaterialTex ( BrushMaterials bMats,
float  color[3],
float *  alpha,
Object brushOb,
const float  volume_co[3],
const float  surface_co[3],
int  faceIndex,
short  isQuad,
DerivedMesh orcoDm 
)
static void dynamicPaint_doSmudge ( DynamicPaintSurface surface,
DynamicPaintBrushSettings brush,
float  timescale 
) [static]
static int dynamicPaint_doStep ( Scene scene,
Object ob,
DynamicPaintSurface surface,
float  timescale,
float  subframe 
) [static]

Definition at line 4778 of file dynamicpaint.c.

References PaintSurfaceData::adj_data, ParticleSettings::adt, ADT_RECALC_ANIM, Scene::base, PaintSurfaceData::bData, BKE_animsys_evaluate_animdata(), BKE_curframe(), PaintBakeData::bNeighs, DynamicPaintModifierData::brush, DynamicPaintSurface::brush_group, brush_usesMaterial(), PaintBakeData::brush_velocity, DynamicPaintSurface::canvas, RenderData::cfra, DynamicPaintBrushSettings::collision, DynamicPaintSurface::data, dynamicPaint_doEffectStep(), dynamicPaint_doSmudge(), dynamicPaint_doWaveStep(), dynamicPaint_freeBrushMaterials(), dynamicPaint_initAdjacencyData(), dynamicPaint_paintMesh(), dynamicPaint_paintParticles(), dynamicPaint_paintSinglePoint(), dynamicPaint_prepareEffectStep(), dynamicPaint_prepareNeighbourData(), dynamicPaint_surfacePreStep(), dynamicPaint_updateBrushMaterials(), DynamicPaintSurface::effect, eModifierMode_Realtime, eModifierMode_Render, eModifierType_DynamicPaint, ListBase::first, DynamicPaintBrushSettings::flags, Group::gobject, ParticleSettings::id, Object::loc, DynamicPaintBrushSettings::mat, MEM_callocN(), MEM_freeN(), MEM_mallocN(), MOD_DPAINT_COL_POINT, MOD_DPAINT_COL_PSYS, MOD_DPAINT_DO_SMUDGE, MOD_DPAINT_SURFACE_T_PAINT, MOD_DPAINT_SURFACE_T_WAVE, ModifierData::mode, modifiers_findByType(), GroupObject::next, Base::next, NULL, GroupObject::ob, Base::object, ParticleSystem::part, PART_EMITTER, DynamicPaintBrushSettings::psys, psys_check_enabled(), Scene::r, scene_setSubframe(), setError(), RenderData::subframe, subframe_updateObject(), PaintSurfaceData::total_points, ParticleSettings::type, DynamicPaintSurface::type, and UPDATE_EVERYTHING.

Referenced by dynamicPaint_calculateFrame().

void dynamicPaint_doWaveStep ( DynamicPaintSurface surface,
float  timescale 
)
static int dynamicPaint_findNeighbourPixel ( PaintUVPoint tempPoints,
DerivedMesh dm,
const char *  uvname,
int  w,
int  h,
int  px,
int  py,
int  n_index 
) [static]
static void dynamicPaint_frameUpdate ( DynamicPaintModifierData pmd,
Scene scene,
Object ob,
DerivedMesh dm 
) [static]
static void dynamicPaint_freeAdjData ( PaintSurfaceData data) [static]
void dynamicPaint_freeBrush ( struct DynamicPaintModifierData pmd)
static void dynamicPaint_freeBrushMaterials ( BrushMaterials bMats) [static]
void dynamicPaint_freeCanvas ( DynamicPaintModifierData pmd)
void dynamicPaint_freeSurface ( DynamicPaintSurface surface)
void dynamicPaint_freeSurfaceData ( DynamicPaintSurface surface)
static int dynamicPaint_generateBakeData ( DynamicPaintSurface surface,
Scene scene,
Object ob 
) [static]

Definition at line 4575 of file dynamicpaint.c.

References PaintSurfaceData::adj_data, ImgSeqFormatData::barycentricWeights, PaintSurfaceData::bData, PaintBakeData::bNormal, boundInsert(), DynamicPaintSurface::canvas, PaintBakeData::clear, co, copy_m4_m4(), copy_v3_v3(), DynamicPaintSurface::data, DynamicPaintCanvasSettings::dm, dynamicPaint_prepareNeighbourData(), dynamicPaint_surfaceHasMoved(), DynamicPaintSurface::flags, DynamicPaintSurface::format, PaintSurfaceData::format_data, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, interp_v3_v3v3v3(), PaintBakeNormal::invNorm, len_v3(), madd_v3_v3fl(), MEM_callocN(), MEM_freeN(), MEM_mallocN(), PaintBakeData::mesh_bounds, MOD_DPAINT_ANTIALIAS, MOD_DPAINT_SURFACE_F_IMAGESEQ, MOD_DPAINT_SURFACE_F_VERTEX, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_WAVE, mul_m4_v3(), mul_mat3_m4_v3(), mul_v3_fl(), mul_v3_v3(), PaintAdjData::n_index, PaintAdjData::n_num, PaintAdjData::n_target, negate_v3(), MVert::no, PaintBakeNormal::normal_scale, normal_short_to_float_v3(), normalize_v3(), Object::obmat, PaintBakeData::prev_obmat, PaintBakeData::prev_velocity, PaintBakeData::prev_verts, PaintBakeData::realCoord, PaintBakeData::s_num, PaintBakeData::s_pos, setError(), Object::size, sub_v3_v3v3(), surface_needsAccelerationData(), surface_needsVelocityData(), surface_totalSamples(), surfaceGenerateGrid(), PaintSurfaceData::total_points, DynamicPaintSurface::type, ImgSeqFormatData::uv_p, Vec3f::v, Bounds3D::valid, and PaintBakeData::velocity.

Referenced by dynamicPaint_calculateFrame().

static void dynamicPaint_initAdjacencyData ( DynamicPaintSurface surface,
int  force_init 
) [static]
static void dynamicPaint_mixPaintColors ( DynamicPaintSurface surface,
int  index,
int  paintFlags,
float *  paintColor,
float *  paintAlpha,
float *  paintWetness,
float *  timescale 
) [static]
static void dynamicPaint_mixWaveHeight ( PaintWavePoint wPoint,
DynamicPaintBrushSettings brush,
float  isect_height 
) [static]
static struct DerivedMesh* dynamicPaint_Modifier_apply ( DynamicPaintModifierData pmd,
Object ob,
DerivedMesh dm 
) [static, read]

Definition at line 1566 of file dynamicpaint.c.

References MCol::a, Material::b, MCol::b, blendColors(), DynamicPaintModifierData::brush, DynamicPaintModifierData::canvas, CD_CALLOC, CD_MCOL, CD_MDEFORMVERT, CD_WEIGHT_MCOL, CDDM_calc_normals(), CDDM_copy(), co, MakeCursor::color, CustomData_add_layer(), CustomData_add_layer_named(), CustomData_get_layer_named(), DynamicPaintSurface::data, defgroup_name_index(), defvert_find_index(), defvert_verify_index(), DynamicPaintBrushSettings::dm, dynamicPaint_applySurfaceDisplace(), dynamicPaint_outputLayerExists(), DerivedMesh::faceData, ListBase::first, DynamicPaintCanvasSettings::flags, DynamicPaintSurface::flags, DynamicPaintSurface::format, FTOCHAR, Material::g, MCol::g, DerivedMesh::getFaceArray, DerivedMesh::getFaceDataArray, DerivedMesh::getNumFaces, DerivedMesh::getVertArray, DerivedMesh::getVertDataArray, give_current_material(), i, if(), interp_v3_v3v3(), madd_v3_v3fl(), MEM_callocN(), MEM_freeN(), MOD_DPAINT_ACTIVE, MOD_DPAINT_BAKING, MOD_DPAINT_PREVIEW, MOD_DPAINT_PREVIEW_READY, MOD_DPAINT_SURFACE_F_IMAGESEQ, MOD_DPAINT_SURFACE_F_VERTEX, MOD_DPAINT_SURFACE_PREV_PAINT, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_PAINT, MOD_DPAINT_SURFACE_T_WAVE, MOD_DPAINT_SURFACE_T_WEIGHT, DynamicPaintSurface::next, normal_short_to_float_v3(), NULL, DynamicPaintSurface::output_name, DynamicPaintSurface::output_name2, DynamicPaintSurface::preview_id, MCol::r, Material::r, DerivedMesh::release, DynamicPaintCanvasSettings::surfaces, PaintSurfaceData::total_points, DynamicPaintSurface::type, PaintSurfaceData::type_data, MFace::v2, MFace::v4, DerivedMesh::vertData, MDeformWeight::weight, and weight_to_rgb().

Referenced by dynamicPaint_Modifier_do().

void dynamicPaint_Modifier_copy ( struct DynamicPaintModifierData pmd,
struct DynamicPaintModifierData tpmd 
)
struct DerivedMesh* dynamicPaint_Modifier_do ( DynamicPaintModifierData pmd,
Scene scene,
Object ob,
DerivedMesh dm 
) [read]

Definition at line 1891 of file dynamicpaint.c.

References dynamicPaint_frameUpdate(), and dynamicPaint_Modifier_apply().

Referenced by applyModifier().

void dynamicPaint_Modifier_free ( struct DynamicPaintModifierData pmd)

Definition at line 953 of file dynamicpaint.c.

References dynamicPaint_freeBrush(), and dynamicPaint_freeCanvas().

Referenced by freeData().

int dynamicPaint_outputLayerExists ( struct DynamicPaintSurface surface,
Object ob,
int  output 
)
void dynamicPaint_outputSurfaceImage ( DynamicPaintSurface surface,
char *  filename,
short  output_layer 
)
static int dynamicPaint_paintMesh ( DynamicPaintSurface surface,
DynamicPaintBrushSettings brush,
Object brushOb,
BrushMaterials bMats,
Scene scene,
float  timescale 
) [static]

Definition at line 3135 of file dynamicpaint.c.

References add_v3_fl(), add_v3_v3(), DynamicPaintBrushSettings::b, PaintSurfaceData::bData, BLI_bvhtree_find_nearest(), BLI_bvhtree_ray_cast(), PaintBakeData::bNormal, boundInsert(), VolumeGrid::bounds, brush_usesMaterial(), PaintBakeData::brush_velocity, bvhtree_from_mesh_faces(), CDDM_copy(), CLAMP(), MVert::co, co, BVHTreeNearest::co, DynamicPaintBrushSettings::collision, copy_v3_v3(), DynamicPaintSurface::data, VolumeGrid::dim, BVHTreeNearest::dist, BVHTreeRayHit::dist, DynamicPaintBrushSettings::dm, do_colorband(), dot(), dynamicPaint_brushMeshCalculateVelocity(), dynamicPaint_doMaterialTex(), dynamicPaint_updatePointData(), DynamicPaintBrushSettings::flags, DynamicPaintSurface::format, free_bvhtree_from_mesh(), DynamicPaintBrushSettings::g, gaussianFactors, gaussianTotal, DerivedMesh::getFaceArray, DerivedMesh::getNumVerts, DerivedMesh::getVertArray, PaintBakeData::grid, VolumeGrid::grid_bounds, HIT_PROXIMITY, HIT_VOLUME, BVHTreeRayHit::index, BVHTreeNearest::index, interp_v3_v3v3v3(), interp_weights_face_v3(), PaintBakeNormal::invNorm, len_v3(), madd_v3_v3v3fl(), MEM_freeN(), mesh_faces_nearest_point_dp(), mesh_faces_spherecast_dp(), meshBrush_boundsIntersect(), MIN3, MOD_DPAINT_COL_DIST, MOD_DPAINT_COL_VOLDIST, MOD_DPAINT_COL_VOLUME, MOD_DPAINT_DO_SMUDGE, MOD_DPAINT_INVERSE_PROX, MOD_DPAINT_NEGATE_VOLUME, MOD_DPAINT_PRFALL_CONSTANT, MOD_DPAINT_PRFALL_RAMP, MOD_DPAINT_PROX_PROJECT, MOD_DPAINT_RAMP_ALPHA, MOD_DPAINT_RAY_BRUSH_AVG, MOD_DPAINT_RAY_CANVAS, MOD_DPAINT_SURFACE_F_IMAGESEQ, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_PAINT, MOD_DPAINT_SURFACE_T_WAVE, MOD_DPAINT_USES_VELOCITY, mul_m4_v3(), mul_mat3_m4_v3(), mul_v3_fl(), negate_v3(), BVHTreeNearest::no, BVHTreeRayHit::no, PaintBakeNormal::normal_scale, normal_short_to_float_v3(), normal_tri_v3(), normalize_v3(), NULL, Object::obmat, DynamicPaintBrushSettings::paint_distance, DynamicPaintBrushSettings::paint_ramp, DynamicPaintBrushSettings::proximity_falloff, DynamicPaintBrushSettings::r, DynamicPaintSurface::radius_scale, DynamicPaintBrushSettings::ray_dir, PaintBakeData::realCoord, DerivedMesh::release, VolumeGrid::s_num, PaintBakeData::s_num, VolumeGrid::s_pos, PaintBakeData::s_pos, sqrtf, sub_v3_v3v3(), VolumeGrid::t_index, BVHTreeFromMesh::tree, DynamicPaintSurface::type, Vec3f::v, MFace::v1, MFace::v2, MFace::v3, MFace::v4, and PaintBakeData::velocity.

Referenced by dynamicPaint_doStep().

static int dynamicPaint_paintParticles ( DynamicPaintSurface surface,
ParticleSystem psys,
DynamicPaintBrushSettings brush,
float  timescale 
) [static]

Definition at line 3532 of file dynamicpaint.c.

References ParticleData::alive, PaintSurfaceData::bData, BLI_begin_threaded_malloc(), BLI_end_threaded_malloc(), BLI_kdtree_balance(), BLI_kdtree_find_nearest(), BLI_kdtree_free(), BLI_kdtree_insert(), BLI_kdtree_new(), BLI_kdtree_range_search(), PaintBakeData::bNormal, boundInsert(), boundIntersectPoint(), VolumeGrid::bounds, boundsIntersectDist(), PaintBakeData::brush_velocity, ParticleKey::co, copy_v3_v3(), DynamicPaintSurface::data, VolumeGrid::dim, KDTreeNearest::dist, dynamicPaint_updatePointData(), ParticleSettings::flag, ParticleData::flag, DynamicPaintBrushSettings::flags, PaintBakeData::grid, VolumeGrid::grid_bounds, if(), KDTreeNearest::index, isnan(), len_v3(), MEM_freeN(), MOD_DPAINT_DO_SMUDGE, MOD_DPAINT_PART_RAD, MOD_DPAINT_SURFACE_T_DISPLACE, MOD_DPAINT_SURFACE_T_PAINT, MOD_DPAINT_SURFACE_T_WAVE, MOD_DPAINT_USES_VELOCITY, mul_v3_fl(), mul_v3_v3fl(), PaintBakeNormal::normal_scale, NULL, p, PARS_DEAD, PARS_NO_DISP, PARS_UNBORN, PARS_UNEXIST, ParticleSystem::part, PART_DIED, PART_UNBORN, DynamicPaintBrushSettings::particle_radius, DynamicPaintBrushSettings::particle_smooth, ParticleSystem::particles, DynamicPaintBrushSettings::r, DynamicPaintSurface::radius_scale, ParticleSettings::randsize, PaintBakeData::realCoord, VolumeGrid::s_num, VolumeGrid::s_pos, PaintBakeData::s_pos, ParticleData::size, ParticleSettings::size, smooth(), sqrtf, ParticleData::state, str, sub_v3_v3(), VolumeGrid::t_index, ParticleSettings::timetweak, ParticleSystem::totpart, DynamicPaintSurface::type, Vec3f::v, ParticleKey::vel, and PaintBakeData::velocity.

Referenced by dynamicPaint_doStep().

static int dynamicPaint_paintSinglePoint ( DynamicPaintSurface surface,
float *  pointCoord,
DynamicPaintBrushSettings brush,
Object brushOb,
BrushMaterials bMats,
Scene scene,
float  timescale 
) [static]
static int dynamicPaint_prepareEffectStep ( DynamicPaintSurface surface,
Scene scene,
Object ob,
float **  force,
float  timescale 
) [static]
static void dynamicPaint_prepareNeighbourData ( DynamicPaintSurface surface,
int  force_init 
) [static]
void dynamicPaint_resetPreview ( DynamicPaintCanvasSettings canvas)
int dynamicPaint_resetSurface ( DynamicPaintSurface surface)
void dynamicPaint_setInitialColor ( DynamicPaintSurface surface)
static void dynamicPaint_setPreview ( DynamicPaintSurface t_surface) [static]
int dynamicPaint_surfaceHasColorPreview ( DynamicPaintSurface surface)
static int dynamicPaint_surfaceHasMoved ( DynamicPaintSurface surface,
Object ob 
) [static]
static int dynamicPaint_surfaceNumOfPoints ( DynamicPaintSurface surface) [static]
static void dynamicPaint_surfacePreStep ( DynamicPaintSurface surface,
float  timescale 
) [static]
static void dynamicPaint_updateBrushMaterials ( Object brushOb,
Material ui_mat,
Scene scene,
BrushMaterials bMats 
) [static]
static void dynamicPaint_updatePointData ( DynamicPaintSurface surface,
unsigned int  index,
DynamicPaintBrushSettings brush,
float  paint[3],
float  influence,
float  depth,
float  vel_factor,
float  timescale 
) [static]
void dynamicPaintSurface_setUniqueName ( DynamicPaintSurface surface,
const char *  basename 
)
void dynamicPaintSurface_updateType ( struct DynamicPaintSurface surface)
static void free_bakeData ( PaintSurfaceData data) [static]
static void freeGrid ( PaintSurfaceData data) [static]
struct DynamicPaintSurface* get_activeSurface ( DynamicPaintCanvasSettings canvas) [read]
float getSurfaceDimension ( PaintSurfaceData sData)
static void mesh_faces_nearest_point_dp ( void *  userdata,
int  index,
const float *  co,
BVHTreeNearest nearest 
) [static]
static void mesh_faces_spherecast_dp ( void *  userdata,
int  index,
const BVHTreeRay ray,
BVHTreeRayHit hit 
) [static]
static int meshBrush_boundsIntersect ( Bounds3D b1,
Bounds3D b2,
DynamicPaintBrushSettings brush,
float  brush_radius 
) [static]
static float mixColors ( float  a_color[3],
float  a_weight,
float  b_color[3],
float  b_weight,
float  ratio 
) [static]

Definition at line 427 of file dynamicpaint.c.

References copy_v3_v3(), and interp_v3_v3v3().

Referenced by dynamicPaint_doEffectStep(), and dynamicPaint_doSmudge().

static void object_cacheIgnoreClear ( Object ob,
int  state 
) [static]
static void scene_setSubframe ( Scene scene,
float  subframe 
) [static]

Definition at line 523 of file dynamicpaint.c.

References RenderData::cfra, Scene::r, and RenderData::subframe.

Referenced by dynamicPaint_doStep().

static int setError ( DynamicPaintCanvasSettings canvas,
const char *  string 
) [static]
static void subframe_updateObject ( Scene scene,
Object ob,
int  flags,
float  frame 
) [static]
void surface_determineForceTargetPoints ( PaintSurfaceData sData,
int  index,
float  force[3],
float  closest_d[2],
int  closest_id[2] 
)
static int surface_duplicateNameExists ( void *  arg,
const char *  name 
) [static]
static int surface_duplicateOutputExists ( void *  arg,
const char *  name 
) [static]
void surface_freeUnusedData ( DynamicPaintSurface surface)
static int surface_getBrushFlags ( DynamicPaintSurface surface,
Scene scene 
) [static]
static int surface_needsAccelerationData ( DynamicPaintSurface surface) [static]
static int surface_needsVelocityData ( DynamicPaintSurface surface,
Scene scene 
) [static]
static void surface_setUniqueOutputName ( DynamicPaintSurface surface,
char *  basename,
int  output 
) [static]
static int surface_totalSamples ( DynamicPaintSurface surface) [static]
static int surface_usesAdjData ( DynamicPaintSurface surface) [static]
static int surface_usesAdjDistance ( DynamicPaintSurface surface) [static]
static void surfaceGenerateGrid ( struct DynamicPaintSurface surface) [static]

Variable Documentation

float gaussianFactors[5] [static]
Initial value:
 {  0.996849f,
                                0.596145f,
                                0.596145f,
                                0.596145f,
                                0.524141f}

BEGIN GPL LICENSE BLOCK *****

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

Contributor(s): Miika Hämäläinen

***** END GPL LICENSE BLOCK *****

Definition at line 80 of file dynamicpaint.c.

Referenced by dynamicPaint_paintMesh().

float gaussianTotal = 3.309425f [static]

Definition at line 85 of file dynamicpaint.c.

Referenced by dynamicPaint_paintMesh().

int neighX[8] = {1,1,0,-1,-1,-1, 0, 1} [static]

Definition at line 88 of file dynamicpaint.c.

Referenced by dynamicPaint_findNeighbourPixel().

int neighY[8] = {0,1,1, 1, 0,-1,-1,-1} [static]

Definition at line 89 of file dynamicpaint.c.

Referenced by dynamicPaint_findNeighbourPixel().