Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

F3D 3.0 compatibility #4

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/libs/f3d.jar
Git LFS file not shown
Binary file modified app/src/main/ic_launcher-playstore.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 1 addition & 2 deletions app/src/main/java/app/f3d/F3D/android/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ protected void onCreate(Bundle savedInstanceState) {

private void handleSelectedFile(Uri uri) {
String filePath = FileUtils.createTempFileFromUri(this,uri);
boolean useGeometry = FileType.checkFileTypeMethod(FileUtils.getFileExtension());
mView.updateFilePath(filePath,useGeometry);
mView.updateFilePath(filePath);
}

private void handleSelectedFileAppNotOpen(){
Expand Down
35 changes: 14 additions & 21 deletions app/src/main/java/app/f3d/F3D/android/MainView.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import android.content.Context;
import android.opengl.GLSurfaceView;
import android.util.Log;
import android.view.MotionEvent;
import android.view.ScaleGestureDetector;

Expand All @@ -19,8 +18,7 @@ public class MainView extends GLSurfaceView {
final private ScaleGestureDetector mScaleDetector;
final private PanGestureDetector mPanDetector;
final private RotateGestureDetector mRotateDetector;
private String internalCachePath = "";
private boolean useGeometryFlag = true;
private String internalFilePath = "";

public MainView(Context context) {
super(context);
Expand Down Expand Up @@ -57,36 +55,31 @@ public void onSurfaceCreated(GL10 gl, EGLConfig config) {

MainView.this.mEngine.setCachePath(MainView.this.getContext().getCacheDir().getAbsolutePath());

MainView.this.mEngine.getOptions().toggle("interactor.axis");
// Axis is not working on Android at the moment
MainView.this.mEngine.getOptions().toggle("render.grid.enable");
MainView.this.mEngine.getOptions().toggle("render.effect.anti-aliasing");
MainView.this.mEngine.getOptions().toggle("render.effect.tone-mapping");
MainView.this.mEngine.getOptions().toggle("render.effect.anti_aliasing");
MainView.this.mEngine.getOptions().toggle("render.effect.tone_mapping");
MainView.this.mEngine.getOptions().toggle("render.hdri.ambient");
MainView.this.mEngine.getOptions().toggle("render.background.skybox");
MainView.this.mEngine.getOptions().toggle("ui.filename");
MainView.this.mEngine.getOptions().toggle("ui.loader-progress");
// MainView.this.mEngine.getOptions().toggle("model.volume.enable");

if(!Objects.equals(internalCachePath, "")) {
if(useGeometryFlag){
MainView.this.mEngine.getLoader().loadGeometry(internalCachePath);
}else{
MainView.this.mEngine.getLoader().loadScene(internalCachePath);
}
MainView.this.mEngine.getOptions().toggle("ui.loader_progress");

if(!Objects.equals(internalFilePath, "")) {
MainView.this.mEngine.getScene().clear();
MainView.this.mEngine.getScene().add(internalFilePath);
}
}
}
public void updateFilePath(String newFilePath, boolean useGeometry) {
public void updateFilePath(String newFilePath) {
// Use the new file path as needed in MainView
internalCachePath = newFilePath;
useGeometryFlag = useGeometry;
internalFilePath = newFilePath;
}

private class ScaleListener extends ScaleGestureDetector.SimpleOnScaleGestureListener {
@Override
public boolean onScale(ScaleGestureDetector detector) {
MainView.this.mEngine.getWindow().getCamera().dolly(detector.getScaleFactor());
MainView.this.mEngine.getWindow().render();
MainView.this.requestRender();
return true;
}
}
Expand All @@ -110,7 +103,7 @@ public void onPan(PanGestureDetector detector) {
camera.setFocalPoint(new double[] { motion[0] + focus[0], motion[1] + focus[1], motion[2] + focus[2] });
camera.setPosition(new double[] { motion[0] + pos[0], motion[1] + pos[1], motion[2] + pos[2] });

window.render();
MainView.this.requestRender();
}
}

Expand All @@ -127,7 +120,7 @@ public void onRotate(RotateGestureDetector detector) {
camera.azimuth(detector.getDistanceX() * delta_azimuth);
camera.elevation(detector.getDistanceY() * delta_elevation);

window.render();
MainView.this.requestRender();
}
}

Expand Down
22 changes: 0 additions & 22 deletions app/src/main/java/app/f3d/F3D/android/Utils/FileType.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,4 @@ public class FileType {
"application/octet-stream", // .3ds, .glb, .mhd, .nrrd, .obj, .ply, .pts, .vtk, .vtu, .vtp, .vti, .vtr, .vts, .vtm
"application/vnd.ms-pki.stl", // .stl,
};
public static boolean checkFileTypeMethod(String fileType){

String[] fileTypesUsingGeometry = {
"obj",
"ply",
"pts",
"stl",
"vtk",
"vtu",
"vtp",
"vti",
"vtr",
"vts",
"dcm", // -> Doubts and needs Volume rendering
"mhd", // -> Doubts and needs Volume rendering
"nrd", // -> Doubts and needs Volume rendering
"tif", // -> Doubts and needs Volume rendering
"vtm" // -> Doubts and needs Volume rendering
};

return Arrays.asList(fileTypesUsingGeometry).contains(fileType);
}
}
4 changes: 2 additions & 2 deletions app/src/main/jniLibs/arm64-v8a/libf3d-java.so
Git LFS file not shown
43 changes: 31 additions & 12 deletions app/src/main/res/drawable/ic_launcher_foreground.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<group android:scaleX="0.5581657"
android:scaleY="0.5581657"
android:translateX="24.3"
android:translateY="24.3">
android:viewportWidth="5"
android:viewportHeight="10">
<group android:scaleX="0.295"
android:scaleY="0.59"
android:translateX="1.7625"
android:translateY="2.05">
<path
android:pathData="M25.225,58.3L53.405,0L76.755,0Z"
android:fillColor="#c0202a"/>
android:pathData="M4.5,0.5L0.5,5.5L0.5,3.5L4.5,0.5z"
android:strokeLineJoin="round"
android:strokeWidth="0.2"
android:fillColor="#788bff"
android:strokeColor="#788bff"
android:strokeLineCap="round"/>
<path
android:pathData="M49.405,60L25.525,60L77.555,1.7Z"
android:fillColor="#209949"/>
android:pathData="M2.5,4.5L4.5,6.5L4.5,4.5L2.5,4.5z"
android:strokeLineJoin="round"
android:strokeWidth="0.2"
android:fillColor="#f9b208"
android:strokeColor="#f9b208"
android:strokeLineCap="round"/>
<path
android:pathData="M28.695,106.42L57.815,46.1L81.185,46.1Z"
android:fillColor="#074e8e"/>
android:pathData="M2.9,4.5L4.5,0.5L0.5,3.5L0.5,5.5L2.1,5.5"
android:strokeLineJoin="round"
android:strokeWidth="0.2"
android:fillColor="#00000000"
android:strokeColor="#788bff"
android:strokeLineCap="round"/>
<path
android:pathData="M2.5,4.5L0.5,9.5L4.5,6.5L4.5,4.5L2.5,4.5z"
android:strokeLineJoin="round"
android:strokeWidth="0.2"
android:fillColor="#00000000"
android:strokeColor="#f9b208"
android:strokeLineCap="round"/>
</group>
</vector>
3 changes: 2 additions & 1 deletion app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@android:color/white"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
3 changes: 2 additions & 1 deletion app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@android:color/white"/>
<background android:drawable="@color/ic_launcher_background"/>
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
</adaptive-icon>
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher.png
Binary file not shown.
Binary file added app/src/main/res/mipmap-hdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher.png
Binary file not shown.
Binary file added app/src/main/res/mipmap-mdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary file not shown.
Binary file added app/src/main/res/mipmap-xhdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary file not shown.
Binary file added app/src/main/res/mipmap-xxhdpi/ic_launcher.webp
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Binary file not shown.
Binary file not shown.
Binary file removed app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary file not shown.
Binary file added app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion app/src/main/res/values-night/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<item name="android:windowFullscreen">true</item>
<item name="android:windowActionBar">false</item>
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values/ic_launcher_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#1B1B19</color>
</resources>
2 changes: 1 addition & 1 deletion app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<item name="android:statusBarColor">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
<item name="android:windowFullscreen">true</item>
<item name="android:windowActionBar">false</item>
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:8.2.1'
classpath 'com.android.tools.build:gradle:8.8.0'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists