Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

12045 Posts in 1593 Topics- by 594 Members - Latest Member: kakCeteScap

26. May 2013, 07:52:18 am
  Show Posts
Pages: [1] 2 3
1  Projects / Games production pipeline / Re: Java Installer on: 20. March 2009, 05:10:34 am
Another option is Excelsior jet. They make your jar-files into linux or windows binaries. I used it for my game Gunslinger. That way the user doesn't need a specific jvm. Technicly, it worked well. However, these days, they are far from cheap.
2  Projects / Games production pipeline / Re: Java Installer on: 16. March 2009, 09:20:16 am
Quote
gouessej, the problem with Java Web Start is the signing headache, user warnings, etc. (Oh, and I forgot: random behavior under mysterious circumstances. Anyone having tried to do reasonable deployment under JWS will know what I mean.)

I admit that user warnings are not that pleasant. But I do not understand what you mean by signing headache. It is no more a headache than compiling. One row in an ant-file:

Code:
<signjar keystore="abc.ks" jar="dist/abc.jar" alias="MyAlias" storepass="mypassword" />

On the plus side for jws:
* Let lwjgl and jogl handle their natives. You just handle your game.
* End users are automaticlly updated to the latest version. Only changed files need to be downloaded.

On the minus side (yes, I think you missed one):
You can't distribute your work on a cd (or something), everybody has to download from a webserver. I miss the feature:

Code:
This file can be downloaded from X.
But if it is on the cd take it from there.
Download updates from X in the future.
3  General Category / General Discussion / Re: Xith.org SVN hosting service on: 16. March 2009, 07:35:01 am
Yes, but let me clean up my code first  Wink

Sounds great!
4  Xith3D Internals / Developer discussion / Re: LineWrapping TextList on: 14. March 2009, 11:18:02 am
In my own project I extend TextList to LineWrappedTextList. It is a simple solution that works for me.

A multi-line label that does linewrapping, breaks words that are to long and handles newlines would be great. Will think about it and look into how labels work.
5  General Category / Support / Re: Projection to screen on: 14. March 2009, 11:13:20 am
Thanks! Works perfectly!
6  Xith3D Internals / Developer discussion / Re: LineWrapping TextList on: 12. March 2009, 06:33:56 pm
and of course, -20 should be replaced by left and right padding (and then some)...
7  General Category / Support / Re: Projection to screen on: 12. March 2009, 08:03:00 am
Thanks (I am always learning something new posting here)... but this is not it. The dot is not lagged behind, it's far away. Calling update bounds didn't change anything visible.

I tried calling the glu.glProject(...) I found in JOGL (only to test it), but the results I got from that were not right either (in fact, they were very wrong). I guess I am doing something wrong.
8  Xith3D Internals / Developer discussion / LineWrapping TextList on: 12. March 2009, 07:44:24 am
I have extended the TextList widget with linewrapping methods. What do you think?

It still remains to break words that don't fit on one line by themselves.

Code:
    public java.util.List<Label> addItemLineWrap(String text)
    {
        return this.addItemLineWrap(text, null, null);
    }

    public java.util.List<Label> addItemLineWrap(String text, Font font)
    {
        return this.addItemLineWrap(text, null, font);
    }

    public java.util.List<Label> addItemLineWrap(String text, Colorf color)
    {
        return this.addItemLineWrap(text, color, null);
    }

    public java.util.List<Label> addItemLineWrap(String text, Colorf color, Font font)
    {
        java.util.List<Label> labels = new ArrayList<Label>();
        Scanner scanner = new Scanner(text);
        StringBuffer line = new StringBuffer();
        Label label = addItem("", font, color);
        Dim2f dim = new Dim2f();
        while (scanner.hasNext())
        {
            String word = scanner.next();
            if (scanner.hasNext())
            {
                word = word + " ";
            }
            label.setText(line.toString() + word);
            label.getMinimalSize(dim);
            if (dim.getWidth() > this.getWidth() - 20)
            {
                label.setText(line.toString());
                line.delete(0, line.length());
                label = addItem(word, font, color);
            }
            line.append(word);
        }
        return labels;
    }

9  General Category / Support / Projection to screen on: 11. March 2009, 09:06:39 am
Hi!

I want to project a 3D point to the screen. I want to mark the position of a certain Node on the hud (even when the node itself is not visible). This is so you can select an enemy as the current target and have it marked even when it is on the other side of a hill or buildning.

I found an old thread about this and copied the code from it. But I can't get it to work. The point is a little bit wrong. I'm not (yet) good enough at the matrix operations of openGL to understand what is happening.

The method below is not exactly the one described on for instance this page. But I tried that one as well, didn't get it to work.
http://pyopengl.sourceforge.net/documentation/manual/gluProject.3G.xml

Code:
import org.openmali.vecmath2.*;
import org.openmali.FastMath;
import org.xith3d.loop.InputAdapterRenderLoop;
import org.xith3d.loop.RenderLoop;
import org.xith3d.base.Xith3DEnvironment;
import org.xith3d.scenegraph.BranchGroup;
import org.xith3d.scenegraph.TransformGroup;
import org.xith3d.scenegraph.Transform3D;
import org.xith3d.scenegraph.StaticTransform;
import org.xith3d.scenegraph.primitives.Cube;
import org.xith3d.render.RenderPass;
import org.xith3d.render.Canvas3DFactory;
import org.xith3d.render.Canvas3D;
import org.xith3d.render.util.WindowClosingListener;
import org.xith3d.ui.hud.HUD;
import org.xith3d.ui.hud.widgets.LineWidget;
import org.jagatoo.input.events.KeyPressedEvent;
import org.jagatoo.input.devices.components.Key;
import org.jagatoo.input.InputSystem;
import org.jagatoo.input.InputSystemException;

public class Test extends InputAdapterRenderLoop implements WindowClosingListener {
    private Xith3DEnvironment env;
    private BranchGroup root;
    private RenderPass scenePass;
    private Canvas3D canvas;
    private Cube cube;
    private TransformGroup cubeTG;
    private LineWidget line;

    public static void main(String[] args) {
        Test test = new Test();
        test.begin(RenderLoop.RunMode.RUN_IN_SAME_THREAD);
    }

    public Test() {
        super(30);

        env = new Xith3DEnvironment(this);
        env.getView().setFrontClipDistance(0.2f);
        env.getView().setBackClipDistance(1500f);

        root = new BranchGroup();

        scenePass = env.addPerspectiveBranch(root);

        canvas = Canvas3DFactory.createWindowed(800, 600, "Project");
        env.addCanvas(canvas);
        canvas.addWindowClosingListener(this);
        try {
            InputSystem.getInstance().registerNewKeyboardAndMouse(canvas.getPeer());
        } catch (InputSystemException e) {
            e.printStackTrace();
        }

        cube = new Cube(1);
        StaticTransform.translate(cube, 0, 3, 0);
        cubeTG = new TransformGroup();
        cubeTG.addChild(cube);
        root.addChild(cubeTG);

        canvas.getView().lookAt(new Tuple3f(10, 0, 0), Point3f.ZERO, Vector3f.POSITIVE_Y_AXIS);

        HUD hud = new HUD(800, 600, 800);
        env.addHUD(hud);

        line = new LineWidget(new Vector2f(0, 5), 5f, Colorf.RED);
        hud.addWidget(line);
        line.setZIndex(1);
    }

    @Override
    /**
       Rotates the cube around zero and tries to mark it's position (or rather, the center of it's worldbounds)
     with a lineWidget.
     */
    public void update(long gameTime, long frameTime, TimingMode timingMode) {
        super.update(gameTime, frameTime, timingMode);

        Transform3D t3d = cubeTG.getTransform();
        t3d.rotZ(timingMode.getSecondsAsFloat(gameTime));
        cubeTG.setTransform(t3d);

        Point3f centerPoint = Point3f.fromPool();
        cube.getWorldBounds().getCenter(centerPoint);
        Point2f point = worldToScreen(centerPoint);
        line.setLocation(point.getX(), point.getY());
        Point3f.toPool(centerPoint);
    }

    public Point2f worldToScreen (Point3f p) {
        // get the model-view and the projection matrix
Matrix4f mP = canvas.getView().calculatePerspective(800, 600).getMatrix4f();
Matrix4f mM = canvas.getView().getModelViewTransform(true).getMatrix4f();

// convert the point into a vector of length 4
Vector4f v = new Vector4f(p.getX(), p.getY(), p.getZ(), 1);

// compute the distance between the eye and the view plane
float vpd = 1.0f / FastMath.tan(canvas.getView().getFieldOfView());

// v' = P x M x v
v.mul(mM, v);
v.mul(mP, v);

// scale the resulting vector so that it lies in the view plane
float x = v.getX() * vpd / v.getZ();
float y = v.getY() * vpd / v.getZ();

        // convert normalized view plane coordinates into screen coordinates
float xs = (float) 800 * (x + 1f) / 2f;
float ys = (float) 600 / 2f * (1f - y);
return new Point2f(xs, ys);
}


    public void onWindowCloseRequested(Canvas3D canvas) {
        this.end();
    }

    public void onKeyPressed(KeyPressedEvent e, Key key) {
        switch (key.getKeyID()) {
            case ESCAPE:
                this.end();
                break;
        }
    }


}


Edit:
This is the old thread:
http://xith.org/forum/index.php/topic,464.15.html

Edit 2:
Sorry, just noticed I posted this in General. Should be in support of course. So I deleted the first and posted it here.
10  General Category / Support / Re: Picking again on: 10. March 2009, 07:51:15 am
I assume it is some kind of experiment gone wrong as there is commented code that does the "correct" thing... ?

Thanks for your help!
11  General Category / Support / Re: Picking again on: 09. March 2009, 06:51:43 pm
Did you read the code in my post?

It adds one PickRequest for each item in the list.
12  General Category / Support / Re: Picking again on: 09. March 2009, 06:12:21 pm
In my inexperience, I assumed it would be faster (somehow depending on hardware acceleration).

I know that my computer can render the terrain at 150 fps. Something like 7 ms per frame. I imagined that picking would be faster than that because then you wouldn't have to bother with textures or light.

I was wrong. Sorry to have disturbed you.  Smiley

Picking with the library works.
13  General Category / Support / Re: Picking again on: 09. March 2009, 07:47:54 am
I was talking about the one in Canvas3D. Reading the code, it is obvious that it happens. But why?

Code:
    /**
     * Renders the scene in GLSelect mode.
     *
     * @param x the Canvas3D-relative x-component of the picking
     * @param y the Canvas3D-relative y-component of the picking
     * @param width with of the pick-ray
     * @param height height of the pick-ray
     *
     * @return a List of the results of this picking of the nearest result
     */
    private final void pick( List< ? extends GroupNode > rootGroups, MouseButton button, int x, int y, int width, int height, Object pickListener, boolean pickAll, Object userObject )
    {
        final List< RenderPass > renderPasses = getRenderer().getRenderPasses( ( (GroupNode)rootGroups.get( 0 ) ).getRoot() );
       
        /*
        final PickRequest preq = PickHeap.allocatePickRequest( renderPasses.get( 0 ), rootGroups, this, button, x, y, pickListener, userObject, pickAll );
       
        getRenderer().addPickRequest( preq );
        */

        for ( int i = 0; i < rootGroups.size(); i++ )
        {
            final PickRequest preq = PickPool.allocatePickRequest( renderPasses.get( 0 ), (GroupNode)rootGroups.get( i ), this, button, x, y, pickListener, userObject, pickAll );
           
            getRenderer().addPickRequest( preq );
        }
    }
14  General Category / Support / Re: Picking again on: 08. March 2009, 03:06:27 pm
A new question about picking. When I use

Code:
canvas.pickNearest( List< ? extends GroupNode > groups, MouseButton button, int x, int y, NearestPickListener pl )

There are one call to the picklistener per item in the list. Almost every time it's the onPickingMissed that is called. And each call takes about 15 ms. So if I pick against 15 objects, this takes a long time. Very few of them are near the point I pick. I guess I misunderstand the method.

If I use the one that takes a single GroupNode, it still takes 15 ms (according to the method), but now only once. And this even if I submit the whole BranchGroup. But it is still a noticeable hickup (on my work computer it takes about 60 ms).
15  General Category / Support / Re: Picking again on: 04. March 2009, 08:06:53 pm
Quote
Quote
I am just starting to work on the terrain again. Maybe I get an idea for this while working on it.

That sounds wonderful! I will make some experiments of my own and if I find something I will let you know.
Pages: [1] 2 3
Theme orange-lt created by panic