demos/buddha.py
author Radek Brich <radek.brich@devl.cz>
Mon, 05 May 2008 15:31:14 +0200
branchpyrit
changeset 92 9af5c039b678
parent 90 f6a72eb99631
permissions -rwxr-xr-x
add MSVC compiler support, make it default for Windows new header file simd.h for SSE abstraction and helpers add mselect pseudo instruction for common or(and(...), andnot(...)) replace many SSE intrinsics with new names new MemoryPool class (mempool.h) for faster KdNode allocation remove setMaxDepth() from Octree and KdTree, make max_depth const, it should be defined in constructor and never changed, change after building tree would cause error in traversal modify DefaultSampler to generate nice 2x2 packets of samples for packet tracing optimize Box and BBox::intersect_packet add precomputed invdir attribute to RayPacket scons build system: check for pthread library on Windows check for SDL generate include/config.h with variables detected by scons configuration move auxiliary files to build/ add sanity checks add writable operator[] to Vector

#!/usr/bin/python

# this demo needs buddha model from
# http://graphics.stanford.edu/data/3Dscanrep/

from pyrit import *
from plyreader import LoadStanfordPlyFile

rt = Raytracer()
top = KdTree()
rt.setTop(top)
rt.setCamera(Camera())

light = Light(position=(-5.0, 2.0, 8.0), colour=(0.9, 0.3, 0.6))
rt.addLight(light)

mat = Material(colour=(0.9, 0.9, 0.9))
mat.setSmooth(True)
LoadStanfordPlyFile(rt, "../models/ply/happy/happy_vrip_res2.ply",
	mat, scale=20.0, trans=(0,-3,0))
top.optimize()

sampler = DefaultSampler(800, 600)
rt.setSampler(sampler)
rt.render()
sampler.getPixmap().writePNG('buddha.png')