Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
P
Printrun
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
machinery
Printrun
Commits
837b086e
Commit
837b086e
authored
Jul 04, 2013
by
Guillaume Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move mouse_to_3d to wxGLPanel
parent
2ed6c1bc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
18 deletions
+21
-18
gcview.py
printrun/gcview.py
+0
-18
panel.py
printrun/gl/panel.py
+21
-0
No files found.
printrun/gcview.py
View file @
837b086e
...
@@ -194,24 +194,6 @@ class GcodeViewPanel(wxGLPanel):
...
@@ -194,24 +194,6 @@ class GcodeViewPanel(wxGLPanel):
else
:
else
:
self
.
zoom
(
1
/
factor
,
(
x
,
y
))
self
.
zoom
(
1
/
factor
,
(
x
,
y
))
def
mouse_to_3d
(
self
,
x
,
y
):
x
=
float
(
x
)
y
=
self
.
height
-
float
(
y
)
# The following could work if we were not initially scaling to zoom on the bed
#if self.orthographic:
# return (x - self.width / 2, y - self.height / 2, 0)
pmat
=
(
GLdouble
*
16
)()
mvmat
=
(
GLdouble
*
16
)()
viewport
=
(
GLint
*
4
)()
px
=
(
GLdouble
)()
py
=
(
GLdouble
)()
pz
=
(
GLdouble
)()
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetDoublev
(
GL_PROJECTION_MATRIX
,
pmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
mvmat
)
gluUnProject
(
x
,
y
,
1.0
,
mvmat
,
pmat
,
viewport
,
px
,
py
,
pz
)
return
(
px
.
value
,
py
.
value
,
pz
.
value
)
def
fit
(
self
):
def
fit
(
self
):
if
not
self
.
parent
.
model
or
not
self
.
parent
.
model
.
loaded
:
if
not
self
.
parent
.
model
or
not
self
.
parent
.
model
.
loaded
:
return
return
...
...
printrun/gl/panel.py
View file @
837b086e
...
@@ -157,3 +157,24 @@ class wxGLPanel(wx.Panel):
...
@@ -157,3 +157,24 @@ class wxGLPanel(wx.Panel):
def
draw_objects
(
self
):
def
draw_objects
(
self
):
'''called in the middle of ondraw after the buffer has been cleared'''
'''called in the middle of ondraw after the buffer has been cleared'''
pass
pass
#==========================================================================
# Utils
#==========================================================================
def
mouse_to_3d
(
self
,
x
,
y
):
x
=
float
(
x
)
y
=
self
.
height
-
float
(
y
)
# The following could work if we were not initially scaling to zoom on the bed
#if self.orthographic:
# return (x - self.width / 2, y - self.height / 2, 0)
pmat
=
(
GLdouble
*
16
)()
mvmat
=
(
GLdouble
*
16
)()
viewport
=
(
GLint
*
4
)()
px
=
(
GLdouble
)()
py
=
(
GLdouble
)()
pz
=
(
GLdouble
)()
glGetIntegerv
(
GL_VIEWPORT
,
viewport
);
glGetDoublev
(
GL_PROJECTION_MATRIX
,
pmat
)
glGetDoublev
(
GL_MODELVIEW_MATRIX
,
mvmat
)
gluUnProject
(
x
,
y
,
1.0
,
mvmat
,
pmat
,
viewport
,
px
,
py
,
pz
)
return
(
px
.
value
,
py
.
value
,
pz
.
value
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment