Exemple #1
0
def _load_library(name, version=""):
  """Try to load a shared library, report an error on failure."""
  try:
    import ctypes
    return ctypes.CDLL("lib{}.so{}".format(name, version))
  except:
    from pi3d.util import Log
    Log.logger(__name__).error("Couldn't load library lib%s.so%s", name, version)
Exemple #2
0
def _load_library(name):
  """Try to load a shared library, report an error on failure."""
  if name:
    try:
      import ctypes
      return ctypes.CDLL(name)
    except:
      from pi3d.util import Log
      Log.logger(__name__).error("Couldn't load library %s", name)
Exemple #3
0
def _load_library(name):
  """Try to load a shared library, report an error on failure."""
  if name:
    try:
      import ctypes
      return ctypes.CDLL(name)
    except:
      from pi3d.util import Log
      Log.logger(__name__).error("Couldn't load library %s", name)
Exemple #4
0
def _load_library(name, dll_type="C"):
    """Try to load a shared library, report an error on failure."""
    if name:
        try:
            if dll_type == "Win":
                return ctypes.WinDLL(name)
            else:
                return ctypes.CDLL(name)
        except:
            from pi3d.util import Log
            Log.logger(__name__).error("Couldn't load library %s", name)
Exemple #5
0
def _load_library(name, dll_type="C"):
    """Try to load a shared library, report an error on failure."""
    if name:
        try:
            if dll_type == "Win":
                return ctypes.WinDLL(name)
            else:
                return ctypes.CDLL(name)
        except:
            from pi3d.util import Log

            Log.logger(__name__).error("Couldn't load library %s", name)
Exemple #6
0
from __future__ import absolute_import, division, print_function, unicode_literals

import ctypes, itertools
import numpy as np

from ctypes import c_float, c_int, c_short

from pi3d.constants import *
from pi3d.util import Log
from pi3d.util import Utility
from pi3d.util.Loadable import Loadable
from pi3d.util.Ctypes import c_floats, c_shorts

LOGGER = Log.logger(__name__)


class Buffer(Loadable):
    """Holds the vertex, normals, incices and tex_coords for each part of
  a Shape that needs to be rendered with a different material or texture
  Shape holds an array of Buffer objects.

  """
    def __init__(self,
                 shape,
                 pts,
                 texcoords,
                 faces,
                 normals=None,
                 smooth=True):
        """Generate a vertex buffer to hold data and indices. If no normals
    are provided then these are generated.
Exemple #7
0
from __future__ import absolute_import, division, print_function, unicode_literals

import threading
import six

from pi3d.util import Log

LOGGER = Log.logger(__name__)

class _Mouse(threading.Thread):
  """holds Mouse object, see also (the preferred) events methods"""
  BUTTON_1 = 1 << 1
  BUTTON_2 = 1 << 2
  BUTTONS = BUTTON_1 & BUTTON_2
  HEADER = 1 << 3
  XSIGN = 1 << 4
  YSIGN = 1 << 5
  INSTANCE = None

  def __init__(self, mouse='mice', restrict=True, width=1920, height=1200):
    """
    Arguments:
      *mouse*
        /dev/input/ device name
      *restrict*
        stops or allows the mouse x and y values to carry on going beyond:
      *width*
        mouse x limit
      *height*
        mouse y limit
    """