Commit 7bdbe424 authored by Dalai Felinto's avatar Dalai Felinto
Browse files

Using GPU offscreen_object_draw instead of operator

parent b09cfa05
...@@ -10,7 +10,7 @@ from .lib import ( ...@@ -10,7 +10,7 @@ from .lib import (
getDisplayBackend, getDisplayBackend,
) )
TODO = True import gpu
# ############################################################ # ############################################################
...@@ -59,7 +59,7 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -59,7 +59,7 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
return {'FINISHED'} return {'FINISHED'}
if event.type == 'TIMER': if event.type == 'TIMER':
self.loop(context, vr.color_object_left, vr.color_object_right) self.loop(context)
if vr.preview_scale and context.area: if vr.preview_scale and context.area:
area.tag_redraw() area.tag_redraw()
...@@ -156,7 +156,7 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -156,7 +156,7 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
return True return True
def loop(self, context, color_object_left, color_object_right): def loop(self, context):
""" """
Get fresh tracking data and render into the FBO Get fresh tracking data and render into the FBO
""" """
...@@ -170,12 +170,9 @@ class VirtualRealityDisplayOperator(bpy.types.Operator): ...@@ -170,12 +170,9 @@ class VirtualRealityDisplayOperator(bpy.types.Operator):
projection_matrix = self._hmd.projection_matrix projection_matrix = self._hmd.projection_matrix
# drawing # drawing
# bpy.ops.view3d.offscreen(offscreen_object=offscreen_object, projection_matrix=projection_matrix, modelview_matrix=modelview_matrix) gpu.offscreen_object_draw(context, offscreen_object, modelview_matrix, projection_matrix)
bpy.ops.view3d.offscreen(projection_matrix=projection_matrix, modelview_matrix=modelview_matrix) #DEBUG
self._hmd.frameReady() self._hmd.frameReady()
self._preview.update(color_object_left, color_object_right) #DEBUG
def _draw_callback_px(self, context): def _draw_callback_px(self, context):
"""callback function, run every time the viewport is refreshed""" """callback function, run every time the viewport is refreshed"""
...@@ -204,19 +201,6 @@ class VirtualRealityInfo(bpy.types.PropertyGroup): ...@@ -204,19 +201,6 @@ class VirtualRealityInfo(bpy.types.PropertyGroup):
subtype='PERCENTAGE', subtype='PERCENTAGE',
) )
color_object_left = bpy.props.IntProperty(
name="Color Object Left",
default=0,
subtype='UNSIGNED',
)
color_object_right = bpy.props.IntProperty(
name="Color Object Right",
default=0,
subtype='UNSIGNED',
)
# ############################################################ # ############################################################
# Callbacks # Callbacks
......
...@@ -13,8 +13,6 @@ from .opengl_helper import ( ...@@ -13,8 +13,6 @@ from .opengl_helper import (
from bgl import * from bgl import *
TODO = True
class Preview: class Preview:
__slots__ = { __slots__ = {
......
...@@ -26,9 +26,6 @@ class VirtualRealityPanel(bpy.types.Panel): ...@@ -26,9 +26,6 @@ class VirtualRealityPanel(bpy.types.Panel):
col.separator() col.separator()
col.prop(vr, "preview_scale", text="Preview") col.prop(vr, "preview_scale", text="Preview")
row = col.row(align=True)
row.prop(vr, "color_object_left")
row.prop(vr, "color_object_right")
# ############################################################ # ############################################################
......
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