本文整理汇总了Python中rpcore.image.Image类的典型用法代码示例。如果您正苦于以下问题:Python Image类的具体用法?Python Image怎么用?Python Image使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Image类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: _make_maps
def _make_maps(self):
""" Internal method to create the cubemap storage """
# Create the cubemaps for the diffuse and specular components
self._prefilter_map = Image.create_cube(
self._name + "IBLPrefDiff", CubemapFilter.PREFILTER_CUBEMAP_SIZE, "R11G11B10")
self._diffuse_map = Image.create_cube(
self._name + "IBLDiff", CubemapFilter.DIFFUSE_CUBEMAP_SIZE, "R11G11B10")
self._spec_pref_map = Image.create_cube(
self._name + "IBLPrefSpec", self._size, "R11G11B10")
self._specular_map = Image.create_cube(
self._name + "IBLSpec", self._size, "R11G11B10")
# Set the correct filtering modes
for tex in [self._diffuse_map, self._specular_map, self._prefilter_map, self._spec_pref_map]:
tex.set_minfilter(SamplerState.FT_linear)
tex.set_magfilter(SamplerState.FT_linear)
tex.set_clear_color(Vec4(0))
tex.clear_image()
# Use mipmaps for the specular cubemap
self._spec_pref_map.set_minfilter(SamplerState.FT_linear_mipmap_linear)
self._specular_map.set_minfilter(SamplerState.FT_linear_mipmap_linear)
开发者ID:gitter-badger,项目名称:RenderPipeline,代码行数:25,代码来源:cubemap_filter.py
示例2: init_internal_manager
def init_internal_manager(self):
""" Creates the light storage manager and the buffer to store the light data """
self.internal_mgr = InternalLightManager()
self.internal_mgr.set_shadow_update_distance(
self.pipeline.settings["shadows.max_update_distance"])
# Storage for the Lights
per_light_vec4s = 4
self.img_light_data = Image.create_buffer(
"LightData", self.MAX_LIGHTS * per_light_vec4s, "RGBA16")
self.img_light_data.set_clear_color(0)
self.img_light_data.clear_image()
self.pta_max_light_index = PTAInt.empty_array(1)
self.pta_max_light_index[0] = 0
# Storage for the shadow sources
per_source_vec4s = 5
self.img_source_data = Image.create_buffer(
"ShadowSourceData", self.MAX_SOURCES * per_source_vec4s, "RGBA16")
self.img_light_data.set_clear_color(0)
self.img_light_data.clear_image()
# Register the buffer
inputs = self.pipeline.stage_mgr.inputs
inputs["AllLightsData"] = self.img_light_data
inputs["ShadowSourceData"] = self.img_source_data
inputs["maxLightIndex"] = self.pta_max_light_index
开发者ID:aimoonchen,项目名称:RenderPipeline,代码行数:28,代码来源:light_manager.py
示例3: init_internal_manager
def init_internal_manager(self):
""" Creates the light storage manager and the buffer to store the light data """
self.internal_mgr = InternalLightManager()
self.internal_mgr.set_shadow_update_distance(
self.pipeline.settings["shadows.max_update_distance"])
# Storage for the Lights
per_light_vec4s = 4
self.img_light_data = Image.create_buffer(
"LightData", self.MAX_LIGHTS * per_light_vec4s, "RGBA16")
self.img_light_data.clear_image()
self.pta_max_light_index = PTAInt.empty_array(1)
self.pta_max_light_index[0] = 0
# Storage for the shadow sources
per_source_vec4s = 5
# IMPORTANT: RGBA32 is really required here. Otherwise artifacts and bad
# shadow filtering occur due to precision issues
self.img_source_data = Image.create_buffer(
"ShadowSourceData", self.MAX_SOURCES * per_source_vec4s, "RGBA32")
self.img_light_data.clear_image()
# Register the buffer
inputs = self.pipeline.stage_mgr.inputs
inputs["AllLightsData"] = self.img_light_data
inputs["ShadowSourceData"] = self.img_source_data
inputs["maxLightIndex"] = self.pta_max_light_index
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:29,代码来源:light_manager.py
示例4: _create_components
def _create_components(self):
""" Internal method to init the widgets components """
# Create the buffer which stores the last FPS values
self._storage_buffer = Image.create_buffer("FPSValues", 250, "R16")
self._storage_buffer.set_clear_color(Vec4(0))
self._storage_buffer.clear_image()
self._store_index = PTAInt.empty_array(1)
self._store_index[0] = 0
self._current_ftime = PTAFloat.empty_array(1)
self._current_ftime[0] = 16.0
self._chart_ms_max = PTAFloat.empty_array(1)
self._chart_ms_max[0] = 40
# Create the texture where the gui component is rendered inside
self._display_tex = Image.create_2d("FPSChartRender", 250, 120, "RGBA8")
self._display_tex.set_clear_color(Vec4(0))
self._display_tex.clear_image()
self._display_img = Sprite(
image=self._display_tex, parent=self._node, w=250, h=120, x=10, y=10)
# Defer the further loading
Globals.base.taskMgr.doMethodLater(0.3, self._late_init, "FPSChartInit")
开发者ID:croxis,项目名称:SpaceDrive,代码行数:26,代码来源:fps_chart.py
示例5: create
def create(self):
self.target = self.create_target("CollectUsedCells")
self.target.size = 0, 0
self.target.prepare_buffer()
self.cell_list_buffer = Image.create_buffer("CellList", 0, "R32I")
self.cell_index_buffer = Image.create_2d_array("CellIndices", 0, 0, 0, "R32I")
self.target.set_shader_inputs(
CellListBuffer=self.cell_list_buffer,
CellListIndices=self.cell_index_buffer)
开发者ID:jakogut,项目名称:RenderPipeline,代码行数:11,代码来源:collect_used_cells_stage.py
示例6: create
def create(self):
# Create the target which converts the scene color to a luminance
self.target_lum = self.create_target("GetLuminance")
self.target_lum.size = -4
self.target_lum.add_color_attachment(bits=(16, 0, 0, 0))
self.target_lum.prepare_buffer()
self.mip_targets = []
# Create the storage for the exposure, this stores the current and last
# frames exposure
# XXX: We have to use F_r16 instead of F_r32 because of a weird nvidia
# driver bug! However, 16 bits should be enough for sure.
self.tex_exposure = Image.create_buffer("ExposureStorage", 1, "R16")
self.tex_exposure.set_clear_color(Vec4(0.5))
self.tex_exposure.clear_image()
# Create the target which extracts the exposure from the average brightness
self.target_analyze = self.create_target("AnalyzeBrightness")
self.target_analyze.size = 1, 1
self.target_analyze.prepare_buffer()
self.target_analyze.set_shader_input("ExposureStorage", self.tex_exposure)
# Create the target which applies the generated exposure to the scene
self.target_apply = self.create_target("ApplyExposure")
self.target_apply.add_color_attachment(bits=16)
self.target_apply.prepare_buffer()
self.target_apply.set_shader_input("Exposure", self.tex_exposure)
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:30,代码来源:auto_exposure_stage.py
示例7: _create_components
def _create_components(self):
""" Internal method to init the widgets components """
self._node.hide()
# Create the texture where the gui component is rendered inside
self._storage_tex = Image.create_2d("ExposureDisplay", 140, 20, "RGBA8")
self._storage_tex.set_clear_color(Vec4(0.2, 0.6, 1.0, 1.0))
self._storage_tex.clear_image()
self._bg_frame = DirectFrame(
parent=self._node, frameColor=(0.1, 0.1, 0.1, 1.0),
frameSize=(200, 0, -10, -85), pos=(0, 0, 0))
self._display_img = Sprite(
image=self._storage_tex, parent=self._node, w=140, h=20, x=20, y=50)
self._display_txt = Text(
text="Current Exposure".upper(), parent=self._node, x=160, y=40,
size=13, color=Vec3(0.8), align="right")
# Create the shader which generates the visualization texture
self._cshader_node = ComputeNode("ExposureWidget")
self._cshader_node.add_dispatch(140 // 10, 20 // 4, 1)
self._cshader_np = self._node.attach_new_node(self._cshader_node)
# Defer the further loading
Globals.base.taskMgr.doMethodLater(1.0, self._late_init, "ExposureLateInit")
开发者ID:croxis,项目名称:SpaceDrive,代码行数:29,代码来源:exposure_widget.py
示例8: create
def create(self):
self.target = self.create_target("FlagUsedCells")
self.target.prepare_buffer()
self.cell_grid_flags = Image.create_2d_array(
"CellGridFlags", 0, 0,
self._pipeline.settings["lighting.culling_grid_slices"], "R8")
self.target.set_shader_input("cellGridFlags", self.cell_grid_flags)
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:8,代码来源:flag_used_cells_stage.py
示例9: create
def create(self):
if self.remove_fireflies:
self.target_firefly = self.create_target("RemoveFireflies")
self.target_firefly.add_color_attachment(bits=16)
self.target_firefly.prepare_buffer()
self.scene_target_img = Image.create_2d(
"BloomDownsample", Globals.resolution.x, Globals.resolution.y, "R11G11B10")
self.scene_target_img.set_minfilter(SamplerState.FT_linear_mipmap_linear)
self.scene_target_img.set_magfilter(SamplerState.FT_linear)
self.scene_target_img.set_wrap_u(SamplerState.WM_clamp)
self.scene_target_img.set_wrap_v(SamplerState.WM_clamp)
self.scene_target_img.set_clear_color(Vec4(0.1, 0.0, 0.0, 1.0))
self.scene_target_img.clear_image()
self.target_extract = self.create_target("ExtractBrightSpots")
self.target_extract.prepare_buffer()
self.target_extract.set_shader_input("DestTex", self.scene_target_img, False, True, -1, 0)
if self.remove_fireflies:
self.target_extract.set_shader_input("ShadedScene", self.target_firefly.color_tex, 1000)
self.downsample_targets = []
self.upsample_targets = []
# Downsample passes
for i in range(self.num_mips):
scale_multiplier = 2 ** (1 + i)
target = self.create_target("Downsample:Step-" + str(i))
target.size = -scale_multiplier, -scale_multiplier
target.prepare_buffer()
target.set_shader_input("sourceMip", i)
target.set_shader_input("SourceTex", self.scene_target_img)
target.set_shader_input("DestTex", self.scene_target_img, False, True, -1, i + 1)
self.downsample_targets.append(target)
# Upsample passes
for i in range(self.num_mips):
scale_multiplier = 2 ** (self.num_mips - i - 1)
target = self.create_target("Upsample:Step-" + str(i))
target.size = -scale_multiplier, -scale_multiplier
target.prepare_buffer()
target.set_shader_input("FirstUpsamplePass", i == 0)
target.set_shader_input("sourceMip", self.num_mips - i)
target.set_shader_input("SourceTex", self.scene_target_img)
target.set_shader_input("DestTex", self.scene_target_img,
False, True, -1, self.num_mips - i - 1)
self.upsample_targets.append(target)
self.target_apply = self.create_target("ApplyBloom")
self.target_apply.add_color_attachment(bits=16)
self.target_apply.prepare_buffer()
self.target_apply.set_shader_input("BloomTex", self.scene_target_img)
开发者ID:croxis,项目名称:SpaceDrive,代码行数:56,代码来源:bloom_stage.py
示例10: create
def create(self):
# TODO: Use no oversized triangle in this stage
self.target = self.create_target("CullProbes")
self.target.size = 0, 0
self.target.prepare_buffer()
self.per_cell_probes = Image.create_buffer("PerCellProbes", 0, "R32I")
self.per_cell_probes.clear_image()
self.target.set_shader_input("PerCellProbes", self.per_cell_probes)
self.target.set_shader_input("threadCount", 1)
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:10,代码来源:cull_probes_stage.py
示例11: create
def create(self):
tile_amount = self._pipeline.light_mgr.num_tiles
self.target = self.create_target("CollectUsedCells")
self.target.size = tile_amount.x, tile_amount.y
self.target.prepare_buffer()
num_slices = self._pipeline.settings["lighting.culling_grid_slices"]
max_cells = tile_amount.x * tile_amount.y * num_slices
self.debug("Allocating", max_cells, "cells")
self._cell_list_buffer = Image.create_buffer("CellList", 1 + max_cells, "R32I")
self._cell_list_buffer.set_clear_color(0)
self._cell_index_buffer = Image.create_2d_array(
"CellIndices", tile_amount.x, tile_amount.y, num_slices, "R32I")
self._cell_index_buffer.set_clear_color(0)
self.target.set_shader_input("CellListBuffer", self._cell_list_buffer)
self.target.set_shader_input("CellListIndices", self._cell_index_buffer)
开发者ID:aimoonchen,项目名称:RenderPipeline,代码行数:19,代码来源:collect_used_cells_stage.py
示例12: _create_storage
def _create_storage(self):
""" Internal method to create the storage for the profile dataset textures """
self._storage_tex = Image.create_3d("IESDatasets", 512, 512, self._max_entries, "R16")
self._storage_tex.set_minfilter(SamplerState.FT_linear)
self._storage_tex.set_magfilter(SamplerState.FT_linear)
self._storage_tex.set_wrap_u(SamplerState.WM_clamp)
self._storage_tex.set_wrap_v(SamplerState.WM_repeat)
self._storage_tex.set_wrap_w(SamplerState.WM_clamp)
self._pipeline.stage_mgr.inputs["IESDatasetTex"] = self._storage_tex
self._pipeline.stage_mgr.defines["MAX_IES_PROFILES"] = self._max_entries
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:11,代码来源:ies_profile_loader.py
示例13: create
def create(self):
self.target = self.create_target("FlagUsedCells")
self.target.prepare_buffer()
tile_amount = self._pipeline.light_mgr.num_tiles
self.cell_grid_flags = Image.create_2d_array(
"CellGridFlags", tile_amount.x, tile_amount.y,
self._pipeline.settings["lighting.culling_grid_slices"], "R8")
self.cell_grid_flags.set_clear_color(0)
self.target.set_shader_input("cellGridFlags", self.cell_grid_flags)
开发者ID:aimoonchen,项目名称:RenderPipeline,代码行数:12,代码来源:flag_used_cells_stage.py
示例14: init
def init(self):
""" Creates the cubemap storage """
# Storage for the specular components (with mipmaps)
self.cubemap_storage = Image.create_cube_array(
"EnvmapStorage", self.resolution, self.max_probes, "RGBA16")
self.cubemap_storage.set_minfilter(SamplerState.FT_linear_mipmap_linear)
self.cubemap_storage.set_magfilter(SamplerState.FT_linear)
self.cubemap_storage.set_clear_color(Vec4(1.0, 0.0, 0.1, 1.0))
self.cubemap_storage.clear_image()
# Storage for the diffuse component
self.diffuse_storage = Image.create_cube_array(
"EnvmapDiffStorage", self.diffuse_resolution, self.max_probes, "RGBA16")
self.diffuse_storage.set_clear_color(Vec4(1, 0, 0.2, 1.0))
self.diffuse_storage.clear_image()
# Data-storage to store all cubemap properties
self.dataset_storage = Image.create_buffer(
"EnvmapData", self.max_probes * 5, "RGBA32")
self.dataset_storage.set_clear_color(Vec4(0))
self.dataset_storage.clear_image()
开发者ID:croxis,项目名称:SpaceDrive,代码行数:22,代码来源:probe_manager.py
示例15: create
def create(self):
# Create the target which converts the scene color to a luminance
self.target_lum = self.create_target("GetLuminance")
self.target_lum.size = -4
self.target_lum.add_color_attachment(bits=(16, 0, 0, 0))
self.target_lum.prepare_buffer()
# Get the current quarter-window size
wsize_x = (Globals.resolution.x + 3) // 4
wsize_y = (Globals.resolution.y + 3) // 4
# Create the targets which downscale the luminance mipmaps
self.mip_targets = []
last_tex = self.target_lum.color_tex
while wsize_x >= 4 or wsize_y >= 4:
wsize_x = (wsize_x+3) // 4
wsize_y = (wsize_y+3) // 4
mip_target = self.create_target("DScaleLum:S" + str(wsize_x))
mip_target.add_color_attachment(bits=(16, 0, 0, 0))
mip_target.size = wsize_x, wsize_y
mip_target.prepare_buffer()
mip_target.set_shader_input("SourceTex", last_tex)
self.mip_targets.append(mip_target)
last_tex = mip_target.color_tex
# Create the storage for the exposure, this stores the current and last
# frames exposure
# XXX: We have to use F_r16 instead of F_r32 because of a weird nvidia
# driver bug! However, 16 bits should be enough for sure.
self.tex_exposure = Image.create_buffer("ExposureStorage", 1, "R16")
self.tex_exposure.set_clear_color(Vec4(0.5))
self.tex_exposure.clear_image()
# Create the target which extracts the exposure from the average brightness
self.target_analyze = self.create_target("AnalyzeBrightness")
self.target_analyze.size = 1, 1
self.target_analyze.prepare_buffer()
self.target_analyze.set_shader_input(
"ExposureStorage", self.tex_exposure)
self.target_analyze.set_shader_input("DownscaledTex", last_tex)
# Create the target which applies the generated exposure to the scene
self.target_apply = self.create_target("ApplyExposure")
self.target_apply.add_color_attachment(bits=16)
self.target_apply.prepare_buffer()
self.target_apply.set_shader_input("Exposure", self.tex_exposure)
开发者ID:croxis,项目名称:SpaceDrive,代码行数:50,代码来源:auto_exposure_stage.py
示例16: create
def create(self):
max_cells = self._pipeline.light_mgr.total_tiles
self.num_rows = int(math.ceil(max_cells / float(self.slice_width)))
self.target = self.create_target("CullProbes")
# TODO: Use no oversized triangle in this stage
self.target.size = self.slice_width, self.num_rows
self.target.prepare_buffer()
self.per_cell_probes = Image.create_buffer(
"PerCellProbes", max_cells * self.max_probes_per_cell, "R32I")
self.per_cell_probes.set_clear_color(0)
self.per_cell_probes.clear_image()
self.target.set_shader_input("PerCellProbes", self.per_cell_probes)
开发者ID:aimoonchen,项目名称:RenderPipeline,代码行数:14,代码来源:cull_probes_stage.py
示例17: _bind_pipes_to_stage
def _bind_pipes_to_stage(self, stage):
""" Sets all required pipes on a stage """
for pipe in stage.required_pipes:
# Check if there is an input block named like the pipe
if pipe in self.input_blocks:
self.input_blocks[pipe].bind_to(stage)
continue
if pipe.startswith("PreviousFrame::"):
# Special case: Pipes from the previous frame. We assume those
# pipes have the same size as the window and a format of
# F_rgba16. Could be subject to change.
pipe_name = pipe.split("::")[-1]
if pipe_name not in self.previous_pipes:
tex_format = "RGBA16"
# XXX: Assuming we have a depth texture whenever "depth"
# occurs in the textures name
if "depth" in pipe_name.lower():
tex_format = "R32"
pipe_tex = Image.create_2d(
"Prev-" + pipe_name, Globals.resolution.x,
Globals.resolution.y, tex_format)
pipe_tex.clear_image()
self.previous_pipes[pipe_name] = pipe_tex
stage.set_shader_input("Previous_" + pipe_name, self.previous_pipes[pipe_name])
continue
elif pipe.startswith("FuturePipe::"):
# Special case: Future Pipes which are not available yet.
# They will contain the unmodified data from the last
# frame.
pipe_name = pipe.split("::")[-1]
self.debug("Awaiting future pipe", pipe_name)
self.future_bindings.append((pipe_name, stage))
continue
if pipe not in self.pipes:
self.fatal("Pipe '" + pipe + "' is missing for", stage)
return False
pipe_value = self.pipes[pipe]
if isinstance(pipe_value, list) or isinstance(pipe_value, tuple):
stage.set_shader_input(pipe, *pipe_value)
else:
stage.set_shader_input(pipe, pipe_value)
return True
开发者ID:mayudong,项目名称:RenderPipeline,代码行数:49,代码来源:stage_manager.py
示例18: _create_store_targets
def _create_store_targets(self):
""" Creates the targets which copy the result texture into the actual storage """
self.target_store = self.create_target("StoreCubemap")
self.target_store.size = self.resolution * 6, self.resolution
self.target_store.prepare_buffer()
self.target_store.set_shader_input("SourceTex", self.target.color_tex)
self.target_store.set_shader_input("DestTex", self.storage_tex)
self.target_store.set_shader_input("currentIndex", self.pta_index)
self.temporary_diffuse_map = Image.create_cube("DiffuseTemp", self.resolution, "RGBA16")
self.target_store_diff = self.create_target("StoreCubemapDiffuse")
self.target_store_diff.size = self.resolution * 6, self.resolution
self.target_store_diff.prepare_buffer()
self.target_store_diff.set_shader_input("SourceTex", self.target.color_tex)
self.target_store_diff.set_shader_input("DestTex", self.temporary_diffuse_map)
self.target_store_diff.set_shader_input("currentIndex", self.pta_index)
开发者ID:gitter-badger,项目名称:RenderPipeline,代码行数:16,代码来源:environment_capture_stage.py
示例19: create
def create(self):
max_cells = self._pipeline.light_mgr.total_tiles
self.num_rows = int(math.ceil(max_cells / float(self.slice_width)))
self.target = self.create_target("CullLights")
# TODO: Use no oversized triangle in this stage
self.target.size = self.slice_width, self.num_rows
self.target.prepare_buffer()
self.per_cell_lights = Image.create_buffer(
"PerCellLights", max_cells * (self.max_lights_per_cell + self.num_light_classes),
"R32I")
self.per_cell_lights.set_clear_color(0)
self.target.set_shader_input("PerCellLightsBuffer", self.per_cell_lights)
self.debug("Using", self.num_rows, "culling lines")
开发者ID:aimoonchen,项目名称:RenderPipeline,代码行数:16,代码来源:cull_lights_stage.py
示例20: create
def create(self):
# Construct the voxel texture
self._cloud_voxels = Image.create_3d(
"CloudVoxels", self._voxel_res_xy, self._voxel_res_xy, self._voxel_res_z, "RGBA8")
self._cloud_voxels.set_wrap_u(SamplerState.WM_repeat)
self._cloud_voxels.set_wrap_v(SamplerState.WM_repeat)
self._cloud_voxels.set_wrap_w(SamplerState.WM_border_color)
self._cloud_voxels.set_border_color(Vec4(0, 0, 0, 0))
# Construct the target which populates the voxel texture
self._grid_target = self.create_target("CreateVoxels")
self._grid_target.size = self._voxel_res_xy, self._voxel_res_xy
self._grid_target.prepare_buffer()
self._grid_target.quad.set_instance_count(self._voxel_res_z)
self._grid_target.set_shader_input("CloudVoxels", self._cloud_voxels)
# Construct the target which shades the voxels
self._shade_target = self.create_target("ShadeVoxels")
self._shade_target.size = self._voxel_res_xy, self._voxel_res_xy
self._shade_target.prepare_buffer()
self._shade_target.quad.set_instance_count(self._voxel_res_z)
self._shade_target.set_shader_input("CloudVoxels", self._cloud_voxels)
self._shade_target.set_shader_input("CloudVoxelsDest", self._cloud_voxels)
开发者ID:ELMERzark,项目名称:RenderPipeline,代码行数:23,代码来源:cloud_voxel_stage.py
注:本文中的rpcore.image.Image类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论