|
| 1 | +////////////////////////////////////////////////////////////////////////// |
| 2 | +// |
| 3 | +// Copyright (c) 2025, Image Engine Design Inc. All rights reserved. |
| 4 | +// |
| 5 | +// Redistribution and use in source and binary forms, with or without |
| 6 | +// modification, are permitted provided that the following conditions are |
| 7 | +// met: |
| 8 | +// |
| 9 | +// * Redistributions of source code must retain the above |
| 10 | +// copyright notice, this list of conditions and the following |
| 11 | +// disclaimer. |
| 12 | +// |
| 13 | +// * Redistributions in binary form must reproduce the above |
| 14 | +// copyright notice, this list of conditions and the following |
| 15 | +// disclaimer in the documentation and/or other materials provided with |
| 16 | +// the distribution. |
| 17 | +// |
| 18 | +// * Neither the name of John Haddon nor the names of |
| 19 | +// any other contributors to this software may be used to endorse or |
| 20 | +// promote products derived from this software without specific prior |
| 21 | +// written permission. |
| 22 | +// |
| 23 | +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS |
| 24 | +// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, |
| 25 | +// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 26 | +// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR |
| 27 | +// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 28 | +// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 29 | +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 30 | +// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF |
| 31 | +// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING |
| 32 | +// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 33 | +// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 34 | +// |
| 35 | +////////////////////////////////////////////////////////////////////////// |
| 36 | + |
| 37 | +#pragma once |
| 38 | + |
| 39 | +#include "GafferImage/ImageProcessor.h" |
| 40 | + |
| 41 | +#include "Gaffer/StringPlug.h" |
| 42 | + |
| 43 | +#include "IECore/Object.h" |
| 44 | + |
| 45 | +#include "Gaffer/TypedObjectPlug.h" |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | +namespace GafferImage |
| 50 | +{ |
| 51 | + |
| 52 | +class GAFFERIMAGE_API DiskBlur : public ImageProcessor |
| 53 | +{ |
| 54 | + public : |
| 55 | + |
| 56 | + explicit DiskBlur( const std::string &name=defaultName<DiskBlur>() ); |
| 57 | + ~DiskBlur() override; |
| 58 | + |
| 59 | + GAFFER_NODE_DECLARE_TYPE( GafferImage::DiskBlur, DiskBlurTypeId, ImageProcessor ); |
| 60 | + |
| 61 | + Gaffer::FloatPlug *radiusPlug(); |
| 62 | + const Gaffer::FloatPlug *radiusPlug() const; |
| 63 | + |
| 64 | + Gaffer::StringPlug *radiusChannelPlug(); |
| 65 | + const Gaffer::StringPlug *radiusChannelPlug() const; |
| 66 | + |
| 67 | + Gaffer::FloatPlug *approximationThresholdPlug(); |
| 68 | + const Gaffer::FloatPlug *approximationThresholdPlug() const; |
| 69 | + |
| 70 | + Gaffer::IntPlug *maxRadiusPlug(); |
| 71 | + const Gaffer::IntPlug *maxRadiusPlug() const; |
| 72 | + |
| 73 | + Gaffer::FloatVectorDataPlug *layerBoundariesPlug(); |
| 74 | + const Gaffer::FloatVectorDataPlug *layerBoundariesPlug() const; |
| 75 | + |
| 76 | + void affects( const Gaffer::Plug *input, AffectedPlugsContainer &outputs ) const override; |
| 77 | + |
| 78 | + protected : |
| 79 | + |
| 80 | + void hash( const Gaffer::ValuePlug *output, const Gaffer::Context *context, IECore::MurmurHash &h ) const override; |
| 81 | + void compute( Gaffer::ValuePlug *output, const Gaffer::Context *context ) const override; |
| 82 | + |
| 83 | + Gaffer::ValuePlug::CachePolicy computeCachePolicy( const Gaffer::ValuePlug *output ) const override; |
| 84 | + |
| 85 | + void hashChannelData( const GafferImage::ImagePlug *parent, const Gaffer::Context *context, IECore::MurmurHash &h ) const override; |
| 86 | + IECore::ConstFloatVectorDataPtr computeChannelData( const std::string &channelName, const Imath::V2i &tileOrigin, const Gaffer::Context *context, const ImagePlug *parent ) const override; |
| 87 | + |
| 88 | + private : |
| 89 | + |
| 90 | + Gaffer::ObjectVectorPlug *tileBoundPlug(); |
| 91 | + const Gaffer::ObjectVectorPlug *tileBoundPlug() const; |
| 92 | + |
| 93 | + Gaffer::ObjectVectorPlug *scanlinesLUTPlug(); |
| 94 | + const Gaffer::ObjectVectorPlug *scanlinesLUTPlug() const; |
| 95 | + |
| 96 | + Gaffer::BoolPlug *useReferenceImplementationPlug(); |
| 97 | + const Gaffer::BoolPlug *useReferenceImplementationPlug() const; |
| 98 | + |
| 99 | + Gaffer::ObjectVectorPlug *layerWeightsPlug(); |
| 100 | + const Gaffer::ObjectVectorPlug *layerWeightsPlug() const; |
| 101 | + |
| 102 | + void hashScanlinesLUT( const Gaffer::Context *context, IECore::MurmurHash &h ) const; |
| 103 | + IECore::ConstObjectVectorPtr computeScanlinesLUT( const Gaffer::Context *context ) const; |
| 104 | + |
| 105 | + void hashTileBound( const Gaffer::Context *context, IECore::MurmurHash &h ) const; |
| 106 | + IECore::ConstObjectVectorPtr computeTileBound( const Imath::V2i &tileOrigin, const Gaffer::Context *context ) const; |
| 107 | + |
| 108 | + void hashLayerWeights( const Gaffer::Context *context, IECore::MurmurHash &h ) const; |
| 109 | + IECore::ConstObjectVectorPtr computeLayerWeights( const Imath::V2i &tileOrigin, const Gaffer::Context *context ) const; |
| 110 | + |
| 111 | + |
| 112 | + static size_t g_firstPlugIndex; |
| 113 | + |
| 114 | +}; |
| 115 | + |
| 116 | +IE_CORE_DECLAREPTR( DiskBlur ) |
| 117 | + |
| 118 | +} // namespace GafferImage |
0 commit comments