コード例 #1
0
    def __init__(self,
                 parent=None,
                 x=0,
                 y=0,
                 callback=None,
                 extra_args=None,
                 radio=False,
                 expand_width=100,
                 checked=False,
                 enabled=True):
        RPObject.__init__(self)

        prefix = "checkbox" if not radio else "radiobox"

        if enabled:
            checked_img = RPLoader.load_texture("/$$rp/data/gui/" + prefix +
                                                "_checked.png")
            unchecked_img = RPLoader.load_texture("/$$rp/data/gui/" + prefix +
                                                  "_default.png")
        else:
            checked_img = RPLoader.load_texture("/$$rp/data/gui/" + prefix +
                                                "_disabled.png")
            unchecked_img = checked_img

        # Set near filter, otherwise textures look like crap
        for tex in [checked_img, unchecked_img]:
            tex.set_minfilter(SamplerState.FT_linear)
            tex.set_magfilter(SamplerState.FT_linear)
            tex.set_wrap_u(SamplerState.WM_clamp)
            tex.set_wrap_v(SamplerState.WM_clamp)
            tex.set_anisotropic_degree(0)

        self._node = DirectCheckBox(parent=parent,
                                    pos=(x + 11, 1, -y - 8),
                                    scale=(10 / 2.0, 1, 10 / 2.0),
                                    checkedImage=checked_img,
                                    uncheckedImage=unchecked_img,
                                    image=unchecked_img,
                                    extraArgs=extra_args,
                                    state=DGG.NORMAL,
                                    relief=DGG.FLAT,
                                    command=self._update_status)

        self._node["frameColor"] = (0, 0, 0, 0)
        self._node["frameSize"] = (-2.6, 2 + expand_width / 7.5, -2.35, 2.5)
        self._node.set_transparency(TransparencyAttrib.M_alpha)

        self._callback = callback
        self._extra_args = extra_args
        self._collection = None

        if checked:
            self.set_checked(True, False)
コード例 #2
0
ファイル: plugin.py プロジェクト: jakogut/RenderPipeline
    def _load_textures(self):
        """ Loads all required textures """
        search_tex = RPLoader.load_texture(self.get_resource("search_tex.png"))
        area_tex = RPLoader.load_texture(self.get_resource("area_tex.png"))

        for tex in [search_tex, area_tex]:
            tex.set_minfilter(SamplerState.FT_linear)
            tex.set_magfilter(SamplerState.FT_linear)
            tex.set_wrap_u(SamplerState.WM_clamp)
            tex.set_wrap_v(SamplerState.WM_clamp)

        self._smaa_stage.area_tex = area_tex
        self._smaa_stage.search_tex = search_tex
コード例 #3
0
    def _load_textures(self):
        """ Loads all required textures """
        search_tex = RPLoader.load_texture(self.get_resource("search_tex.png"))
        area_tex = RPLoader.load_texture(self.get_resource("area_tex.png"))

        for tex in [search_tex, area_tex]:
            tex.set_minfilter(SamplerState.FT_linear)
            tex.set_magfilter(SamplerState.FT_linear)
            tex.set_wrap_u(SamplerState.WM_clamp)
            tex.set_wrap_v(SamplerState.WM_clamp)

        self._smaa_stage.area_tex = area_tex
        self._smaa_stage.search_tex = search_tex
コード例 #4
0
 def _load_skydome(self):
     """ Loads the skydome """
     skydome = RPLoader.load_texture(
         "/$$rp/data/builtin_models/skybox/skybox.txo")
     skydome.set_wrap_u(SamplerState.WM_clamp)
     skydome.set_wrap_v(SamplerState.WM_clamp)
     self._pipeline.stage_mgr.inputs["DefaultSkydome"] = skydome
コード例 #5
0
ファイル: plugin.py プロジェクト: aimoonchen/RenderPipeline
    def on_pipeline_created(self):
        cloud_voxels = RPLoader.load_3d_texture(self.get_resource("slices/#.png"))
        cloud_voxels.set_wrap_w(SamplerState.WM_clamp)
        self.apply_stage.set_shader_input("CloudVoxels", cloud_voxels)

        noise_tex = RPLoader.load_texture(self.get_resource("noise.png"))
        noise_tex.set_minfilter(SamplerState.FT_linear_mipmap_linear)
        self.apply_stage.set_shader_input("NoiseTex", noise_tex)
コード例 #6
0
ファイル: plugin.py プロジェクト: mayudong/RenderPipeline
 def _load_grain(self):
     grain_tex = RPLoader.load_texture("/$$rp/data/film_grain/grain.txo")
     grain_tex.set_minfilter(SamplerState.FT_linear)
     grain_tex.set_magfilter(SamplerState.FT_linear)
     grain_tex.set_wrap_u(SamplerState.WM_repeat)
     grain_tex.set_wrap_v(SamplerState.WM_repeat)
     grain_tex.set_anisotropic_degree(0)
     self._stage.set_shader_input("PrecomputedGrain", grain_tex)
コード例 #7
0
ファイル: sprite.py プロジェクト: mayudong/RenderPipeline
    def __init__(self,
                 image=None,
                 parent=None,
                 x=0,
                 y=0,
                 w=None,
                 h=None,
                 transparent=True,
                 near_filter=True,
                 any_filter=True):
        """ Creates a new image, taking (x,y) as topleft coordinates.

        When near_filter is set to true, a near filter will be set to the
        texture passed. This provides sharper images.

        When any_filter is set to false, the passed image won't be modified at
        all. This enables you to display existing textures, otherwise the
        texture would get a near filter in the 3D View, too. """

        RPObject.__init__(self)

        if not isinstance(image, Texture):
            if not isinstance(image, str):
                self.warn("Invalid argument to image parameter:", image)
                return
            image = RPLoader.load_texture(image)

            if w is None or h is None:
                w, h = image.get_x_size(), image.get_y_size()
        else:
            if w is None or h is None:
                w = 10
                h = 10

        self._width, self._height = w, h
        self._initial_pos = self._translate_pos(x, y)

        self.node = OnscreenImage(image=image,
                                  parent=parent,
                                  pos=self._initial_pos,
                                  scale=(self._width / 2.0, 1,
                                         self._height / 2.0))

        if transparent:
            self.node.set_transparency(TransparencyAttrib.M_alpha)

        tex = self.node.get_texture()

        # Apply a near filter, but only if the parent has no scale, otherwise
        # it will look weird
        if near_filter and any_filter and parent.get_sx() == 1.0:
            tex.set_minfilter(SamplerState.FT_nearest)
            tex.set_magfilter(SamplerState.FT_nearest)

        if any_filter:
            tex.set_anisotropic_degree(8)
            tex.set_wrap_u(SamplerState.WM_clamp)
            tex.set_wrap_v(SamplerState.WM_clamp)
コード例 #8
0
ファイル: plugin.py プロジェクト: aimoonchen/RenderPipeline
 def _load_grain(self):
     grain_tex = RPLoader.load_texture(
         "/$$rp/data/film_grain/grain.txo")
     grain_tex.set_minfilter(SamplerState.FT_linear)
     grain_tex.set_magfilter(SamplerState.FT_linear)
     grain_tex.set_wrap_u(SamplerState.WM_repeat)
     grain_tex.set_wrap_v(SamplerState.WM_repeat)
     grain_tex.set_anisotropic_degree(0)
     self._stage.set_shader_input("PrecomputedGrain", grain_tex)
コード例 #9
0
 def load_grain(self):
     """ Loads the precomputed film grain """
     grain_tex = RPLoader.load_texture(
         "/$$rp/rpcore/data/film_grain/grain.txo.pz")
     grain_tex.set_minfilter(SamplerState.FT_linear)
     grain_tex.set_magfilter(SamplerState.FT_linear)
     grain_tex.set_wrap_u(SamplerState.WM_repeat)
     grain_tex.set_wrap_v(SamplerState.WM_repeat)
     grain_tex.set_anisotropic_degree(0)
     self.stage.set_shader_input("PrecomputedGrain", grain_tex)
コード例 #10
0
ファイル: checkbox.py プロジェクト: aimoonchen/RenderPipeline
    def __init__(self, parent=None, x=0, y=0, callback=None, extra_args=None,
                 radio=False, expand_width=100, checked=False, enabled=True):
        RPObject.__init__(self)

        prefix = "checkbox" if not radio else "radiobox"

        if enabled:
            checked_img = RPLoader.load_texture(
                "/$$rp/data/gui/" + prefix + "_checked.png")
            unchecked_img = RPLoader.load_texture(
                "/$$rp/data/gui/" + prefix + "_default.png")
        else:
            checked_img = RPLoader.load_texture(
                "/$$rp/data/gui/" + prefix + "_disabled.png")
            unchecked_img = checked_img

        # Set near filter, otherwise textures look like crap
        for tex in [checked_img, unchecked_img]:
            tex.set_minfilter(SamplerState.FT_linear)
            tex.set_magfilter(SamplerState.FT_linear)
            tex.set_wrap_u(SamplerState.WM_clamp)
            tex.set_wrap_v(SamplerState.WM_clamp)
            tex.set_anisotropic_degree(0)

        self._node = DirectCheckBox(
            parent=parent, pos=(x + 11, 1, -y - 8), scale=(10 / 2.0, 1, 10 / 2.0),
            checkedImage=checked_img, uncheckedImage=unchecked_img,
            image=unchecked_img, extraArgs=extra_args, state=DGG.NORMAL,
            relief=DGG.FLAT, command=self._update_status)

        self._node["frameColor"] = (0, 0, 0, 0)
        self._node["frameSize"] = (-2.6, 2 + expand_width / 7.5, -2.35, 2.5)
        self._node.set_transparency(TransparencyAttrib.M_alpha)

        self._callback = callback
        self._extra_args = extra_args
        self._collection = None

        if checked:
            self.set_checked(True, False)
コード例 #11
0
ファイル: plugin.py プロジェクト: croxis/SpaceDrive
    def on_pipeline_created(self):
        # High-res noise
        noise1 = RPLoader.load_texture(self.get_resource("noise1-data.txo"))
        noise1.set_wrap_u(SamplerState.WM_repeat)
        noise1.set_wrap_v(SamplerState.WM_repeat)
        noise1.set_wrap_w(SamplerState.WM_repeat)
        noise1.set_minfilter(SamplerState.FT_linear_mipmap_linear)
        self.apply_stage.set_shader_input("Noise1", noise1)

        # Low-res noise
        noise2 = RPLoader.load_texture(self.get_resource("noise2-data.txo"))
        noise2.set_wrap_u(SamplerState.WM_repeat)
        noise2.set_wrap_v(SamplerState.WM_repeat)
        noise2.set_wrap_w(SamplerState.WM_repeat)
        noise2.set_minfilter(SamplerState.FT_linear_mipmap_linear)
        self.apply_stage.set_shader_input("Noise2", noise2)

        # Weather tex
        weather = RPLoader.load_texture(self.get_resource("weather_tex.png"))
        weather.set_wrap_u(SamplerState.WM_repeat)
        weather.set_wrap_v(SamplerState.WM_repeat)
        self.apply_stage.set_shader_input("WeatherTex", weather)
コード例 #12
0
    def on_pipeline_created(self):
        # High-res noise
        noise1 = RPLoader.load_texture(self.get_resource("noise1-data.txo.pz"))
        noise1.set_wrap_u(SamplerState.WM_repeat)
        noise1.set_wrap_v(SamplerState.WM_repeat)
        noise1.set_wrap_w(SamplerState.WM_repeat)
        noise1.set_minfilter(SamplerState.FT_linear_mipmap_linear)
        self.apply_stage.set_shader_input("Noise1", noise1)

        # Low-res noise
        noise2 = RPLoader.load_texture(self.get_resource("noise2-data.txo.pz"))
        noise2.set_wrap_u(SamplerState.WM_repeat)
        noise2.set_wrap_v(SamplerState.WM_repeat)
        noise2.set_wrap_w(SamplerState.WM_repeat)
        noise2.set_minfilter(SamplerState.FT_linear_mipmap_linear)
        self.apply_stage.set_shader_input("Noise2", noise2)

        # Weather tex
        weather = RPLoader.load_texture(self.get_resource("weather_tex.png"))
        weather.set_wrap_u(SamplerState.WM_repeat)
        weather.set_wrap_v(SamplerState.WM_repeat)
        self.apply_stage.set_shader_input("WeatherTex", weather)
コード例 #13
0
ファイル: sprite.py プロジェクト: aimoonchen/RenderPipeline
    def __init__(self, image=None, parent=None, x=0, y=0, w=None, h=None,
                 transparent=True, near_filter=True, any_filter=True):
        """ Creates a new image, taking (x,y) as topleft coordinates.

        When near_filter is set to true, a near filter will be set to the
        texture passed. This provides sharper images.

        When any_filter is set to false, the passed image won't be modified at
        all. This enables you to display existing textures, otherwise the
        texture would get a near filter in the 3D View, too. """

        RPObject.__init__(self)

        if not isinstance(image, Texture):
            if not isinstance(image, str):
                self.warn("Invalid argument to image parameter:", image)
                return
            image = RPLoader.load_texture(image)

            if w is None or h is None:
                w, h = image.get_x_size(), image.get_y_size()
        else:
            if w is None or h is None:
                w = 10
                h = 10

        self._width, self._height = w, h
        self._initial_pos = self._translate_pos(x, y)

        self.node = OnscreenImage(
            image=image, parent=parent, pos=self._initial_pos,
            scale=(self._width / 2.0, 1, self._height / 2.0))

        if transparent:
            self.node.set_transparency(TransparencyAttrib.M_alpha)

        tex = self.node.get_texture()

        # Apply a near filter, but only if the parent has no scale, otherwise
        # it will look weird
        if near_filter and any_filter and parent.get_sx() == 1.0:
            tex.set_minfilter(SamplerState.FT_nearest)
            tex.set_magfilter(SamplerState.FT_nearest)

        if any_filter:
            tex.set_anisotropic_degree(8)
            tex.set_wrap_u(SamplerState.WM_clamp)
            tex.set_wrap_v(SamplerState.WM_clamp)
コード例 #14
0
 def _load_skydome(self):
     """ Loads the skydome """
     skydome = RPLoader.load_texture("/$$rp/data/builtin_models/skybox/skybox.txo")
     skydome.set_wrap_u(SamplerState.WM_clamp)
     skydome.set_wrap_v(SamplerState.WM_clamp)
     self._pipeline.stage_mgr.inputs["DefaultSkydome"] = skydome
コード例 #15
0
 def on_pipeline_created(self):
     dirt_tex = RPLoader.load_texture(self.get_resource("lens_dirt.txo.pz"))
     self._bloom_stage.set_shader_input("LensDirtTex", dirt_tex)
コード例 #16
0
ファイル: plugin.py プロジェクト: croxis/SpaceDrive
 def on_pipeline_created(self):
     dirt_tex = RPLoader.load_texture(self.get_resource("lens_dirt.txo"))
     self._bloom_stage.set_shader_input("LensDirtTex", dirt_tex)