Exemple #1
0
import platform
from tdasm import Runtime
from renmas3.core import ColorManager, ShadePoint, Material, Factory
from renmas3.materials import Lambertian

col_mgr = ColorManager(False)

mat = Material(col_mgr.zero_spectrum())

lamb = Lambertian(col_mgr.create_spectrum((0.3, 0.4, 0.6)))

mat.add(lamb)

factory = Factory()
sp = factory.shade_point()
sp.normal = factory.vector3(0, 1, 0)
sp.wi = factory.vector3(2, 2, 2)

print(mat.brdf(sp))

runtime = Runtime()
mat.brdf_asm([runtime], col_mgr.assembler)

bits = platform.architecture()[0]
if bits == "64bit":
    ASM = (
        "#DATA \n"
        + col_mgr.zero_spectrum().struct()
        + ShadePoint.struct()
        + """
        shadepoint sp1
Exemple #2
0
import platform
from tdasm import Runtime
from renmas3.core import ColorManager, ShadePoint, Material, Factory
from renmas3.materials import Lambertian

col_mgr = ColorManager(False)

mat = Material(col_mgr.zero_spectrum())

lamb = Lambertian(col_mgr.create_spectrum((0.3, 0.4, 0.6)))

mat.add(lamb)

factory = Factory()
sp = factory.shade_point()
sp.normal = factory.vector3(0, 1, 0)
sp.wi = factory.vector3(2, 2, 2)

print(mat.brdf(sp))

runtime = Runtime()
mat.brdf_asm([runtime], col_mgr.assembler)

bits = platform.architecture()[0]
if bits == '64bit':
    ASM = "#DATA \n" + col_mgr.zero_spectrum().struct() + ShadePoint.struct(
    ) + """
        shadepoint sp1
        uint64 ptr_brdf
        #CODE
        macro mov eax, sp1
Exemple #3
0
print(end-start)

filename = 'I:\\GitRENMAS\\tests3\\renderer\\sphere1.py'
filename = 'E:\\GitRENMAS\\renmas\\tests3\\renderer\\sphere1.py'

exec(compile(open(filename).read(), filename, 'exec'), dict(locals()), dict(globals()))

factory = Factory()
light = factory.create_light(mgr=ren.color_mgr, typ='point', source='A',\
        position=(9,10,9), direction=(2,2,2))

ren.add('point_light1', light)
ren.prepare()

direct_lighting = DirectLighting(ren)
sp = factory.shade_point(hit=(5,5,5))
sp.material = 0

ret = direct_lighting.estimate_direct(sp)
runtime = Runtime()
direct_lighting.estimate_direct_asm([runtime], 'estimate_dir')
print(ret)

structs = ren.color_mgr.zero_spectrum().struct() + ShadePoint.struct()
ASM = "#DATA \n" + structs + """
 #DATA
   spectrum spec1
  shadepoint sp1

 #CODE
 macro mov eax, sp1