Skip to content

Commit

Permalink
Merge branch 'fix/193'
Browse files Browse the repository at this point in the history
  • Loading branch information
andresoviedo committed Jul 25, 2022
2 parents bdfc71b + 662b4f6 commit c1e9358
Show file tree
Hide file tree
Showing 49 changed files with 3,080 additions and 1,049 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,12 @@ The application does not use any third party library.
* Collada format (DAE): https://en.wikipedia.org/wiki/COLLADA


News (02/02/2022)
News (25/07/2022)
=================

* /¡\ repo moved to the3deers organization + MIT License 2020
* New version released 3.2.0
* Repository Explorer improved
* Smoothing implementation fixed
* Fixed memory leak


* New version released 3.3.0
* New orthographic, isometric and free camera views
* Interactive object orientation

Demo
====
Expand Down Expand Up @@ -75,7 +71,7 @@ Features
- OpenGL ES 2.0 API
- Formats: OBJ (wavefront), STL (STereoLithography) & DAE (Collada-BETA)
- calculation of normals
- transformations: scaling, rotation, translation
- transformations: scaling, rotation, translation, orientation
- colors
- textures
- lighting
Expand All @@ -86,6 +82,7 @@ Features
- skybox
- object pick
- camera support
- perspective, orthographic and isometric views
- tap to select object
- drag to move camera
- rotate with 2 fingers to rotate camera
Expand Down Expand Up @@ -196,6 +193,13 @@ ChangeLog

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

- 3.3.0 (23/06/2022)
- (n) interactive object orientation
- (n) isometric, orthographic and free camera view
- (n) New gui axis + gui info
- (f) fixed FPS counter
- (i) some user options are being saved (camera settings)

- 3.2.0 (02/02/2022)
- (i) repository explorer improved - multiple index files
- (f) smoothing fixed
Expand Down
Binary file modified app/build/outputs/apk/release/app-release.apk
Binary file not shown.
9 changes: 7 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="31"
android:versionName="3.2.0">
android:versionCode="32"
android:versionName="3.3.0">

<uses-sdk
tools:overrideLibrary="android.support.compat, android.arch.lifecycle" />
Expand Down Expand Up @@ -49,6 +49,11 @@

<!-- android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" -->
</activity>
<activity
android:name="org.andresoviedo.app.model3D.demo.GlyphsDemoActivity"
android:label="@string/title_activity_model"
android:parentActivityName="org.andresoviedo.app.model3D.MainActivity" >
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ public void onLoad(Object3DData obj53) {
Object3DData obj53 = new WavefrontLoader(GLES20.GL_TRIANGLE_FAN, new LoadListenerAdapter(){
@Override
public void onLoad(Object3DData obj53) {
obj53.setLocation(new float[] { 2f, 0f, 0f });
obj53.setColor(new float[] { 1.0f, 1.0f, 1f, 1.0f });
Rescaler.rescale(obj53, 2f);
obj53.setLocation(new float[] { 2f, 0f, 0f });
DemoLoaderTask.this.onLoad(obj53);
}
}).load(new URI("android://org.andresoviedo.dddmodel2/assets/models/ToyPlane.obj")).get(0);
Expand All @@ -171,10 +171,10 @@ public void onLoad(Object3DData obj53) {
Object3DData obj53 = new ColladaLoader().load(new URI("android://org.andresoviedo.dddmodel2/assets/models/cowboy.dae"), new LoadListenerAdapter(){
@Override
public void onLoad(Object3DData obj53) {
obj53.setLocation(new float[] { 0f, -1f, 1f});
obj53.setColor(new float[] { 1.0f, 1.0f, 1f, 1.0f });
obj53.setRotation(new float[]{-90,0,0});
Rescaler.rescale(obj53, 2f);
obj53.setLocation(new float[] { 0f, 0f, 2f});
obj53.setCentered(true);
DemoLoaderTask.this.onLoad(obj53);
}
}).get(0);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
package org.andresoviedo.app.model3D.demo;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.widget.Toast;

import org.andresoviedo.android_3d_model_engine.gui.Text;
import org.andresoviedo.android_3d_model_engine.gui.Widget;
import org.andresoviedo.android_3d_model_engine.model.Camera;
import org.andresoviedo.android_3d_model_engine.model.Constants;
import org.andresoviedo.android_3d_model_engine.model.Projection;
import org.andresoviedo.android_3d_model_engine.services.SceneLoader;
import org.andresoviedo.android_3d_model_engine.view.ModelSurfaceView;
import org.andresoviedo.android_3d_model_engine.view.ViewEvent;
import org.andresoviedo.util.event.EventListener;

import java.util.EventObject;

/**
* This activity represents the container for our 3D viewer.
*
* @author andresoviedo
*/
public class GlyphsDemoActivity extends Activity implements EventListener {

private ModelSurfaceView glView;
private SceneLoader scene;
private Camera camera;

private Text abcd;

@Override
protected void onCreate(Bundle savedInstanceState) {
Log.i("GlyphsDemoActivity", "onCreate: Loading activity... "+savedInstanceState);
super.onCreate(savedInstanceState);

try {
// Create our 3D scenario
Log.i("GlyphsDemoActivity", "Creating Scene...");
scene = new SceneLoader(this);
scene.addListener(this);

// Camera setup
final Camera camera = new Camera(Constants.UNIT);
camera.setProjection(Projection.PERSPECTIVE);
camera.setChanged(true);
scene.setCamera(camera);


Log.i("GlyphsDemoActivity", "Loading GLSurfaceView...");
glView = new ModelSurfaceView(this, Constants.COLOR_GRAY, this.scene);
glView.addListener(this);
glView.setProjection(Projection.PERSPECTIVE);
setContentView(glView);


abcd = Text.allocate(10, 6);
abcd.setPadding(Widget.PADDING_01);
abcd.update("abcdefghij\n" +
"klmnopqrst\n" +
"uvwxyz\n" +
"ABCDEFGHIJ\n" +
"KLMNOPQRST\n" +
"UVWXYZ");
abcd.setVisible(true);
scene.addObject(abcd);


} catch (Exception e) {
Log.e("GlyphsDemoActivity", e.getMessage(), e);
Toast.makeText(this, "Error loading OpenGL view:\n" + e.getMessage(), Toast.LENGTH_LONG).show();
}

}

@Override
public boolean onEvent(EventObject event) {
if (event instanceof ViewEvent) {
ViewEvent viewEvent = (ViewEvent) event;
if (viewEvent.getCode() == ViewEvent.Code.SURFACE_CHANGED) {
abcd.setScale(Constants.UNIT/5,Constants.UNIT/5,Constants.UNIT/5);
float ratio = (float) viewEvent.getWidth() / viewEvent.getHeight();
float x = -ratio * Constants.UNIT + abcd.getCurrentDimensions().getWidth() / 2 - abcd.getCurrentDimensions().getCenter()[0] + Constants.UNIT * 0.05f;
float y = 1 * Constants.UNIT - abcd.getCurrentDimensions().getHeight() / 2 - abcd.getCurrentDimensions().getCenter()[1] - Constants.UNIT * 0.05f;
abcd.setLocation( new float[]{x,y,0});
}
}
return false;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import org.andresoviedo.android_3d_model_engine.services.collada.ColladaLoader;
import org.andresoviedo.android_3d_model_engine.services.wavefront.WavefrontLoader;
import org.andresoviedo.app.model3D.demo.GlyphsDemoActivity;
import org.andresoviedo.dddmodel2.R;
import org.andresoviedo.util.android.AndroidUtils;
import org.andresoviedo.util.android.AssetUtils;
Expand Down Expand Up @@ -51,7 +52,7 @@ public class MenuActivity extends ListActivity {


private enum Action {
LOAD_MODEL, CARGAR_MODELO, GITHUB, SETTINGS, HELP, AYUDA, ABOUT, ACERCA, EXIT, SALIR, UNKNOWN, DEMO
LOAD_MODEL, CARGAR_MODELO, GITHUB, SETTINGS, HELP, AYUDA, ABOUT, ACERCA, EXIT, SALIR, UNKNOWN, DEMO, DEMOS
}

/**
Expand All @@ -78,7 +79,9 @@ protected void onCreate(Bundle savedInstanceState) {
public void onListItemClick(ListView l, View v, int position, long id) {
String selectedItem = (String) getListView().getItemAtPosition(position);
// Toast.makeText(getApplicationContext(), "Click ListItem '" + selectedItem + "'", Toast.LENGTH_LONG).show();
String selectedAction = selectedItem.replace(' ', '_').toUpperCase(Locale.getDefault());
String selectedAction = selectedItem.replace(' ', '_')
.replaceAll("\\.", "")
.toUpperCase(Locale.getDefault());
Action action = Action.UNKNOWN;
try {
action = Action.valueOf(selectedAction);
Expand All @@ -87,6 +90,21 @@ public void onListItemClick(ListView l, View v, int position, long id) {
}
try {
switch (action) {
case DEMOS:
ContentUtils.showListDialog(this, "Demos List", new String[]{"Random Objects", "GUI"}, (DialogInterface dialog, int which) -> {
if (which == 0) {
Intent demoIntent = new Intent(MenuActivity.this.getApplicationContext(), ModelActivity.class);
demoIntent.putExtra("immersiveMode", "false");
demoIntent.putExtra("backgroundColor", "0 0 0 1");
MenuActivity.this.startActivity(demoIntent);
} else if (which == 1) {
Intent demoIntent = new Intent(MenuActivity.this.getApplicationContext(), GlyphsDemoActivity.class);
MenuActivity.this.startActivity(demoIntent);
} else {
// TODO:
}
});
break;
case DEMO:
Intent demoIntent = new Intent(MenuActivity.this.getApplicationContext(), ModelActivity.class);
demoIntent.putExtra("immersiveMode", "false");
Expand Down
Loading

0 comments on commit c1e9358

Please sign in to comment.