OGRE: Python

| OGRE 14.5 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Python
Optional Components

Convenience functions for python. More...

## Functions
| Python.Numpy.AsDataStream (arr)
| copy numpy array to Ogre.MemoryDataStream that can be used in Ogre
| Python.HighPy.camera_intrinsics (str window_name, K, imsize)
| set camera intrinsics
| Python.HighPy.imshow (str window_name, str|os.PathLike img_path)
| show an image in the window
| Python.HighPy.mesh_hide (str window_name, str|os.PathLike mesh_path)
| hide a mesh in the window
| Python.HighPy.mesh_show (str window_name, str|os.PathLike mesh_path, rot_mat=None, position=(0, 0, 0), str|None material_name=None, str|None entity_name=None)
| show a mesh in the window
| Python.HighPy.point_light (str window_name, position=(0, 0, 0))
| create a point light in the window
| Python.Numpy.view (o)
| writable numpy view to the ogre data types
| Python.HighPy.window_compositor (str window_name, str compositor_name)
| set a compositor for the window
| Python.HighPy.window_create (str window_name, window_size, int flags=AXES_ZBACKWARD_YUP)
| create a window
int | Python.HighPy.window_draw (str window_name)
| draw the window
| Python.HighPy.window_pixel_data (str window_name, str|None compositor_name=None, str|None texture_name=None, int mrt_index=0)
| get the pixel data from the window or the active compositor
| Python.HighPy.window_use_imgui (str window_name, callback)
| enable imgui for the window

## Variables
int | Python.HighPy.AXES_ZBACKWARD_YUP = 0
| Ogre & OpenGL coordinate system
int | Python.HighPy.AXES_ZFORWARD_YDOWN = 1
| OpenCV & colmap coordinate system.
| Python.HighPy.user_resource_locations = set()
| add paths here to override the default resource location `"."`

## Detailed Description

Convenience functions for python.

## Function Documentation

## ◆ AsDataStream()

Python.Numpy.AsDataStream | ( |  | arr | ) |

copy numpy array to Ogre.MemoryDataStream that can be used in Ogre

Parameters

  arr | some numpy array

References view().

## ◆ view()

Python.Numpy.view | ( |  | o | ) |

writable numpy view to the ogre data types

take care that the ogre type does not get released while the view is used. e.g. this is invalid

v = Ogre.Vector3()
return Ogre.Numpy.view(v)
Ogre::Vector< 3, Real >

instead do

return Ogre.Numpy.view(v).copy()

to pass numpy arrays into Ogre use AsDataStream()

References Ogre::PixelUtil.getNumElemBytes().

Referenced by AsDataStream().

## ◆ window_create()

Python.HighPy.window_create | ( | str | window_name,
|  |  | window_size,
|  | int | flags = AXES_ZBACKWARD_YUP )

create a window

Parameters

  window_name | name of the window
  window_size | size of the window in pixels
  flags | window create options

## ◆ window_draw()

int Python.HighPy.window_draw | ( | str | window_name | ) |

draw the window

Parameters

  window_name | name of the window

Returns
  last key pressed inside the window

## ◆ window_use_imgui()

Python.HighPy.window_use_imgui | ( | str | window_name,
|  |  | callback )

enable imgui for the window

Parameters

  window_name | name of the window
  callback | function to call for imgui rendering

## ◆ window_compositor()

Python.HighPy.window_compositor | ( | str | window_name,
|  | str | compositor_name )

set a compositor for the window

Parameters

  window_name | name of the window
  compositor_name | name of the compositor

References Ogre::CompositorManager.getSingleton().

## ◆ window_pixel_data()

Python.HighPy.window_pixel_data | ( | str | window_name,
|  | str | None | compositor_name = None,
|  | str | None | texture_name = None,
|  | int | mrt_index = 0 )

get the pixel data from the window or the active compositor

Parameters

  window_name | name of the window
  compositor_name | name of the compositor
  texture_name | name of the texture
  mrt_index | index of the MRT

Return values

  0 | bytearray holding the pixel data
  1 | tuple (bytes per pixel, height, width, channels)

References Ogre::CompositorManager.getSingleton().

## ◆ imshow()

Python.HighPy.imshow | ( | str | window_name,
|  | str | os.PathLike | img_path )

show an image in the window

Parameters

  window_name | name of the window
  img_path | path to the image file

## ◆ camera_intrinsics()

Python.HighPy.camera_intrinsics | ( | str | window_name,
|  |  | K,
|  |  | imsize )

set camera intrinsics

Parameters

  window_name | name of the window
  K | 3x3 camera matrix
  imsize | image size in pixels

## ◆ mesh_show()

Python.HighPy.mesh_show | ( | str | window_name,
|  | str | os.PathLike | mesh_path,
|  |  | rot_mat = None,
|  |  | position = (0, 0, 0),
|  | str | None | material_name = None,
|  | str | None | entity_name = None )

show a mesh in the window

Parameters

  window_name | name of the window
  mesh_path | path to the mesh file
  rot_mat | 3x3 rotation matrix
  position | 3x1 translation vector
  material_name | optional material name to use instead of the default
  entity_name | optional entity name to allow multiple instances of the same mesh

## ◆ mesh_hide()

Python.HighPy.mesh_hide | ( | str | window_name,
|  | str | os.PathLike | mesh_path )

hide a mesh in the window

Parameters

  window_name | name of the window
  mesh_path | path to the mesh file

## ◆ point_light()

Python.HighPy.point_light | ( | str | window_name,
|  |  | position = (0, 0, 0) )

create a point light in the window

Parameters

  window_name | name of the window
  position | position of the light in world coordinates

## Variable Documentation

## ◆ AXES_ZBACKWARD_YUP

int Python.HighPy.AXES_ZBACKWARD_YUP = 0

Ogre & OpenGL coordinate system

## ◆ AXES_ZFORWARD_YDOWN

int Python.HighPy.AXES_ZFORWARD_YDOWN = 1

OpenCV & colmap coordinate system.

## ◆ user_resource_locations

Python.HighPy.user_resource_locations = set()

add paths here to override the default resource location `"."`