本文整理汇总了Python中rpcore.RenderPipeline.load_settings方法的典型用法代码示例。如果您正苦于以下问题:Python RenderPipeline.load_settings方法的具体用法?Python RenderPipeline.load_settings怎么用?Python RenderPipeline.load_settings使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rpcore.RenderPipeline
的用法示例。
在下文中一共展示了RenderPipeline.load_settings方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainBase
# 需要导入模块: from rpcore import RenderPipeline [as 别名]
# 或者: from rpcore.RenderPipeline import load_settings [as 别名]
class MainBase(ShowBase):
def __init__(self):
load_prc_file_data("", "win-size {} {}".format(w, h))
load_prc_file_data("", "window-type offscreen")
self.rp = RenderPipeline(self)
self.rp.load_settings(
os.path.join(base_path, "pipeline.yaml"))
self.rp.set_empty_loading_screen()
self.rp.create()
self.rp.daytime_mgr.time = 0.45
model = loader.loadModel("preview.bam")
model.reparent_to(render)
model.set_two_sided(True)
self.rp.prepare_scene(model)
base.disable_mouse()
base.camLens.set_fov(110)
base.render2d.hide()
base.pixel2d.hide()
base.pixel2dp.hide()
main_cam = model.find("**/Camera")
if main_cam:
transform_mat = main_cam.get_transform(render).get_mat()
transform_mat = Mat4.convert_mat(CS_zup_right, CS_yup_right) * transform_mat
base.camera.set_mat(transform_mat)
else:
print("WARNING: No camera found")
示例2: GameControl
# 需要导入模块: from rpcore import RenderPipeline [as 别名]
# 或者: from rpcore.RenderPipeline import load_settings [as 别名]
class GameControl(ShowBase):
"""
controlling the game itself, menu, editors level selection... it's sorta a fake-fsm.
did i mention i dont like fsm's and prefer totaly whicked logic instead?
"""
def __init__(self):
load_prc_file_data("", "textures-power-2 none")
load_prc_file_data("", "win-size 1600 900")
# load_prc_file_data("", "fullscreen #t")
load_prc_file_data("", "window-title cuboid")
load_prc_file_data("", "icon-filename res/icon.ico")
# I found openal works better for me
load_prc_file_data("", "audio-library-name p3openal_audio")
# ------ Begin of render pipeline code ------
# Insert the pipeline path to the system path, this is required to be
# able to import the pipeline classes
pipeline_path = "../../"
# Just a special case for my development setup, so I don't accidentally
# commit a wrong path. You can remove this in your own programs.
if not os.path.isfile(os.path.join(pipeline_path, "setup.py")):
pipeline_path = "../../RenderPipeline/"
sys.path.insert(0, pipeline_path)
# Use the utility script to import the render pipeline classes
from rpcore import RenderPipeline
self.render_pipeline = RenderPipeline()
self.render_pipeline.mount_mgr.mount()
self.render_pipeline.load_settings("/$$rpconfig/pipeline.yaml")
self.render_pipeline.settings["pipeline.display_debugger"] = False
self.render_pipeline.set_empty_loading_screen()
self.render_pipeline.create(self)
# [Optional] use the default skybox, you can use your own skybox as well
# self.render_pipeline.create_default_skybox()
# ------ End of render pipeline code, thats it! ------
# Set time of day
self.render_pipeline.daytime_mgr.time = 0.812
self.menu = Menu(self)
self.level = Level(self)
self.cube = Cube(self.level)
self.camControl = CamControl(self.cube)
self.gui = GUI(self)
self.menu.showMenu()
base.accept("i",self.camControl.zoomIn)
base.accept("o",self.camControl.zoomOut)
def startGame(self,level=0):
#debug purpose only: to directly play a certian lvl number
from sys import argv
if len(argv) >1:
level = int(argv[1])
self.menu.hideMenu()
self.level.loadLevel(level)
self.cube.resetCube()
self.cube.resetStats()
self.cube.enableGameControl()
base.accept("escape", self.pauseGame)
def pauseGame(self):
self.cube.disableGameControl()
self.menu.showMenu()
self.menu.showResume()
#base.accept("escape", self.resumeGame )
def resumeGame(self):
self.menu.hideMenu()
self.menu.hideResume()
self.cube.enableGameControl()
base.accept("escape", self.pauseGame)
def levelEnd(self):
self.cube.disableGameControl()
self.menu.showMenu()