| 71 | } |
| 72 | |
| 73 | IECore::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 |
nothing calls this directly
no test coverage detected