Пример #1
0
    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

        # 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.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
Пример #2
0
    def _init_internal_mgr(self):
        """ Creates the light storage manager and the buffer to store the light data """
        self._internal_mgr = InternalLightManager()

        # Storage for the Lights
        per_light_vec4s = 4
        self._img_light_data = Image.create_buffer(
            "LightData", self._MAX_LIGHTS * per_light_vec4s, Texture.T_float,
            Texture.F_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, Texture.T_float,
            Texture.F_rgba16)
        self._img_light_data.set_clear_color(0)
        self._img_light_data.clear_image()

        # Register the buffer
        add_input = self._pipeline.stage_mgr.add_input
        add_input("AllLightsData", self._img_light_data.get_texture())
        add_input("ShadowSourceData", self._img_source_data.get_texture())
        add_input("maxLightIndex", self._pta_max_light_index)
Пример #3
0
    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")
Пример #4
0
    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
Пример #5
0
    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")
Пример #6
0
    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
Пример #7
0
 def __init__(self, pipeline):
     DebugObject.__init__(self, "GPUCommandQueue")
     self._pipeline = pipeline
     self._commands_per_frame = 512
     self._command_list = GPUCommandList()
     self._pta_num_commands = PTAInt.empty_array(1)
     self._create_data_storage()
     self._create_command_target()
     self._commands = []
     self._register_defines()
 def __init__(self, pipeline):
     RenderStage.__init__(self, pipeline)
     self.resolution = 128
     self.diffuse_resolution = 4
     self.regions = []
     self.cameras = []
     self.rig_node = Globals.render.attach_new_node("EnvmapCamRig")
     self.pta_index = PTAInt.empty_array(1)
     self.storage_tex = None
     self.storage_tex_diffuse = None
Пример #9
0
 def __init__(self, pipeline):
     RenderStage.__init__(self, pipeline)
     self.resolution = 128
     self.diffuse_resolution = 4
     self.regions = []
     self.cameras = []
     self.rig_node = Globals.render.attach_new_node("EnvmapCamRig")
     self.pta_index = PTAInt.empty_array(1)
     self.storage_tex = None
     self.storage_tex_diffuse = None
Пример #10
0
 def __init__(self, pipeline):
     RPObject.__init__(self)
     self._pipeline = pipeline
     self._commands_per_frame = 1024
     self._command_list = GPUCommandList()
     self._pta_num_commands = PTAInt.empty_array(1)
     self._create_data_storage()
     self._create_command_target()
     self._commands = []
     self._register_defines()
    def _setup_inputs(self):
        """ Sets all required inputs """
        self.pta_probes = PTAInt.empty_array(1)

        # Construct the UBO which stores all environment probe data
        self.data_ubo = SimpleInputBlock("EnvProbes")
        self.data_ubo.add_input("num_probes", self.pta_probes)
        self.data_ubo.add_input("cubemaps", self.probe_mgr.cubemap_storage)
        self.data_ubo.add_input("diffuse_cubemaps", self.probe_mgr.diffuse_storage)
        self.data_ubo.add_input("dataset", self.probe_mgr.dataset_storage)
        self._pipeline.stage_mgr.input_blocks.append(self.data_ubo)

        # Use the UBO in light culling
        CullLightsStage.required_inputs.append("EnvProbes")
Пример #12
0
 def __init__(self, pipeline):
     RenderStage.__init__(self, pipeline)
     self.area_tex = None
     self.search_tex = None
     self.use_reprojection = True
     self._jitter_index = PTAInt.empty_array(1)
Пример #13
0
 def _create_ptas(self):
     self._pta_grid_pos = PTALVecBase3.empty_array(1)
     self._pta_grid_size = PTAFloat.empty_array(1)
     self._pta_grid_res = PTAInt.empty_array(1)
     self._pta_grid_size[0] = self._voxel_ws
     self._pta_grid_res[0] = self._voxel_res
Пример #14
0
 def __init__(self, pipeline):
     RenderStage.__init__(self, pipeline)
     self.area_tex = None
     self.search_tex = None
     self.use_reprojection = True
     self._jitter_index = PTAInt.empty_array(1)