PYME.LMVis.layers.base module

Test module docstring

class PYME.LMVis.layers.base.BaseEngine

Bases: BindMixin, ShaderMixin

abstract render(gl_canvas, layer)
class PYME.LMVis.layers.base.BaseLayer(**kwargs)

Bases: HasTraits

This class represents a layer that should be rendered. It should represent a fairly high level concept of a layer - e.g. a Point-cloud of data coming from XX, or a Surface representation of YY. If such a layer can be rendered multiple different but similar ways (e.g. points/pointsprites or shaded/wireframe etc) which otherwise share common settings e.g. point size, point colour, etc … these representations should be coded as one layer with a selectable rendering backend or ‘engine’ responsible for managing shaders and actually executing the opengl code. In this case use the EngineLayer class as a base

.

In simpler cases, such as rendering an overlay it is acceptable for a layer to do it’s own rendering and manage it’s own shader. In this case, use SimpleLayer as a base.

property bbox

Bounding box in form [x0,y0,z0, x1,y1,z1] (or none if a bounding box does not make sense for this layer) over-ride in derived classes

abstract render(gl_canvas)

Abstract render method to be over-ridden in derived classes. Should check self.visible before drawing anything.

Parameters
gl_canvasthe canvas to draw to - an instance of PYME.LMVis.gl_render3D_shaders.LMGLShaderCanvas
serialise()
settings_dict()
visible = <PYME.misc.mock_traits.CStr object>
class PYME.LMVis.layers.base.BindMixin

Bases: object

Contains the core logic for binding data to OpenGL buffers

class PYME.LMVis.layers.base.EngineLayer(**kwargs)

Bases: BaseLayer

Base class for layers who delegate their rendering to an engine.

engine = <PYME.misc.mock_traits.CStr object>
abstract get_colors()

Provides the engine with a way of obtaining vertex data. Should be over-ridden in derived class

Returns
a numpy array of vertices suitable for passing to glColorPointerf()
abstract get_normals()

Provides the engine with a way of obtaining vertex data. Should be over-ridden in derived class

Returns
a numpy array of normals suitable for passing to glNormalPointerf()
abstract get_vertices()

Provides the engine with a way of obtaining vertex data. Should be over-ridden in derived class

Returns
a numpy array of vertices suitable for passing to glVertexPointerf()
render(gl_canvas)

Abstract render method to be over-ridden in derived classes. Should check self.visible before drawing anything.

Parameters
gl_canvasthe canvas to draw to - an instance of PYME.LMVis.gl_render3D_shaders.LMGLShaderCanvas
settings_dict()
show_lut = <PYME.misc.mock_traits.CStr object>
class PYME.LMVis.layers.base.ShaderMixin

Bases: object

Contains the core logic for managing shaders

get_shader_program(canvas)
get_specific_shader_program(canvas, shader_program_cls)

Get a specific shader program instance for this engine. This is useful for engines that need to use multiple different shaders. Added to allow points layers to switch between using points and using quads as the desired point size exceeds the maximum point size supported by the hardware.

set_shader_program(shader_program)
property shader_program
class PYME.LMVis.layers.base.SimpleLayer(**kwargs)

Bases: BaseLayer, ShaderMixin

Layer base class for layers which do their own rendering and manage their own shaders

Derived classes should implement the render method to draw to the canvas.