Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Hamalainen <blender@miikah.org>2011-05-24 11:08:58 +0400
committerMiika Hamalainen <blender@miikah.org>2011-05-24 11:08:58 +0400
commit3b41ab432badf2d4598b798e0d0c6c9ece51172b (patch)
tree8b646a88ae5dbc8441b0434fc925f7e3f09c7bb5 /source/blender/modifiers/intern/MOD_dynamicpaint.c
parent25e276d3570d292f7e0a1306a864419024465d3b (diff)
Applied Dynamic Paint 1.18f patch as a codebase for GSoC.
Diffstat (limited to 'source/blender/modifiers/intern/MOD_dynamicpaint.c')
-rw-r--r--source/blender/modifiers/intern/MOD_dynamicpaint.c109
1 files changed, 109 insertions, 0 deletions
diff --git a/source/blender/modifiers/intern/MOD_dynamicpaint.c b/source/blender/modifiers/intern/MOD_dynamicpaint.c
new file mode 100644
index 00000000000..66038db47a8
--- /dev/null
+++ b/source/blender/modifiers/intern/MOD_dynamicpaint.c
@@ -0,0 +1,109 @@
+/*
+* ***** 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 *****
+*
+*/
+
+#include "stddef.h"
+
+#include "DNA_meshdata_types.h"
+#include "DNA_object_types.h"
+
+#include "MEM_guardedalloc.h"
+
+#include "BKE_cdderivedmesh.h"
+#include "BKE_modifier.h"
+#include "BKE_dynamicpaint.h"
+
+#include "depsgraph_private.h"
+
+#include "MOD_util.h"
+
+
+static void initData(ModifierData *md)
+{
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
+
+ pmd->canvas = NULL;
+ pmd->paint = NULL;
+ pmd->baking = 0;
+ pmd->time = -1;
+ pmd->type = 0;
+}
+
+static void copyData(ModifierData *md, ModifierData *target)
+{
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData*)md;
+ DynamicPaintModifierData *tpmd = (DynamicPaintModifierData*)target;
+
+ dynamicPaint_Modifier_copy(pmd, tpmd);
+}
+
+static void freeData(ModifierData *md)
+{
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
+
+ dynamicPaint_Modifier_free (pmd);
+}
+
+static CustomDataMask requiredDataMask(Object *ob, ModifierData *md)
+{
+ CustomDataMask dataMask = 0;
+
+ dataMask |= (1 << CD_MTFACE);
+
+ return dataMask;
+}
+
+static void deformVerts(
+ ModifierData *md, Object *ob, DerivedMesh *derivedData,
+ float (*vertexCos)[3], int numVerts, int useRenderParams, int isFinalCalc)
+{
+ DynamicPaintModifierData *pmd = (DynamicPaintModifierData*) md;
+ DerivedMesh *dm = get_cddm(ob, NULL, derivedData, vertexCos);
+
+
+ dynamicPaint_Modifier_do(pmd, md->scene, ob, dm);
+
+ if(dm != derivedData)
+ dm->release(dm);
+}
+
+static int dependsOnTime(ModifierData *md)
+{
+ return 1;
+}
+
+
+ModifierTypeInfo modifierType_DynamicPaint = {
+ /* name */ "Dynamic Paint",
+ /* structName */ "DynamicPaintModifierData",
+ /* structSize */ sizeof(DynamicPaintModifierData),
+ /* type */ eModifierTypeType_OnlyDeform,
+ /* flags */ eModifierTypeFlag_AcceptsMesh
+ | eModifierTypeFlag_Single,
+
+ /* copyData */ copyData,
+ /* deformVerts */ deformVerts,
+ /* deformMatrices */ 0,
+ /* deformVertsEM */ 0,
+ /* deformMatricesEM */ 0,
+ /* applyModifier */ 0,
+ /* applyModifierEM */ 0,
+ /* initData */ initData,
+ /* requiredDataMask */ requiredDataMask,
+ /* freeData */ freeData,
+ /* isDisabled */ 0,
+ /* updateDepgraph */ 0,
+ /* dependsOnTime */ dependsOnTime,
+ /* foreachObjectLink */ 0,
+ /* foreachIDLink */ 0,
+};