-
Notifications
You must be signed in to change notification settings - Fork 0
/
IVE_template.py
67 lines (51 loc) · 1.58 KB
/
IVE_template.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#filename :IVE_VIDEO_Template
#description :This python file runs in World vizard to display 360 images in a folder on Oculus headset
#author :Payam Tabrizian
#date :15.6.2017
#usage :World Vizard
#python_version :2.7
#==============================================================================
import sys
import viz
import vizact
import os
import oculus
import win32con
import win32gui
import vizshape
import oculus
#import oculus_08 as oculus
# Define global Variables#
IMAGE_PATH = os.path.join(os.getcwd(),"ENV")
FILE_PATH = os.getcwd()
viz.mouse.setOverride(viz.ON)
env_map_namelist = []
for im_name in os.listdir(IMAGE_PATH):
if im_name.endswith('_negx.png'):
env_map_name = im_name[:-9] + '.png'
env_map_namelist.append(env_map_name)
#Initiate Env#
viz.setMultiSample(4)
viz.fov(60)
viz.go()
# define window operations #
def MaximizeWindow():
viz.window.setFullscreenRectangle([0,0,1920,1080])
viz.window.setFullscreen(1)
def RestoreWindow():
win32gui.ShowWindow(viz.window.getHandle(),win32con.SW_RESTORE)
###Playback procedure###
def Loop():
hmd = oculus.Rift()
link=viz.link(hmd.getSensor(), viz.MainView)
for x in range (0,len(env_map_namelist)):
env = viz.addEnvironmentMap(IMAGE_PATH+"/"+env_map_namelist[x])
sky = viz.addCustomNode('skydome.dlc')
sky.texture(env)
viz.setOption(env_map_namelist[x],viz.FREE_TEXTURE_MEMORY_HINT)
yield viztask.waitKeyDown(" ")
sky.remove()
link.remove()
def run():
yield Loop()
viztask.schedule(run())