Commit a6a2274f authored by Dalai Felinto's avatar Dalai Felinto
Browse files

Rename: offscreen_object > offscreen and color_object > color_texture

parent 2fdd7617
...@@ -58,8 +58,8 @@ class HMD_Base: ...@@ -58,8 +58,8 @@ class HMD_Base:
"_head_transformation", "_head_transformation",
"_is_direct_mode", "_is_direct_mode",
"_eye_pose", "_eye_pose",
"_offscreen_object", "_offscreen",
"_color_object", "_color_texture",
"_modelview_matrix", "_modelview_matrix",
"_near", "_near",
"_far", "_far",
...@@ -74,8 +74,8 @@ class HMD_Base: ...@@ -74,8 +74,8 @@ class HMD_Base:
self._height = [0, 0] self._height = [0, 0]
self._projection_matrix = [Matrix.Identity(4), Matrix.Identity(4)] self._projection_matrix = [Matrix.Identity(4), Matrix.Identity(4)]
self._modelview_matrix = [Matrix.Identity(4), Matrix.Identity(4)] self._modelview_matrix = [Matrix.Identity(4), Matrix.Identity(4)]
self._color_object = [0, 0] self._color_texture = [0, 0]
self._offscreen_object = [None, None] self._offscreen = [None, None]
self._eye_orientation_raw = [[1.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]] self._eye_orientation_raw = [[1.0, 0.0, 0.0, 0.0], [1.0, 0.0, 0.0, 0.0]]
self._eye_position_raw = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]] self._eye_position_raw = [[0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]
self._scale = self._calculateScale(context) self._scale = self._calculateScale(context)
...@@ -103,13 +103,12 @@ class HMD_Base: ...@@ -103,13 +103,12 @@ class HMD_Base:
self._height[self._current_eye] = value self._height[self._current_eye] = value
@property @property
def offscreen_object(self): def offscreen(self):
return self._offscreen_object[self._current_eye] return self._offscreen[self._current_eye]
@property @property
@property def color_texture(self):
def color_object(self): return self._color_texture[self._current_eye]
return self._color_object[self._current_eye]
@property @property
def projection_matrix(self): def projection_matrix(self):
...@@ -131,13 +130,13 @@ class HMD_Base: ...@@ -131,13 +130,13 @@ class HMD_Base:
""" """
try: try:
for i in range(2): for i in range(2):
self._offscreen_object[i] = gpu.offscreen.new(self._width[i], self._height[i], 0) self._offscreen[i] = gpu.offscreen.new(self._width[i], self._height[i], 0)
self._color_object[i] = self._offscreen_object[i].color_object self._color_texture[i] = self._offscreen[i].color_texture
except Exception as E: except Exception as E:
print(E) print(E)
self._offscreen_object[0] = None self._offscreen[0] = None
self._offscreen_object[1] = None self._offscreen[1] = None
return False return False
else: else:
...@@ -171,7 +170,7 @@ class HMD_Base: ...@@ -171,7 +170,7 @@ class HMD_Base:
""" """
try: try:
for i in range(2): for i in range(2):
self._offscreen_object[i] = None self._offscreen[i] = None
except Exception as E: except Exception as E:
print(E) print(E)
......
...@@ -77,7 +77,7 @@ class Oculus(HMD_Base): ...@@ -77,7 +77,7 @@ class Oculus(HMD_Base):
return True return True
def _setup(self): def _setup(self):
return self._hmd.setup(self._color_object[0], self._color_object[1]) return self._hmd.setup(self._color_texture[0], self._color_texture[1])
def loop(self, context): def loop(self, context):
""" """
......
...@@ -266,12 +266,12 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -266,12 +266,12 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
return False return False
# get the data from device # get the data from device
color_object = [0, 0] color_texture = [0, 0]
for i in range(2): for i in range(2):
self._hmd.setEye(i) self._hmd.setEye(i)
color_object[i] = self._hmd.color_object color_texture[i] = self._hmd.color_texture
self._preview.init(color_object[0], color_object[1]) self._preview.init(color_texture[0], color_texture[1])
return True return True
def _slaveSetup(self, context): def _slaveSetup(self, context):
...@@ -409,15 +409,15 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -409,15 +409,15 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
for i in range(2): for i in range(2):
self._hmd.setEye(i) self._hmd.setEye(i)
offscreen_object = self._hmd.offscreen_object offscreen = self._hmd.offscreen
projection_matrix = self._hmd.projection_matrix projection_matrix = self._hmd.projection_matrix
modelview_matrix = self._hmd.modelview_matrix modelview_matrix = self._hmd.modelview_matrix
# drawing # drawing
try: try:
offscreen_object.draw_view3d(projection_matrix, modelview_matrix) offscreen.draw_view3d(projection_matrix, modelview_matrix)
except: except:
offscreen_object.draw_view3d(scene, view3d, region, projection_matrix, modelview_matrix) offscreen.draw_view3d(scene, view3d, region, projection_matrix, modelview_matrix)
self._hmd.frameReady() self._hmd.frameReady()
self._is_rendering = False self._is_rendering = False
......
...@@ -16,20 +16,20 @@ from bgl import * ...@@ -16,20 +16,20 @@ from bgl import *
class Preview: class Preview:
__slots__ = { __slots__ = {
"_color_object_left", "_color_texture_left",
"_color_object_right", "_color_texture_right",
} }
def init(self, color_object_left, color_object_right): def init(self, color_texture_left, color_texture_right):
""" """
Initialize preview window Initialize preview window
:param color_object_left: 2D Texture binding ID (bind to the Framebuffer Object) for left eye :param color_texture_left: 2D Texture binding ID (bind to the Framebuffer Object) for left eye
:type color_object_left: bgl.GLuint :type color_texture_left: bgl.GLuint
:param color_object_right: 2D Texture binding ID (bind to the Framebuffer Object) for right eye :param color_texture_right: 2D Texture binding ID (bind to the Framebuffer Object) for right eye
:type color_object_right: bgl.GLuint :type color_texture_right: bgl.GLuint
""" """
self.update(color_object_left, color_object_right) self.update(color_texture_left, color_texture_right)
def quit(self): def quit(self):
""" """
...@@ -37,17 +37,17 @@ class Preview: ...@@ -37,17 +37,17 @@ class Preview:
""" """
pass pass
def update(self, color_object_left, color_object_right): def update(self, color_texture_left, color_texture_right):
""" """
Update OpenGL binding textures Update OpenGL binding textures
:param color_object_left: 2D Texture binding ID (bind to the Framebuffer Object) for left eye :param color_texture_left: 2D Texture binding ID (bind to the Framebuffer Object) for left eye
:type color_object_left: bgl.GLuint :type color_texture_left: bgl.GLuint
:param color_object_right: 2D Texture binding ID (bind to the Framebuffer Object) for right eye :param color_texture_right: 2D Texture binding ID (bind to the Framebuffer Object) for right eye
:type color_object_right: bgl.GLuint :type color_texture_right: bgl.GLuint
""" """
self._color_object_left = color_object_left self._color_texture_left = color_texture_left
self._color_object_right = color_object_right self._color_texture_right = color_texture_right
def _drawRectangle(self, eye): def _drawRectangle(self, eye):
...@@ -92,10 +92,10 @@ class Preview: ...@@ -92,10 +92,10 @@ class Preview:
glEnable(GL_TEXTURE_2D) glEnable(GL_TEXTURE_2D)
glActiveTexture(GL_TEXTURE0) glActiveTexture(GL_TEXTURE0)
glBindTexture(GL_TEXTURE_2D, self._color_object_left) glBindTexture(GL_TEXTURE_2D, self._color_texture_left)
self._drawRectangle(0) self._drawRectangle(0)
glBindTexture(GL_TEXTURE_2D, self._color_object_right) glBindTexture(GL_TEXTURE_2D, self._color_texture_right)
self._drawRectangle(1) self._drawRectangle(1)
glBindTexture(GL_TEXTURE_2D, act_tex[0]) glBindTexture(GL_TEXTURE_2D, act_tex[0])
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment