ya2 · news · projects · code · about

c21040039dcfb9f2edec153d4bc5c6d82a324778
[pmachines.git] / ya2 / engine / gfx.py
1 # from math import pi
2 # from panda3d.core import ClockObject
3 # from ya2.gameobject import GfxColleague
4 # from ya2.engine.particle import Particle
5 # from ya2.lib.p3d.gfx import P3dGfxMgr, P3dAnimNode, P3dAmbientLight, \
6 # P3dSpotlight
7
8
9 # GfxMgr = P3dGfxMgr
10 # AnimNode = P3dAnimNode
11 # AmbientLight = P3dAmbientLight
12 # Spotlight = P3dSpotlight
13
14
15 # class EngineGfx(GfxColleague):
16
17 # def __init__(self, mediator, model_path, antialiasing, shaders, fps, srgb):
18 # GfxColleague.__init__(self, mediator)
19 # self.gfx_mgr = GfxMgr(model_path, antialiasing, shaders, srgb)
20 # self.root = None
21 # self.part2eff = {}
22 # if fps: self.set_frame_rate(fps)
23 # # if self.mediator.cfg.gui_cfg.shaders and \
24 # # self.eng.lib.version.startswith('1.10'):
25 # # self.set_toon()
26 # # self.set_bloom()
27
28 # def init(self):
29 # self.root = self.gfx_mgr.root.attach_node('world')
30
31 # def clean(self): self.root.remove_node()
32
33 # def load_model(self, filename, callback=None, anim=None):
34 # try: return self.gfx_mgr.load_model(filename, callback, anim)
35 # except OSError:
36 # return self.gfx_mgr.load_model(filename + '.bam', callback, anim)
37
38 # def set_toon(self): self.gfx_mgr.set_toon()
39
40 # def set_bloom(self): self.gfx_mgr.set_bloom()
41
42 # def print_stats(self, two_d=True, three_d=True, analyze=True, ls=True):
43 # self.gfx_mgr.print_stats(two_d, three_d, analyze, ls)
44
45 # @staticmethod
46 # def set_frame_rate(fps):
47 # globalClock.setMode(ClockObject.MLimited)
48 # globalClock.set_frame_rate(fps)
49 # # base.set_sleep(.01)
50
51 # @staticmethod
52 # def particle(parent, texture, color=(1, 1, 1, 1), ampl=pi/6, ray=.5,
53 # rate=.0001, gravity=-.85, vel=3.8, part_duration=1.0,
54 # autodestroy=None, size=10):
55 # return Particle(parent, texture, color, ampl, ray, rate, gravity, vel,
56 # part_duration, autodestroy, size)