コード例 #1
0
ファイル: demo_teapot.py プロジェクト: jsj2008/blog-source
#!/usr/bin/python

from sys import path as module_paths
module_paths.append('./pymesh')
module_paths.append('./pyctm')
module_paths.append('./pyeuclid')

from platform_open import *
from export_ctm import *
from weld import *
import parametric, patch

outfile = "teapot.ctm"

print "Loading RIB file..."
funcs = patch.load_rib("models/uteapot.rib")
slices, stacks = 8, 8

print "Evaluating parametric functions..."
verts, faces = parametric.multisurface(slices, stacks, funcs)

print "Welding verts..."
verts, faces = weld(verts, faces)

export_ctm(verts, faces, outfile)
platform_open(outfile)
コード例 #2
0
ファイル: demo_granny.py プロジェクト: jsj2008/blog-source
#!/usr/bin/python

from sys import path as module_paths
module_paths.append('./pymesh')

from platform_open import *
from export_ctm import *
import parametric, tubes

filename = "granny.ctm"
func = tubes.granny
slices, stacks = 128, 16

verts, faces = parametric.closed_surface(slices, stacks, func)
export_ctm(verts, faces, filename)
platform_open(filename)
コード例 #3
0
ファイル: gumbo.py プロジェクト: renjiec/opengl-insights
if GenerateCtm:

    from export_ctm import *

    funcs = patch.gen_funcs_from_rib(infile)
    slices, stacks = 8, 8

    print "Evaluating parametric functions..."
    verts, faces = parametric.multisurface(slices, stacks, funcs)

    # Note that creases are not supported by weld().
    print "Welding verts..."
    verts, faces = weld(verts, faces)

    export_raw(verts, faces, outfile)
    platform_open(outfile)

else:

    def dump_tuples(headerFile, mylist):
        for v in mylist:
            s = []
            for value in v[:]:
                if math.floor(value) == value:
                    s.append(str(int(value)))
                else:
                    s.append('%gf' % value)
            headerFile.write("\t{ %s, %s, %s },\n" % tuple(s))

    verts, norms, knots = patch.gen_indexed_knots_from_rib(infile)
    headerFile = open('GumboData.h', 'w')