本文整理匯總了Python中rpcore.loader.RPLoader.load_texture方法的典型用法代碼示例。如果您正苦於以下問題:Python RPLoader.load_texture方法的具體用法?Python RPLoader.load_texture怎麽用?Python RPLoader.load_texture使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rpcore.loader.RPLoader
的用法示例。
在下文中一共展示了RPLoader.load_texture方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _load_textures
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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
示例2: on_pipeline_created
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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)
示例3: _load_grain
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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)
示例4: __init__
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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)
示例5: on_pipeline_created
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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)
示例6: __init__
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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)
示例7: _load_skydome
# 需要導入模塊: from rpcore.loader import RPLoader [as 別名]
# 或者: from rpcore.loader.RPLoader import load_texture [as 別名]
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