Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

11855 Posts in 1569 Topics- by 3045 Members - Latest Member: lensreslai

10. February 2012, 06:24:26 AM
Xith3D CommunityGeneral CategoryFeature Requests & Brilliant Ideas (Moderators: Marvin Fröhlich, 'n ddrylliog)Integration with Qt Jambi GUI
Pages: 1 [2] 3 4
Print
Author Topic: Integration with Qt Jambi GUI  (Read 21602 times)
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #15 on: 10. August 2007, 01:28:36 AM »

I have slightly modified it and cleaned it up a little but.

The X-click now ends the RenderLoop, which must be integrated into the CanvasPeer implementation itself.
I have separated the QT stuff from the Xith- and other stuff, so that it is much better to see, what is QT and what is not.
The threading problems are not solved. I have no more time this week. I will proceed next week.
It would help a lot, if you would translate all the french stuff to english.

Marvin
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #16 on: 10. August 2007, 06:53:56 PM »

Great work ! Shocked
i will translate my stuff to english soon.
Indeed, it's a part of the 3D GIS project i 'm making, so i haven't thougt to make it in english. But i will.
Thanks you!

Ludo.
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #17 on: 11. August 2007, 11:59:38 AM »

Indeed, it's a part of the 3D GIS project i 'm making, so i haven't thougt to make it in english. But i will.

Well, even if it depends a little, if I write my comments in English or German in my private projects, I always wrote and write variables in English. This way I never have a problem with forbidden chars in any (code-)language. And I never risk, that my code is not understandable for anybody.

Marvin
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #18 on: 12. August 2007, 06:44:58 PM »

I have a remark/suggestion about the modifications you made and especially the architecture of this application.
You have made the class Vue3D (xith class) the master class of this little java project.
I mean that this class controls the application and contains the main method.

But from my point of view, the main class should be the QTEnv class.
Why? because i see the Qt widget (QTEnv) as a container for a xith canvas.
By this way, i can embed one or several xith canvas in a Qt application easily.
For example, i can show you a screenshot of my current 3DGIS application:

Here, there are two Xith widgets

I've started to modify what you did to implement that, this is not a problem.
Now the The QTEnv contructor instantiates a new Vue3D.


But i agree that it's better to separate xith stuff from Qt stuff.

Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #19 on: 12. August 2007, 08:18:22 PM »

Well it is not better or worse to do it the one way or the other. It doesn't make a difference. So, if you like it better this way, just do it. Just choose the way, that fits you application's needs better.

In a cleanly structured application I would not make one of these two classes the root or the master class. I would make them both slaves. The master should be the application itself. The xith part and QT part are just rendering- and GUI parts of your app. (Do you know MVC (Model, View, Controller)?)

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #20 on: 22. August 2007, 03:22:11 PM »

When is QT Jambi support going to be integrated into the Xith3D SVN ? Who is in charge of that ?
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #21 on: 22. August 2007, 04:32:09 PM »

When is QT Jambi support going to be integrated into the Xith3D SVN ?

Well, as far as Ludo and I have decided it will never be integrated in the xith SVN. It will be available for download as a separate package. In this case the natives are really big. We should think about doing the same for SWT, too.

Ludo last said, that he wanted to make some minor changes. It should be ready. I will ask him for that, if he doesn't come online these days.

Who is in charge of that ?

Ludo and me (especially Ludo).

Marvin
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #22 on: 22. August 2007, 04:37:57 PM »

Well, as far as Ludo and I have decided it will never be integrated in the xith SVN. It will be available for download as a separate package. In this case the natives are really big. We should think about doing the same for SWT, too.
OK then, but we should make sure it is maintained, or it will be dead soon.. (at the rhythm at which we're breaking compatibility Cheesy). Well, ok we're getting more and more stable now..
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #23 on: 22. August 2007, 04:45:09 PM »

OK then, but we should make sure it is maintained, or it will be dead soon.. (at the rhythm at which we're breaking compatibility Cheesy). Well, ok we're getting more and more stable now..

We do indeed Smiley.
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #24 on: 24. August 2007, 10:39:25 AM »

Do you "valid" my question on these topics ? Smiley
->  http://lists.trolltech.com/qt-jambi-interest/2007-08/thread00011-0.html
The same in french : http://forum.qtfr.org/viewtopic.php?id=4699
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #25 on: 24. August 2007, 03:55:45 PM »

Well, they're rather quick to answer Smiley It seems you've got your solution, Ludo.
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #26 on: 25. August 2007, 11:01:53 AM »

Yes they're good !
Logged
'n ddrylliog
Moderator
Guru
*****
Offline Offline

Posts: 1188



View Profile WWW Email
« Reply #27 on: 25. August 2007, 11:24:18 AM »

Yes they're good !
So, does it work ?
Logged
Ludovic Marcé
Enjoying the stay
*
Offline Offline

Posts: 60


ludo123456@jabber.fr
View Profile
« Reply #28 on: 27. August 2007, 10:52:21 AM »

Yes and no.
Let's say it's better now.
I have to "play" with Xith Runmodes.
So my application is initialized in RunMode RUN_IN_SEPARATE_THREAD_AND_WAIT.
It's ok when viewing the 3d scene and moving the camera with the mouse or the keyboard (interactive mode).
But when i want to update the canvas fastly, for example for launching an animation, i have to change the runmode before.
Else, only the last frame is displayed when the animation is finished.





Here is the class AnimCamera i have made for my project:
Code:
/**
 * Animates the camera from a list of points
 */
package fr.ign.cogit.appli.risques.ihm;

import java.util.ArrayList;
import java.util.List;

import org.openmali.vecmath.Matrix3f;
import org.openmali.vecmath.Vector3f;
import org.xith3d.base.Xith3DEnvironment;
import org.xith3d.loop.RenderLoop;
import org.xith3d.loop.RenderLoop.RunMode;
import org.xith3d.loop.RenderLoop.StopOperation;
import org.xith3d.loop.UpdatingThread.TimingMode;
import org.xith3d.scenegraph.StaticTransform;
import org.xith3d.scenegraph.Transformable;

import org.xith3d.utility.view.CameraFlightListener;

/**
 * @author Ludo
 *
 */
public class AnimCamera implements CameraFlightListener {
    private CameraFlight camFlight = null;
    private long gameTime = 0;
    private Transformable cam;
    private RenderLoop loop;
    private boolean endAnim = false;
   
    private List<Vector3f> posList;
private Xith3DEnvironment env;
long t0;
   
    public AnimCamera(Transformable cam, RenderLoop loop, Xith3DEnvironment env) {
this.cam = cam;
this.loop = loop;
this.env = env;
posList = new ArrayList<Vector3f>();
}
   
    public void startFlight()
    {
        t0 = System.currentTimeMillis();
camFlight = new CameraFlight();
computeRotCam();
camFlight.addCameraFlightListener( this );
loop.setStopOperation(StopOperation.DO_NOTHING);
System.out.println( loop.getStopOperation().toString() );
loop.end();
loop.begin(RunMode.RUN_IN_SAME_THREAD);
        camFlight.start( loop.getGameTime() + (System.currentTimeMillis() - t0) );

System.out.println( "CameraFlight started." );

gameTime = loop.getGameTime();
endAnim = false;
while (!endAnim) {
updateCamera();
}
    }
   
    public void stopFlight()
    {
        camFlight = null;
    }
   
/* (non-Javadoc)
* @see org.xith3d.utility.view.CameraFlightListener#onCameraFlightEnded(long, long, double)
*/
public void onCameraFlightEnded(long frames, long millis, double averageFPS) {
        final double roundedFPS = ((double)((int)(averageFPS * 100.0)) / 100.0);
//        loop.end();
        loop.setStopOperation(StopOperation.DESTROY);
//        loop.begin(RunMode.RUN_IN_SEPARATE_THREAD_AND_WAIT);
        endAnim = true;
        System.out.println( "CameraFlight ended. (average FPS: " + roundedFPS + ")" );
}


public void addPos(Vector3f pos) {
posList.add( new Vector3f(pos) );
}

private void computeRotCam() {
for (int i = 0; i < posList.size(); i++) {
Vector3f point = new Vector3f();
Vector3f vec = new Vector3f();
point.set( posList.get( i ) );
if ( i!= posList.size() -1 ) {
vec.set( posList.get(i + 1) );
}
else {
vec.set( posList.get(0) );
}
vec.sub(point);
Matrix3f rot = new Matrix3f();
cam.getTransform().getRotation(rot);
// rot.set( StaticTransform.getRotationMatrix( new Vector3f(0f, 0f, 1f), vec.angle(new Vector3f(1f, 0f, 0f)) ) );
System.out.println(rot + "\n" + point);
camFlight.addRotPos( rot, vec, 1000f );
}
}

public void updateCamera() {
gameTime = loop.getGameTime() + (System.currentTimeMillis() - t0);
camFlight.updateCamera(cam, gameTime);
loop.nextFrame();
}
}

PS: The constuctor of CameraFlight() shouldn't not be null. It should initialize the list of points instead:
Code:
    /**
     * Creates a new CameraFlight
     */
    public CameraFlight()
    {
        interPoints = new ArrayList<InterpolationPoint>();
    }
Logged
Marvin Fröhlich
Xith Lord
Administrator
Guru
*****
Offline Offline

Posts: 4337


May the 4th, be with you...


View Profile
« Reply #29 on: 27. August 2007, 06:12:22 PM »

PS: The constuctor of CameraFlight() shouldn't not be null. It should initialize the list of points instead:
Code:
    /**
     * Creates a new CameraFlight
     */
    public CameraFlight()
    {
        interPoints = new ArrayList<InterpolationPoint>();
    }

Well, the list of InterpolationPoints was not meant to be available from outside. Now I've added a constructor, that takes such a list. But you should better use the CameraFlightRecorder to record a flight and store it on the disk. Then you can load it through one of the constructors of CameraFlight or use one of the load() methods. This is much more usable than typing all the points and matrices manually.

Marvin
Logged
Pages: 1 [2] 3 4
Print
Jump to:  

Theme orange-lt created by panic