PK!^[::panda3d_render_pass/__init__.py__version__ = '0.1.0' from .renderpass import RenderPass PK!2\ !panda3d_render_pass/renderpass.pyimport panda3d.core as p3d class RenderPass: def __init__( self, name, pipe=None, engine=None, window=None, camera=None, scene=None, shader=None, frame_buffer_properties=None, clear_color=p3d.LColor(0.41, 0.41, 0.41, 0.0) ): self.name = name self._pipe = pipe if pipe else base.pipe self._engine = engine if engine else base.graphics_engine self._window = window if window else base.win self._root = p3d.NodePath(p3d.ModelNode(f'{self.name}_root')) if scene: scene.instance_to(self._root) else: quad = self._make_fullscreen_quad() quad.reparent_to(self._root) if shader: self._root.set_shader(shader) self._camera = self._make_camera(camera) self.output = p3d.Texture(f'{self.name}_output') self.buffer = self._make_buffer(frame_buffer_properties) self.buffer.add_render_texture( self.output, p3d.GraphicsOutput.RTM_bind_or_copy, p3d.GraphicsOutput.RTP_color ) self.display_region = self.buffer.make_display_region(0, 1, 0, 1) if self._camera: self.display_region.set_camera(self._camera) self.buffer.set_clear_color(clear_color) def _make_camera(self, source_cam): cam = p3d.Camera(f'{self.name}_camera') cam_nodepath = self._root.attach_new_node(cam) cam.set_scene(self._root) if source_cam: def update(callback_data): try: lens = source_cam.get_node(0).get_lens() except AttributeError: lens = source_cam.find('**/+Camera').get_node(0).get_lens() cam.set_lens(lens) cam_nodepath.set_pos(source_cam.get_pos(self._root)) cam_nodepath.set_hpr(source_cam.get_hpr(self._root)) callback_data.upcall() callback = p3d.CallbackNode(f'{self.name}_update_camera') callback.set_cull_callback(update) cam_nodepath.attach_new_node(callback) return cam_nodepath def _make_buffer(self, fb_props): if not fb_props: fb_props = p3d.FrameBufferProperties() fb_props.set_rgba_bits(8, 8, 8, 0) fb_props.set_depth_bits(24) return self._engine.make_output( self._pipe, self.name, 0, fb_props, p3d.WindowProperties(), p3d.GraphicsPipe.BF_refuse_window | p3d.GraphicsPipe.BF_size_track_host, self._window.get_gsg(), self._window ) def _make_fullscreen_quad(self): tris = p3d.GeomTristrips(p3d.GeomEnums.UH_static) tris.add_next_vertices(4) vdata = p3d.GeomVertexData( 'abc', p3d.GeomVertexFormat.get_empty(), p3d.GeomEnums.UH_static ) geom = p3d.Geom(vdata) geom.add_primitive(tris) geom.set_bounds(p3d.OmniBoundingVolume()) node = p3d.GeomNode(f'{self.name}_fullscreen_quad') node.add_geom(geom) return p3d.NodePath(node) PK!k..+panda3d_render_pass-0.1.0.dist-info/LICENSEMIT License Copyright (c) 2019 Daniel Stokes Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. PK!HڽTU)panda3d_render_pass-0.1.0.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!H@B,panda3d_render_pass-0.1.0.dist-info/METADATATm6_|̀iHLHڨ'[>I΅wISf0b_ٕ?;>J`5q-oF!llf?K Tin,`9TеPwɀ:mNHp?R3ev` Nߢ=XXsfp۵ڟNVxIvxH"z>e/~!WڑD12}[KTu34xT}!{P1&lOh #[Gtq;% V&I*HGH6;iA g ~5K)9:N%ox;@b|vK-K 7:TYɒ%4`*RD )(wj䍋!ʡ@;jġgaAzH+DPhpω8H4]qZ{n:'6 C=v{a"x-KmV$Ǣ*A80w<]jVr3?L ݲ/50gW4@2qm}hS*]VhM1$T9rl:u'[I?9]X?<2Dy-x~9E|.$Y4 }FQǮSMd Ҍ؋)e (a3c {B8E`Dz8_r@(B,zOlĴ:Ac,3Z0ɦ\ڋiPLw|g nQ;Nj2zl])]Ԍ44}iPK!H!DP2*panda3d_render_pass-0.1.0.dist-info/RECORD=0R7JDTʗh(x௿\.&784Q)RF79%+{f 8LgqjSg927IOnU5/98 E!Uu2Tܫڍ/8A80O:: (HK %c C%a j˹&cꑰ ݾ/, Ȓ&e[pW׆py(}:}r%J8Vcշ{t4,h