Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - nIkO_mx

#1
It seems a good idea...can you give me some tips about it?  As i said i'm not so experienced so every help is very appreciate!
thank you!

N.
#2
Support / OBJLoader problem with some obj line (nan)
August 18, 2015, 01:31:51 PM
Hello
I'm working on an OBJ viewer and I'm having some problem with some objs in particular.
The 3D scanner that I'm using sometimes put some lines with "nan" in the obj file

(Example)

v 0.5969 0.9050 0.7055
vn nan nan nan
vt nan nan
v 0.5970 0.9050 0.7054
vn nan nan nan
vt nan nan
v 0.5970 0.9050 0.7055
vn nan nan nan
vt nan nan
v 0.6056 0.9209 0.6957


So the obj loader crash when it try to recognize them at this point:

try {
                        uvs[var55][var61] = Float.valueOf(var62).floatValue();
                    } catch (Exception var48) {
                        uvs[var55][var61] = 0.0F;
                        Logger.log("Error in OBJ-file near: " + line, 0);
                    }
                }




I was thinking to do a little change in the library just to tell objloader to simply ignore those line with "nan" values, putting something inside it like " if (var62 == "nan") ....etc", but as i know is not nice to modify the code of someone else library, plus I think I'm not enought experienced to do it right so...I'm asking here...has someone some advice for my problem??

thank you!

p.s.
here is the Log:

08-18 13:16:26.218  28622-28652/it.proteomed.www.proteoviewer E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
    Process: it.proteomed.www.proteoviewer, PID: 28622
    java.lang.RuntimeException: An error occured while executing doInBackground()
            at android.os.AsyncTask$3.done(AsyncTask.java:300)
            at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:355)
            at java.util.concurrent.FutureTask.setException(FutureTask.java:222)
            at java.util.concurrent.FutureTask.run(FutureTask.java:242)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
     [b]Caused by: java.lang.RuntimeException: [ 1439896586207 ] - ERROR: Error in OBJ-file near: vt nan nan[/b]
            at com.threed.jpct.Logger.log(Logger.java:206)
            [b]at com.threed.jpct.Loader.loadOBJ(Loader.java:419)
            at com.threed.jpct.Loader.loadOBJ(Loader.java:229)[/b]
            at it.proteomed.www.proteoviewer.MainActivity$2.doInBackground(MainActivity.java:220)
            at it.proteomed.www.proteoviewer.MainActivity$2.doInBackground(MainActivity.java:194)
            at android.os.AsyncTask$2.call(AsyncTask.java:288)
            at java.util.concurrent.FutureTask.run(FutureTask.java:237)
            at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at java.lang.Thread.run(Thread.java:841)
#3
Support / Re: Problem with progressdialog
July 10, 2015, 02:25:38 PM
Hello Egon!
Your tip was really useful!
I've tried to run an AsyncTask using .start() method and it finally got working!!
So, if someone have the same problem: yes AsyncTask is the answer!

Thank you so much!

n.
#4
Support / Re: Problem with progressdialog
July 07, 2015, 12:51:41 AM
hello! Thank you so much for the quick reply!
I've tried also with thread but i still get black screen (background color) during loading... here is my code:  do you have some more advice for me??
@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        switch (id) {
            case R.id.Ruota:
                iF = 0;
                break;
            case R.id.Disegna:
                iF = 1;
                break;
            case R.id.Cancella:
                iF = 2;
                break;
            case R.id.Load:
                Tm = true;
                try {
                    world.removeObject(mesh);
                    mesh = null;
                } catch (Exception e) {
                    throw new RuntimeException(e.toString());
                }
                model = getResources().openRawResource(R.raw.model);
                mtl = getResources().openRawResource(R.raw.material);
                PrgD = ProgressDialog.show(MainActivity.this, "Please wait ...",  "Task in progress ...", true);
                PrgD.setCancelable(true);
                Thread tt = new Thread(new Runnable() {
                    @Override
                    public void run() {
                        try {
                            mesh = Object3D.mergeAll(Loader.loadOBJ(model, mtl, 1));
                            renderer.ObjLoad();
                            Logger.log("MESH LOADED");
                        } catch (Exception e) {

                        }
                        PrgD.dismiss();
                    }
                });
                tt.run();
                break;
        }
        return false;
    }


thank you!

n.
#5
Support / Problem with progressdialog
July 04, 2015, 03:01:27 PM
Hello, congratulations for this useful forum!
I'm creating an app based on JPCT demo to load and view obj files.
I have implemented funcions for load, pinch, drag and rotate objects.
As described in some other topic in this forum the Loader takes some time to load OBJ's, so I'm trying to insert a progressdialog to inform the user that loading is in progress.
I'm using an Object3D that i clear and reload as I need.

This is the code I've written inside the menu:

@Override
    public boolean onOptionsItemSelected(MenuItem item) {
        int id = item.getItemId();
        switch (id) {
            case R.id.Ruota:
                iF = 0;
                break;
            case R.id.Disegna:
                iF = 1;
                break;
            case R.id.Cancella:
                iF = 2;
                break;
            case R.id.Load:
                ProgressDialog PrgD = new ProgressDialog(MainActivity.this);
                PrgD.setTitle("mymessage1");
                PrgD.setMessage("mymessage2");
                PrgD.setCancelable(false);
                PrgD.setIndeterminate(true);
                PrgD.show();
                Tm = true;

                try {
                    world.removeObject(mesh);
                    mesh = null;
                }catch (Exception e){
                    throw new RuntimeException(e.toString());
                }
                model = getResources().openRawResource(R.raw.model);
                mtl = getResources().openRawResource(R.raw.material);
                mesh = Object3D.mergeAll(Loader.loadOBJ(model, mtl, 1));
                renderer.ObjLoad();
                PrgD.dismiss();
                break;


renderer.ObjLoad() is a void inside MyRenderer class where i set cameras, textures etc for the new model loaded.
Everithing works fine, i can read models from raw dir and display them with texture, but I can't see the progressdialog!
The dialog works fine untill i call Loader function inside my code (if i comment out the "mesh =..." line it works!).
If i put back the loader line the loader works, but instead of progressdialog i see empty screen..
I've also tried with an AsyncTask, calling the loader in Background, but the problem still remains: i'm not able to display the progress dialog...
I'm a beginner with coding, so maybe i'm doing some dumb error....can someone help me?
Thanks!