コード例 #1
0
    def testConvertPerspective(self):

        with IECoreArnold.UniverseBlock():

            n = IECoreArnold.NodeAlgo.convert(
                IECore.Camera(
                    parameters={
                        "projection":
                        "perspective",
                        "projection:fov":
                        45.0,
                        "resolution":
                        IECore.V2i(512),
                        "screenWindow":
                        IECore.Box2f(IECore.V2f(-1, -0.5), IECore.V2f(1, 0.5))
                    }))

            self.assertTrue(
                arnold.AiNodeEntryGetName(arnold.AiNodeGetNodeEntry(n)),
                "persp_camera")
            self.assertEqual(arnold.AiNodeGetFlt(n, "fov"), 45.0)

            self.assertEqual(arnold.AiNodeGetPnt2(n, "screen_window_min"),
                             arnold.AtPoint2(-1, -0.5))
            self.assertEqual(arnold.AiNodeGetPnt2(n, "screen_window_max"),
                             arnold.AtPoint2(1, 0.5))
コード例 #2
0
	def testIndexedUVs( self ) :

		m = IECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1 ), IECore.V2f( 1 ) ) )
		m["uv"] = IECore.PrimitiveVariable( IECore.PrimitiveVariable.Interpolation.FaceVarying, m["uv"].data, IECore.IntVectorData( [ 0, 3, 1, 2 ] ) )
		uvData = m["uv"].data
		uvIds = m["uv"].indices

		with IECoreArnold.UniverseBlock( writable = True ) :

			n = IECoreArnold.NodeAlgo.convert( m )

			uvs = arnold.AiNodeGetArray( n, "uvlist" )
			self.assertEqual( uvs.contents.nelements, 4 )

			uvIndices = arnold.AiNodeGetArray( n, "uvidxs" )
			self.assertEqual( uvIndices.contents.nelements, 4 )

			for i in range( 0, 4 ) :
				aiUv = arnold.AiArrayGetPnt2( uvs, i )
				aiUVId = arnold.AiArrayGetInt( uvIndices, i )
				aiIndexedUV = arnold.AiArrayGetPnt2( uvs, aiUVId )
				self.assertEqual( aiUVId, uvIds[i] )
				self.assertEqual( aiUv, arnold.AtPoint2( uvData[i][0], uvData[i][1] ) )
				self.assertEqual( aiIndexedUV, arnold.AtPoint2( uvData[uvIds[i]][0], uvData[uvIds[i]][1] ) )
コード例 #3
0
	def testUVs( self ) :

		m = IECore.MeshPrimitive.createPlane( IECore.Box2f( IECore.V2f( -1 ), IECore.V2f( 1 ) ) )
		uvData = m["uv"].data

		with IECoreArnold.UniverseBlock( writable = True ) :

			n = IECoreArnold.NodeAlgo.convert( m )

			uvs = arnold.AiNodeGetArray( n, "uvlist" )
			self.assertEqual( uvs.contents.nelements, 4 )

			uvIndices = arnold.AiNodeGetArray( n, "uvidxs" )
			self.assertEqual( uvIndices.contents.nelements, 4 )

			for i in range( 0, 4 ) :
				p = arnold.AiArrayGetPnt2( uvs, i )
				self.assertEqual( arnold.AiArrayGetPnt2( uvs, i ), arnold.AtPoint2( uvData[i][0], uvData[i][1] ) )
				self.assertEqual( arnold.AiArrayGetInt( uvIndices, i ), i )
コード例 #4
0
    def testAdditionalUVs(self):

        m = IECore.MeshPrimitive.createPlane(
            IECore.Box2f(IECore.V2f(-1), IECore.V2f(1)))
        m["myMap_s"] = m["s"]
        m["myMap_t"] = m["t"]
        s, t = m["s"].data, m["t"].data

        with IECoreArnold.UniverseBlock():

            n = IECoreArnold.NodeAlgo.convert(m)

            uvs = arnold.AiNodeGetArray(n, "myMap")
            self.assertEqual(uvs.contents.nelements, 4)

            uvIndices = arnold.AiNodeGetArray(n, "myMapidxs")
            self.assertEqual(uvIndices.contents.nelements, 4)

            for i in range(0, 4):
                p = arnold.AiArrayGetPnt2(uvs, i)
                self.assertEqual(arnold.AiArrayGetPnt2(uvs, i),
                                 arnold.AtPoint2(s[i], 1 - t[i]))
                self.assertEqual(arnold.AiArrayGetInt(uvIndices, i), i)