MCPcopy Create free account
hub / github.com/ImageEngine/cortex / doConversion

Method doConversion

src/IECoreGL/SplineToGLTextureConverter.cpp:73–106  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73IECore::RunTimeTypedPtr SplineToGLTextureConverter::doConversion( IECore::ConstObjectPtr src, IECore::ConstCompoundObjectPtr operands ) const
74{
75
76 TexturePtr t = nullptr;
77 IECoreImage::SplineToImagePtr op = new IECoreImage::SplineToImage();
78 op->splineParameter()->setValue( boost::const_pointer_cast< IECore::Object >(src) );
79 op->resolutionParameter()->setValue( m_resolutionParameter->getValue() );
80 IECoreImage::ImagePrimitivePtr image = boost::static_pointer_cast<IECoreImage::ImagePrimitive>( op->operate() );
81
82 bool r = image->channelValid( "R" );
83 bool g = image->channelValid( "G" );
84 bool b = image->channelValid( "B" );
85 bool y = image->channelValid( "Y" );
86
87 if ( !y && r && g && b )
88 {
89 t = new ColorTexture( image.get() );
90 }
91 else if ( y && !r && !g && !b )
92 {
93 t = new LuminanceTexture( image.get() );
94 }
95 else
96 {
97 throw IECore::Exception( "Invald image format, SplineToGLTextureConverter supports RGB[A] and Y[A]." );
98 }
99
100 if ( ! t )
101 {
102 throw IECore::Exception( "Failed to create IECoreGL Texture." );
103 }
104
105 return t;
106}
107

Callers

nothing calls this directly

Calls 7

splineParameterMethod · 0.80
resolutionParameterMethod · 0.80
operateMethod · 0.80
channelValidMethod · 0.80
setValueMethod · 0.45
getValueMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected