コード例 #1
0
ファイル: vrzero.py プロジェクト: bazil852/python-vrzero
    def init(self):
        if self.use_framebuffer:
            os.putenv('SDL_FBDEV', '/dev/fb0')
            os.putenv('SDL_VIDEODRIVER', 'fbcon')

        self.DISPLAY = pi3d.Display.create(
            w=self.hmd_screen_width,
            h=self.hmd_screen_height,
            display_config=pi3d.DISPLAY_CONFIG_HIDE_CURSOR
            | pi3d.DISPLAY_CONFIG_FULLSCREEN,
            use_glx=True)

        self.DISPLAY.set_background(0.0, 0.0, 0.0, 1)
        self.DISPLAY.frames_per_second = self.target_fps

        shader_name = "barrel" if not self.use_simple_display else "uv_flat"
        if self.use_crosseyed_method:
            self.hmd_eye_seperation = -self.hmd_eye_seperation
        self.CAMERA = pi3d.StereoCam(separation=self.hmd_eye_seperation,
                                     interlace=0,
                                     shader="shaders/" + shader_name)
        #self.CAMERA = pi3d.StereoCam(separation=self.hmd_eye_seperation, interlace=0)

        #exit(1)
        # Setup Inputs

        #self.inputs = pi3d.InputEvents(self.key_handler_func, self.mouse_handler_func, self.joystick_handler_func)
        if Gamepad.available():
            self.gamepad = Gamepad.PS4()
            self.gamepad.startBackgroundUpdates()

        else:
            print('Controller not connected :(')

        self.hmd = OpenHMD()
コード例 #2
0
ファイル: vrzero.py プロジェクト: zx110101/python-vrzero
    def init(self):
        if self.use_framebuffer:
            os.putenv('SDL_FBDEV', '/dev/fb0')
            os.putenv('SDL_VIDEODRIVER', 'fbcon')

        self.DISPLAY = pi3d.Display.create(w=self.hmd_screen_width,
                                           h=self.hmd_screen_height,
                                           use_pygame=True)
        self.DISPLAY.set_background(0.0, 0.0, 0.0, 1)
        self.DISPLAY.frames_per_second = self.target_fps

        shader_name = "barrel" if not self.use_simple_display else "uv_flat"
        if self.use_crosseyed_method:
            self.hmd_eye_seperation = -self.hmd_eye_seperation
        self.CAMERA = pi3d.StereoCam(separation=self.hmd_eye_seperation,
                                     interlace=0,
                                     shader=shader_name)

        # Setup Inputs

        self.inputs = pi3d.InputEvents(self.key_handler_func,
                                       self.mouse_handler_func,
                                       self.joystick_handler_func)
        self.hmd = OpenHMD()
コード例 #3
0
ファイル: ForestStereo.py プロジェクト: celesteh/pi3d_demos
StereoCam instance was created before any other Camera instance.
"""

import math, random

import demo
import pi3d

# Setup display and initialise pi3d
DISPLAY = pi3d.Display.create(w=1200, h=600)
DISPLAY.set_background(0.4, 0.8, 0.8, 1)  # r,g,b,alpha
# yellowish directional light blueish ambient light
pi3d.Light(lightpos=(1, -1, -3),
           lightcol=(1.0, 1.0, 0.8),
           lightamb=(0.25, 0.2, 0.3))
CAMERA = pi3d.StereoCam(separation=-0.5, interlace=0)
""" If CAMERA is set with interlace <= 0 (default) then CAMERA.draw() will produce
two images side by side (each viewed from `separation` apart) i.e. -ve
requires viewing slightly cross-eyed.

If interlace is set to a positive value then the two images are interlaced
in vertical stripes this number of pixels wide. The resultant image needs
to be viewed through a grid. See https://github.com/pi3d/pi3d_demos/make_grid.py
"""

# load shader
shader = pi3d.Shader("uv_bump")
shinesh = pi3d.Shader("uv_reflect")
flatsh = pi3d.Shader("uv_flat")

tree2img = pi3d.Texture("textures/tree2.png")
コード例 #4
0
# Select your Avatars here (you can manualy add more)
AVATAR_1 = 'Link'
AVATAR_2 = 'Goku'

os.putenv('SDL_FBDEV', '/dev/fb0')
os.putenv('SDL_VIDEODRIVER', 'fbcon')

DISPLAY = pi3d.Display.create(w=DEFAULT_SCREEN_WIDTH, h=DEFAULT_SCREEN_HEIGHT, use_pygame=True)
DISPLAY.set_background(0.0,0.0,0.0,1)
DISPLAY.frames_per_second = 30
pi3d.Light(lightpos=(1, -1, -3), lightcol=(1.0, 1.0, 0.8), lightamb=(0.25, 0.2, 0.3))

# Initialize Camera
if(USE_STEREO):
  shader_name = "barrel" if USE_TUNNEL else "uv_flat"
  CAMERA = pi3d.StereoCam(separation=DEFAULT_EYE_SEPERATION, interlace=0, shader=shader_name)
else:
  CAMERA = pi3d.Camera(absolute=False)

#========================================

# Create Hero & map, Select your avatars here
if AVATAR_1 == 'Link':
  avatar = avatars.link()
elif AVATAR_1 == 'Cloud':
  avatar = avatars.cloud()
elif AVATAR_1 == 'Lego':
  avatar = avatars.lego()
elif AVATAR_1 == 'Roshi':
  avatar = avatars.roshi()
elif AVATAR_1 == 'Goku':