def main(): init_windows() make_lights() init_view() # panel.needredraw() panels = panel.defpanellist('nurbs.s') p = panels[0] # def cbtrim (a) : flags[TRIM:TRIM+1] = [int (a.val)] p.trim.upfunc = cbtrim # def cbquit (a) : import sys sys.exit (1) p.quit.upfunc = cbquit # def cbmotion (a) : flags[FREEZE:FREEZE+1] = [int (a.val)] p.motion.upfunc = cbmotion # def cbxyzaxis (a) : flags[AXVIS:AXVIS+1] = [int (a.val)] p.xyzaxis.upfunc = cbxyzaxis # def cbtrimpnts (a) : flags[TPVIS:TPVIS+1] = [int (a.val)] p.trimpnts.upfunc = cbtrimpnts # def cbcntlpnts (a) : flags[CPVIS:CPVIS+1] = [int (a.val)] p.cntlpnts.upfunc = cbcntlpnts # def cbnurb (a) : flags[VIS:VIS+1] = [int (a.val)] p.nurb.upfunc = cbnurb # set_scene(flags) setnurbsproperty( N_ERRORCHECKING, 1.0 ) setnurbsproperty( N_PIXEL_TOLERANCE, 50.0 ) draw_trim_surface(flags) # while 1: act = panel.dopanel() # wid = panel.userredraw () if wid : winset (wid) reshapeviewport() set_scene(flags) draw_trim_surface(flags) # set_scene(flags) draw_trim_surface(flags)
def main () : # # iter keeps track of the iterations. It is used as the # (x, y, z) rotation increments to which the objects rotate. iter = 0 # # make the objects. the objects are put in the odict dictionary # od = objectdef.makeobjects () # # initialize gl # initgl () # # initialize time and iterations per second # time0 = time.time () # epoch-time of previous second fps = 0 # frames per second # # initialize panels # panel.needredraw() panels = panel.defpanellist('flying.s') #XXX p = panels[0] p.sphere.upfunc = callbacksphere p.cylinder.upfunc = callbackcylinder p.cube.upfunc = callbackcube p.icecream.upfunc = callbackicecream p.disk.upfunc = callbackdisk p.diamond.upfunc = callbackdiamond # NOT YET IMPLEMENTED p.glass.upfunc = callbackglass p.pyramid.upfunc = callbackpyramid p.table.upfunc = callbacktable p.wire.upfunc = callbackwire p.filled.upfunc = callbackfilled p.flat.upfunc = callbackflat p.gouraud.upfunc = callbackgouraud p.quit.upfunc = callbackquit p.showall.upfunc = callbackshowall p.shownone.upfunc = callbackshownone p.showall.back = p p.shownone.back = p # qanels = panel.defpanellist('freeze.s') #XXX q = qanels[0] # ranels = panel.defpanellist('materials.s') #XXX r = ranels[0] r.m9.upfunc = cbsetmaterial r.m8.upfunc = cbsetmaterial r.m7.upfunc = cbsetmaterial r.m6.upfunc = cbsetmaterial r.m5.upfunc = cbsetmaterial r.m4.upfunc = cbsetmaterial r.m3.upfunc = cbsetmaterial r.m2.upfunc = cbsetmaterial r.m1.upfunc = cbsetmaterial r.specR.activefunc = cbmaterial r.specG.activefunc = cbmaterial r.specB.activefunc = cbmaterial r.diffR.activefunc = cbmaterial r.diffG.activefunc = cbmaterial r.diffB.activefunc = cbmaterial r.shine.activefunc = cbmaterial r.m9.back = r r.m8.back = r r.m7.back = r r.m6.back = r r.m5.back = r r.m4.back = r r.m3.back = r r.m2.back = r r.m1.back = r r.diffR.back = r r.diffG.back = r r.diffB.back = r r.specR.back = r r.specG.back = r r.specB.back = r r.shine.back = r # sanels = panel.defpanellist('light.s') #XXX s = sanels[0] s.X.back = s s.Y.back = s s.Z.back = s s.R.back = s s.G.back = s s.B.back = s s.light1.back = s s.light2.back = s s.local.back = s s.light1.upfunc = cbsetlight s.light2.upfunc = cbsetlight s.R.activefunc = cblight s.G.activefunc = cblight s.B.activefunc = cblight s.X.activefunc = cblight s.Y.activefunc = cblight s.Z.activefunc = cblight # while 1 : # act = panel.dopanel() # wid = panel.userredraw () if wid : winset (wid) reshapeviewport() # # increment iter # if int (q.freeze.val) = 0 : iter = iter + 1 fps = fps + 1 if time.time() - time0 >= 1 : f = float(fps)/float(time.time()-time0) q.mystrip.val = f q.mystrip.fixact () q.fixpanel() time0 = time.time() fps = 0 # # clear the zbuffer and make the background light blue # zclear() c3i (LightBlue) clear() # # for each object in the objects dictionary # for key in objects.keys() : # # if the object should be displayed # if getDict (objects, key, 0) = ONE : loo = getDict (objects, key, 1) for o in loo : # # get attributes and materail # attr = o [1] mat = o [2] # # display the object # drawit(od[o[0]],iter,attr,mat)
def main(): foreground() # keepaspect(1, 1) prefposition(10, 610, 10, 610) obswid = winopen('Observer View') doublebuffer() RGBmode() gconfig() # keepaspect(1, 1) prefposition(10, 310, 650, 950) topwid = winopen('Top View') doublebuffer() RGBmode() gconfig() # panels = panel.defpanellist('observer.s') panels = panels + panel.defpanellist('camera.s') panels = panels + panel.defpanellist('topview.s') # p = panels[0] q = panels[1] r = panels[2] # p.farclip = q.farclip p.nearclip = q.nearclip p.zoom = q.zoom p.quitbutton = q.quitbutton # p.xpos = r.xpos p.zpos = r.zpos p.direction = r.direction # p.direction.winds = 1.0 # allow full rotation # def quit(act): import sys sys.exit(0) p.quitbutton.downfunc = quit # p.left.back = p p.fast_left.back = p p.right.back = p p.fast_right.back = p p.forward.back = p p.fast_forward.back = p p.reverse.back = p p.fast_reverse.back = p p.up.back = p p.down.back = p # p.left.activefunc = left p.fast_left.activefunc = fast_left p.right.activefunc = right p.fast_right.activefunc = fast_right p.forward.activefunc = forward p.fast_forward.activefunc = fast_forward p.reverse.activefunc = reverse p.fast_reverse.activefunc = fast_reverse p.up.activefunc = up p.down.activefunc = down # makeobjects() # drawall(p, obswid, topwid) panel.needredraw() while 1: act = panel.dopanel() if panel.userredraw() or act: drawall(p, obswid, topwid)
def main(): init_windows() make_lights() init_view() # panel.needredraw() panels = panel.defpanellist('nurbs.s') p = panels[0] # def cbtrim(a): flags[TRIM:TRIM + 1] = [int(a.val)] p.trim.upfunc = cbtrim # def cbquit(a): import sys sys.exit(1) p.quit.upfunc = cbquit # def cbmotion(a): flags[FREEZE:FREEZE + 1] = [int(a.val)] p.motion.upfunc = cbmotion # def cbxyzaxis(a): flags[AXVIS:AXVIS + 1] = [int(a.val)] p.xyzaxis.upfunc = cbxyzaxis # def cbtrimpnts(a): flags[TPVIS:TPVIS + 1] = [int(a.val)] p.trimpnts.upfunc = cbtrimpnts # def cbcntlpnts(a): flags[CPVIS:CPVIS + 1] = [int(a.val)] p.cntlpnts.upfunc = cbcntlpnts # def cbnurb(a): flags[VIS:VIS + 1] = [int(a.val)] p.nurb.upfunc = cbnurb # set_scene(flags) setnurbsproperty(N_ERRORCHECKING, 1.0) setnurbsproperty(N_PIXEL_TOLERANCE, 50.0) draw_trim_surface(flags) # while 1: act = panel.dopanel() # wid = panel.userredraw() if wid: winset(wid) reshapeviewport() set_scene(flags) draw_trim_surface(flags) # set_scene(flags) draw_trim_surface(flags)