diff options
author | Lukas Tönne <lukas.toenne@gmail.com> | 2018-08-12 14:59:39 +0300 |
---|---|---|
committer | Lukas Tönne <lukas.toenne@gmail.com> | 2018-08-12 14:59:39 +0300 |
commit | b8ab411185c11ce98e7e791b0d30a9d9b1ce6d69 (patch) | |
tree | 9c219e06fc6a1f9b09d6fbf7d86c8526cfa6d775 /source/blender/shader_fx/intern | |
parent | 209686f1c8189bc01f91d14a922651844df8b201 (diff) | |
parent | dc2d841b7c50565302af2986d62ddbd29c332acd (diff) |
Merge branch 'hair_guides' into hair_guides_groominghair_guides_grooming
Diffstat (limited to 'source/blender/shader_fx/intern')
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_blur.c | 66 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_colorize.c | 69 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_flip.c | 69 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_light.c | 104 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_pixel.c | 66 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_rim.c | 70 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_swirl.c | 103 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_util.c | 55 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_util.h | 36 | ||||
-rw-r--r-- | source/blender/shader_fx/intern/FX_shader_wave.c | 71 |
10 files changed, 709 insertions, 0 deletions
diff --git a/source/blender/shader_fx/intern/FX_shader_blur.c b/source/blender/shader_fx/intern/FX_shader_blur.c new file mode 100644 index 00000000000..128ebba8875 --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_blur.c @@ -0,0 +1,66 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2017, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_blur.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "BLI_utildefines.h" + +#include "FX_shader_types.h" + +static void initData(ShaderFxData *fx) +{ + BlurShaderFxData *gpfx = (BlurShaderFxData *)fx; + ARRAY_SET_ITEMS(gpfx->radius, 1, 1); + gpfx->samples = 4; + gpfx->coc = 0.025f; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +ShaderFxTypeInfo shaderfx_Type_Blur = { + /* name */ "Blur", + /* structName */ "BlurShaderFxData", + /* structSize */ sizeof(BlurShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ eShaderFxTypeFlag_Single, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepsgraph */ NULL, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_colorize.c b/source/blender/shader_fx/intern/FX_shader_colorize.c new file mode 100644 index 00000000000..edf276b842c --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_colorize.c @@ -0,0 +1,69 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_colorize.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "DNA_shader_fx_types.h" + +#include "BLI_utildefines.h" + +#include "FX_shader_types.h" + +static void initData(ShaderFxData *fx) +{ + ColorizeShaderFxData *gpfx = (ColorizeShaderFxData *)fx; + ARRAY_SET_ITEMS(gpfx->low_color, 0.0f, 0.0f, 0.0f, 1.0f); + ARRAY_SET_ITEMS(gpfx->high_color, 1.0f, 1.0f, 1.0f, 1.0f); + gpfx->mode = eShaderFxColorizeMode_GrayScale; + gpfx->factor = 0.5f; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +ShaderFxTypeInfo shaderfx_Type_Colorize = { + /* name */ "Colorize", + /* structName */ "ColorizeShaderFxData", + /* structSize */ sizeof(ColorizeShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ 0, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepsgraph */ NULL, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_flip.c b/source/blender/shader_fx/intern/FX_shader_flip.c new file mode 100644 index 00000000000..404e2f8160e --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_flip.c @@ -0,0 +1,69 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2017, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_flip.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_gpencil_types.h" + +#include "BLI_math_base.h" +#include "BLI_utildefines.h" + +#include "FX_shader_types.h" + +static void initData(ShaderFxData *fx) +{ + FlipShaderFxData *gpfx = (FlipShaderFxData *)fx; + gpfx->flag |= FX_FLIP_HORIZONTAL; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +ShaderFxTypeInfo shaderfx_Type_Flip = { + /* name */ "Flip", + /* structName */ "FlipShaderFxData", + /* structSize */ sizeof(FlipShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ eShaderFxTypeFlag_Single, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepsgraph */ NULL, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_light.c b/source/blender/shader_fx/intern/FX_shader_light.c new file mode 100644 index 00000000000..9a17ea8ae5f --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_light.c @@ -0,0 +1,104 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_light.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_gpencil_types.h" + +#include "BLI_math_base.h" +#include "BLI_utildefines.h" + +#include "BKE_library_query.h" +#include "BKE_modifier.h" +#include "BKE_shader_fx.h" + +#include "FX_shader_types.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" + +static void initData(ShaderFxData *fx) +{ + LightShaderFxData *gpfx = (LightShaderFxData *)fx; + gpfx->energy = 10.0f; + gpfx->ambient = 5.0f; + gpfx->object = NULL; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +static void updateDepsgraph(ShaderFxData *md, const ModifierUpdateDepsgraphContext *ctx) +{ + LightShaderFxData *fxd = (LightShaderFxData *)md; + if (fxd->object != NULL) { + DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_GEOMETRY, "Light ShaderFx"); + DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_TRANSFORM, "Light ShaderFx"); + } + DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Light ShaderFx"); +} + +static bool isDisabled(ShaderFxData *fx, int UNUSED(userRenderParams)) +{ + LightShaderFxData *fxd = (LightShaderFxData *)fx; + + return !fxd->object; +} + +static void foreachObjectLink( + ShaderFxData *fx, Object *ob, + ShaderFxObjectWalkFunc walk, void *userData) +{ + LightShaderFxData *fxd = (LightShaderFxData *)fx; + + walk(userData, ob, &fxd->object, IDWALK_CB_NOP); +} + +ShaderFxTypeInfo shaderfx_Type_Light = { + /* name */ "Light", + /* structName */ "LightShaderFxData", + /* structSize */ sizeof(LightShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ 0, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ isDisabled, + /* updateDepsgraph */ updateDepsgraph, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ foreachObjectLink, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_pixel.c b/source/blender/shader_fx/intern/FX_shader_pixel.c new file mode 100644 index 00000000000..a3ffd3a9b0d --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_pixel.c @@ -0,0 +1,66 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2017, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_pixel.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "BLI_utildefines.h" + +#include "FX_shader_types.h" + +static void initData(ShaderFxData *fx) +{ + PixelShaderFxData *gpfx = (PixelShaderFxData *)fx; + ARRAY_SET_ITEMS(gpfx->size, 5, 5); + ARRAY_SET_ITEMS(gpfx->rgba, 0.0f, 0.0f, 0.0f, 0.9f); + gpfx->flag |= FX_PIXEL_USE_LINES; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +ShaderFxTypeInfo shaderfx_Type_Pixel = { + /* name */ "Pixelate", + /* structName */ "PixelShaderFxData", + /* structSize */ sizeof(PixelShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ eShaderFxTypeFlag_Single, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepsgraph */ NULL, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_rim.c b/source/blender/shader_fx/intern/FX_shader_rim.c new file mode 100644 index 00000000000..bea6f645033 --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_rim.c @@ -0,0 +1,70 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_rim.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "DNA_shader_fx_types.h" + +#include "BLI_utildefines.h" + +#include "FX_shader_types.h" + +static void initData(ShaderFxData *fx) +{ + RimShaderFxData *gpfx = (RimShaderFxData *)fx; + ARRAY_SET_ITEMS(gpfx->offset, 50, -100); + ARRAY_SET_ITEMS(gpfx->rim_rgb, 1.0f, 1.0f, 0.5f); + ARRAY_SET_ITEMS(gpfx->mask_rgb, 0.0f, 0.0f, 0.0f); + gpfx->mode = eShaderFxRimMode_Multiply; + ARRAY_SET_ITEMS(gpfx->blur, 0, 0); +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +ShaderFxTypeInfo shaderfx_Type_Rim = { + /* name */ "Rim", + /* structName */ "RimShaderFxData", + /* structSize */ sizeof(RimShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ 0, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepsgraph */ NULL, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_swirl.c b/source/blender/shader_fx/intern/FX_shader_swirl.c new file mode 100644 index 00000000000..9667f466eec --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_swirl.c @@ -0,0 +1,103 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_swirl.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_gpencil_types.h" + +#include "BLI_math_base.h" +#include "BLI_utildefines.h" + +#include "BKE_library_query.h" +#include "BKE_modifier.h" +#include "BKE_shader_fx.h" + +#include "FX_shader_types.h" + +#include "DEG_depsgraph.h" +#include "DEG_depsgraph_build.h" + +static void initData(ShaderFxData *md) +{ + SwirlShaderFxData *gpmd = (SwirlShaderFxData *)md; + gpmd->radius = 100; + gpmd->angle = M_PI_2; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +static void updateDepsgraph(ShaderFxData *fx, const ModifierUpdateDepsgraphContext *ctx) +{ + SwirlShaderFxData *fxd = (SwirlShaderFxData *)fx; + if (fxd->object != NULL) { + DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_GEOMETRY, "Swirl ShaderFx"); + DEG_add_object_relation(ctx->node, fxd->object, DEG_OB_COMP_TRANSFORM, "Swirl ShaderFx"); + } + DEG_add_object_relation(ctx->node, ctx->object, DEG_OB_COMP_TRANSFORM, "Swirl ShaderFx"); +} + +static bool isDisabled(ShaderFxData *fx, int UNUSED(userRenderParams)) +{ + SwirlShaderFxData *fxd = (SwirlShaderFxData *)fx; + + return !fxd->object; +} + +static void foreachObjectLink( + ShaderFxData *fx, Object *ob, + ShaderFxObjectWalkFunc walk, void *userData) +{ + SwirlShaderFxData *fxd = (SwirlShaderFxData *)fx; + + walk(userData, ob, &fxd->object, IDWALK_CB_NOP); +} + +ShaderFxTypeInfo shaderfx_Type_Swirl = { + /* name */ "Swirl", + /* structName */ "SwirlShaderFxData", + /* structSize */ sizeof(SwirlShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ 0, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ isDisabled, + /* updateDepsgraph */ updateDepsgraph, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ foreachObjectLink, + /* foreachIDLink */ NULL, +}; diff --git a/source/blender/shader_fx/intern/FX_shader_util.c b/source/blender/shader_fx/intern/FX_shader_util.c new file mode 100644 index 00000000000..64a1553adec --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_util.c @@ -0,0 +1,55 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/shader_fx/intern/FX_shader_util.c + * \ingroup shader_fx + */ + + +#include <stdio.h> + +#include "MEM_guardedalloc.h" + +#include "BLI_blenlib.h" +#include "BLI_utildefines.h" + +#include "BKE_shader_fx.h" + +#include "FX_shader_types.h" +#include "FX_shader_util.h" + +void shaderfx_type_init(ShaderFxTypeInfo *types[]) +{ +#define INIT_FX_TYPE(typeName) (types[eShaderFxType_##typeName] = &shaderfx_Type_##typeName) + INIT_FX_TYPE(Blur); + INIT_FX_TYPE(Colorize); + INIT_FX_TYPE(Flip); + INIT_FX_TYPE(Light); + INIT_FX_TYPE(Pixel); + INIT_FX_TYPE(Rim); + INIT_FX_TYPE(Swirl); + INIT_FX_TYPE(Wave); +#undef INIT_FX_TYPE +} diff --git a/source/blender/shader_fx/intern/FX_shader_util.h b/source/blender/shader_fx/intern/FX_shader_util.h new file mode 100644 index 00000000000..e2fdcd6fb4c --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_util.h @@ -0,0 +1,36 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) Blender Foundation. + * All rights reserved. + * + * The Original Code is: all of this file. + * + * Contributor(s): none yet. + * + * ***** END GPL LICENSE BLOCK ***** + */ + +/** \file blender/shader_fx/intern/FX_shader_util.h + * \ingroup shader_fx + */ + + +#ifndef __FX_SHADER_UTIL_H__ +#define __FX_SHADER_UTIL_H__ + +#endif /* __FX_SHADER_UTIL_H__ */ diff --git a/source/blender/shader_fx/intern/FX_shader_wave.c b/source/blender/shader_fx/intern/FX_shader_wave.c new file mode 100644 index 00000000000..ea4563a00e1 --- /dev/null +++ b/source/blender/shader_fx/intern/FX_shader_wave.c @@ -0,0 +1,71 @@ +/* + * ***** 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. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * The Original Code is Copyright (C) 2018, Blender Foundation + * This is a new part of Blender + * + * Contributor(s): Antonio Vazquez + * + * ***** END GPL LICENSE BLOCK ***** + * + */ + +/** \file blender/shader_fx/intern/FX_shader_wave.c + * \ingroup shader_fx + */ + +#include <stdio.h> + +#include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "DNA_gpencil_types.h" + +#include "BLI_utildefines.h" + +#include "FX_shader_types.h" + +static void initData(ShaderFxData *fx) +{ + WaveShaderFxData *gpfx = (WaveShaderFxData *)fx; + gpfx->amplitude = 10.0f; + gpfx->period = 20.0f; + gpfx->phase = 0.0f; + gpfx->orientation = 1; +} + +static void copyData(const ShaderFxData *md, ShaderFxData *target) +{ + BKE_shaderfx_copyData_generic(md, target); +} + +ShaderFxTypeInfo shaderfx_Type_Wave = { + /* name */ "Wave Distorsion", + /* structName */ "WaveShaderFxData", + /* structSize */ sizeof(WaveShaderFxData), + /* type */ eShaderFxType_GpencilType, + /* flags */ eShaderFxTypeFlag_Single, + + /* copyData */ copyData, + + /* initData */ initData, + /* freeData */ NULL, + /* isDisabled */ NULL, + /* updateDepsgraph */ NULL, + /* dependsOnTime */ NULL, + /* foreachObjectLink */ NULL, + /* foreachIDLink */ NULL, +}; |