Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
gmsh
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Larry Price
gmsh
Commits
56dfcaf8
Commit
56dfcaf8
authored
11 years ago
by
Maxime Graulich
Browse files
Options
Downloads
Patches
Plain Diff
Set x/y/z view with quaternion (iOS)
parent
f6c93d1b
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
contrib/mobile/drawContext.cpp
+14
-0
14 additions, 0 deletions
contrib/mobile/drawContext.cpp
contrib/mobile/iOS/Onelab/DetailViewController.mm
+13
-12
13 additions, 12 deletions
contrib/mobile/iOS/Onelab/DetailViewController.mm
with
27 additions
and
12 deletions
contrib/mobile/drawContext.cpp
+
14
−
0
View file @
56dfcaf8
...
...
@@ -94,6 +94,9 @@ void drawContext::load(std::string filename)
void
drawContext
::
eventHandler
(
int
event
,
float
x
,
float
y
)
{
this
->
_current
.
set
(
this
->
_scale
,
this
->
_translate
,
this
->
_right
,
this
->
_left
,
this
->
_bottom
,
this
->
_top
,
this
->
_width
,
this
->
_height
,
x
,
y
);
double
xx
[
3
]
=
{
1.
,
0.
,
0.
};
double
yy
[
3
]
=
{
0.
,
1.
,
0.
};
double
q
[
4
];
switch
(
event
)
{
case
0
:
// finger(s) press the screen
...
...
@@ -121,6 +124,17 @@ void drawContext::eventHandler(int event, float x, float y)
case
4
:
// release the finger(s)
// Do nothink ?
break
;
case
5
:
// X view
axis_to_quat
(
xx
,
M_PI
/
2
,
q
);
setQuaternion
(
q
[
0
],
q
[
1
],
q
[
2
],
q
[
3
]);
break
;
case
6
:
// Y view
axis_to_quat
(
yy
,
M_PI
/
2
,
q
);
setQuaternion
(
q
[
0
],
q
[
1
],
q
[
2
],
q
[
3
]);
break
;
case
7
:
// Z view
setQuaternion
(
0.
,
0.
,
0.
,
1.
);
break
;
default:
// all other reset the position
setQuaternion
(
0.
,
0.
,
0.
,
1.
);
for
(
int
i
=
0
;
i
<
3
;
i
++
){
...
...
This diff is collapsed.
Click to expand it.
contrib/mobile/iOS/Onelab/DetailViewController.mm
+
13
−
12
View file @
56dfcaf8
...
...
@@ -26,7 +26,6 @@
{
if
(
_detailItem
!=
newDetailItem
)
{
_detailItem
=
newDetailItem
;
// Update the view.
[
self
configureView
];
}
...
...
@@ -39,17 +38,20 @@
-
(
void
)
configureView
{
// Update the user interface for the detail item.
if
(
self
.
detailItem
)
{
self
.
detailDescriptionLabel
.
text
=
[
self
.
detailItem
description
];
}
}
-
(
void
)
viewDidAppear
:(
BOOL
)
animated
{
if
(
self
.
initialModel
!=
nil
)
[
self
.
glView
load
:
self
.
initialModel
];
}
-
(
void
)
viewDidLoad
{
[
super
viewDidLoad
];
// Do any additional setup after loading the view, typically from a nib.
[[
NSNotificationCenter
defaultCenter
]
addObserver
:
self
selector
:
@selector
(
requestRender
)
name
:
@"requestRender"
object
:
nil
];
[
self
configureView
];
scaleFactor
=
1.
;
setObjCBridge
((
__bridge
void
*
)
self
);
...
...
@@ -59,16 +61,16 @@
UIBarButtonItem
*
more
=
[[
UIBarButtonItem
alloc
]
initWithBarButtonSystemItem
:
UIBarButtonSystemItemAdd
target
:
self
action
:
@selector
(
showMore
:
)];
UIBarButtonItem
*
model
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"Load model"
style
:
UIBarButtonItemStyleBordered
target
:
self
action
:
@selector
(
showModelsList
)];
NSArray
*
btns
=
[[
NSArray
alloc
]
initWithObjects
:
settings
,
postpro
,
more
,
nil
];
[
self
.
navigationController
.
navigationItem
setLeftBarButtonItems
:
btns
];
[
self
.
navigationController
.
navigationItem
setRightBarButtonItem
:
model
];
[
self
.
navigationItem
setLeftBarButtonItems
:
btns
];
[
self
.
navigationItem
setRightBarButtonItem
:
model
];
}
else
{
UIBarButtonItem
*
model
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"Models list"
style
:
UIBarButtonItemStyleBordered
target
:
self
action
:
@selector
(
showModelsList
)];
UIBarButtonItem
*
postpro
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"Post processing"
style
:
UIBarButtonItemStyleBordered
target
:
self
action
:
@selector
(
showPostpro
)];
UIBarButtonItem
*
more
=
[[
UIBarButtonItem
alloc
]
initWithBarButtonSystemItem
:
UIBarButtonSystemItemAdd
target
:
self
action
:
@selector
(
showMore
:
)];
UIBarButtonItem
*
model
=
[[
UIBarButtonItem
alloc
]
initWithTitle
:
@"Load model"
style
:
UIBarButtonItemStyleBordered
target
:
self
action
:
@selector
(
showModelsList
)];
NSArray
*
btns
=
[[
NSArray
alloc
]
initWithObjects
:
postpro
,
more
,
nil
];
self
.
navigationItem
.
righ
tBarButtonItem
=
model
;
self
.
navigationItem
.
lef
tBarButtonItems
=
btns
;
[
self
.
navigationItem
setLef
tBarButtonItem
:
model
]
;
[
self
.
navigationItem
setRigh
tBarButtonItems
:
btns
]
;
}
}
...
...
@@ -335,14 +337,13 @@
else
if
([
text
isEqualToString
:
@"Show geometry"
])
glView
->
mContext
->
showGeom
();
else
if
([
text
isEqualToString
:
@"Set X view"
]){
/*glView->mContext->setRotation(0, 0, 0);
glView->mContext->setRotation(90, 0, 0);*/
glView
->
mContext
->
eventHandler
(
5
);
}
else
if
([
text
isEqualToString
:
@"Set Y view"
]){
//
glView->mContext->
setRotation(0, 90, 0
);
glView
->
mContext
->
eventHandler
(
6
);
}
else
if
([
text
isEqualToString
:
@"Set Z view"
]){
//
glView->mContext->
setRotation(0, 0, 0
);
glView
->
mContext
->
eventHandler
(
7
);
}
[
glView
drawView
];
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment