diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-11-24 04:28:01 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2014-01-28 18:33:57 +0400 |
commit | 6498b96ce7081db039354228213d72e8c70bd3aa (patch) | |
tree | 17aa60d6dcec97497df8c349b6023f35cd06d78d /release/scripts/freestyle/styles | |
parent | df471369e26b08232000763b2128d6f58a916f82 (diff) |
Reorganized the Freestyle Python API in a hierarchical package structure.
Both C- and Python-coded API components were rearranged into logical groups.
New Python modules are packaged as follows:
freestyle - Top-level package
freestyle.types - Classes for core data structues (e.g., view map)
freestyle.chainingiterators - Pre-defined chaining iterators
freestyle.functions - Pre-defined 0D and 1D functions
freestyle.predicates - Pre-defined 0D and 1D predicates
freestyle.shaders - Pre-defined stroke shaders
freestyle.utils - Utility functions
The Python modules are installed in scripts/freestyle/modules. Pre-defined
styles are installed in scripts/freestyle/styles.
To-do: update styles according to the new Freestyle API package structure.
Diffstat (limited to 'release/scripts/freestyle/styles')
39 files changed, 1587 insertions, 0 deletions
diff --git a/release/scripts/freestyle/styles/anisotropic_diffusion.py b/release/scripts/freestyle/styles/anisotropic_diffusion.py new file mode 100644 index 00000000000..274381a9a89 --- /dev/null +++ b/release/scripts/freestyle/styles/anisotropic_diffusion.py @@ -0,0 +1,44 @@ +# ##### 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 ##### + +# Filename : anisotropic_diffusion.py +# Author : Fredo Durand +# Date : 12/08/2004 +# Purpose : Smoothes lines using an anisotropic diffusion scheme + +from freestyle import ChainPredicateIterator, ConstantThicknessShader, ExternalContourUP1D, IncreasingColorShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, Stroke, StrokeTextureShader, TrueBP1D, TrueUP1D +from logical_operators import AndUP1D, NotUP1D +from shaders import pyDiffusion2Shader + +# pyDiffusion2Shader parameters +offset = 0.25 +nbIter = 30 + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) +Operators.select(upred) +bpred = TrueBP1D() +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) +shaders_list = [ + ConstantThicknessShader(4), + StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False), + SamplingShader(2), + pyDiffusion2Shader(offset, nbIter), + IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/apriori_and_causal_density.py b/release/scripts/freestyle/styles/apriori_and_causal_density.py new file mode 100644 index 00000000000..501c5169be9 --- /dev/null +++ b/release/scripts/freestyle/styles/apriori_and_causal_density.py @@ -0,0 +1,39 @@ +# ##### 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 ##### + +# Filename : apriori_and_causal_density.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Selects the lines with high a priori density and +# subjects them to the causal density so as to avoid +# cluttering + +from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \ + Operators, QuantitativeInvisibilityUP1D, TrueBP1D +from PredicatesU1D import pyDensityUP1D, pyHighViewMapDensityUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.3, IntegrationType.LAST)) +Operators.select(upred) +bpred = TrueBP1D() +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + ConstantThicknessShader(2), + ConstantColorShader(0, 0, 0, 1), + ] +Operators.create(pyDensityUP1D(1, 0.1, IntegrationType.MEAN), shaders_list) diff --git a/release/scripts/freestyle/styles/apriori_density.py b/release/scripts/freestyle/styles/apriori_density.py new file mode 100644 index 00000000000..f59dd5cd36d --- /dev/null +++ b/release/scripts/freestyle/styles/apriori_density.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : apriori_density.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws lines having a high a priori density + +from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D +from PredicatesU1D import pyHighViewMapDensityUP1D +from logical_operators import AndUP1D, NotUP1D + +Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.1,5))) +bpred = TrueBP1D() +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyHighViewMapDensityUP1D(0.0007,5)) +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + ConstantThicknessShader(2), + ConstantColorShader(0.0, 0.0, 0.0,1) + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/backbone_stretcher.py b/release/scripts/freestyle/styles/backbone_stretcher.py new file mode 100644 index 00000000000..c920d66328e --- /dev/null +++ b/release/scripts/freestyle/styles/backbone_stretcher.py @@ -0,0 +1,35 @@ +# ##### 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 ##### + +# Filename : backbone_stretcher.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Stretches the geometry of visible lines + +from freestyle import BackboneStretcherShader, ChainSilhouetteIterator, ConstantColorShader, \ + Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + TextureAssignerShader(4), + ConstantColorShader(0.5, 0.5, 0.5), + BackboneStretcherShader(20), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/blueprint_circles.py b/release/scripts/freestyle/styles/blueprint_circles.py new file mode 100644 index 00000000000..8d80893a6c3 --- /dev/null +++ b/release/scripts/freestyle/styles/blueprint_circles.py @@ -0,0 +1,42 @@ +# ##### 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 ##### + +# Filename : blueprint_circles.py +# Author : Emmanuel Turquin +# Date : 04/08/2005 +# Purpose : Produces a blueprint using circular contour strokes + +from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ + Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D +from PredicatesU1D import pyHigherLengthUP1D +from logical_operators import AndUP1D, NotUP1D +from shaders import pyBluePrintCirclesShader, pyPerlinNoise1DShader + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) +bpred = SameShapeIdBP1D() +Operators.select(upred) +Operators.bidirectional_chain(ChainPredicateIterator(upred,bpred), NotUP1D(upred)) +Operators.select(pyHigherLengthUP1D(200)) +shaders_list = [ + ConstantThicknessShader(5), + pyBluePrintCirclesShader(3), + pyPerlinNoise1DShader(0.1, 15, 8), + TextureAssignerShader(4), + IncreasingColorShader(0.8, 0.8, 0.3, 0.4, 0.3, 0.3, 0.3, 0.1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/blueprint_ellipses.py b/release/scripts/freestyle/styles/blueprint_ellipses.py new file mode 100644 index 00000000000..d5e9f385c12 --- /dev/null +++ b/release/scripts/freestyle/styles/blueprint_ellipses.py @@ -0,0 +1,42 @@ +# ##### 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 ##### + +# Filename : blueprint_ellipses.py +# Author : Emmanuel Turquin +# Date : 04/08/2005 +# Purpose : Produces a blueprint using elliptic contour strokes + +from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ + Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D +from PredicatesU1D import pyHigherLengthUP1D +from logical_operators import AndUP1D, NotUP1D +from shaders import pyBluePrintEllipsesShader, pyPerlinNoise1DShader + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) +bpred = SameShapeIdBP1D() +Operators.select(upred) +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) +Operators.select(pyHigherLengthUP1D(200)) +shaders_list = [ + ConstantThicknessShader(5), + pyBluePrintEllipsesShader(3), + pyPerlinNoise1DShader(0.1, 10, 8), + TextureAssignerShader(4), + IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.3, 0.3, 0.3, 0.1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/blueprint_squares.py b/release/scripts/freestyle/styles/blueprint_squares.py new file mode 100644 index 00000000000..35cfc33fd69 --- /dev/null +++ b/release/scripts/freestyle/styles/blueprint_squares.py @@ -0,0 +1,43 @@ +# ##### 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 ##### + +# Filename : blueprint_squares.py +# Author : Emmanuel Turquin +# Date : 04/08/2005 +# Purpose : Produces a blueprint using square contour strokes + +from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ + Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TextureAssignerShader, TrueUP1D +from PredicatesU1D import pyHigherLengthUP1D +from logical_operators import AndUP1D, NotUP1D +from shaders import pyBluePrintSquaresShader, pyPerlinNoise1DShader + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) +bpred = SameShapeIdBP1D() +Operators.select(upred) +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) +Operators.select(pyHigherLengthUP1D(200)) +shaders_list = [ + ConstantThicknessShader(8), + pyBluePrintSquaresShader(2, 20), + pyPerlinNoise1DShader(0.07, 10, 8), + TextureAssignerShader(4), + IncreasingColorShader(0.6, 0.3, 0.3, 0.7, 0.6, 0.3, 0.3, 0.3), + ConstantThicknessShader(4), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/cartoon.py b/release/scripts/freestyle/styles/cartoon.py new file mode 100644 index 00000000000..de4a5dd6c5d --- /dev/null +++ b/release/scripts/freestyle/styles/cartoon.py @@ -0,0 +1,38 @@ +# ##### 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 ##### + +# Filename : cartoon.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws colored lines. The color is automatically +# infered from each object's material in a cartoon-like +# fashion. + +from freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, TrueUP1D +from logical_operators import NotUP1D +from shaders import pyMaterialColorShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + BezierCurveShader(3), + ConstantThicknessShader(4), + pyMaterialColorShader(0.8), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/contour.py b/release/scripts/freestyle/styles/contour.py new file mode 100644 index 00000000000..f7a42d9c906 --- /dev/null +++ b/release/scripts/freestyle/styles/contour.py @@ -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. +# +# ##### END GPL LICENSE BLOCK ##### + +# Filename : contour.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws each object's visible contour + +from freestyle import ChainPredicateIterator, ConstantThicknessShader, ContourUP1D, IncreasingColorShader, \ + Operators, QuantitativeInvisibilityUP1D, SameShapeIdBP1D, TrueUP1D +from logical_operators import AndUP1D, NotUP1D + +Operators.select(AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D())) +bpred = SameShapeIdBP1D() +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ContourUP1D()) +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + ConstantThicknessShader(5.0), + IncreasingColorShader(0.8,0,0,1,0.1,0,0,1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/curvature2d.py b/release/scripts/freestyle/styles/curvature2d.py new file mode 100644 index 00000000000..4204951fbd5 --- /dev/null +++ b/release/scripts/freestyle/styles/curvature2d.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : curvature2d.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : The stroke points are colored in gray levels and depending +# on the 2d curvature value + +from freestyle import ChainSilhouetteIterator, ConstantThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, Stroke, StrokeTextureShader, TrueUP1D +from logical_operators import NotUP1D +from shaders import py2DCurvatureColorShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False), + ConstantThicknessShader(5), + py2DCurvatureColorShader() + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/external_contour.py b/release/scripts/freestyle/styles/external_contour.py new file mode 100644 index 00000000000..c7e51f1a16d --- /dev/null +++ b/release/scripts/freestyle/styles/external_contour.py @@ -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. +# +# ##### END GPL LICENSE BLOCK ##### + +# Filename : external_contour.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the external contour of the scene + +from freestyle import ChainPredicateIterator, ConstantColorShader, ConstantThicknessShader, \ + ExternalContourUP1D, Operators, QuantitativeInvisibilityUP1D, TrueBP1D, TrueUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) +Operators.select(upred) +bpred = TrueBP1D() +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) +shaders_list = [ + ConstantThicknessShader(3), + ConstantColorShader(0.0, 0.0, 0.0, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/external_contour_sketchy.py b/release/scripts/freestyle/styles/external_contour_sketchy.py new file mode 100644 index 00000000000..b8d381ea24e --- /dev/null +++ b/release/scripts/freestyle/styles/external_contour_sketchy.py @@ -0,0 +1,43 @@ +# ##### 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 ##### + +# Filename : external_contour_sketchy.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the external contour of the scene using a sketchy +# chaining iterator (in particular each ViewEdge can be drawn +# several times + +from ChainingIterators import pySketchyChainingIterator +from freestyle import ExternalContourUP1D, IncreasingColorShader, IncreasingThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ + TextureAssignerShader, TrueUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) +Operators.select(upred) +Operators.bidirectional_chain(pySketchyChainingIterator(), NotUP1D(upred)) +shaders_list = [ + SamplingShader(4), + SpatialNoiseShader(10, 150, 2, 1, 1), + IncreasingThicknessShader(4, 10), + SmoothingShader(400, 0.1, 0, 0.2, 0, 0, 0, 1), + IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + TextureAssignerShader(4), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/external_contour_smooth.py b/release/scripts/freestyle/styles/external_contour_smooth.py new file mode 100644 index 00000000000..045984ea4a5 --- /dev/null +++ b/release/scripts/freestyle/styles/external_contour_smooth.py @@ -0,0 +1,39 @@ +# ##### 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 ##### + +# Filename : external_contour_smooth.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws a smooth external contour + +from freestyle import ChainPredicateIterator, ExternalContourUP1D, IncreasingColorShader, \ + IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ + SmoothingShader, TrueBP1D, TrueUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) +Operators.select(upred) +bpred = TrueBP1D() +Operators.bidirectional_chain(ChainPredicateIterator(upred, bpred), NotUP1D(upred)) +shaders_list = [ + SamplingShader(2), + IncreasingThicknessShader(4,20), + IncreasingColorShader(1.0, 0.0, 0.5,1, 0.5,1, 0.3, 1), + SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/haloing.py b/release/scripts/freestyle/styles/haloing.py new file mode 100644 index 00000000000..feadb5dd1ee --- /dev/null +++ b/release/scripts/freestyle/styles/haloing.py @@ -0,0 +1,46 @@ +# ##### 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 ##### + +# Filename : haloing.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : This style module selects the lines that +# are connected (in the image) to a specific +# object and trims them in order to produce +# a haloing effect around the target shape + +from freestyle import ChainSilhouetteIterator, Id, IncreasingColorShader, IncreasingThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TipRemoverShader, TrueUP1D +from PredicatesU1D import pyIsOccludedByUP1D +from logical_operators import AndUP1D, NotUP1D +from shaders import pyTVertexRemoverShader + +# id corresponds to the id of the target object +# (accessed by SHIFT+click) +id = Id(3,0) +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyIsOccludedByUP1D(id)) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +shaders_list = [ + IncreasingThicknessShader(3, 5), + IncreasingColorShader(1,0,0, 1,0,1,0,1), + SamplingShader(1.0), + pyTVertexRemoverShader(), + TipRemoverShader(3.0), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/ignore_small_occlusions.py b/release/scripts/freestyle/styles/ignore_small_occlusions.py new file mode 100644 index 00000000000..a9dc102a0bd --- /dev/null +++ b/release/scripts/freestyle/styles/ignore_small_occlusions.py @@ -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. +# +# ##### END GPL LICENSE BLOCK ##### + +# Filename : ignore_small_oclusions.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : The strokes are drawn through small occlusions + +from ChainingIterators import pyFillOcclusionsAbsoluteChainingIterator +from freestyle import ConstantColorShader, ConstantThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +#Operators.bidirectional_chain(pyFillOcclusionsChainingIterator(0.1)) +Operators.bidirectional_chain(pyFillOcclusionsAbsoluteChainingIterator(12)) +shaders_list = [ + SamplingShader(5.0), + ConstantThicknessShader(3), + ConstantColorShader(0.0, 0.0, 0.0), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/invisible_lines.py b/release/scripts/freestyle/styles/invisible_lines.py new file mode 100644 index 00000000000..b94d7b0a5fd --- /dev/null +++ b/release/scripts/freestyle/styles/invisible_lines.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : invisible_lines.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws all lines whose Quantitative Invisibility +# is different from 0 + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D + +upred = NotUP1D(QuantitativeInvisibilityUP1D(0)) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +shaders_list = [ + SamplingShader(5.0), + ConstantThicknessShader(3.0), + ConstantColorShader(0.7, 0.7, 0.7), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/japanese_bigbrush.py b/release/scripts/freestyle/styles/japanese_bigbrush.py new file mode 100644 index 00000000000..4a5203fb31f --- /dev/null +++ b/release/scripts/freestyle/styles/japanese_bigbrush.py @@ -0,0 +1,56 @@ +# ##### 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 ##### + +# Filename : japanese_bigbrush.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Simulates a big brush fr oriental painting + +from freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantColorShader, \ + ConstantThicknessShader, IntegrationType, Operators, QuantitativeInvisibilityUP1D, \ + SamplingShader, TextureAssignerShader, TipRemoverShader +from Functions0D import pyInverseCurvature2DAngleF0D +from PredicatesB1D import pyLengthBP1D +from PredicatesU0D import pyParameterUP0D +from PredicatesU1D import pyDensityUP1D, pyHigherLengthUP1D, pyHigherNumberOfTurnsUP1D +from logical_operators import NotUP1D +from shaders import pyNonLinearVaryingThicknessShader, pySamplingShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +## Splits strokes at points of highest 2D curavture +## when there are too many abrupt turns in it +func = pyInverseCurvature2DAngleF0D() +Operators.recursive_split(func, pyParameterUP0D(0.2, 0.8), NotUP1D(pyHigherNumberOfTurnsUP1D(3, 0.5)), 2) +## Keeps only long enough strokes +Operators.select(pyHigherLengthUP1D(100)) +## Sorts so as to draw the longest strokes first +## (this will be done using the causal density) +Operators.sort(pyLengthBP1D()) +shaders_list = [ + pySamplingShader(10), + BezierCurveShader(30), + SamplingShader(50), + ConstantThicknessShader(10), + pyNonLinearVaryingThicknessShader(4, 25, 0.6), + TextureAssignerShader(6), + ConstantColorShader(0.2, 0.2, 0.2,1.0), + TipRemoverShader(10), + ] +## Use the causal density to avoid cluttering +Operators.create(pyDensityUP1D(8, 0.4, IntegrationType.MEAN), shaders_list) diff --git a/release/scripts/freestyle/styles/long_anisotropically_dense.py b/release/scripts/freestyle/styles/long_anisotropically_dense.py new file mode 100644 index 00000000000..f181bcc2348 --- /dev/null +++ b/release/scripts/freestyle/styles/long_anisotropically_dense.py @@ -0,0 +1,68 @@ +# ##### 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 ##### + +# Filename : long_anisotropically_dense.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Selects the lines that are long and have a high anisotropic +# a priori density and uses causal density +# to draw without cluttering. Ideally, half of the +# selected lines are culled using the causal density. +# +# ********************* WARNING ************************************* +# ******** The Directional a priori density maps must ****** +# ******** have been computed prior to using this style module ****** + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, DensityF1D, \ + IntegrationType, Operators, QuantitativeInvisibilityUP1D, SamplingShader, UnaryPredicate1D +from PredicatesB1D import pyLengthBP1D +from PredicatesU1D import pyHighDensityAnisotropyUP1D, pyHigherLengthUP1D +from logical_operators import NotUP1D + +## custom density predicate +class pyDensityUP1D(UnaryPredicate1D): + def __init__(self, wsize, threshold, integration=IntegrationType.MEAN, sampling=2.0): + UnaryPredicate1D.__init__(self) + self._wsize = wsize + self._threshold = threshold + self._integration = integration + self._func = DensityF1D(self._wsize, self._integration, sampling) + self._func2 = DensityF1D(self._wsize, IntegrationType.MAX, sampling) + def __call__(self, inter): + c = self._func(inter) + m = self._func2(inter) + if c < self._threshold: + return 1 + if m > 4*c: + if c < 1.5*self._threshold: + return 1 + return 0 + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(),NotUP1D(QuantitativeInvisibilityUP1D(0))) +Operators.select(pyHigherLengthUP1D(40)) +## selects lines having a high anisotropic a priori density +Operators.select(pyHighDensityAnisotropyUP1D(0.3,4)) +Operators.sort(pyLengthBP1D()) +shaders_list = [ + SamplingShader(2.0), + ConstantThicknessShader(2), + ConstantColorShader(0.2,0.2,0.25,1), + ] +## uniform culling +Operators.create(pyDensityUP1D(3.0,2.0e-2, IntegrationType.MEAN, 0.1), shaders_list) diff --git a/release/scripts/freestyle/styles/multiple_parameterization.py b/release/scripts/freestyle/styles/multiple_parameterization.py new file mode 100644 index 00000000000..922a5ffa972 --- /dev/null +++ b/release/scripts/freestyle/styles/multiple_parameterization.py @@ -0,0 +1,47 @@ +# ##### 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 ##### + +# Filename : multiple_parameterization.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : The thickness and the color of the strokes vary continuously +# independently from occlusions although only +# visible lines are actually drawn. This is equivalent +# to assigning the thickness using a parameterization covering +# the complete silhouette (visible+invisible) and drawing +# the strokes using a second parameterization that only +# covers the visible portions. + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingColorShader, \ + IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ + TextureAssignerShader, TrueUP1D +from shaders import pyHLRShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +## Chain following the same nature, but without the restriction +## of staying inside the selection (0). +Operators.bidirectional_chain(ChainSilhouetteIterator(0)) +shaders_list = [ + SamplingShader(20), + IncreasingThicknessShader(1.5, 30), + ConstantColorShader(0.0, 0.0, 0.0), + IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + TextureAssignerShader(-1), + pyHLRShader(), ## this shader draws only visible portions + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/nature.py b/release/scripts/freestyle/styles/nature.py new file mode 100644 index 00000000000..fdc627ecade --- /dev/null +++ b/release/scripts/freestyle/styles/nature.py @@ -0,0 +1,39 @@ +# ##### 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 ##### + +# Filename : nature.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Uses the NatureUP1D predicate to select the lines +# of a given type (among Nature.SILHOUETTE, Nature.CREASE, Nature.SUGGESTIVE_CONTOURS, +# Nature.BORDERS). +# The suggestive contours must have been enabled in the +# options dialog to appear in the View Map. + +from freestyle import ChainSilhouetteIterator, IncreasingColorShader, \ + IncreasingThicknessShader, Nature, Operators, TrueUP1D +from PredicatesU1D import pyNatureUP1D +from logical_operators import NotUP1D + +Operators.select(pyNatureUP1D(Nature.SILHOUETTE)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(pyNatureUP1D(Nature.SILHOUETTE))) +shaders_list = [ + IncreasingThicknessShader(3, 10), + IncreasingColorShader(0.0, 0.0, 0.0, 1, 0.8, 0, 0, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/near_lines.py b/release/scripts/freestyle/styles/near_lines.py new file mode 100644 index 00000000000..977b99546bc --- /dev/null +++ b/release/scripts/freestyle/styles/near_lines.py @@ -0,0 +1,38 @@ +# ##### 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 ##### + +# Filename : near_lines.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the lines that are "closer" than a threshold +# (between 0 and 1) + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + IntegrationType, Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D +from PredicatesU1D import pyZSmallerUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), pyZSmallerUP1D(0.5, IntegrationType.MEAN)) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +shaders_list = [ + TextureAssignerShader(-1), + ConstantThicknessShader(5), + ConstantColorShader(0.0, 0.0, 0.0), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/occluded_by_specific_object.py b/release/scripts/freestyle/styles/occluded_by_specific_object.py new file mode 100644 index 00000000000..0ae0804f2a8 --- /dev/null +++ b/release/scripts/freestyle/styles/occluded_by_specific_object.py @@ -0,0 +1,40 @@ +# ##### 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 ##### + +# Filename : occluded_by_specific_object.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws only the lines that are occluded by a given object + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Id, Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from PredicatesU1D import pyIsInOccludersListUP1D +from logical_operators import AndUP1D, NotUP1D + +## the id of the occluder (use SHIFT+click on the ViewMap to +## retrieve ids) +id = Id(3,0) +upred = AndUP1D(NotUP1D(QuantitativeInvisibilityUP1D(0)), pyIsInOccludersListUP1D(id)) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +shaders_list = [ + SamplingShader(5), + ConstantThicknessShader(3), + ConstantColorShader(0.3, 0.3, 0.3, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/polygonalize.py b/release/scripts/freestyle/styles/polygonalize.py new file mode 100644 index 00000000000..e570e15ca6c --- /dev/null +++ b/release/scripts/freestyle/styles/polygonalize.py @@ -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. +# +# ##### END GPL LICENSE BLOCK ##### + +# Filename : polygonalize.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Make the strokes more "polygonal" + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, PolygonalizationShader, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + SamplingShader(2.0), + ConstantThicknessShader(3), + ConstantColorShader(0.0, 0.0, 0.0), + PolygonalizationShader(8), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/qi0.py b/release/scripts/freestyle/styles/qi0.py new file mode 100644 index 00000000000..8386817754a --- /dev/null +++ b/release/scripts/freestyle/styles/qi0.py @@ -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. +# +# ##### END GPL LICENSE BLOCK ##### + +# Filename : qi0.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the visible lines (chaining follows same nature lines) +# (most basic style module) + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + SamplingShader(5.0), + ConstantThicknessShader(4.0), + ConstantColorShader(0.0, 0.0, 0.0) + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/qi0_not_external_contour.py b/release/scripts/freestyle/styles/qi0_not_external_contour.py new file mode 100644 index 00000000000..6315f1291d4 --- /dev/null +++ b/release/scripts/freestyle/styles/qi0_not_external_contour.py @@ -0,0 +1,41 @@ +# ##### 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 ##### + +# Filename : qi0_not_external_contour.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the visible lines (chaining follows same nature lines) +# that do not belong to the external contour of the scene + +from freestyle import BackboneStretcherShader, ChainSilhouetteIterator, ExternalContourUP1D, \ + IncreasingColorShader, IncreasingThicknessShader, Operators, QuantitativeInvisibilityUP1D, \ + SamplingShader, SpatialNoiseShader, TextureAssignerShader, TrueUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(QuantitativeInvisibilityUP1D(0), ExternalContourUP1D()) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +shaders_list = [ + SamplingShader(4), + SpatialNoiseShader(4, 150, 2, True, True), + IncreasingThicknessShader(2, 5), + BackboneStretcherShader(20), + IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + TextureAssignerShader(4), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/qi1.py b/release/scripts/freestyle/styles/qi1.py new file mode 100644 index 00000000000..d5424b37748 --- /dev/null +++ b/release/scripts/freestyle/styles/qi1.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : qi1.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws lines hidden by one surface. +# *** Quantitative Invisibility must have been +# enabled in the options dialog to use this style module **** + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(1)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(1))) +shaders_list = [ + SamplingShader(5.0), + ConstantThicknessShader(3), + ConstantColorShader(0.5, 0.5, 0.5, 1) + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/qi2.py b/release/scripts/freestyle/styles/qi2.py new file mode 100644 index 00000000000..367139de2e2 --- /dev/null +++ b/release/scripts/freestyle/styles/qi2.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : qi2.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws lines hidden by two surfaces. +# *** Quantitative Invisibility must have been +# enabled in the options dialog to use this style module **** + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(2)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(2))) +shaders_list = [ + SamplingShader(10), + ConstantThicknessShader(1.5), + ConstantColorShader(0.7, 0.7, 0.7, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/sequentialsplit_sketchy.py b/release/scripts/freestyle/styles/sequentialsplit_sketchy.py new file mode 100644 index 00000000000..755098d96b6 --- /dev/null +++ b/release/scripts/freestyle/styles/sequentialsplit_sketchy.py @@ -0,0 +1,44 @@ +# ##### 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 ##### + +# Filename : sequentialsplit_sketchy.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Use the sequential split with two different +# predicates to specify respectively the starting and +# the stopping extremities for strokes + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, Nature, \ + Operators, QuantitativeInvisibilityUP1D, SpatialNoiseShader, TextureAssignerShader, TrueUP1D +from PredicatesU0D import pyBackTVertexUP0D, pyVertexNatureUP0D +from logical_operators import NotUP1D + +upred = QuantitativeInvisibilityUP1D(0) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +## starting and stopping predicates: +start = pyVertexNatureUP0D(Nature.NON_T_VERTEX) +stop = pyBackTVertexUP0D() +Operators.sequential_split(start, stop, 10) +shaders_list = [ + SpatialNoiseShader(7, 120, 2, True, True), + IncreasingThicknessShader(5, 8), + ConstantColorShader(0.2, 0.2, 0.2, 1), + TextureAssignerShader(4), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py b/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py new file mode 100644 index 00000000000..c1cc4361f7f --- /dev/null +++ b/release/scripts/freestyle/styles/sketchy_multiple_parameterization.py @@ -0,0 +1,43 @@ +# ##### 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 ##### + +# Filename : sketchy_multiple_parameterization.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Builds sketchy strokes whose topology relies on a +# parameterization that covers the complete lines (visible+invisible) +# whereas only the visible portions are actually drawn + +from ChainingIterators import pySketchyChainSilhouetteIterator +from freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ + TextureAssignerShader, TrueUP1D +from shaders import pyHLRShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, False)) +shaders_list = [ + SamplingShader(2), + SpatialNoiseShader(15, 120, 2, True, True), + IncreasingThicknessShader(5, 30), + SmoothingShader(100, 0.05, 0, 0.2, 0, 0, 0, 1), + IncreasingColorShader(0, 0.2, 0, 1, 0.2, 0.7, 0.2, 1), + TextureAssignerShader(6), + pyHLRShader(), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/sketchy_topology_broken.py b/release/scripts/freestyle/styles/sketchy_topology_broken.py new file mode 100644 index 00000000000..27669d20a4e --- /dev/null +++ b/release/scripts/freestyle/styles/sketchy_topology_broken.py @@ -0,0 +1,47 @@ +# ##### 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 ##### + +# Filename : sketchy_topology_broken.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : The topology of the strokes is, first, built +# independantly from the 3D topology of objects, +# and, second, so as to chain several times the same ViewEdge. + +from ChainingIterators import pySketchyChainingIterator +from freestyle import IncreasingColorShader, IncreasingThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ + TextureAssignerShader, TrueUP1D +from shaders import pyBackboneStretcherNoCuspShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +## Chain 3 times each ViewEdge indpendantly from the +## initial objects topology +Operators.bidirectional_chain(pySketchyChainingIterator(3)) +shaders_list = [ + SamplingShader(4), + SpatialNoiseShader(6, 120, 2, True, True), + IncreasingThicknessShader(4, 10), + SmoothingShader(100, 0.1, 0, 0.2, 0, 0, 0, 1), + pyBackboneStretcherNoCuspShader(20), + #ConstantColorShader(0.0, 0.0, 0.0) + IncreasingColorShader(0.2, 0.2, 0.2, 1, 0.5, 0.5, 0.5, 1), + #IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + TextureAssignerShader(4), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/sketchy_topology_preserved.py b/release/scripts/freestyle/styles/sketchy_topology_preserved.py new file mode 100644 index 00000000000..25e593b7c99 --- /dev/null +++ b/release/scripts/freestyle/styles/sketchy_topology_preserved.py @@ -0,0 +1,42 @@ +# ##### 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 ##### + +# Filename : sketchy_topology_preserved.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : The topology of the strokes is built +# so as to chain several times the same ViewEdge. +# The topology of the objects is preserved + +from ChainingIterators import pySketchyChainSilhouetteIterator +from freestyle import ConstantColorShader, IncreasingThicknessShader, Operators, \ + QuantitativeInvisibilityUP1D, SamplingShader, SmoothingShader, SpatialNoiseShader, \ + TextureAssignerShader, TrueUP1D + +upred = QuantitativeInvisibilityUP1D(0) +Operators.select(upred) +Operators.bidirectional_chain(pySketchyChainSilhouetteIterator(3, True)) +shaders_list = [ + SamplingShader(4), + SpatialNoiseShader(20, 220, 2, True, True), + IncreasingThicknessShader(4, 8), + SmoothingShader(300, 0.05, 0, 0.2, 0, 0, 0, 0.5), + ConstantColorShader(0.6, 0.2, 0.0), + TextureAssignerShader(4), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py b/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py new file mode 100644 index 00000000000..474183c3810 --- /dev/null +++ b/release/scripts/freestyle/styles/split_at_highest_2d_curvatures.py @@ -0,0 +1,41 @@ +# ##### 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 ##### + +# Filename : split_at_highest_2d_curvature.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the visible lines (chaining follows same nature lines) +# (most basic style module) + +from freestyle import ChainSilhouetteIterator, ConstantThicknessShader, IncreasingColorShader, \ + Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D +from Functions0D import pyInverseCurvature2DAngleF0D +from PredicatesU0D import pyParameterUP0D +from PredicatesU1D import pyHigherLengthUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +func = pyInverseCurvature2DAngleF0D() +Operators.recursive_split(func, pyParameterUP0D(0.4, 0.6), NotUP1D(pyHigherLengthUP1D(100)), 2) +shaders_list = [ + ConstantThicknessShader(10), + IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + TextureAssignerShader(3), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/split_at_tvertices.py b/release/scripts/freestyle/styles/split_at_tvertices.py new file mode 100644 index 00000000000..70446e0178e --- /dev/null +++ b/release/scripts/freestyle/styles/split_at_tvertices.py @@ -0,0 +1,40 @@ +# ##### 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 ##### + +# Filename : split_at_tvertices.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws strokes that starts and stops at Tvertices (visible or not) + +from freestyle import ChainSilhouetteIterator, ConstantThicknessShader, IncreasingColorShader, \ + Nature, Operators, QuantitativeInvisibilityUP1D, TextureAssignerShader, TrueUP1D +from PredicatesU0D import pyVertexNatureUP0D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +start = pyVertexNatureUP0D(Nature.T_VERTEX) +## use the same predicate to decide where to start and where to stop +## the strokes: +Operators.sequential_split(start, start, 10) +shaders_list = [ + ConstantThicknessShader(5), + IncreasingColorShader(1, 0, 0, 1, 0, 1, 0, 1), + TextureAssignerShader(3), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/stroke_texture.py b/release/scripts/freestyle/styles/stroke_texture.py new file mode 100644 index 00000000000..c925633b579 --- /dev/null +++ b/release/scripts/freestyle/styles/stroke_texture.py @@ -0,0 +1,38 @@ +# ##### 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 ##### + +# Filename : stroke_texture.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws textured strokes (illustrate the StrokeTextureShader shader) + +from freestyle import BezierCurveShader, ChainSilhouetteIterator, ConstantColorShader, \ + ConstantThicknessShader, Operators, QuantitativeInvisibilityUP1D, SamplingShader, \ + Stroke, StrokeTextureShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + SamplingShader(3), + BezierCurveShader(4), + StrokeTextureShader("washbrushAlpha.bmp", Stroke.DRY_MEDIUM, True), + ConstantThicknessShader(40), + ConstantColorShader(0, 0, 0, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/suggestive.py b/release/scripts/freestyle/styles/suggestive.py new file mode 100644 index 00000000000..bb5e20f2a2e --- /dev/null +++ b/release/scripts/freestyle/styles/suggestive.py @@ -0,0 +1,38 @@ +# ##### 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 ##### + +# Filename : suggestive.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Draws the suggestive contours. +# ***** The suggestive contours must be enabled +# in the options dialog ***** + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \ + Nature, Operators, QuantitativeInvisibilityUP1D, TrueUP1D +from PredicatesU1D import pyNatureUP1D +from logical_operators import AndUP1D, NotUP1D + +upred = AndUP1D(pyNatureUP1D(Nature.SUGGESTIVE_CONTOUR), QuantitativeInvisibilityUP1D(0)) +Operators.select(upred) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(upred)) +shaders_list = [ + IncreasingThicknessShader(1, 3), + ConstantColorShader(0.2, 0.2, 0.2, 1), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py b/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py new file mode 100644 index 00000000000..20c8240b3cd --- /dev/null +++ b/release/scripts/freestyle/styles/thickness_fof_depth_discontinuity.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : thickness_fof_depth_discontinuity.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Assigns to strokes a thickness that depends on the depth discontinuity + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D +from shaders import pyDepthDiscontinuityThicknessShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + SamplingShader(1), + ConstantThicknessShader(3), + ConstantColorShader(0.0, 0.0, 0.0), + pyDepthDiscontinuityThicknessShader(0.8, 6), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/tipremover.py b/release/scripts/freestyle/styles/tipremover.py new file mode 100644 index 00000000000..efcddb7321f --- /dev/null +++ b/release/scripts/freestyle/styles/tipremover.py @@ -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. +# +# ##### END GPL LICENSE BLOCK ##### + +# Filename : tipremover.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Removes strokes extremities + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TipRemoverShader, TrueUP1D +from logical_operators import NotUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + SamplingShader(5), + ConstantThicknessShader(3), + ConstantColorShader(0, 0, 0), + TipRemoverShader(20), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/tvertex_remover.py b/release/scripts/freestyle/styles/tvertex_remover.py new file mode 100644 index 00000000000..565962c1b0e --- /dev/null +++ b/release/scripts/freestyle/styles/tvertex_remover.py @@ -0,0 +1,37 @@ +# ##### 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 ##### + +# Filename : tvertex_remover.py +# Author : Stephane Grabli +# Date : 04/08/2005 +# Purpose : Removes TVertices + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, IncreasingThicknessShader, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, TrueUP1D +from logical_operators import NotUP1D +from shaders import pyTVertexRemoverShader + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator(), NotUP1D(QuantitativeInvisibilityUP1D(0))) +shaders_list = [ + IncreasingThicknessShader(3, 5), + ConstantColorShader(0.2, 0.2, 0.2, 1), + SamplingShader(10.0), + pyTVertexRemoverShader(), + ] +Operators.create(TrueUP1D(), shaders_list) diff --git a/release/scripts/freestyle/styles/uniformpruning_zsort.py b/release/scripts/freestyle/styles/uniformpruning_zsort.py new file mode 100644 index 00000000000..efa977ccf5f --- /dev/null +++ b/release/scripts/freestyle/styles/uniformpruning_zsort.py @@ -0,0 +1,39 @@ +# ##### 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 ##### + +# Filename : uniformpruning_zsort.py +# Authors : Fredo Durand, Stephane Grabli, Francois Sillion, Emmanuel Turquin +# Date : 08/04/2005 + +from freestyle import ChainSilhouetteIterator, ConstantColorShader, ConstantThicknessShader, IntegrationType, \ + Operators, QuantitativeInvisibilityUP1D, SamplingShader, Stroke, StrokeTextureShader +from PredicatesB1D import pyZBP1D +from PredicatesU1D import pyDensityUP1D + +Operators.select(QuantitativeInvisibilityUP1D(0)) +Operators.bidirectional_chain(ChainSilhouetteIterator()) +#Operators.sequential_split(pyVertexNatureUP0D(Nature.VIEW_VERTEX), 2) +Operators.sort(pyZBP1D()) +shaders_list = [ + StrokeTextureShader("smoothAlpha.bmp", Stroke.OPAQUE_MEDIUM, False), + ConstantThicknessShader(3), + SamplingShader(5.0), + ConstantColorShader(0, 0, 0, 1), + ] +Operators.create(pyDensityUP1D(2, 0.05, IntegrationType.MEAN, 4), shaders_list) +#Operators.create(pyDensityFunctorUP1D(8, 0.03, pyGetInverseProjectedZF1D(), 0, 1, IntegrationType.MEAN), shaders_list) |