ya2 · news · projects · code · about

removed unused code
[pmachines.git] / ya2 / engine / configuration.py
CommitLineData
cb700bcc
FC
1# from panda3d.core import load_prc_file_data
2# from ya2.lib.builder import LibP3d
3
4
5# class GuiCfg:
6
7# def __init__(self, fps=False, win_size='1280 720', win_orig=None,
8# win_title='lib', fullscreen=False, sync_video=None,
9# antialiasing=False, shaders=True, volume=1, fixed_fps=0):
10# self.fps = fps
11# self.win_size = win_size
12# self.win_title = win_title
13# self.win_orig = win_orig
14# self.fullscreen = fullscreen
15# self.sync_video = LibP3d.runtime() if sync_video is None \
16# else sync_video
17# self.antialiasing = antialiasing
18# self.shaders = shaders
19# self.volume = volume
20# self.fixed_fps = fixed_fps
21
22
23# class ProfilingCfg:
24
25# def __init__(self, profiling=False, pyprof_percall=False):
26# self.profiling = profiling # profiling with panda3d's tools
27# self.pyprof_percall = pyprof_percall
28
29
30# class LangCfg:
31
32# def __init__(self, lang='en', lang_path='assets/locale',
33# lang_domain='lib_game', languages=[('English', 'en')]):
34# self.lang = lang
35# self.lang_path = lang_path
36# self.lang_domain = lang_domain
37# self.languages = languages
38
39
40# class CursorCfg:
41
42# def __init__(self, cursor_hidden=False, cursor_path='',
43# cursor_scale=(1, 1, 1), cursor_color=(1, 1, 1, 1),
44# cursor_hotspot=(0, 0)):
45# self.cursor_hidden = cursor_hidden
46# self.cursor_path = cursor_path
47# self.cursor_scale = cursor_scale
48# self.cursor_color = cursor_color
49# self.cursor_hotspot = cursor_hotspot
50
51
52# class DevCfg:
53
54# def __init__(
55# self, mt_render=False, model_path='assets/models', excluded='',
56# shaders_dev=False, pbr=False, gamma=1.0, menu_joypad=True,
57# verbose='', verbose_log=False, xmpp_server='', start_wp='',
58# port=9099, server='localhost:9098', srgb=False, opengl_3_2=False,
59# gl_debug=False, async_textures=False, show_buffers=False,
60# anisotropic=8, pbr_normal=True, pbr_occlusion=True,
61# pbr_shadows=True, pbr_exposure=True, pbr_msaa_samples=4,
62# pbr_fog=True, offscreen=False, directx=False,
63# functional_test=False, functional_ref=False):
64# self.multithreaded_render = mt_render # multithreaded rendering
65# self.model_path = model_path
66# self.excluded = excluded
67# self.shaders_dev = shaders_dev
68# self.pbr = pbr
69# self.pbr_normal = pbr_normal
70# self.pbr_occlusion = pbr_occlusion
71# self.pbr_shadows = pbr_shadows
72# self.pbr_exposure = pbr_exposure
73# self.pbr_msaa_samples = pbr_msaa_samples
74# self.pbr_fog = pbr_fog
75# self.gamma = gamma
76# self.directx = directx
77# self.menu_joypad = menu_joypad
78# self.verbose = verbose
79# self.verbose_log = verbose_log
80# self.xmpp_server = xmpp_server
81# self.port = port
82# self.server = server
83# self.start_wp = start_wp
84# self.srgb = srgb
85# self.opengl_3_2 = opengl_3_2
86# self.gl_debug = gl_debug
87# self.async_textures = async_textures
88# self.show_buffers = show_buffers
89# self.anisotropic = anisotropic
90# self.offscreen = offscreen
91# self.functional_test = functional_test
92# self.functional_ref = functional_ref
93
94
95# class Cfg:
96
97# def __init__(self, gui_cfg=None, profiling_cfg=None, lang_cfg=None,
98# cursor_cfg=None, dev_cfg=None):
99# self.gui_cfg = gui_cfg or GuiCfg()
100# self.profiling_cfg = profiling_cfg or ProfilingCfg()
101# self.lang_cfg = lang_cfg or LangCfg()
102# self.cursor_cfg = cursor_cfg or CursorCfg()
103# self.dev_cfg = dev_cfg or DevCfg()
104# self.__configure()
105
106# @staticmethod
107# def __set(key, val): load_prc_file_data('', key + ' ' + str(val))
108
109# def __configure(self):
110# cfginfo = [
111# ('texture-anisotropic-degree', self.dev_cfg.anisotropic),
112# # ('client-sleep', 0.001),
113# ('texture-minfilter', 'linear_mipmap_linear'),
114# ('gl-coordinate-system', 'default'),
115# ('textures-power-2', 'down'),
116# ('textures-auto-power-2', 1),
117# ('show-frame-rate-meter', int(self.gui_cfg.fps)),
118# ('hardware-animated-vertices', 'true'),
119# ('x-init-threads', 'true'),
120# # temp workaround for mtrendering (linux)
121# ('basic-shaders-only', 'false'),
122# ('default-model-extension', '.bam'),
123# #('compressed-textures', 1), # particles don't work
124# #('model-cache-textures', 1),
125# #('model-cache-compressed-textures', 1),
126# #('bam-version', '6 45'),
127# ('audio-ouput-rate', 44100)]
128# if self.gui_cfg.win_size:
129# cfginfo += [('win-size', self.gui_cfg.win_size)]
130# if self.gui_cfg.win_orig:
131# cfginfo += [('win-origin', self.gui_cfg.win_orig)]
132# if self.dev_cfg.srgb:
133# cfginfo += [('framebuffer-srgb', 'true')]
134# if self.dev_cfg.opengl_3_2:
135# cfginfo += [('gl-version', '3 2')]
136# if self.dev_cfg.gl_debug:
137# cfginfo += [('gl-debug', 1)]
138# if self.dev_cfg.show_buffers:
139# cfginfo += [('show-buffers', 'true')]
140# if self.dev_cfg.async_textures:
141# cfginfo += [
142# ('preload-textures', 0),
143# ('preload-simple-textures', 1),
144# ('texture-compression', 1),
145# ('allow-incomplete-render', 1)]
146# if self.dev_cfg.directx:
147# cfginfo += [
148# ('load-display', 'pandadx9')]
149# cfginfo += [
150# ('window-title', self.gui_cfg.win_title),
151# ('cursor-hidden', int(self.cursor_cfg.cursor_hidden)),
152# ('sync-video', int(self.gui_cfg.sync_video)),
153# ('framebuffer-multisample', 1),
154# ('multisamples', 2)]
155# if self.dev_cfg.multithreaded_render:
156# cfginfo += [('threading-model', '/Draw')]
157# if self.dev_cfg.offscreen:
158# cfginfo += [('window-type', 'offscreen')]
159# if self.profiling_cfg.profiling:
160# cfginfo += [
161# ('want-pstats', 1),
162# ('task-timer-verbose', 1),
163# ('pstats-tasks', 1),
164# ('gl-finish', 1),
165# ('pstats-host', '127.0.0.1')]
166# for verb in self.dev_cfg.verbose.split(';'):
167# if not verb: continue
168# verb_el = verb.strip().split()
169# if verb_el[0] == 'direct':
170# cfginfo += [
171# ('default-directnotify-level', verb_el[1])]
172# elif verb_el[0] == 'panda':
173# cfginfo += [
174# ('notify-level', verb_el[1])]
175# else:
176# cfginfo += [
177# ('notify-level-' + verb_el[0], verb_el[1])]
178# list(map(lambda args: self.__set(*args), cfginfo))