From 14df7de9163ef6bc0a12303abed3a50697038a8c Mon Sep 17 00:00:00 2001 From: Tamito Kajiyama Date: Thu, 9 Oct 2014 00:34:55 +0900 Subject: D801: Freestyle: remove old and unused stroke shaders This patch removes several stroke shaders written in C++ that are unused and don't serve a real purpose any more. The removed shaders are: - BPy_ColorVariationPatternShader - BPy_StrokeTextureShader - BPy_TextureAssignerShader - BPy_ThicknessVariationPatternShader - BPy_fstreamShader - BPy_streamShader and a few more that weren't even exposed to the Python API. Some minor edits were made by the reviewer. Differential Revision: https://developer.blender.org/D801 Reviewed by: kjym3 --- source/blender/freestyle/CMakeLists.txt | 12 - .../freestyle/intern/python/BPy_StrokeShader.cpp | 36 -- .../BPy_ColorVariationPatternShader.cpp | 122 ------- .../StrokeShader/BPy_ColorVariationPatternShader.h | 54 --- .../StrokeShader/BPy_StrokeTextureShader.cpp | 143 -------- .../python/StrokeShader/BPy_StrokeTextureShader.h | 53 --- .../StrokeShader/BPy_TextureAssignerShader.cpp | 130 ------- .../StrokeShader/BPy_TextureAssignerShader.h | 53 --- .../BPy_ThicknessVariationPatternShader.cpp | 128 ------- .../BPy_ThicknessVariationPatternShader.h | 54 --- .../python/StrokeShader/BPy_fstreamShader.cpp | 114 ------ .../intern/python/StrokeShader/BPy_fstreamShader.h | 53 --- .../python/StrokeShader/BPy_streamShader.cpp | 110 ------ .../intern/python/StrokeShader/BPy_streamShader.h | 53 --- .../intern/stroke/AdvancedStrokeShaders.cpp | 73 ---- .../freestyle/intern/stroke/BasicStrokeShaders.cpp | 388 --------------------- .../freestyle/intern/stroke/BasicStrokeShaders.h | 302 ---------------- 17 files changed, 1878 deletions(-) delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp delete mode 100644 source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h (limited to 'source') diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt index bfd1c17df7d..cb187eca6ac 100644 --- a/source/blender/freestyle/CMakeLists.txt +++ b/source/blender/freestyle/CMakeLists.txt @@ -189,8 +189,6 @@ set(SRC intern/python/StrokeShader/BPy_CalligraphicShader.h intern/python/StrokeShader/BPy_ColorNoiseShader.cpp intern/python/StrokeShader/BPy_ColorNoiseShader.h - intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp - intern/python/StrokeShader/BPy_ColorVariationPatternShader.h intern/python/StrokeShader/BPy_ConstantColorShader.cpp intern/python/StrokeShader/BPy_ConstantColorShader.h intern/python/StrokeShader/BPy_ConstantThicknessShader.cpp @@ -211,22 +209,12 @@ set(SRC intern/python/StrokeShader/BPy_SmoothingShader.h intern/python/StrokeShader/BPy_SpatialNoiseShader.cpp intern/python/StrokeShader/BPy_SpatialNoiseShader.h - intern/python/StrokeShader/BPy_StrokeTextureShader.cpp - intern/python/StrokeShader/BPy_StrokeTextureShader.h intern/python/StrokeShader/BPy_StrokeTextureStepShader.cpp intern/python/StrokeShader/BPy_StrokeTextureStepShader.h - intern/python/StrokeShader/BPy_TextureAssignerShader.cpp - intern/python/StrokeShader/BPy_TextureAssignerShader.h intern/python/StrokeShader/BPy_ThicknessNoiseShader.cpp intern/python/StrokeShader/BPy_ThicknessNoiseShader.h - intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp - intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h intern/python/StrokeShader/BPy_TipRemoverShader.cpp intern/python/StrokeShader/BPy_TipRemoverShader.h - intern/python/StrokeShader/BPy_fstreamShader.cpp - intern/python/StrokeShader/BPy_fstreamShader.h - intern/python/StrokeShader/BPy_streamShader.cpp - intern/python/StrokeShader/BPy_streamShader.h intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.cpp intern/python/UnaryFunction0D/BPy_UnaryFunction0DDouble.h intern/python/UnaryFunction0D/BPy_UnaryFunction0DEdgeNature.cpp diff --git a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp index a6c7a40e780..6b4a1872b61 100644 --- a/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp +++ b/source/blender/freestyle/intern/python/BPy_StrokeShader.cpp @@ -32,11 +32,9 @@ #include "StrokeShader/BPy_BlenderTextureShader.h" #include "StrokeShader/BPy_CalligraphicShader.h" #include "StrokeShader/BPy_ColorNoiseShader.h" -#include "StrokeShader/BPy_ColorVariationPatternShader.h" #include "StrokeShader/BPy_ConstantColorShader.h" #include "StrokeShader/BPy_ConstantThicknessShader.h" #include "StrokeShader/BPy_ConstrainedIncreasingThicknessShader.h" -#include "StrokeShader/BPy_fstreamShader.h" #include "StrokeShader/BPy_GuidingLinesShader.h" #include "StrokeShader/BPy_IncreasingColorShader.h" #include "StrokeShader/BPy_IncreasingThicknessShader.h" @@ -44,12 +42,8 @@ #include "StrokeShader/BPy_SamplingShader.h" #include "StrokeShader/BPy_SmoothingShader.h" #include "StrokeShader/BPy_SpatialNoiseShader.h" -#include "StrokeShader/BPy_streamShader.h" -#include "StrokeShader/BPy_StrokeTextureShader.h" #include "StrokeShader/BPy_StrokeTextureStepShader.h" -#include "StrokeShader/BPy_TextureAssignerShader.h" #include "StrokeShader/BPy_ThicknessNoiseShader.h" -#include "StrokeShader/BPy_ThicknessVariationPatternShader.h" #include "StrokeShader/BPy_TipRemoverShader.h" #ifdef __cplusplus @@ -94,11 +88,6 @@ int StrokeShader_Init(PyObject *module) Py_INCREF(&ColorNoiseShader_Type); PyModule_AddObject(module, "ColorNoiseShader", (PyObject *)&ColorNoiseShader_Type); - if (PyType_Ready(&ColorVariationPatternShader_Type) < 0) - return -1; - Py_INCREF(&ColorVariationPatternShader_Type); - PyModule_AddObject(module, "ColorVariationPatternShader", (PyObject *)&ColorVariationPatternShader_Type); - if (PyType_Ready(&ConstantColorShader_Type) < 0) return -1; Py_INCREF(&ConstantColorShader_Type); @@ -115,11 +104,6 @@ int StrokeShader_Init(PyObject *module) PyModule_AddObject(module, "ConstrainedIncreasingThicknessShader", (PyObject *)&ConstrainedIncreasingThicknessShader_Type); - if (PyType_Ready(&fstreamShader_Type) < 0) - return -1; - Py_INCREF(&fstreamShader_Type); - PyModule_AddObject(module, "fstreamShader", (PyObject *)&fstreamShader_Type); - if (PyType_Ready(&GuidingLinesShader_Type) < 0) return -1; Py_INCREF(&GuidingLinesShader_Type); @@ -155,36 +139,16 @@ int StrokeShader_Init(PyObject *module) Py_INCREF(&SpatialNoiseShader_Type); PyModule_AddObject(module, "SpatialNoiseShader", (PyObject *)&SpatialNoiseShader_Type); - if (PyType_Ready(&streamShader_Type) < 0) - return -1; - Py_INCREF(&streamShader_Type); - PyModule_AddObject(module, "streamShader", (PyObject *)&streamShader_Type); - - if (PyType_Ready(&StrokeTextureShader_Type) < 0) - return -1; - Py_INCREF(&StrokeTextureShader_Type); - PyModule_AddObject(module, "StrokeTextureShader", (PyObject *)&StrokeTextureShader_Type); - if (PyType_Ready(&StrokeTextureStepShader_Type) < 0) return -1; Py_INCREF(&StrokeTextureStepShader_Type); PyModule_AddObject(module, "StrokeTextureStepShader", (PyObject *)&StrokeTextureStepShader_Type); - if (PyType_Ready(&TextureAssignerShader_Type) < 0) - return -1; - Py_INCREF(&TextureAssignerShader_Type); - PyModule_AddObject(module, "TextureAssignerShader", (PyObject *)&TextureAssignerShader_Type); - if (PyType_Ready(&ThicknessNoiseShader_Type) < 0) return -1; Py_INCREF(&ThicknessNoiseShader_Type); PyModule_AddObject(module, "ThicknessNoiseShader", (PyObject *)&ThicknessNoiseShader_Type); - if (PyType_Ready(&ThicknessVariationPatternShader_Type) < 0) - return -1; - Py_INCREF(&ThicknessVariationPatternShader_Type); - PyModule_AddObject(module, "ThicknessVariationPatternShader", (PyObject *)&ThicknessVariationPatternShader_Type); - if (PyType_Ready(&TipRemoverShader_Type) < 0) return -1; Py_INCREF(&TipRemoverShader_Type); diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp deleted file mode 100644 index 173e00b0ed8..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp +++ /dev/null @@ -1,122 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.cpp - * \ingroup freestyle - */ - -#include "BPy_ColorVariationPatternShader.h" - -#include "../../stroke/BasicStrokeShaders.h" -#include "../BPy_Convert.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------INSTANCE METHODS ---------------------------------- - -static char ColorVariationPatternShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ColorVariationPatternShader`\n" -"\n" -"[Color shader]\n" -"\n" -".. method:: __init__(pattern_name, stretch=True)\n" -"\n" -" Builds a ColorVariationPatternShader object.\n" -"\n" -" :arg pattern_name: The file name of the texture file to use as\n" -" pattern.\n" -" :type pattern_name: str\n" -" :arg stretch: Tells whether the texture must be strecthed or\n" -" repeted to fit the stroke.\n" -" :type stretch: bool\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Applies a pattern to vary the original color. The new color is the\n" -" result of the multiplication of the pattern and the original color.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; - -static int ColorVariationPatternShader___init__(BPy_ColorVariationPatternShader *self, PyObject *args, PyObject *kwds) -{ - static const char *kwlist[] = {"pattern_name", "stretch", NULL}; - const char *s; - PyObject *obj = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!", (char **)kwlist, &s, &PyBool_Type, &obj)) - return -1; - bool b = (!obj) ? true : bool_from_PyBool(obj); - self->py_ss.ss = new StrokeShaders::ColorVariationPatternShader(s, b); - return 0; -} - -/*-----------------------BPy_ColorVariationPatternShader type definition ------------------------------*/ - -PyTypeObject ColorVariationPatternShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ColorVariationPatternShader", /* tp_name */ - sizeof(BPy_ColorVariationPatternShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ColorVariationPatternShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ColorVariationPatternShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h deleted file mode 100644 index af5cf17caff..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ColorVariationPatternShader.h - * \ingroup freestyle - */ - -#ifndef __FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H__ -#define __FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H__ - -#include "../BPy_StrokeShader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -extern PyTypeObject ColorVariationPatternShader_Type; - -#define BPy_ColorVariationPatternShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ColorVariationPatternShader_Type)) - -/*---------------------------Python BPy_ColorVariationPatternShader structure definition----------*/ -typedef struct { - BPy_StrokeShader py_ss; -} BPy_ColorVariationPatternShader; - - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif - - -#endif /* __FREESTYLE_PYTHON_COLORVARIATIONPATTERNSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp deleted file mode 100644 index db2807addc4..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.cpp - * \ingroup freestyle - */ - -#include "BPy_StrokeTextureShader.h" - -#include "../../stroke/BasicStrokeShaders.h" -#include "../BPy_Convert.h" -#include "../BPy_MediumType.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------INSTANCE METHODS ---------------------------------- - -static char StrokeTextureShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`StrokeTextureShader`\n" -"\n" -"[Texture shader]\n" -"\n" -".. method:: __init__(texture_file, medium_type=Stroke.OPAQUE_MEDIUM, tips=False)\n" -"\n" -" Builds a StrokeTextureShader object.\n" -"\n" -" :arg texture_file: \n" -" :type texture_file: str\n" -" :arg medium_type: The medium type and therefore, the blending mode\n" -" that must be used for the rendering of this stroke.\n" -" :type medium_type: :class:`freestyle.types.MediumType`\n" -" :arg tips: Tells whether the texture includes tips or not. If it\n" -" is the case, the texture image must respect the following format.\n" -" :type tips: bool\n" -"\n" -" The format of a texture image including tips::\n" -"\n" -" ___________\n" -" | |\n" -" | A |\n" -" |___________|\n" -" | | |\n" -" | B | C |\n" -" |_____|_____|\n" -"\n" -" * A : The stroke's corpus texture.\n" -" * B : The stroke's left extremity texture.\n" -" * C : The stroke's right extremity texture.\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns a texture and a blending mode to the stroke in order to\n" -" simulate its marks system.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; - -static int StrokeTextureShader___init__(BPy_StrokeTextureShader *self, PyObject *args, PyObject *kwds) -{ - static const char *kwlist[] = {"texture_file", "medium_type", "tips", NULL}; - const char *s1; - PyObject *obj2 = 0, *obj3 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|O!O!", (char **)kwlist, - &s1, &MediumType_Type, &obj2, &PyBool_Type, &obj3)) - { - return -1; - } - Stroke::MediumType mt = (!obj2) ? Stroke::OPAQUE_MEDIUM : MediumType_from_BPy_MediumType(obj2); - bool b = (!obj3) ? false : bool_from_PyBool(obj3); - self->py_ss.ss = new StrokeShaders::StrokeTextureShader(s1, mt, b); - return 0; -} - -/*-----------------------BPy_StrokeTextureShader type definition ------------------------------*/ - -PyTypeObject StrokeTextureShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "StrokeTextureShader", /* tp_name */ - sizeof(BPy_StrokeTextureShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - StrokeTextureShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)StrokeTextureShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h deleted file mode 100644 index d025e8b7c2d..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_StrokeTextureShader.h - * \ingroup freestyle - */ - -#ifndef __FREESTYLE_PYTHON_STROKETEXTURESHADER_H__ -#define __FREESTYLE_PYTHON_STROKETEXTURESHADER_H__ - -#include "../BPy_StrokeShader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -extern PyTypeObject StrokeTextureShader_Type; - -#define BPy_StrokeTextureShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&StrokeTextureShader_Type)) - -/*---------------------------Python BPy_StrokeTextureShader structure definition----------*/ -typedef struct { - BPy_StrokeShader py_ss; -} BPy_StrokeTextureShader; - - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif - - -#endif /* __FREESTYLE_PYTHON_STROKETEXTURESHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp deleted file mode 100644 index 78a07cb6c38..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp +++ /dev/null @@ -1,130 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.cpp - * \ingroup freestyle - */ - -#include "BPy_TextureAssignerShader.h" - -#include "../../stroke/BasicStrokeShaders.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------INSTANCE METHODS ---------------------------------- - -static char TextureAssignerShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`TextureAssignerShader`\n" -"\n" -"[Texture shader]\n" -"\n" -".. method:: __init__(preset)\n" -"\n" -" Builds a TextureAssignerShader object.\n" -"\n" -" :arg preset: The preset number to use.\n" -" :type preset: int\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Assigns a texture to the stroke in order to simulate its marks\n" -" system. This shader takes as input an integer value telling which\n" -" texture and blending mode to use among a set of predefined\n" -" textures. Here are the different presets:\n" -"\n" -" * 0: `/brushes/charcoalAlpha.bmp`, `Stroke.HUMID_MEDIUM`\n" -" * 1: `/brushes/washbrushAlpha.bmp`, `Stroke.HUMID_MEDIUM`\n" -" * 2: `/brushes/oil.bmp`, `Stroke.HUMID_MEDIUM`\n" -" * 3: `/brushes/oilnoblend.bmp`, `Stroke.HUMID_MEDIUM`\n" -" * 4: `/brushes/charcoalAlpha.bmp`, `Stroke.DRY_MEDIUM`\n" -" * 5: `/brushes/washbrushAlpha.bmp`, `Stroke.DRY_MEDIUM`\n" -" * 6: `/brushes/opaqueDryBrushAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n" -" * 7: `/brushes/opaqueBrushAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n" -"\n" -" Any other value will lead to the following preset:\n" -"\n" -" * Default: `/brushes/smoothAlpha.bmp`, `Stroke.OPAQUE_MEDIUM`\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; - -static int TextureAssignerShader___init__(BPy_TextureAssignerShader *self, PyObject *args, PyObject *kwds) -{ - static const char *kwlist[] = {"preset", NULL}; - int i; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "i", (char **)kwlist, &i)) - return -1; - self->py_ss.ss = new StrokeShaders::TextureAssignerShader(i); - return 0; -} - -/*-----------------------BPy_TextureAssignerShader type definition ------------------------------*/ - -PyTypeObject TextureAssignerShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "TextureAssignerShader", /* tp_name */ - sizeof(BPy_TextureAssignerShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - TextureAssignerShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)TextureAssignerShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h deleted file mode 100644 index 046f785dc57..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_TextureAssignerShader.h - * \ingroup freestyle - */ - -#ifndef __FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H__ -#define __FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H__ - -#include "../BPy_StrokeShader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -extern PyTypeObject TextureAssignerShader_Type; - -#define BPy_TextureAssignerShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&TextureAssignerShader_Type)) - -/*---------------------------Python BPy_TextureAssignerShader structure definition----------*/ -typedef struct { - BPy_StrokeShader py_ss; -} BPy_TextureAssignerShader; - - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif - - -#endif /* __FREESTYLE_PYTHON_TEXTUREASSIGNERSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp deleted file mode 100644 index 3196065cd34..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.cpp - * \ingroup freestyle - */ - -#include "BPy_ThicknessVariationPatternShader.h" - -#include "../../stroke/BasicStrokeShaders.h" -#include "../BPy_Convert.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------INSTANCE METHODS ---------------------------------- - -static char ThicknessVariationPatternShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`ThicknessVariationPatternShader`\n" -"\n" -"[Thickness shader]\n" -"\n" -".. method:: __init__(pattern_name, thickness_min=1.0, thickness_max=5.0, stretch=True)\n" -"\n" -" Builds a ThicknessVariationPatternShader object.\n" -"\n" -" :arg pattern_name: The texture file name.\n" -" :type pattern_name: str\n" -" :arg thickness_min: The minimum thickness we don't want to exceed.\n" -" :type thickness_min: float\n" -" :arg thickness_max: The maximum thickness we don't want to exceed.\n" -" :type thickness_max: float\n" -" :arg stretch: Tells whether the pattern texture must be stretched\n" -" or repeated to fit the stroke.\n" -" :type stretch: bool\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Applies a pattern (texture) to vary thickness. The new thicknesses\n" -" are the result of the multiplication of the pattern and the\n" -" original thickness.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; - -static int ThicknessVariationPatternShader___init__(BPy_ThicknessVariationPatternShader *self, - PyObject *args, PyObject *kwds) -{ - static const char *kwlist[] = {"pattern_name", "thickness_min", "thickness_max", "stretch", NULL}; - const char *s1; - float f2 = 1.0, f3 = 5.0; - PyObject *obj4 = 0; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s|ffO!", (char **)kwlist, &s1, &f2, &f3, &PyBool_Type, &obj4)) - return -1; - bool b = (!obj4) ? true : bool_from_PyBool(obj4); - self->py_ss.ss = new StrokeShaders::ThicknessVariationPatternShader(s1, f2, f3, b); - return 0; -} - -/*-----------------------BPy_ThicknessVariationPatternShader type definition ------------------------------*/ - -PyTypeObject ThicknessVariationPatternShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "ThicknessVariationPatternShader", /* tp_name */ - sizeof(BPy_ThicknessVariationPatternShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - ThicknessVariationPatternShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)ThicknessVariationPatternShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h deleted file mode 100644 index 604e875f815..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_ThicknessVariationPatternShader.h - * \ingroup freestyle - */ - -#ifndef __FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H__ -#define __FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H__ - -#include "../BPy_StrokeShader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -extern PyTypeObject ThicknessVariationPatternShader_Type; - -#define BPy_ThicknessVariationPatternShader_Check(v) \ - (PyObject_IsInstance((PyObject *)v, (PyObject *)&ThicknessVariationPatternShader_Type)) - -/*---------------------------Python BPy_ThicknessVariationPatternShader structure definition----------*/ -typedef struct { - BPy_StrokeShader py_ss; -} BPy_ThicknessVariationPatternShader; - - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif - - -#endif /* __FREESTYLE_PYTHON_THICKNESSVARIATIONPATTERNSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp deleted file mode 100644 index b838cae9817..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.cpp - * \ingroup freestyle - */ - -#include "BPy_fstreamShader.h" - -#include "../../stroke/AdvancedStrokeShaders.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------INSTANCE METHODS ---------------------------------- - -static char fstreamShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`fstreamShader`\n" -"\n" -"[Output shader]\n" -"\n" -".. method:: __init__(filename)\n" -"\n" -" Builds a fstreamShader object.\n" -"\n" -" :arg filename: The output file name.\n" -" :type filename: str\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Streams the Stroke in a file.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; - -static int fstreamShader___init__(BPy_fstreamShader *self, PyObject *args, PyObject *kwds) -{ - static const char *kwlist[] = {"filename", NULL}; - const char *s; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "s", (char **)kwlist, &s)) - return -1; - self->py_ss.ss = new StrokeShaders::fstreamShader(s); - return 0; -} - -/*-----------------------BPy_fstreamShader type definition ------------------------------*/ - -PyTypeObject fstreamShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "fstreamShader", /* tp_name */ - sizeof(BPy_fstreamShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - fstreamShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)fstreamShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h deleted file mode 100644 index 9f2371a3756..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_fstreamShader.h - * \ingroup freestyle - */ - -#ifndef __FREESTYLE_PYTHON_FSTREAMSHADER_H__ -#define __FREESTYLE_PYTHON_FSTREAMSHADER_H__ - -#include "../BPy_StrokeShader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -extern PyTypeObject fstreamShader_Type; - -#define BPy_fstreamShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&fstreamShader_Type)) - -/*---------------------------Python BPy_fstreamShader structure definition----------*/ -typedef struct { - BPy_StrokeShader py_ss; -} BPy_fstreamShader; - - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif - - -#endif /* __FREESTYLE_PYTHON_FSTREAMSHADER_H__ */ diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp deleted file mode 100644 index 97a6ca0d39e..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp +++ /dev/null @@ -1,110 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.cpp - * \ingroup freestyle - */ - -#include "BPy_streamShader.h" - -#include "../../stroke/BasicStrokeShaders.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -//------------------------INSTANCE METHODS ---------------------------------- - -static char streamShader___doc__[] = -"Class hierarchy: :class:`freestyle.types.StrokeShader` > :class:`streamShader`\n" -"\n" -"[Output shader]\n" -"\n" -".. method:: __init__()\n" -"\n" -" Builds a streamShader object.\n" -"\n" -".. method:: shade(stroke)\n" -"\n" -" Streams the Stroke into stdout.\n" -"\n" -" :arg stroke: A Stroke object.\n" -" :type stroke: :class:`freestyle.types.Stroke`\n"; - -static int streamShader___init__(BPy_streamShader *self, PyObject *args, PyObject *kwds) -{ - static const char *kwlist[] = {NULL}; - - if (!PyArg_ParseTupleAndKeywords(args, kwds, "", (char **)kwlist)) - return -1; - self->py_ss.ss = new StrokeShaders::streamShader(); - return 0; -} - -/*-----------------------BPy_streamShader type definition ------------------------------*/ - -PyTypeObject streamShader_Type = { - PyVarObject_HEAD_INIT(NULL, 0) - "streamShader", /* tp_name */ - sizeof(BPy_streamShader), /* tp_basicsize */ - 0, /* tp_itemsize */ - 0, /* tp_dealloc */ - 0, /* tp_print */ - 0, /* tp_getattr */ - 0, /* tp_setattr */ - 0, /* tp_reserved */ - 0, /* tp_repr */ - 0, /* tp_as_number */ - 0, /* tp_as_sequence */ - 0, /* tp_as_mapping */ - 0, /* tp_hash */ - 0, /* tp_call */ - 0, /* tp_str */ - 0, /* tp_getattro */ - 0, /* tp_setattro */ - 0, /* tp_as_buffer */ - Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ - streamShader___doc__, /* tp_doc */ - 0, /* tp_traverse */ - 0, /* tp_clear */ - 0, /* tp_richcompare */ - 0, /* tp_weaklistoffset */ - 0, /* tp_iter */ - 0, /* tp_iternext */ - 0, /* tp_methods */ - 0, /* tp_members */ - 0, /* tp_getset */ - &StrokeShader_Type, /* tp_base */ - 0, /* tp_dict */ - 0, /* tp_descr_get */ - 0, /* tp_descr_set */ - 0, /* tp_dictoffset */ - (initproc)streamShader___init__, /* tp_init */ - 0, /* tp_alloc */ - 0, /* tp_new */ -}; - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif diff --git a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h b/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h deleted file mode 100644 index 047ff4b58b5..00000000000 --- a/source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * ***** 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. - * - * ***** END GPL LICENSE BLOCK ***** - */ - -/** \file source/blender/freestyle/intern/python/StrokeShader/BPy_streamShader.h - * \ingroup freestyle - */ - -#ifndef __FREESTYLE_PYTHON_STREAMSHADER_H__ -#define __FREESTYLE_PYTHON_STREAMSHADER_H__ - -#include "../BPy_StrokeShader.h" - -#ifdef __cplusplus -extern "C" { -#endif - -/////////////////////////////////////////////////////////////////////////////////////////// - -extern PyTypeObject streamShader_Type; - -#define BPy_streamShader_Check(v) (PyObject_IsInstance((PyObject *)v, (PyObject *)&streamShader_Type)) - -/*---------------------------Python BPy_streamShader structure definition----------*/ -typedef struct { - BPy_StrokeShader py_ss; -} BPy_streamShader; - - -/////////////////////////////////////////////////////////////////////////////////////////// - -#ifdef __cplusplus -} -#endif - - -#endif /* __FREESTYLE_PYTHON_STREAMSHADER_H__ */ diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index 274e36a4c9b..e37631e5bd6 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -81,20 +81,6 @@ int CalligraphicShader::shade(Stroke &ioStroke) const return 0; } -#if 0 -void TipRemoverShader::shade(Stroke &ioStroke) const -{ - StrokeInternal::StrokeVertexIterator v, vend; - for (v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd(); v != vend; ++v) { - if (((*v)->curvilinearAbscissa() < _tipLength) || - (((*v)->strokeLength() - (*v)->curvilinearAbscissa()) < _tipLength)) { - (*v)->attribute().setThickness(0.0, 0.0); - (*v)->attribute().setColor(1, 1, 1); - } - } -} -#endif - ///////////////////////////////////////// // // SPATIAL NOISE SHADER @@ -347,63 +333,4 @@ void Smoother::copyVertices() _stroke->UpdateLength(); } -#if 0 // FIXME - -///////////////////////////////////////// -// -// OMISSION SHADER -// -///////////////////////////////////////// - -OmissionShader::OmissionShader(real sizeWindow, real thrVari, real thrFlat, real lFlat) -{ - _sizeWindow = sizeWindow; - _thresholdVariation = thrVari; - _thresholdFlat = thrFlat; - _lengthFlat = lFlat; -} - -int OmissionShader::shade(Stroke &ioStroke) const -{ - Omitter omi(ioStroke); - omi.omit(_sizeWindow, _thresholdVariation, _thresholdFlat, _lengthFlat); - - return 0; -} - - -// OMITTER -/////////////////////////// - -Omitter::Omitter(Stroke &ioStroke) : Smoother(ioStroke) -{ - StrokeInternal::StrokeVertexIterator v, vend; - int i = 0; - for (v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd(); v != vend; ++v, ++i) { - _u[i] = (v)->curvilinearAbscissa(); - } -} - -void Omitter::omit(real sizeWindow, real thrVari, real thrFlat, real lFlat) -{ - _sizeWindow=sizeWindow; - _thresholdVariation=thrVari; - _thresholdFlat=thrFlat; - _lengthFlat=lFlat; - - for (int i = 1; i < _nbVertices-1; ++i) { - if (_u[i] < _lengthFlat) - continue; - // is the previous segment flat? - int j = i - 1; - while ((j >= 0) && (_u[i] - _u[j] < _lengthFlat)) { - if ((_normal[j] * _normal[i]) < _thresholdFlat) - ; // FIXME - --j; - } - } -} - -#endif - } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index 69ca45d3ec7..8d0720d83d9 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -43,9 +43,6 @@ #include "BKE_global.h" -//soc #include -//soc #include - extern "C" { # include "IMB_imbuf.h" # include "IMB_imbuf_types.h" @@ -55,18 +52,6 @@ namespace Freestyle { // Internal function -#if 0 // soc -void convert(const QImage& iImage, float **oArray, unsigned &oSize) -{ - oSize = iImage.width(); - *oArray = new float[oSize]; - for (unsigned int i = 0; i < oSize; ++i) { - QRgb rgb = iImage.pixel(i,0); - (*oArray)[i] = ((float)qBlue(rgb)) / 255.0f; - } -} -#endif - static void convert(ImBuf *imBuf, float **oArray, unsigned &oSize) { oSize = imBuf->x; @@ -191,76 +176,6 @@ int LengthDependingThicknessShader::shade(Stroke& stroke) const return 0; } - -ThicknessVariationPatternShader::ThicknessVariationPatternShader(const string pattern_name, float iMinThickness, - float iMaxThickness, bool stretch) -: StrokeShader() -{ - _stretch = stretch; - _minThickness = iMinThickness; - _maxThickness = iMaxThickness; - ImBuf *image = NULL; - vector pathnames; - StringUtils::getPathName(TextureManager::Options::getPatternsPath(), pattern_name, pathnames); - for (vector::const_iterator j = pathnames.begin(); j != pathnames.end(); ++j) { - ifstream ifs(j->c_str()); - if (ifs.is_open()) { - /* OCIO_TODO: support different input color space */ - image = IMB_loadiffname(j->c_str(), 0, NULL); - break; - } - } - if (image == NULL) - cerr << "Error: cannot find pattern \"" << pattern_name << "\" - check the path in the Options" << endl; - else - convert(image, &_aThickness, _size); - IMB_freeImBuf(image); -} - - -int ThicknessVariationPatternShader::shade(Stroke& stroke) const -{ - StrokeInternal::StrokeVertexIterator v, vend; - float *array = NULL; - /* int size; */ /* UNUSED */ - array = _aThickness; - /* size = _size; */ /* UNUSED */ - int vert_size = stroke.strokeVerticesSize(); - int sig = 0; - unsigned index; - const float *originalThickness; - for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) { - originalThickness = v->attribute().getThickness(); - if (_stretch) { - float tmp = v->u() * (_size - 1); - index = (unsigned)floor(tmp); - if ((tmp - index) > (index + 1 - tmp)) - ++index; - } - else { - index = (unsigned)floor(v->curvilinearAbscissa()); - } - index %= _size; - float thicknessR = array[index] * originalThickness[0]; - float thicknessL = array[index] * originalThickness[1]; - if (thicknessR + thicknessL < _minThickness) { - thicknessL = _minThickness / 2.0f; - thicknessR = _minThickness / 2.0f; - } - if (thicknessR + thicknessL > _maxThickness) { - thicknessL = _maxThickness / 2.0f; - thicknessR = _maxThickness / 2.0f; - } - if ((sig == 0) || (sig == vert_size - 1)) - v->attribute().setThickness(1, 1); - else - v->attribute().setThickness(thicknessR, thicknessL); - ++sig; - } - return 0; -} - - static const unsigned NB_VALUE_NOISE = 512; ThicknessNoiseShader::ThicknessNoiseShader() : StrokeShader() @@ -328,51 +243,6 @@ int IncreasingColorShader::shade(Stroke& stroke) const return 0; } -ColorVariationPatternShader::ColorVariationPatternShader(const string pattern_name, bool stretch) : StrokeShader() -{ - _stretch = stretch; - ImBuf *image = NULL; - vector pathnames; - StringUtils::getPathName(TextureManager::Options::getPatternsPath(), pattern_name, pathnames); - for (vector::const_iterator j = pathnames.begin(); j != pathnames.end(); ++j) { - ifstream ifs(j->c_str()); - if (ifs.is_open()) { - /* OCIO_TODO: support different input color space */ - image = IMB_loadiffname(j->c_str(), 0, NULL); //soc - break; - } - } - if (image == NULL) - cerr << "Error: cannot find pattern \"" << pattern_name << "\" - check the path in the Options" << endl; - else - convert(image, &_aVariation, _size); - IMB_freeImBuf(image); -} - -int ColorVariationPatternShader::shade(Stroke& stroke) const -{ - StrokeInternal::StrokeVertexIterator v, vend; - unsigned index; - for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) { - const float *originalColor = v->attribute().getColor(); - if (_stretch) { - float tmp = v->u() * (_size - 1); - index = (unsigned)floor(tmp); - if ((tmp - index) > (index + 1 - tmp)) - ++index; - } - else { - index = (unsigned)floor(v->curvilinearAbscissa()); - } - index %= _size; - float r = _aVariation[index] * originalColor[0]; - float g = _aVariation[index] * originalColor[1]; - float b = _aVariation[index] * originalColor[2]; - v->attribute().setColor(r, g, b); - } - return 0; -} - int MaterialColorShader::shade(Stroke& stroke) const { Interface0DIterator v, vend; @@ -389,29 +259,6 @@ int MaterialColorShader::shade(Stroke& stroke) const return 0; } - -int CalligraphicColorShader::shade(Stroke& stroke) const -{ - Interface0DIterator v; - Functions0D::VertexOrientation2DF0D fun; - StrokeVertex *sv; - for (v = stroke.verticesBegin(); !v.isEnd(); ++v) { - if (fun(v) < 0) - return -1; - Vec2f vertexOri(fun.result); - Vec2d ori2d(-vertexOri[1], vertexOri[0]); - ori2d.normalizeSafe(); - real scal = ori2d * _orientation; - sv = dynamic_cast(&(*v)); - if ((scal < 0)) - sv->attribute().setColor(0, 0, 0); - else - sv->attribute().setColor(1, 1, 1); - } - return 0; -} - - ColorNoiseShader::ColorNoiseShader() : StrokeShader() { _amplitude = 1.0f; @@ -439,11 +286,9 @@ int ColorNoiseShader::shade(Stroke& stroke) const float b = bruit * _amplitude + originalColor[2]; v->attribute().setColor(r, g, b); } - return 0; } - // // Texture Shaders // @@ -466,19 +311,6 @@ int StrokeTextureStepShader::shade(Stroke& stroke) const return 0; } -// Legacy shaders from freestyle standalone texture system -int TextureAssignerShader::shade(Stroke& stroke) const -{ - cout << "TextureAssignerShader is not supported in blender, please use the BlenderTextureShader" << endl; - return 0; -} - -int StrokeTextureShader::shade(Stroke& stroke) const -{ - cout << "StrokeTextureShader is not supported in blender, please use the BlenderTextureShader" << endl; - return 0; -} - // // Geometry Shaders // @@ -541,119 +373,6 @@ int ExternalContourStretcherShader::shade(Stroke& stroke) const return 0; } -int BSplineShader::shade(Stroke& stroke) const -{ - if (stroke.strokeVerticesSize() < 4) - return 0; - - // Find the new vertices - vector newVertices; - double t = 0.0; - float _sampling = 5.0f; - - StrokeInternal::StrokeVertexIterator p0, p1, p2, p3, end; - p0 = stroke.strokeVerticesBegin(); - p1 = p0; - p2 = p1; - p3 = p2; - end = stroke.strokeVerticesEnd(); - double a[4], b[4]; - int n = 0; - while (p1 != end) { -#if 0 - if (p1 == end) - p1 = p0; -#endif - if (p2 == end) - p2 = p1; - if (p3 == end) - p3 = p2; - // compute new matrix - a[0] = (-(p0)->x() + 3 * (p1)->x() - 3 * (p2)->x() + (p3)->x()) / 6.0; - a[1] = (3 * (p0)->x() - 6 * (p1)->x() + 3 * (p2)->x()) / 6.0; - a[2] = (-3 * (p0)->x() + 3 * (p2)->x()) / 6.0; - a[3] = ((p0)->x() + 4 * (p1)->x() + (p2)->x()) / 6.0; - - b[0] = (-(p0)->y() + 3 * (p1)->y() - 3 * (p2)->y() + (p3)->y()) / 6.0; - b[1] = (3 * (p0)->y() - 6 * (p1)->y() + 3 * (p2)->y()) / 6.0; - b[2] = (-3 * (p0)->y() + 3 * (p2)->y()) / 6.0; - b[3] = ((p0)->y() + 4 * (p1)->y() + (p2)->y()) / 6.0; - - // draw the spline depending on resolution: - Vec2d p1p2((p2)->x() - (p1)->x(), (p2)->y() - (p1)->y()); - double norm = p1p2.norm(); - //t = _sampling / norm; - t = 0; - while (t < 1) { - newVertices.push_back(Vec2d((a[3] + t * (a[2] + t * (a[1] + t * a[0]))), - (b[3] + t * (b[2] + t * (b[1] + t * b[0]))))); - t = t + _sampling / norm; - } - if (n > 2) { - ++p0; - ++p1; - ++p2; - ++p3; - } - else { - if (n == 0) - ++p3; - if (n == 1) { - ++p2; - ++p3; - } - if (n == 2) { - ++p1; - ++p2; - ++p3; - } - ++n; - } - } - //last point: - newVertices.push_back(Vec2d((p0)->x(), (p0)->y())); - - int originalSize = newVertices.size(); - _sampling = stroke.ComputeSampling(originalSize); - - // Resample and set x,y coordinates - stroke.Resample(_sampling); - int newsize = stroke.strokeVerticesSize(); - - int nExtraVertex = 0; - if (newsize < originalSize) { - cerr << "Warning: unsufficient resampling" << endl; - } - else { - nExtraVertex = newsize - originalSize; - } - - // assigns the new coordinates: - vector::iterator p = newVertices.begin(), pend = newVertices.end(); - vector::iterator last = p; - n = 0; - StrokeInternal::StrokeVertexIterator it, itend; - for (it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd(); - (it != itend) && (p != pend); - ++it, ++p, ++n) - { - it->setX(p->x()); - it->setY(p->y()); - last = p; - } - - // nExtraVertex should stay unassigned - for (int i = 0; i < nExtraVertex; ++i, ++it, ++n) { - it->setX(last->x()); - it->setY(last->y()); - if (it.isEnd()) { - // XXX Shouldn't we break in this case??? - cerr << "Warning: Problem encountered while creating B-spline" << endl; - } - } - stroke.UpdateLength(); - return 0; -} //!! Bezier curve stroke shader int BezierCurveShader::shade(Stroke& stroke) const @@ -673,15 +392,6 @@ int BezierCurveShader::shade(Stroke& stroke) const previous = v; } -#if 0 - Vec2d tmp; - bool equal = false; - if (data.front() == data.back()) { - tmp = data.back(); - data.pop_back(); - equal = true; - } -#endif // here we build the bezier curve BezierCurve bcurve(data, _error); @@ -702,25 +412,6 @@ int BezierCurveShader::shade(Stroke& stroke) const } } -#if 0 - if (equal) { - if (data.back() == data.front()) { - vector::iterator d = data.begin(), dend; - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "ending point = starting point" << endl; - cout << "---------------DATA----------" << endl; - for (dend = data.end(); d != dend; ++d) { - cout << d->x() << "-" << d->y() << endl; - } - cout << "--------------BEZIER RESULT----------" << endl; - for (d = CurveVertices.begin(), dend = CurveVertices.end(); d != dend; ++d) { - cout << d->x() << "-" << d->y() << endl; - } - } - } - } -#endif - // Resample the Stroke depending on the number of vertices of the bezier curve: int originalSize = CurveVertices.size(); #if 0 @@ -734,11 +425,6 @@ int BezierCurveShader::shade(Stroke& stroke) const cerr << "Warning: unsufficient resampling" << endl; } else { -#if 0 - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Oversampling" << endl; - } -#endif nExtraVertex = newsize - originalSize; if (nExtraVertex != 0) { if (G.debug & G_DEBUG_FREESTYLE) { @@ -752,22 +438,12 @@ int BezierCurveShader::shade(Stroke& stroke) const vector::iterator last = p; int n; StrokeInternal::StrokeVertexIterator it, itend; -#if 0 - for (; p != pend; ++n, ++p); -#endif for (n = 0, it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd(), pend = CurveVertices.end(); (it != itend) && (p != pend); ++it, ++p, ++n) { it->setX(p->x()); it->setY(p->y()); -#if 0 - double x = p->x(); - double y = p->y(); - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "x = " << x << "-" << "y = " << y << endl; - } -#endif last = p; } stroke.UpdateLength(); @@ -816,46 +492,6 @@ int BezierCurveShader::shade(Stroke& stroke) const return 0; } -int InflateShader::shade(Stroke& stroke) const -{ - // we're computing the curvature variance of the stroke. (Combo 5) - // If it's too high, forget about it - Functions1D::Curvature2DAngleF1D fun; - if (fun(stroke) < 0) - return -1; - if (fun.result > _curvatureThreshold) - return 0; - - Functions0D::VertexOrientation2DF0D ori_fun; - Functions0D::Curvature2DAngleF0D curv_fun; - Functions1D::Normal2DF1D norm_fun; - Interface0DIterator it; - StrokeVertex *sv; - for (it = stroke.verticesBegin(); !it.isEnd(); ++it) { - if (ori_fun(it) < 0) - return -1; - Vec2f ntmp(ori_fun.result); - Vec2f n(ntmp.y(), -ntmp.x()); - if (norm_fun(stroke) < 0) - return -1; - Vec2f strokeN(norm_fun.result); - if (n * strokeN < 0) { - n[0] = -n[0]; - n[1] = -n[1]; - } - sv = dynamic_cast(&(*it)); - float u = sv->u(); - float t = 4.0f * (0.25f - (u - 0.5) * (u - 0.5)); - if (curv_fun(it) < 0) - return -1; - float curvature_coeff = (M_PI - curv_fun.result) / M_PI; - Vec2d newPoint(sv->x() + curvature_coeff * t * _amount * n.x(), - sv->y() + curvature_coeff * t * _amount * n.y()); - sv->setPoint(newPoint[0], newPoint[1]); - } - stroke.UpdateLength(); - return 0; -} class CurvePiece { @@ -1040,40 +676,16 @@ int TipRemoverShader::shade(Stroke& stroke) const // assign old attributes to new stroke vertices: vector::iterator a = oldAttributes.begin(), aend = oldAttributes.end(); -#if 0 - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "-----------------------------------------------" << endl; - } -#endif for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); (v != vend) && (a != aend); ++v, ++a) { v->setAttribute(*a); -#if 0 - if (G.debug & G_DEBUG_FREESTYLE) { - cout << "thickness = " << (*a).getThickness()[0] << "-" << (*a).getThickness()[1] << endl; - } -#endif } // we're done! return 0; } -int streamShader::shade(Stroke& stroke) const -{ - if (G.debug & G_DEBUG_FREESTYLE) { - cout << stroke << endl; - } - return 0; -} - -int fstreamShader::shade(Stroke& stroke) const -{ - _stream << stroke << endl; - return 0; -} - } // end of namespace StrokeShaders } /* namespace Freestyle */ diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h index 6ac22c5b2d1..e3842f45eb0 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h @@ -218,51 +218,6 @@ public: virtual int shade(Stroke& stroke) const; }; -/*! [ Thickness Shader ]. -* Applys a pattern (texture) to vary thickness. -* The new thicknesses are the result of the multiplication -* of the pattern and the original thickness -*/ -class ThicknessVariationPatternShader : public StrokeShader -{ -public: - /*! Builds the shader. - * \param pattern_name - * The texture file name. - * \param iMinThickness - * The minimum thickness we don't want to exceed. - * \param iMaxThickness - * The maximum thickness we don't want to exceed. - * \param stretch - * Tells whether the pattern texture must be stretched or repeted to fit the stroke. - */ - ThicknessVariationPatternShader(const string pattern_name, float iMinThickness = 1.0f, float iMaxThickness = 5.0f, - bool stretch = true); - - /*! Destructor.*/ - virtual ~ThicknessVariationPatternShader() - { - if (0 != _aThickness) { - delete[] _aThickness; - _aThickness = 0; - } - } - - virtual string getName() const - { - return "ThicknessVariationPatternShader"; - } - - /*! The shading method. */ - virtual int shade(Stroke& stroke) const; - -private: - float *_aThickness; // array of thickness values, in % of the max (i.e comprised between 0 and 1) - unsigned _size; - float _minThickness; - float _maxThickness; - bool _stretch; -}; /*! [ Thickness Shader ]. * Adds some noise to the stroke thickness. @@ -389,44 +344,6 @@ public: virtual int shade(Stroke& stroke) const; }; -/*! [ Color Shader ]. - * Applys a pattern to vary original color. - * The new color is the result of the multiplication of the pattern and the original color - */ -class ColorVariationPatternShader : public StrokeShader -{ -public: - /*! Builds the shader from the pattern texture file name. - * \param pattern_name - * The file name of the texture file to use as pattern - * \param stretch - * Tells whether the texture must be strecthed or repeted to fit the stroke. - */ - ColorVariationPatternShader(const string pattern_name, bool stretch = true); - - /*! Destructor */ - virtual ~ColorVariationPatternShader() - { - if (0 != _aVariation) { - delete[] _aVariation; - _aVariation = 0; - } - } - - virtual string getName() const - { - return "ColorVariationPatternShader"; - } - - /*! The shading method. */ - virtual int shade(Stroke& stroke) const; - -private: - float *_aVariation; // array of coef values, in % of the max (i.e comprised between 0 and 1) - unsigned _size; - bool _stretch; -}; - /* [ Color Shader ]. * Assigns a color to the stroke depending on the material of the shape to which ot belongs to. (Disney shader) */ @@ -449,28 +366,6 @@ public: virtual int shade(Stroke& stroke) const; }; -class CalligraphicColorShader : public StrokeShader -{ -private: - /* UNUSED */ - // int _textureId; - Vec2d _orientation; - -public: - CalligraphicColorShader(const Vec2d &iOrientation) : StrokeShader() - { - _orientation = iOrientation; - _orientation.normalize(); - } - - virtual string getName() const - { - return "CalligraphicColorShader"; - } - - virtual int shade(Stroke& stroke) const; -}; - /*! [ Color Shader ]. * Shader to add noise to the stroke colors. */ @@ -500,105 +395,6 @@ public: virtual int shade(Stroke& stroke) const; }; -// -// Texture Shaders -// -/////////////////////////////////////////////////////////////////////////////// -/*! [ Texture Shader ]. -* Assigns a texture to the stroke in order to simulate -* its marks system. This shader takes as input an integer value -* telling which texture and blending mode to use among a set of -* predefined textures. -* Here are the different presets: -* 0) -> /brushes/charcoalAlpha.bmp, HUMID_MEDIUM -* 1) -> /brushes/washbrushAlpha.bmp, HUMID_MEDIUM -* 2) -> /brushes/oil.bmp, HUMID_MEDIUM -* 3) -> /brushes/oilnoblend.bmp, HUMID_MEDIUM -* 4) -> /brushes/charcoalAlpha.bmp, DRY_MEDIUM -* 5) -> /brushes/washbrushAlpha.bmp, DRY_MEDIUM -* 6) -> /brushes/opaqueDryBrushAlpha.bmp, OPAQUE_MEDIUM -* 7) -> /brushes/opaqueBrushAlpha.bmp, Stroke::OPAQUE_MEDIUM -* Any other value will lead to the following preset: -* default) -> /brushes/smoothAlpha.bmp, OPAQUE_MEDIUM. -*/ -class TextureAssignerShader : public StrokeShader // FIXME -{ -private: - int _textureId; - -public: - /*! Builds the shader. - * \param id - * The number of the preset to use. - */ - TextureAssignerShader(int id) : StrokeShader() - { - _textureId = id; - } - - virtual string getName() const - { - return "TextureAssignerShader"; - } - - /*! The shading method */ - virtual int shade(Stroke& stroke) const; -}; - -/*! [ Texture Shader ]. -* Assigns a texture and a blending mode to the stroke -* in order to simulate its marks system. -*/ -class StrokeTextureShader : public StrokeShader -{ -private: - string _texturePath; - Stroke::MediumType _mediumType; - bool _tips; // 0 or 1 - -public: - /*! Builds the shader from the texture file name and the blending mode to use. - * \param textureFile - * The the texture file name. - * \attention The textures must be placed in the $FREESTYLE_DIR/data/textures/brushes directory. - * \param mediumType - * The medium type and therefore, the blending mode that must be used for the rendering of this stroke. - * \param iTips - * Tells whether the texture includes tips or not. - * If it is the case, the texture image must respect the following format: - * \verbatim - * __________ - * | | - * | A | - * |__________| - * | | | - * | B | C | - * |_____|____| - * - * \endverbatim - * - A : The stroke's corpus texture - * - B : The stroke's left extremity texture - * - C : The stroke's right extremity texture - */ - StrokeTextureShader(const string textureFile, Stroke::MediumType mediumType = Stroke::OPAQUE_MEDIUM, - bool iTips = false) - : StrokeShader() - { - _texturePath = textureFile; - _mediumType = mediumType; - _tips = iTips; - } - - virtual string getName() const - { - return "StrokeTextureShader"; - } - - /*! The shading method */ - virtual int shade(Stroke& stroke) const; -}; - - // // Geometry Shaders // @@ -678,20 +474,6 @@ public: virtual int shade(Stroke& stroke) const; }; -// B-Spline stroke shader -class BSplineShader: public StrokeShader -{ -public: - BSplineShader() : StrokeShader() {} - - virtual string getName() const - { - return "BSplineShader"; - } - - virtual int shade(Stroke& stroke) const; -}; - // Bezier curve stroke shader /*! [ Geometry Shader ]. @@ -724,37 +506,6 @@ public: virtual int shade(Stroke& stroke) const; }; -/* Shader to inflate the curves. It keeps the extreme points positions and moves the other ones along the 2D normal. - * The displacement value is proportional to the 2d curvature at the considered point (the higher the curvature, - * the smaller the displacement) and to a value specified by the user. - */ -class InflateShader : public StrokeShader -{ -private: - float _amount; - float _curvatureThreshold; - -public: - /*! Builds an inflate shader - * \param iAmount - * A multiplicative coefficient that acts on the amount and direction of displacement - * \param iThreshold - * The curves having a 2d curvature > iThreshold at one of their points is not inflated - */ - InflateShader(float iAmount, float iThreshold) : StrokeShader() - { - _amount = iAmount; - _curvatureThreshold = iThreshold; - } - - virtual string getName() const - { - return "InflateShader"; - } - - /*! The shading method */ - virtual int shade(Stroke& stroke) const; -}; /*! [ Geometry Shader ]. * Shader to modify the Stroke geometry so that it looks more "polygonal". @@ -846,59 +597,6 @@ protected: real _tipLength; }; -/*! [ output Shader ]. - * streams the Stroke - */ -class streamShader : public StrokeShader -{ -public: - /*! Destructor. */ - virtual ~streamShader() {} - - /*! Returns the string "streamShader".*/ - virtual string getName() const - { - return "streamShader"; - } - - /*! The shading method. */ - virtual int shade(Stroke& stroke) const; -}; - -/*! [ output Shader ]. - * streams the Stroke in a file - */ -class fstreamShader : public StrokeShader -{ -protected: - mutable ofstream _stream; - -public: - /*! Builds the shader from the output file name */ - fstreamShader(const char *iFileName) : StrokeShader() - { - _stream.open(iFileName); - if (!_stream.is_open()) { - cerr << "couldn't open file " << iFileName << endl; - } - } - - /*! Destructor. */ - virtual ~fstreamShader() - { - _stream.close(); - } - - /*! Returns the string "fstreamShader".*/ - virtual string getName() const - { - return "fstreamShader"; - } - - /*! The shading method. */ - virtual int shade(Stroke& stroke) const; -}; - /*! [ Texture Shader ]. * Shader to assign texture to the Stroke material. */ -- cgit v1.2.3