Skip to content

Commit

Permalink
v3.0.3 - fixed normal / smooth features
Browse files Browse the repository at this point in the history
  • Loading branch information
andresoviedo committed Sep 5, 2020
1 parent 8dc172f commit 25034dd
Show file tree
Hide file tree
Showing 16 changed files with 33,621 additions and 146 deletions.
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ The application does not use any third party library.
* Collada format (DAE): https://en.wikipedia.org/wiki/COLLADA


News (03/09/2020)
News (05/09/2020)
=================

* New version released 3.0.2
* New version released 3.0.3
* Collada support for polygon with holes
* Wavefront support for smoothing groups
* New FPS counter (frames per second)
Expand Down Expand Up @@ -183,6 +183,9 @@ ChangeLog

(f) fixed, (i) improved, (n) new feature

- 3.0.3 (05/09/2020)
- (f) smooth faces are not toggle featured - not all models should be smoothed
- (f) fixed normal calculation - using high precision numbers
- 3.0.2 (03/09/2020)
- (f) setUniform4fv function had length zero - issue detected with Xiaomi Redmi 8
- (f) gl_MaxVertexUniformVectors is apparently not working - "too many uniforms" - detected in Xiaomi Redmi 8
Expand Down
Binary file modified app/build/outputs/apk/release/app-release.apk
Binary file not shown.
4 changes: 2 additions & 2 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="org.andresoviedo.dddmodel2"
android:versionCode="26"
android:versionName="3.0.2">
android:versionCode="27"
android:versionName="3.0.3">

<uses-sdk
tools:overrideLibrary="android.support.compat, android.arch.lifecycle" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,15 +92,15 @@ protected void onCreate(Bundle savedInstanceState) {
backgroundColor[3] = Float.parseFloat(backgroundColors[3]);
}
} catch (Exception ex) {
Log.e("ModelActivity", "Error parsing activity parameters: "+ex.getMessage(), ex);
Log.e("ModelActivity", "Error parsing activity parameters: " + ex.getMessage(), ex);
}

}

handler = new Handler(getMainLooper());

// Create our 3D scenario
Log.i("ModelActivity","Loading Scene...");
Log.i("ModelActivity", "Loading Scene...");
scene = new SceneLoader(this, paramUri, paramType, gLView);
if (paramUri == null) {
final LoaderTask task = new DemoLoaderTask(this, null, scene);
Expand All @@ -115,44 +115,44 @@ protected void onCreate(Bundle savedInstanceState) {
}*/

try {
Log.i("ModelActivity","Loading GLSurfaceView...");
Log.i("ModelActivity", "Loading GLSurfaceView...");
gLView = new ModelSurfaceView(this, backgroundColor, this.scene);
gLView.addListener(this);
setContentView(gLView);
scene.setView(gLView);
} catch (Exception e) {
Log.e("ModelActivity",e.getMessage(),e);
Toast.makeText(this, "Error loading OpenGL view:\n" +e.getMessage(), Toast.LENGTH_LONG).show();
Log.e("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading OpenGL view:\n" + e.getMessage(), Toast.LENGTH_LONG).show();
}

try {
Log.i("ModelActivity","Loading TouchController...");
Log.i("ModelActivity", "Loading TouchController...");
touchController = new TouchController(this);
touchController.addListener(this);
} catch (Exception e) {
Log.e("ModelActivity",e.getMessage(),e);
Toast.makeText(this, "Error loading TouchController:\n" +e.getMessage(), Toast.LENGTH_LONG).show();
Log.e("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading TouchController:\n" + e.getMessage(), Toast.LENGTH_LONG).show();
}

try {
Log.i("ModelActivity","Loading CollisionController...");
Log.i("ModelActivity", "Loading CollisionController...");
collisionController = new CollisionController(gLView, scene);
collisionController.addListener(scene);
touchController.addListener(collisionController);
touchController.addListener(scene);
}catch(Exception e){
Log.e("ModelActivity",e.getMessage(),e);
Toast.makeText(this, "Error loading CollisionController\n" +e.getMessage(), Toast.LENGTH_LONG).show();
} catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading CollisionController\n" + e.getMessage(), Toast.LENGTH_LONG).show();
}

try {
Log.i("ModelActivity","Loading CameraController...");
Log.i("ModelActivity", "Loading CameraController...");
cameraController = new CameraController(scene.getCamera());
gLView.getModelRenderer().addListener(cameraController);
touchController.addListener(cameraController);
}catch (Exception e){
} catch (Exception e) {
Log.e("ModelActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading CameraController" +e.getMessage(), Toast.LENGTH_LONG).show();
Toast.makeText(this, "Error loading CameraController" + e.getMessage(), Toast.LENGTH_LONG).show();
}

try {
Expand All @@ -175,7 +175,7 @@ protected void onCreate(Bundle savedInstanceState) {
// load model
scene.init();

Log.i("ModelActivity","Finished loading");
Log.i("ModelActivity", "Finished loading");
}

/**
Expand Down Expand Up @@ -233,6 +233,9 @@ public boolean onOptionsItemSelected(MenuItem item) {
case R.id.model_toggle_animation:
scene.toggleAnimation();
break;
case R.id.model_toggle_smooth:
scene.toggleSmooth();
break;
case R.id.model_toggle_collision:
scene.toggleCollision();
break;
Expand Down Expand Up @@ -273,7 +276,7 @@ private void toggleImmersive() {
} else {
showSystemUI();
}
Toast.makeText(this, "Fullscreen " +this.immersiveMode, Toast.LENGTH_SHORT).show();
Toast.makeText(this, "Fullscreen " + this.immersiveMode, Toast.LENGTH_SHORT).show();
}

private void hideSystemUIDelayed() {
Expand Down Expand Up @@ -355,7 +358,7 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) {
public boolean onEvent(EventObject event) {
if (event instanceof ModelRenderer.ViewEvent) {
ModelRenderer.ViewEvent viewEvent = (ModelRenderer.ViewEvent) event;
if(viewEvent.getCode() == ModelRenderer.ViewEvent.Code.SURFACE_CHANGED) {
if (viewEvent.getCode() == ModelRenderer.ViewEvent.Code.SURFACE_CHANGED) {
touchController.setSize(viewEvent.getWidth(), viewEvent.getHeight());
gLView.setTouchController(touchController);

Expand Down
6 changes: 6 additions & 0 deletions app/src/main/res/menu/model.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@
android:orderInCategory="500"
android:showAsAction="ifRoom"
android:title="@string/toggle_animation"/>
<item
android:id="@+id/model_toggle_smooth"
android:icon="@android:drawable/ic_menu_gallery"
android:orderInCategory="600"
android:showAsAction="ifRoom"
android:title="Toggle Smooth"/>
<item
android:id="@+id/model_load_texture"
android:icon="@android:drawable/ic_menu_gallery"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import org.andresoviedo.android_3d_model_engine.collision.Octree;
import org.andresoviedo.android_3d_model_engine.drawer.RendererFactory;
import org.andresoviedo.android_3d_model_engine.services.collada.entities.MeshData;
import org.andresoviedo.util.android.AndroidUtils;
import org.andresoviedo.util.event.EventListener;
import org.andresoviedo.util.io.IOUtils;
Expand Down Expand Up @@ -66,6 +67,9 @@ protected static class ChangeEvent extends EventObject {
*/
private int drawMode = GLES20.GL_POINTS;

// mesh vertex data
private MeshData meshData = null;

// Model data
protected FloatBuffer vertexBuffer = null;
private FloatBuffer normalsBuffer = null;
Expand Down Expand Up @@ -138,6 +142,14 @@ protected static class ChangeEvent extends EventObject {
public Object3DData() {
}

public void setMeshData(MeshData meshData) {
this.meshData = meshData;
}

public MeshData getMeshData() {
return meshData;
}

public Object3DData(FloatBuffer vertexBuffer) {
this.vertexBuffer = vertexBuffer;
this.setDrawUsingArrays(true);
Expand Down
Loading

0 comments on commit 25034dd

Please sign in to comment.