本文整理匯總了Python中rpcore.RenderPipeline.set_empty_loading_screen方法的典型用法代碼示例。如果您正苦於以下問題:Python RenderPipeline.set_empty_loading_screen方法的具體用法?Python RenderPipeline.set_empty_loading_screen怎麽用?Python RenderPipeline.set_empty_loading_screen使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpcore.RenderPipeline
的用法示例。
在下文中一共展示了RenderPipeline.set_empty_loading_screen方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: MainBase
# 需要導入模塊: from rpcore import RenderPipeline [as 別名]
# 或者: from rpcore.RenderPipeline import set_empty_loading_screen [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: Application
# 需要導入模塊: from rpcore import RenderPipeline [as 別名]
# 或者: from rpcore.RenderPipeline import set_empty_loading_screen [as 別名]
class Application(ShowBase):
ICOMING_PORT = 62360
def __init__(self):
load_prc_file_data("", "win-size 512 512")
# load_prc_file_data("", "window-type offscreen")
load_prc_file_data("", "model-cache-dir")
load_prc_file_data("", "model-cache-textures #f")
load_prc_file_data("", "textures-power-2 none")
load_prc_file_data("", "alpha-bits 0")
load_prc_file_data("", "print-pipe-types #f")
# Construct render pipeline
self.render_pipeline = RenderPipeline()
self.render_pipeline.mount_mgr.config_dir = "config/"
self.render_pipeline.set_empty_loading_screen()
self.render_pipeline.create(self)
self.setup_scene()
# Disable model caching
BamCache.get_global_ptr().cache_models = False
self.update_queue = []
self.start_listen()
# Render initial frames
for i in range(10):
self.taskMgr.step()
last_update = 0.0
self.scene_node = None
current_lights = []
current_envprobes = []
# Wait for updates
while True:
# Update once in a while
curr_time = time.time()
if curr_time > last_update + 1.0:
last_update = curr_time
self.taskMgr.step()
if self.update_queue:
if self.scene_node:
self.scene_node.remove_node()
# Only take the latest packet
payload = self.update_queue.pop(0)
print("RENDERING:", payload)
scene = loader.loadModel(Filename.from_os_specific(payload["scene"]))
for light in scene.find_all_matches("**/+PointLight"):
light.remove_node()
for light in scene.find_all_matches("**/+Spotlight"):
light.remove_node()
# Find camera
main_cam = scene.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")
base.camera.set_pos(0, -3.5, 0)
base.camera.look_at(0, -2.5, 0)
base.camLens.set_fov(64.0)
self.scene_node = scene
scene.reparent_to(render)
# Render scene
for i in range(8):
self.taskMgr.step()
dest_path = Filename.from_os_specific(payload["dest"])
print("Saving screenshot to", dest_path)
self.win.save_screenshot(dest_path)
self.notify_about_finish(int(payload["pingback_port"]))
def start_listen(self):
""" Starts the listener thread """
thread = Thread(target=self.listener_thread, args=(), name="ListenerThread")
thread.setDaemon(True)
thread.start()
return thread
def listener_thread(self):
""" Thread which listens to incoming updates """
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
print("Listening on 127.0.0.1:" + str(self.ICOMING_PORT))
try:
sock.bind(("127.0.0.1", self.ICOMING_PORT))
#.........這裏部分代碼省略.........
示例3: GameControl
# 需要導入模塊: from rpcore import RenderPipeline [as 別名]
# 或者: from rpcore.RenderPipeline import set_empty_loading_screen [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()
示例4: Application
# 需要導入模塊: from rpcore import RenderPipeline [as 別名]
# 或者: from rpcore.RenderPipeline import set_empty_loading_screen [as 別名]
class Application(ShowBase):
def __init__(self):
sys.path.insert(0, "../../")
load_prc_file_data("", "win-size 512 512")
load_prc_file_data("", "textures-power-2 none")
load_prc_file_data("", "print-pipe-types #f")
load_prc_file_data("", "notify-level-glgsg error")
# load_prc_file_data("", "win-size 1024 1024")
from rpcore import RenderPipeline, PointLight
self.render_pipeline = RenderPipeline()
self.render_pipeline.mount_mgr.config_dir = "config/"
self.render_pipeline.set_empty_loading_screen()
self.render_pipeline.create(self)
sphere = loader.loadModel("res/sphere.bam")
sphere.reparent_to(render)
self.disableMouse()
self.camLens.setFov(40)
self.camLens.setNearFar(0.03, 2000.0)
self.camera.set_pos(0, -3.5, 0)
self.camera.look_at(0, -2.5, 0)
self.render2d.hide()
self.aspect2d.hide()
light = PointLight()
light.pos = 10, -10, 10
light.radius = 1e20
light.color = (1, 1, 1)
light.inner_radius = 4.0
light.energy = 3
self.render_pipeline.add_light(light)
light = PointLight()
light.pos = -10, -10, 10
light.radius = 1e20
light.color = (1, 1, 1)
light.inner_radius = 4.0
light.energy = 3
self.render_pipeline.add_light(light)
for mat in sphere.find_all_materials():
mat.roughness = material.roughness
mat.base_color = Vec4(*(list(material.basecolor) + [1]))
mat.refractive_index = material.ior
mat.metallic = 1.0 if material.mat_type == "metallic" else 0.0
if material.mat_type == "clearcoat":
mat.emission = (2, 0, 0, 0)
mat.metallic = 1.0
mat.refractive_index = 1.51
if material.mat_type == "foliage":
mat.emission = (5, 0, 0, 0)
mat.metallic = 0.0
mat.refractive_index = 1.51
for i in range(10):
self.taskMgr.step()
self.win.save_screenshot("scene-rp.png")
base.accept("r", self.reload)
def reload(self):
print("Reloading")
self.render_pipeline.reload_shaders()
for i in range(4):
self.taskMgr.step()
self.win.save_screenshot("scene-rp.png")