Ejemplo n.º 1
0
    def test_hemisphere_cos(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat1 = ren.shader.material("default")
        sam = renmas2.materials.HemisphereCos(1.5)
        mat1.add(sam)

        normal = factory.vector(2, 4, 5)
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)

        ren.macro_call.set_runtimes([runtime])
        mat1.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["next_dir_ptr"] = runtime.address_module(mat1.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z)
        runtime.run("test")

        print(ds['hp.wi'])
        print(ds['hp.ndotwi'])
        print(ds['hp.pdf'])

        mat1.next_direction(hp)
        print(hp.ndotwi)
        print(hp.wi)
        print(hp.pdf)
Ejemplo n.º 2
0
    def test_phong1(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        spec = ren.converter.create_spectrum((0.2, 0.3, 0.1))
        ren.macro_call.set_runtimes([runtime])

        phong = factory.create_phong(spec, 2.0)
        mat.add(phong)
        t = 2.3
        hit_point = factory.vector(2.2, 3.1, 4.4)
        normal = factory.vector(2.9, 1.2, 4.5)
        normal.normalize()
        ray = factory.create_ray(origin=(4, 4, 4), direction=(6, 7, 8))

        hp = renmas2.shapes.HitPoint(t, hit_point, normal, 0, ray)
        wi = factory.vector(-6, 8, -3.8)
        wi.normalize()
        hp.wo = ray.dir * -1.0
        hp.wi = wi
        hp.ndotwi = normal.dot(wi)

        mat.f_asm([runtime], ren.assembler, ren.structures)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        self.populate_ds(ds, hp)
        ds["brdf_ptr"] = runtime.address_module(mat.f_asm_name)
        runtime.run("test")

        spectrum = mat.f(hp)
        print(spectrum)
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 3
0
    def test_phong1(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        spec = ren.converter.create_spectrum((0.2, 0.3, 0.1))
        ren.macro_call.set_runtimes([runtime])

        phong = factory.create_phong(spec, 2.0) 
        mat.add(phong)
        t = 2.3
        hit_point = factory.vector(2.2, 3.1, 4.4)
        normal = factory.vector(2.9, 1.2, 4.5)
        normal.normalize()
        ray = factory.create_ray(origin=(4,4,4), direction=(6,7,8))

        hp = renmas2.shapes.HitPoint(t, hit_point, normal, 0, ray)
        wi = factory.vector(-6,8,-3.8)
        wi.normalize()
        hp.wo = ray.dir * -1.0
        hp.wi = wi
        hp.ndotwi = normal.dot(wi)

        mat.f_asm([runtime], ren.assembler, ren.structures)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        self.populate_ds(ds, hp)
        ds["brdf_ptr"] = runtime.address_module(mat.f_asm_name)
        runtime.run("test")

        spectrum = mat.f(hp)
        print(spectrum)
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 4
0
    def test_transmission_sampling(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        eta_in = 1.3
        eta_out = 1.0
        sampling = renmas2.materials.PerfectTransmissionSampling(eta_in, eta_out)
        mat.add(sampling)

        eta_in = ren.converter.zero_spectrum().set(1.3)
        eta_out = ren.converter.zero_spectrum().set(1.0)
        fresnel = renmas2.materials.FresnelDielectric(eta_in, eta_out) 
        spec = ren.converter.create_spectrum((0.5, 0.5, 0.5))

        perf_spec = renmas2.materials.PerfectTransmission(spec, fresnel, 1.0)
        mat.add(perf_spec)

        ref_sam = renmas2.materials.PerfectSpecularSampling()
        mat.add(ref_sam)

        spec2 = ren.converter.create_spectrum((0.9, 0.9, 0.9))
        fresnel2 = renmas2.materials.FresnelDielectric(eta_in, eta_out) 
        perf_ref = renmas2.materials.PerfectSpecular(spec2, fresnel2, 1.0)
        mat.add(perf_ref)

        normal = factory.vector(2, 4.5, 5) 
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        wo = factory.vector(-2, 1, 0)
        wo.normalize()
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)
        hp.wo = wo
        hp.fliped = False 

        ren.macro_call.set_runtimes([runtime])
        mat.next_direction_bsdf_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)

        ds["next_dir_ptr"] = runtime.address_module(mat.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z, 0.0)
        ds["hp.wo"] = (wo.x, wo.y, wo.z, 0.0)
        ds["hp.fliped"] = 0
        runtime.run("test")

        mat.next_direction_bsdf(hp)
        print ("Python")
        print (hp.wi)
        print (hp.ndotwi)
        print (hp.specular)
        print (hp.f_spectrum)
        print ("ASM")
        print (ds["hp.wi"])
        print (ds["hp.ndotwi"])
        print (ds["hp.specular"])
        print (ds["hp.f_spectrum.values"])
Ejemplo n.º 5
0
    def test_hemisphere_cos(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        spec = ren.converter.create_spectrum((0.2, 0.3, 0.1))
        mat1 = renmas2.core.material.Material(ren.converter.zero_spectrum())
        phong = factory.create_phong(spec, 2.0) 
        lam_sampling = renmas2.materials.LambertianSampling()
        mat1.add(phong)
        mat1.add(lam_sampling)

        normal = factory.vector(2, 4, 5) 
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)

        ren.macro_call.set_runtimes([runtime])
        mat1.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["next_dir_ptr"] = runtime.address_module(mat1.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z)
        runtime.run("test")

        print(ds['hp.wi'])
        print(ds['hp.ndotwi'])
        print(ds['hp.pdf'])
        
        mat1.next_direction(hp)
        print(hp.ndotwi)
        print(hp.wi)
        print(hp.pdf)
Ejemplo n.º 6
0
    def test_hemisphere_cos(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat1 = ren.shader.material("default")
        sam = renmas2.materials.HemisphereCos(1.5)
        mat1.add(sam)

        normal = factory.vector(2, 4, 5) 
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)

        ren.macro_call.set_runtimes([runtime])
        mat1.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["next_dir_ptr"] = runtime.address_module(mat1.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z)
        runtime.run("test")

        print(ds['hp.wi'])
        print(ds['hp.ndotwi'])
        print(ds['hp.pdf'])
        
        mat1.next_direction(hp)
        print(hp.ndotwi)
        print(hp.wi)
        print(hp.pdf)
Ejemplo n.º 7
0
    def test_hemisphere_cos(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        spec = ren.converter.create_spectrum((0.2, 0.3, 0.1))
        mat1 = renmas2.core.material.Material(ren.converter.zero_spectrum())
        phong = factory.create_phong(spec, 2.0)
        lam_sampling = renmas2.materials.LambertianSampling()
        mat1.add(phong)
        mat1.add(lam_sampling)

        normal = factory.vector(2, 4, 5)
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)

        ren.macro_call.set_runtimes([runtime])
        mat1.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["next_dir_ptr"] = runtime.address_module(mat1.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z)
        runtime.run("test")

        print(ds['hp.wi'])
        print(ds['hp.ndotwi'])
        print(ds['hp.pdf'])

        mat1.next_direction(hp)
        print(hp.ndotwi)
        print(hp.wi)
        print(hp.pdf)
Ejemplo n.º 8
0
    def test_transmission_sampling(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        eta_in = 1.3
        eta_out = 1.0
        sampling = renmas2.materials.PerfectTransmissionSampling(
            eta_in, eta_out)
        mat.add(sampling)

        eta_in = ren.converter.zero_spectrum().set(1.3)
        eta_out = ren.converter.zero_spectrum().set(1.0)
        fresnel = renmas2.materials.FresnelDielectric(eta_in, eta_out)
        spec = ren.converter.create_spectrum((0.5, 0.5, 0.5))

        perf_spec = renmas2.materials.PerfectTransmission(spec, fresnel, 1.0)
        mat.add(perf_spec)

        normal = factory.vector(2, 4.5, 5)
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        wo = factory.vector(-2, 1, 0)
        wo.normalize()
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)
        hp.wo = wo
        hp.fliped = False

        ren.macro_call.set_runtimes([runtime])
        mat.next_direction_btdf_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)

        ds["next_dir_ptr"] = runtime.address_module(mat.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z, 0.0)
        ds["hp.wo"] = (wo.x, wo.y, wo.z, 0.0)
        ds["hp.fliped"] = 0
        runtime.run("test")

        mat.next_direction_btdf(hp)
        print("Python")
        print(hp.wi)
        print(hp.ndotwi)
        print(hp.specular)
        print(hp.f_spectrum)
        print("ASM")
        print(ds["hp.wi"])
        print(ds["hp.ndotwi"])
        print(ds["hp.specular"])
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 9
0
    def test_lamb1(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())

        #mat.f_asm([runtime], ren.assembler, ren.structures)

        mat1 = ren.shader.material("default")
        mat1.f_asm([runtime], ren.assembler, ren.structures)

        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["brdf_ptr"] = runtime.address_module(mat1.f_asm_name)
        runtime.run("test")
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 10
0
    def test_lamb1(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())

        #mat.f_asm([runtime], ren.assembler, ren.structures)

        mat1 = ren.shader.material("default")
        mat1.f_asm([runtime], ren.assembler, ren.structures)

        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["brdf_ptr"] = runtime.address_module(mat1.f_asm_name)
        runtime.run("test")
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 11
0
    def test_perfect_specular(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        spec = ren.converter.create_spectrum((1.0, 1.0, 1.0))
        ren.macro_call.set_runtimes([runtime])

        eta_in = ren.converter.zero_spectrum().set(1.5)
        eta_out = ren.converter.zero_spectrum().set(1.0)
        fresnel = renmas2.materials.FresnelDielectric(eta_in, eta_out) 

        perf_spec = renmas2.materials.PerfectSpecular(spec, fresnel, 1.0)
        mat.add(perf_spec)

        t = 2.3
        hit_point = factory.vector(2.2, 3.1, 4.4)
        normal = factory.vector(2.9, 1.2, 4.5)
        normal.normalize()
        hp = renmas2.shapes.HitPoint(t, hit_point, normal, 0)
        wi = factory.vector(6,-27,3.8)
        wi.normalize()
        wo = factory.vector(2, 2, 4)
        wo.normalize()
        hp.wo = wo
        hp.wi = wi
        hp.ndotwi = normal.dot(wi)
        print (hp.ndotwi)
        hp.fliped = True 
        hp.specular = 89

        mat.f_asm([runtime], ren.assembler, ren.structures)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        self.populate_ds(ds, hp)
        ds["brdf_ptr"] = runtime.address_module(mat.f_asm_name)
        runtime.run("test")

        spectrum = mat.f(hp)
        print("shlick", self.shlick(1.5, hp.ndotwi))
        print("Python")
        print(spectrum)
        print("---------------------------------------")
        print("Asm")
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 12
0
    def test_perfect_specular(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        spec = ren.converter.create_spectrum((1.0, 1.0, 1.0))
        ren.macro_call.set_runtimes([runtime])

        eta_in = ren.converter.zero_spectrum().set(1.5)
        eta_out = ren.converter.zero_spectrum().set(1.0)
        fresnel = renmas2.materials.FresnelDielectric(eta_in, eta_out)

        perf_spec = renmas2.materials.PerfectSpecular(spec, fresnel, 1.0)
        mat.add(perf_spec)

        t = 2.3
        hit_point = factory.vector(2.2, 3.1, 4.4)
        normal = factory.vector(2.9, 1.2, 4.5)
        normal.normalize()
        hp = renmas2.shapes.HitPoint(t, hit_point, normal, 0)
        wi = factory.vector(6, -27, 3.8)
        wi.normalize()
        wo = factory.vector(2, 2, 4)
        wo.normalize()
        hp.wo = wo
        hp.wi = wi
        hp.ndotwi = normal.dot(wi)
        print(hp.ndotwi)
        hp.fliped = True
        hp.specular = 89

        mat.f_asm([runtime], ren.assembler, ren.structures)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        self.populate_ds(ds, hp)
        ds["brdf_ptr"] = runtime.address_module(mat.f_asm_name)
        runtime.run("test")

        spectrum = mat.f(hp)
        print("shlick", self.shlick(1.5, hp.ndotwi))
        print("Python")
        print(spectrum)
        print("---------------------------------------")
        print("Asm")
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 13
0
    def test_transmission_sampling(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        eta_in = 1.3
        eta_out = 1.0
        sampling = renmas2.materials.PerfectTransmissionSampling(eta_in, eta_out)

        normal = factory.vector(2, 4.5, 5) 
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        wo = factory.vector(-2, 1, 0)
        wo.normalize()
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)
        hp.wo = wo
        hp.fliped = False

        ren.macro_call.set_runtimes([runtime])
        sampling.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)

        ds["next_dir_ptr"] = runtime.address_module(sampling.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z, 0.0)
        ds["hp.wo"] = (wo.x, wo.y, wo.z, 0.0)
        ds["hp.fliped"] = 0
        runtime.run("test")

        sampling.next_direction(hp)
        print ("Python")
        print (hp.wi)
        print (hp.ndotwi)
        print ("ASM")
        print (ds["hp.wi"])
        print (ds["hp.ndotwi"])
Ejemplo n.º 14
0
    def test_perfect_sampling(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        sam = renmas2.materials.PerfectSpecularSampling()
        mat.add(sam)

        normal = factory.vector(2, 4.5, 5) 
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        wo = factory.vector(-2, 1, 0)
        wo.normalize()
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)
        hp.wo = wo

        ren.macro_call.set_runtimes([runtime])
        mat.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["next_dir_ptr"] = runtime.address_module(mat.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z, 0.0)
        ds["hp.wo"] = (wo.x, wo.y, wo.z, 0.0)
        runtime.run("test")

        print ("PDF =", hp.pdf)
        print ("wi =", hp.wi)
        print ("ndotwi =", hp.ndotwi)
        mat.next_direction(hp)
        print ("PDF =", hp.pdf, " ASM pdf = ", ds["hp.pdf"])
        print ("wi =", hp.wi)
        print ("asm wi", ds["hp.wi"])
        print ("ndotwi =", hp.ndotwi, " asm ndtowi=", ds["hp.ndotwi"])
        print ("normal=", hp.normal)
Ejemplo n.º 15
0
    def test_perfect_sampling(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()

        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        sam = renmas2.materials.PerfectSpecularSampling()
        mat.add(sam)

        normal = factory.vector(2, 4.5, 5)
        normal.normalize()
        hit_point = factory.vector(3, 5, 6)
        wo = factory.vector(-2, 1, 0)
        wo.normalize()
        hp = renmas2.shapes.HitPoint(1.5, hit_point, normal, 0)
        hp.wo = wo

        ren.macro_call.set_runtimes([runtime])
        mat.next_direction_asm([runtime], ren.structures, ren.assembler)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        ds["next_dir_ptr"] = runtime.address_module(mat.nd_asm_name)
        ds["hp.normal"] = (normal.x, normal.y, normal.z, 0.0)
        ds["hp.t"] = 1.5
        ds["hp.hit"] = (hit_point.x, hit_point.y, hit_point.z, 0.0)
        ds["hp.wo"] = (wo.x, wo.y, wo.z, 0.0)
        runtime.run("test")

        print("PDF =", hp.pdf)
        print("wi =", hp.wi)
        print("ndotwi =", hp.ndotwi)
        mat.next_direction(hp)
        print("PDF =", hp.pdf, " ASM pdf = ", ds["hp.pdf"])
        print("wi =", hp.wi)
        print("asm wi", ds["hp.wi"])
        print("ndotwi =", hp.ndotwi, " asm ndtowi=", ds["hp.ndotwi"])
        print("normal=", hp.normal)
Ejemplo n.º 16
0
    def test_ward1(self):
        factory = renmas2.Factory()
        ren = renmas2.Renderer()
        runtime = Runtime()
        mat = renmas2.core.material.Material(ren.converter.zero_spectrum())
        spec = ren.converter.create_spectrum((0.2, 0.3, 0.1))
        ren.macro_call.set_runtimes([runtime])

        ward = factory.create_ward(spec, 0.1, 1.0) 
        mat.add(ward)
        t = 2.3
        hit_point = factory.vector(2.2, 3.1, 4.4)
        normal = factory.vector(2.9, 1.2, 4.5)
        normal.normalize()
        hp = renmas2.shapes.HitPoint(t, hit_point, normal, 0)
        wi = factory.vector(6,-8,3.8)
        wi.normalize()
        wo = factory.vector(2, 2, 4)
        wo.normalize()
        hp.wo = wo
        hp.wi = wi
        hp.ndotwi = normal.dot(wi)

        mat.f_asm([runtime], ren.assembler, ren.structures)
        mc = ren.assembler.assemble(self.asm_code1(ren))
        ds = runtime.load("test", mc)
        self.populate_ds(ds, hp)
        ds["brdf_ptr"] = runtime.address_module(mat.f_asm_name)
        runtime.run("test")

        spectrum = mat.f(hp)
        print("Python")
        print(spectrum)
        print("---------------------------------------")
        print("Asm")
        print(ds["hp.f_spectrum.values"])
Ejemplo n.º 17
0
    ASM = "#DATA \n" + col_mgr.zero_spectrum().struct() + ShadePoint.struct(
    ) + """
        shadepoint sp1
        uint64 ptr_brdf
        #CODE
        macro mov eax, sp1
        call qword [ptr_brdf] 
        #END
    """
else:
    ASM = "#DATA \n" + col_mgr.zero_spectrum().struct() + ShadePoint.struct(
    ) + """
        shadepoint sp1
        uint32 ptr_brdf
        #CODE
        macro mov eax, sp1
        call dword [ptr_brdf] 
        #END
    """

mc = col_mgr.assembler.assemble(ASM)
#mc.print_machine_code()
ds = runtime.load('test', mc)
ds['ptr_brdf'] = runtime.address_module(mat.brdf_asm_name)
ds['sp1.normal'] = sp.normal.to_ds()
ds['sp1.wi'] = sp.wi.to_ds()

runtime.run('test')

print(ds['sp1.f_spectrum.values'])
Ejemplo n.º 18
0
        macro mov eax, sp1
        call qword [ptr_brdf] 
        #END
    """
    )
else:
    ASM = (
        "#DATA \n"
        + col_mgr.zero_spectrum().struct()
        + ShadePoint.struct()
        + """
        shadepoint sp1
        uint32 ptr_brdf
        #CODE
        macro mov eax, sp1
        call dword [ptr_brdf] 
        #END
    """
    )

mc = col_mgr.assembler.assemble(ASM)
# mc.print_machine_code()
ds = runtime.load("test", mc)
ds["ptr_brdf"] = runtime.address_module(mat.brdf_asm_name)
ds["sp1.normal"] = sp.normal.to_ds()
ds["sp1.wi"] = sp.wi.to_ds()

runtime.run("test")

print(ds["sp1.f_spectrum.values"])