Panda3D
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
FilterManager Class Reference
Inheritance diagram for FilterManager:
DirectObject

Public Member Functions

 __init__ (self, win, cam, forcex=0, forcey=0)
 
 cleanup (self)
 
 createBuffer (self, name, xsize, ysize, texgroup, depthbits=True, fbprops=None)
 
 getClears (self, region)
 
 getScaledSize (self, mul, div, align)
 
 isFullscreen (self)
 
 renderQuadInto (self, name="filter-stage", mul=1, div=1, align=1, depthtex=None, colortex=None, auxtex0=None, auxtex1=None, fbprops=None)
 
 renderSceneInto (self, depthtex=None, colortex=None, auxtex=None, auxbits=0, textures=None, fbprops=None, clamping=None)
 
 resizeBuffers (self)
 
 setClears (self, region, clears)
 
 setStackedClears (self, region, clears0, clears1)
 
 windowEvent (self, win)
 
- Public Member Functions inherited from DirectObject
 accept (self, event, method, extraArgs=[])
 
 acceptOnce (self, event, method, extraArgs=[])
 
 addTask (self, *args, **kwargs)
 
 detectLeaks (self)
 
 doMethodLater (self, *args, **kwargs)
 
 getAllAccepting (self)
 
 ignore (self, event)
 
 ignoreAll (self)
 
 isAccepting (self, event)
 
 isIgnoring (self, event)
 
 removeAllTasks (self)
 
 removeTask (self, taskOrName)
 

Public Attributes

 basex
 
 basey
 
 buffers
 
 camera
 
 caminit
 
 camstate
 
 engine
 
 forcex
 
 forcey
 
 nextsort
 
 rclears
 
 region
 
 sizes
 
 wclears
 
 win
 
 windowEvent
 

Static Public Attributes

 create_buffer = createBuffer
 
 get_clears = getClears
 
 get_scaled_size = getScaledSize
 
 is_fullscreen = isFullscreen
 
 notify = None
 
 render_quad_into = renderQuadInto
 
 render_scene_into = renderSceneInto
 
 resize_buffers = resizeBuffers
 
 set_clears = setClears
 
 set_stacked_clears = setStackedClears
 
 window_event = windowEvent
 
- Static Public Attributes inherited from DirectObject
 accept_once = acceptOnce
 
 add_task = addTask
 
 detect_leaks = detectLeaks
 
 do_method_later = doMethodLater
 
 get_all_accepting = getAllAccepting
 
 ignore_all = ignoreAll
 
 is_accepting = isAccepting
 
 is_ignoring = isIgnoring
 
 remove_all_tasks = removeAllTasks
 
 remove_task = removeTask
 

Additional Inherited Members

- Protected Member Functions inherited from DirectObject
 _addTask (self, task)
 
 _clearTask (self, task)
 
- Protected Attributes inherited from DirectObject
 _taskList
 

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
win,
cam,
forcex = 0,
forcey = 0 )
 The FilterManager constructor requires you to provide
a window which is rendering a scene, and the camera which is
used by that window to render the scene.  These are henceforth
called the 'original window' and the 'original camera.' 

Reimplemented from DirectObject.

Member Function Documentation

◆ cleanup()

cleanup ( self)
 Restore everything to its original state, deleting any
new buffers in the process. 

◆ createBuffer()

createBuffer ( self,
name,
xsize,
ysize,
texgroup,
depthbits = True,
fbprops = None )
 Low-level buffer creation.  Not intended for public use. 

◆ getClears()

getClears ( self,
region )

◆ getScaledSize()

getScaledSize ( self,
mul,
div,
align )
 Calculate the size of the desired window. Not public. 

◆ isFullscreen()

isFullscreen ( self)

◆ renderQuadInto()

renderQuadInto ( self,
name = "filter-stage",
mul = 1,
div = 1,
align = 1,
depthtex = None,
colortex = None,
auxtex0 = None,
auxtex1 = None,
fbprops = None )
 Creates an offscreen buffer for an intermediate
computation. Installs a quad into the buffer.  Returns
the fullscreen quad.  The size of the buffer is initially
equal to the size of the main window.  The parameters 'mul',
'div', and 'align' can be used to adjust that size. 

◆ renderSceneInto()

renderSceneInto ( self,
depthtex = None,
colortex = None,
auxtex = None,
auxbits = 0,
textures = None,
fbprops = None,
clamping = None )
 Causes the scene to be rendered into the supplied textures
instead of into the original window.  Puts a fullscreen quad
into the original window to show the render-to-texture results.
Returns the quad.  Normally, the caller would then apply a
shader to the quad.

To elaborate on how this all works:

* An offscreen buffer is created.  It is set up to mimic
  the original display region - it is the same size,
  uses the same clear colors, and contains a DisplayRegion
  that uses the original camera.

* A fullscreen quad and an orthographic camera to render
  that quad are both created.  The original camera is
  removed from the original window, and in its place, the
  orthographic quad-camera is installed.

* The fullscreen quad is textured with the data from the
  offscreen buffer.  A shader is applied that tints the
  results pink.

* Automatic shader generation NOT enabled.
  If you have a filter that depends on a render target from
  the auto-shader, you either need to set an auto-shader
  attrib on the main camera or scene, or, you need to provide
  these outputs in your own shader.

* All clears are disabled on the original display region.
  If the display region fills the whole window, then clears
  are disabled on the original window as well.  It is
  assumed that rendering the full-screen quad eliminates
  the need to do clears.

Hence, the original window which used to contain the actual
scene, now contains a pink-tinted quad with a texture of the
scene.  It is assumed that the user will replace the shader
on the quad with a more interesting filter. 

◆ resizeBuffers()

resizeBuffers ( self)
 Resize all buffers to match the size of the window. 

◆ setClears()

setClears ( self,
region,
clears )

◆ setStackedClears()

setStackedClears ( self,
region,
clears0,
clears1 )

◆ windowEvent()

windowEvent ( self,
win )
 When the window changes size, automatically resize all buffers 

Member Data Documentation

◆ basex

basex

◆ basey

basey

◆ buffers

buffers

◆ camera

camera

◆ caminit

caminit

◆ camstate

camstate

◆ create_buffer

create_buffer = createBuffer
static

◆ engine

engine

◆ forcex

forcex

◆ forcey

forcey

◆ get_clears

get_clears = getClears
static

◆ get_scaled_size

get_scaled_size = getScaledSize
static

◆ is_fullscreen

is_fullscreen = isFullscreen
static

◆ nextsort

nextsort

◆ notify

notify = None
static

◆ rclears

rclears

◆ region

region

◆ render_quad_into

render_quad_into = renderQuadInto
static

◆ render_scene_into

render_scene_into = renderSceneInto
static

◆ resize_buffers

resize_buffers = resizeBuffers
static

◆ set_clears

set_clears = setClears
static

◆ set_stacked_clears

set_stacked_clears = setStackedClears
static

◆ sizes

sizes

◆ wclears

wclears

◆ win

win

◆ window_event

window_event = windowEvent
static

◆ windowEvent

windowEvent