File tree Expand file tree Collapse file tree
app/src/main/java/com/asha/md360player4android
vrlib/src/main/java/com/asha/vrlib Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ public abstract class MD360PlayerActivity extends Activity {
5252 sInteractiveMode .put (MDVRLibrary .INTERACTIVE_MODE_TOUCH ,"TOUCH" );
5353 sInteractiveMode .put (MDVRLibrary .INTERACTIVE_MODE_MOTION_WITH_TOUCH ,"M & T" );
5454 sInteractiveMode .put (MDVRLibrary .INTERACTIVE_MODE_CARDBORAD_MOTION ,"CARDBOARD M" );
55+ sInteractiveMode .put (MDVRLibrary .INTERACTIVE_MODE_CARDBORAD_MOTION_WITH_TOUCH ,"CARDBOARD M&T" );
5556
5657 sProjectionMode .put (MDVRLibrary .PROJECTION_MODE_SPHERE ,"SPHERE" );
5758 sProjectionMode .put (MDVRLibrary .PROJECTION_MODE_DOME180 ,"DOME 180" );
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ public class MDVRLibrary {
5050 public static final int INTERACTIVE_MODE_TOUCH = 2 ;
5151 public static final int INTERACTIVE_MODE_MOTION_WITH_TOUCH = 3 ;
5252 public static final int INTERACTIVE_MODE_CARDBORAD_MOTION = 4 ;
53+ public static final int INTERACTIVE_MODE_CARDBORAD_MOTION_WITH_TOUCH = 5 ;
5354
5455 // display mode
5556 public static final int DISPLAY_MODE_NORMAL = 101 ;
Original file line number Diff line number Diff line change 1+ package com .asha .vrlib .strategy .interactive ;
2+
3+ import android .content .res .Resources ;
4+
5+ import com .asha .vrlib .MD360Director ;
6+
7+ /**
8+ * Created by hzqiujiadi on 16/10/13.
9+ * hzqiujiadi ashqalcn@gmail.com
10+ */
11+ public class CardboardMTStrategy extends CardboardMotionStrategy {
12+
13+ private static final float sDensity = Resources .getSystem ().getDisplayMetrics ().density ;
14+
15+ private static final float sDamping = 0.2f ;
16+
17+ public CardboardMTStrategy (InteractiveModeManager .Params params ) {
18+ super (params );
19+ }
20+
21+ @ Override
22+ public boolean handleDrag (int distanceX , int distanceY ) {
23+ for (MD360Director director : getDirectorList ()){
24+ director .setDeltaX (director .getDeltaX () - distanceX / sDensity * sDamping );
25+ director .setDeltaY (director .getDeltaY () - distanceY / sDensity * sDamping );
26+ }
27+ return false ;
28+ }
29+
30+ }
Original file line number Diff line number Diff line change @@ -52,6 +52,8 @@ protected AbsInteractiveStrategy createStrategy(int mode) {
5252 return new MotionWithTouchStrategy (mParams );
5353 case MDVRLibrary .INTERACTIVE_MODE_CARDBORAD_MOTION :
5454 return new CardboardMotionStrategy (mParams );
55+ case MDVRLibrary .INTERACTIVE_MODE_CARDBORAD_MOTION_WITH_TOUCH :
56+ return new CardboardMTStrategy (mParams );
5557 case MDVRLibrary .INTERACTIVE_MODE_TOUCH :
5658 default :
5759 return new TouchStrategy (mParams );
You can’t perform that action at this time.
0 commit comments