( self )
| 44 | class ToGLStateConverterTest( unittest.TestCase ) : |
| 45 | |
| 46 | def test( self ) : |
| 47 | |
| 48 | attributes = [ |
| 49 | ( "doubleSided", IECore.BoolData( True ), IECoreGL.DoubleSidedStateComponent( True ) ), |
| 50 | ( "render:displayColor", IECore.Color3fData( imath.Color3f( 1, 2, 3 ) ), IECoreGL.Color( imath.Color4f( 1, 2, 3, 1 ) ) ), |
| 51 | ( "render:displayColor", IECore.Color4fData( imath.Color4f( 1, 2, 3, 4 ) ), IECoreGL.Color( imath.Color4f( 1, 2, 3, 4 ) ) ), |
| 52 | ( "render:displayColor", IECore.Color3fVectorData( [ imath.Color3f( 1, 2, 3 ) ] ), IECoreGL.Color( imath.Color4f( 1, 2, 3, 1 ) ) ), |
| 53 | ( "gl:primitive:wireframe", IECore.BoolData( True ), IECoreGL.Primitive.DrawWireframe( True ) ), |
| 54 | ( "gl:primitive:wireframeWidth", IECore.FloatData( 2.5 ), IECoreGL.Primitive.WireframeWidth( 2.5 ) ), |
| 55 | ( "gl:primitive:wireframeColor", IECore.Color4fData( imath.Color4f( 0.1, 0.25, 0.5, 1 ) ), IECoreGL.WireframeColorStateComponent( imath.Color4f( 0.1, 0.25, 0.5, 1 ) ) ), |
| 56 | ( "gl:primitive:bound", IECore.BoolData( True ), IECoreGL.Primitive.DrawBound( True ) ), |
| 57 | ( "gl:primitive:boundColor", IECore.Color4fData( imath.Color4f( 0.1, 0.25, 0.5, 1 ) ), IECoreGL.BoundColorStateComponent( imath.Color4f( 0.1, 0.25, 0.5, 1 ) ) ), |
| 58 | ( "gl:primitive:solid", IECore.BoolData( True ), IECoreGL.Primitive.DrawSolid( True ) ), |
| 59 | ( "gl:primitive:points", IECore.BoolData( True ), IECoreGL.Primitive.DrawPoints( True ) ), |
| 60 | ( "gl:primitive:pointWidth", IECore.FloatData( 2.5 ), IECoreGL.Primitive.PointWidth( 2.5 ) ), |
| 61 | ( "gl:primitive:pointColor", IECore.Color4fData( imath.Color4f( 0.1, 0.25, 0.5, 1 ) ), IECoreGL.PointColorStateComponent( imath.Color4f( 0.1, 0.25, 0.5, 1 ) ) ), |
| 62 | ( "gl:pointsPrimitive:useGLPoints", IECore.StringData( "forGLPoints" ), IECoreGL.PointsPrimitive.UseGLPoints( IECoreGL.GLPointsUsage.ForPointsOnly ) ), |
| 63 | ( "gl:pointsPrimitive:glPointWidth", IECore.FloatData( 1.5 ), IECoreGL.PointsPrimitive.GLPointWidth( 1.5 ) ), |
| 64 | ( "gl:curvesPrimitive:useGLLines", IECore.BoolData( True ), IECoreGL.CurvesPrimitive.UseGLLines( True ) ), |
| 65 | ( "gl:curvesPrimitive:glLineWidth", IECore.FloatData( 1.5 ), IECoreGL.CurvesPrimitive.GLLineWidth( 1.5 ) ), |
| 66 | ( "gl:curvesPrimitive:ignoreBasis", IECore.BoolData( True ), IECoreGL.CurvesPrimitive.IgnoreBasis( True ) ), |
| 67 | ( "gl:smoothing:points", IECore.BoolData( True ), IECoreGL.PointSmoothingStateComponent( True ) ), |
| 68 | ( "gl:smoothing:lines", IECore.BoolData( True ), IECoreGL.LineSmoothingStateComponent( True ) ), |
| 69 | ( "gl:smoothing:polygons", IECore.BoolData( True ), IECoreGL.PolygonSmoothingStateComponent( True ) ), |
| 70 | ] |
| 71 | |
| 72 | for name, value, component in attributes : |
| 73 | a = IECore.CompoundObject() |
| 74 | a[name] = value |
| 75 | s = IECoreGL.ToGLStateConverter( a ).convert() |
| 76 | c = s.get( component.typeId() ) |
| 77 | self.assertEqual( c.typeId(), component.typeId() ) |
| 78 | self.assertEqual( c.value, component.value ) |
| 79 | |
| 80 | def testShaderAttribute( self ) : |
| 81 |
nothing calls this directly
no test coverage detected