Revision e1a86bf2
Added by Leszek Koltunski over 2 years ago
src/main/java/org/distorted/objectlib/main/ObjectControl.java | ||
---|---|---|
19 | 19 |
|
20 | 20 |
package org.distorted.objectlib.main; |
21 | 21 |
|
22 |
import java.io.InputStream; |
|
23 |
|
|
22 | 24 |
import android.app.Activity; |
23 | 25 |
import android.content.SharedPreferences; |
24 | 26 |
import android.util.DisplayMetrics; |
... | ... | |
82 | 84 |
private static final Static4D mTemp= new Static4D(0,0,0,1); |
83 | 85 |
|
84 | 86 |
private static boolean mForcedIconMode = false; |
85 |
private static boolean mForcedDmeshMode= false; |
|
86 |
private static boolean mForcedJsonMode = false; |
|
87 | 87 |
|
88 | 88 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
89 | 89 |
// cast the 3D axis we are currently rotating along (which is already casted to the surface of the |
... | ... | |
522 | 522 |
mForcedIconMode = mode; |
523 | 523 |
} |
524 | 524 |
|
525 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
526 |
|
|
527 |
public static void setDmeshMode(boolean mode) |
|
528 |
{ |
|
529 |
mForcedDmeshMode = mode; |
|
530 |
} |
|
531 |
|
|
532 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
533 |
|
|
534 |
public static void setJsonMode(boolean mode) |
|
535 |
{ |
|
536 |
mForcedJsonMode = mode; |
|
537 |
} |
|
538 |
|
|
539 | 525 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
540 | 526 |
|
541 | 527 |
public static boolean isInIconMode() |
... | ... | |
543 | 529 |
return mForcedIconMode; |
544 | 530 |
} |
545 | 531 |
|
546 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
547 |
|
|
548 |
public static boolean isInDmeshMode() |
|
549 |
{ |
|
550 |
return mForcedDmeshMode; |
|
551 |
} |
|
552 |
|
|
553 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
|
554 |
|
|
555 |
public static boolean isInJsonMode() |
|
556 |
{ |
|
557 |
return mForcedJsonMode; |
|
558 |
} |
|
559 |
|
|
560 | 532 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
561 | 533 |
// PUBLIC API |
562 | 534 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
736 | 708 |
|
737 | 709 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
738 | 710 |
|
739 |
public void changeObject(ObjectType newObject)
|
|
711 |
public void changeObject(int ordinal, InputStream jsonStream, InputStream meshStream)
|
|
740 | 712 |
{ |
741 |
mPreRender.changeObject(newObject);
|
|
713 |
mPreRender.changeObject(ordinal, jsonStream, meshStream);
|
|
742 | 714 |
} |
743 | 715 |
|
744 | 716 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
745 | 717 |
|
746 |
public void recreateObject()
|
|
718 |
public void changeIfDifferent(int ordinal, InputStream jsonStream, InputStream meshStream)
|
|
747 | 719 |
{ |
748 |
mPreRender.recreateObject(); |
|
720 |
TwistyObject object = mPreRender.getObject(); |
|
721 |
ObjectType old = object==null ? null : object.getObjectType(); |
|
722 |
|
|
723 |
if( old==null || old.ordinal() != ordinal ) |
|
724 |
{ |
|
725 |
mPreRender.changeObject(ordinal, jsonStream, meshStream); |
|
726 |
} |
|
749 | 727 |
} |
750 | 728 |
|
751 | 729 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
Also available in: Unified diff
Move the main app to the 'J1M1' object creation mode, i.e. create them from the Json files and using the Dmesh fiels as well.
Make it possible for any app descending from the 'objectlib' to use any of the J0M0, J0M1, J1M0, J1M1 modes.