當前位置: 首頁>>代碼示例>>Python>>正文


Python RPLoader.load_shader方法代碼示例

本文整理匯總了Python中rpcore.loader.RPLoader.load_shader方法的典型用法代碼示例。如果您正苦於以下問題:Python RPLoader.load_shader方法的具體用法?Python RPLoader.load_shader怎麽用?Python RPLoader.load_shader使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在rpcore.loader.RPLoader的用法示例。


在下文中一共展示了RPLoader.load_shader方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: _late_init

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
    def _late_init(self, task):
        """ Gets called after the pipeline was initialized """
        self._display_txt = Text(
            text="40 ms", parent=self._node, x=20, y=25,
            size=13, color=Vec3(1), may_change=True)
        self._display_txt_bottom = Text(
            text="0 ms", parent=self._node, x=20, y=120,
            size=13, color=Vec3(1), may_change=True)


        # Create the shader which generates the visualization texture
        self._cshader_node = ComputeNode("FPSChartUpdateChart")
        self._cshader_node.add_dispatch(250 // 10, 120 // 4, 1)
        self._cshader_np = self._node.attach_new_node(self._cshader_node)

        self._cshader = RPLoader.load_shader("/$$rp/shader/fps_chart.compute.glsl")
        self._cshader_np.set_shader(self._cshader)
        self._cshader_np.set_shader_input("DestTex", self._display_tex)
        self._cshader_np.set_shader_input("FPSValues", self._storage_buffer)
        self._cshader_np.set_shader_input("index", self._store_index)
        self._cshader_np.set_shader_input("maxMs", self._chart_ms_max)

        self._update_shader_node = ComputeNode("FPSChartUpdateValues")
        self._update_shader_node.add_dispatch(1, 1, 1)
        self._update_shader_np = self._node.attach_new_node(self._update_shader_node)
        self._ushader = RPLoader.load_shader("/$$rp/shader/fps_chart_update.compute.glsl")
        self._update_shader_np.set_shader(self._ushader)
        self._update_shader_np.set_shader_input("DestTex", self._storage_buffer)
        self._update_shader_np.set_shader_input("index", self._store_index)
        self._update_shader_np.set_shader_input("currentData", self._current_ftime)

        Globals.base.addTask(self._update, "UpdateFPSChart", sort=-50)

        return task.done
開發者ID:croxis,項目名稱:SpaceDrive,代碼行數:36,代碼來源:fps_chart.py

示例2: _late_init

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
 def _late_init(self, task):
     """ Gets called after the pipeline got initialized """
     scene_tex = self._pipeline.stage_mgr.pipes["ShadedScene"]
     self._zoomer.set_shader(RPLoader.load_shader(
         "/$$rp/shader/default_gui_shader.vert.glsl",
         "/$$rp/shader/pixel_inspector.frag.glsl"))
     self._zoomer.set_shader_input("SceneTex", scene_tex)
     return task.done
開發者ID:aimoonchen,項目名稱:RenderPipeline,代碼行數:10,代碼來源:pixel_inspector.py

示例3: create_shaders

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
 def create_shaders(self):
     """ Creates all the shaders used for precomputing """
     self.shaders = {}
     resource_path = self.handle.get_shader_resource("eric_bruneton")
     for fname in listdir(resource_path):
         fpath = join(resource_path, fname)
         if isfile(fpath) and fname.endswith(".compute.glsl"):
             shader_name = fname.split(".")[0]
             shader_obj = RPLoader.load_shader(fpath)
             self.shaders[shader_name] = shader_obj
開發者ID:aimoonchen,項目名稱:RenderPipeline,代碼行數:12,代碼來源:scattering_methods.py

示例4: do_load

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
    def do_load(self, filename):
        """ Internal method to load the effect from the given filename, do
        not use this directly, instead use load(). """
        self.filename = filename
        self.effect_name = self._convert_filename_to_name(filename)
        self.effect_hash = self._generate_hash(filename, self._options)

        # Load the YAML file
        parsed_yaml = load_yaml_file(filename) or {}
        self._parse_content(parsed_yaml)

        # Construct a shader object for each pass
        for pass_id in self._PASSES:
            vertex_src = self._generated_shader_paths["vertex-" + pass_id]
            fragment_src = self._generated_shader_paths["fragment-" + pass_id]
            self._shader_objs[pass_id] = RPLoader.load_shader(vertex_src, fragment_src)
        return True
開發者ID:jakogut,項目名稱:RenderPipeline,代碼行數:19,代碼來源:effect.py

示例5: _late_init

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
    def _late_init(self, task):
        """ Gets called after the pipeline initialized, this extracts the
        exposure texture from the stage manager """
        stage_mgr = self._pipeline.stage_mgr

        if "Exposure" not in stage_mgr.pipes:
            self.debug("Disabling exposure widget, could not find the exposure data.")
            self._node.remove_node()
            return

        self._node.show()

        exposure_tex = stage_mgr.pipes["Exposure"]
        self._cshader = RPLoader.load_shader("/$$rp/shader/visualize_exposure.compute.glsl")
        self._cshader_np.set_shader(self._cshader)
        self._cshader_np.set_shader_input("DestTex", self._storage_tex)
        self._cshader_np.set_shader_input("ExposureTex", exposure_tex)

        return task.done
開發者ID:croxis,項目名稱:SpaceDrive,代碼行數:21,代碼來源:exposure_widget.py

示例6: _get_shader_handle

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
    def _get_shader_handle(self, path, *args):
        """ Returns a handle to a Shader object, containing all sources passed
        as arguments. The path argument will be used to locate shaders if no
        absolute path is given. This is the internal method used in load_shader
        and load_plugin_shader. """
        assert len(args) > 0 and len(args) <= 3
        path_args = []

        for source in args:
            for prefix in ("/$$rpconfig", "/$$rp/shader", "/$$rptemp"):
                if prefix in source:
                    path_args.append(source)
                    break
            else:
                path_args.append(path.format(source))

        # If only one shader is specified, assume its a postprocess fragment shader,
        # and use the default vertex shader
        if len(args) == 1:
            path_args = ["/$$rp/shader/default_post_process.vert.glsl"] + path_args
        return RPLoader.load_shader(*path_args)
開發者ID:jakogut,項目名稱:RenderPipeline,代碼行數:23,代碼來源:render_stage.py

示例7: build

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
    def build(cls, texture, view_width, view_height):
        """ Builds a shader to display <texture> in a view port with the size
        <view_width> * <view_height> """
        view_width, view_height = int(view_width), int(view_height)

        cache_key = "/$$rptemp/$$TEXDISPLAY-X{}-Y{}-Z{}-TT{}-CT{}-VW{}-VH{}.frag.glsl".format(
            texture.get_x_size(),
            texture.get_y_size(),
            texture.get_z_size(),
            texture.get_texture_type(),
            texture.get_component_type(),
            view_width,
            view_height)

        # Only regenerate the file when there is no cache entry for it
        if not isfile(cache_key) or True:
            fragment_shader = cls._build_fragment_shader(texture, view_width, view_height)

            with open(cache_key, "w") as handle:
                handle.write(fragment_shader)

        return RPLoader.load_shader("/$$rp/shader/default_gui_shader.vert.glsl", cache_key)
開發者ID:aimoonchen,項目名稱:RenderPipeline,代碼行數:24,代碼來源:display_shader_builder.py

示例8: reload_shaders

# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_shader [as 別名]
 def reload_shaders(self):
     """ Reloads the command shader """
     shader = RPLoader.load_shader(
         "/$$rp/shader/default_post_process.vert.glsl",
         "/$$rp/shader/process_command_queue.frag.glsl")
     self._command_target.shader = shader
開發者ID:aimoonchen,項目名稱:RenderPipeline,代碼行數:8,代碼來源:gpu_command_queue.py


注:本文中的rpcore.loader.RPLoader.load_shader方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。