Before I rip out tempita and start a DSL

This commit is contained in:
Steven Robertson
2010-08-30 14:45:44 -04:00
parent 0c78e972b1
commit cceb75396f
3 changed files with 53 additions and 37 deletions

38
main.py
View File

@ -11,39 +11,25 @@
import os
import sys
import time
import ctypes
import struct
# These imports are order-sensitive!
import pyglet
import pyglet.gl as gl
gl.get_current_context()
from ctypes import *
import numpy as np
from fr0stlib import pyflam3
from cuburnlib.device_code import MWCRNGTest
from cuburnlib.cuda import LaunchContext
class CUGenome(pyflam3.Genome):
def _render(self, frame, trans):
obuf = (ctypes.c_ubyte * ((3+trans)*self.width*self.height))()
stats = pyflam3.RenderStats()
pyflam3.flam3_render(ctypes.byref(frame), obuf,
pyflam3.flam3_field_both,
trans+3, trans, ctypes.byref(stats))
return obuf, stats, frame
#from cuburnlib.device_code import MWCRNGTest
#from cuburnlib.cuda import LaunchContext
from fr0stlib.pyflam3 import *
from fr0stlib.pyflam3._flam3 import *
from cuburnlib.render import *
def main(genome_path):
ctx = LaunchContext([MWCRNGTest], block=(256,1,1), grid=(64,1), tests=True)
ctx.compile(True)
ctx.run_tests()
#ctx = LaunchContext([MWCRNGTest], block=(256,1,1), grid=(64,1), tests=True)
#ctx.compile(True)
#ctx.run_tests()
with open(genome_path) as fp:
genome = CUGenome.from_string(fp.read())[0]
genomes = Genome.from_string(fp.read())
render = Render(genomes)
render.render_frame()
#genome.width, genome.height = 512, 512
#genome.sample_density = 1000