Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (524)
Games in Android Showcase (127)
games submitted by our members
Games in WIP (593)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1]
1  Games Center / Featured Games / Re: Overbind on: 2012-10-27 20:11:43
what a wonderful game!

P.S. I think people are cheating on your fastest times lol. 13 seconds for the third challenge. That's how long it takes to walk to the first magnet box!
2  Java Game APIs & Engines / JOGL Development / Re: [solved]Problems deploying applet on: 2012-10-27 01:42:42
problem has been solved by none other then sven. I was using the wrong libraries...  persecutioncomplex

Thanks again.
http://forum.jogamp.org/Applet-deploy-serious-problems-td4026628.html
3  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-26 21:19:50
Thanks alot for the advice, I'll try that route next. This has been a real headache.
4  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-26 19:51:02
This code gives an error:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
ExitException[ 3]JNLPException[category: Launch File Error : Exception: java.lang.Exception: JNLP not an applet, nor a JavaFX application : LaunchDesc: 
<jnlp spec="1.0+" codebase="" href="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
  <information>
    <title>Orbital Explorer</title>
    <vendor>None</vendor>
    <homepage href="http://www.realchemist.zxq.net/"/>
    <description>Atomic orbital demonstrations</description>
    <offline-allowed/>
  </information>
  <security>
    <all-permissions/>
  </security>
  <update check="always" policy="always"/>
  <resources>
    <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="32m" max-heap-size="256m" java-vm-args="-XX:MaxDirectMemorySize=128M"/>
    <property name="sun.java2d.noddraw" value="true"/>
    <jar href="http://www.angelfire.com/indie/kcsoft/orbexplor.jar" download="eager" main="true"/>
    <jar href="http://jogamp.org/deployment/webstart/jar/gluegen-rt.jar" download="eager" main="false"/>
    <jar href="http://jogamp.org/deployment/webstart/jar/jogl.all.jar" download="eager" main="false"/>
    <jar href="http://jogamp.org/deployment/webstart/jar/applet-launcher.jar" download="eager" main="false"/>
  </resources>
  <application-desc main-class="OrbitalExplorer.orbitalExplorerApp"/>
</jnlp> ]
   at sun.plugin2.applet.JNLP2Manager.loadJarFiles(Unknown Source)
   at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:722)


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="256" height="320">
   <param name="code" value="org.jdesktop.applet.util.JNLPAppletLauncher">
   <param name="archive" value="http://jogamp.org/deployment/webstart/jar/gluegen-rt.jar,
               http://jogamp.org/deployment/webstart/jar/jogl.all.jar,
               http://www.angelfire.com/indie/kcsoft/orbexplor.jar"
>
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="OrbitalExplorer.orbitalExplorerApp">
   <param name="subapplet.displayname" value="Orbital Explorer">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1" value="http://jogamp.org/deployment/webstart/jogl-awt.jnlp">
   <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
   <param name="jnlp_href" value="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
   <comment>
     <embed code="org.jdesktop.applet.util.JNLPAppletLauncher"
          width="256" height="320"
          type="application/x-java-applet;version=1.6"
          pluginspage="http://java.sun.com/javase/downloads/ea.jsp"
          archive="http://jogamp.org/deployment/webstart/jar/gluegen-rt.jar,
               http://jogamp.org/deployment/webstart/jar/jogl.all.jar,
               http://www.angelfire.com/indie/kcsoft/orbexplor.jar"

          codebase_lookup="false"
          subapplet.classname="OrbitalExplorer.orbitalExplorerApp"
          subapplet.displayname value="Orbital Explorer"
          noddraw.check value="true"
          progressbar="true"
          jnlpNumExtensions="1"
          jnlpExtension1="http://jogamp.org/deployment/webstart/jogl-awt.jnlp"
          java_arguments="-Dsun.java2d.noddraw=true"
          jnlp_href="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
        <noembed>Sorry, no Java support detected.</noembed>
     </embed>
   </comment>
</object>



My main class extends Applet, is this wrong? Should I be using newt?

Really wasn't expecting this to take longer than to write the applet. Undecided
5  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-26 01:53:37
Found my old applet project that used to work but the jars cerftificates ran out, and it was on an outdated jogl, copied the code with updated libraries except the old jnlp extension no longer exists. It says loading atleast... hahaha

http://realchemist.zxq.net/pages/Applets/test2.html
test2.html
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
      width="256"
      height="320"
      archive="http://jogamp.org/deployment/webstart/jar/applet-launcher.jar,
            http://jogamp.org/deployment/webstart/nativewindow.all.jar,
            http://jogamp.org/deployment/webstart/jar/jogl.all.jar,
            http://jogamp.org/deployment/webstart/jar/gluegen-rt.jar,
              http://www.angelfire.com/indie/kcsoft/orbexplor.jar"
>
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="OrbitalExplorer.orbitalExplorerApp">
   <param name="subapplet.displayname" value="Orbital Explorer Test">
   <param name="noddraw.check" value="true">
   <param name="noddraw.check.silent" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1" value="http://jogamp.org/deployment/webstart/jogl-awt.jnlp">
</applet>
6  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-26 00:29:04
Okay I got it to be a grey blank applet? Not sure why that is just yet.

http://www.realchemist.zxq.net/pages/Applets/test.html

My main class extends Applet, is this wrong? Should I be using newt?

oe.jnlp
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
<?xml version="1.0" encoding="UTF-8"?>
   <jnlp spec="1.0+" href="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
      <information>
         <title>Orbital Explorer</title>
         <vendor>None</vendor>
         <homepage href="http://www.angelfire.com/indie/kcsoft/"/>
         <description>Atomic orbital demonstrations</description>
         <offline-allowed/>
      </information>
      <security>
         <all-permissions/>
      </security>

      <update check="always" policy="always"/>
      <resources>
         <j2se version="1.6+" href="http://java.sun.com/products/autodl/j2se" initial-heap-size="32m" max-heap-size="256m" java-vm-args="-XX:MaxDirectMemorySize=128M"/>
         <jar href="http://www.angelfire.com/indie/kcsoft/orbexplor.jar" main="true"/>
         <jar href="http://jogamp.org/deployment/webstart/jar/gluegen-rt.jar" main="false"/>
         <jar href="http://jogamp.org/deployment/webstart/jar/jogl.all.jar" main="false"/>
         <property name="sun.java2d.noddraw" value="true"/>
      </resources>
      <application-desc main-class="OrbitalExplorer.orbitalExplorerApp" />
   </jnlp>


test.html
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
      width=256
      height=322
      archive="http://jogamp.org/deployment/webstart/jar/gluegen-rt.jar,
               http://jogamp.org/deployment/webstart/jar/jogl.all.jar,
               http://www.angelfire.com/indie/kcsoft/orbexplor.jar"
>
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="OrbitalExplorer.orbitalExplorerApp">
   <param name="subapplet.displayname" value="OrbitalExplorer">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1"
          value="http://jogamp.org/deployment/webstart/jogl-awt.jnlp">
   <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
   <param name="jnlp_href" value="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
</applet>
7  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-25 23:56:58
it should draw a white glcanvas with 4 awt buttons on the bottom. when you click on a button it should then display some scattered pyramids. mouse clicking and moving on the canvas rotates the shape. The shapes are representations of atomic orbitals(chemistry) derived from schroedingers equation. Thanks for the file I'm about to give it a shot.
8  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-25 23:42:35
I'm using OpenJDK 7 and NetX / IcedTea 1.2

Just found out I didn't have the iced-tea plug-in. Wow thanks now hopefully things will come together better. That's the only example I have been able to get to run.
9  Java Game APIs & Engines / JOGL Development / Re: Problems deploying applet on: 2012-10-25 21:50:43
My manifest file is solid, my program runs fine, my jar is sealed and signed.

Trying a new approach. I figure the applet is impossible to make work. Kept getting an error about not being able to find "org.jdesktop.applet.util.JNLPAppletLauncher" even after downloading signing and uploading each required .jar ...

So now I'm trying with the .jnlp

Here's what I have going on:
http://realchemist.zxq.net/pages/Applets/test.html
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
<applet code="org.jdesktop.applet.util.JNLPAppletLauncher"
      width=256
      height=322
      archive="http://jogamp.org/deployment/util/applet-launcher.jar,
               http://jogamp.org/deployment/webstart/nativewindow.all.jar,
               http://jogamp.org/deployment/webstart/jogl.all.jar,
               http://jogamp.org/deployment/webstart/gluegen-rt.jar,
               http://www.angelfire.com/indie/kcsoft/orbexplor.jar"
>
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="OrbitalExplorer.orbitalExplorerApp">
   <param name="subapplet.displayname" value="OrbitalExplorer">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1"
          value="http://jogamp.org/deployment/webstart/jogl-core.jnlp">
   <param name="java_arguments" value="-Dsun.java2d.noddraw=true">
   <param name="jnlp_href" value="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
</applet>


then the oe.jnlp code is
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
<?xml version="1.0" encoding="utf-8"?>
<jnlp href="http://www.angelfire.com/indie/kcsoft/oe.jnlp">
  <information>
    <title>Orbital Explorer</title>
    <vendor>None</vendor>
    <homepage href="http://www.realchemist.zxq.net"/>
    <description>Atomic orbital demonstrations</description>
    <description kind="short">Atomic orbital demonstrations</description>
    <offline-allowed/>
  </information>

    <resources>
      <j2se href="http://java.sun.com/products/autodl/j2se" version="1.4+"/>
      <property name="sun.java2d.noddraw" value="true"/>
      <jar href="http://www.angelfire.com/indie/kcsoft/orbexplor.jar" main="true"/>
      <extension name="jogl-all-awt" href="http://jogamp.org/deployment/webstart/jogl-all-awt.jnlp" />
    </resources>

  <applet-desc
      name="OrbitalExplorer"
      main-class="OrbitalExplorer.orbitalExplorerApp"
      width="256"
      height="320">
  </applet-desc>
</jnlp>


Now I'm getting a fun error:
Exit Exception
Error While Initializing Managers
dump:
1  
2  
3  
4  
5  
6  
7  
8  
ExitException[ 3]JNLParseException[ Could not parse launch file. Error at line 29.]
   at sun.plugin2.applet.JNLP2Manager.redirectLaunchDesc(Unknown Source)
   at sun.plugin2.applet.JNLP2Manager.initialize(Unknown Source)
   at sun.plugin2.main.client.PluginMain.initManager(Unknown Source)
   at sun.plugin2.main.client.PluginMain.access$200(Unknown Source)
   at sun.plugin2.main.client.PluginMain$2.run(Unknown Source)
   at java.lang.Thread.run(Thread.java:722)
Error while initializing manager: ExitException[ 3]JNLParseException[ Could not parse launch file. Error at line 29.], bail out


Is JOGL 2.0 broken or am I really this daft? Does this work on anyone elses machine?
10  Java Game APIs & Engines / JOGL Development / [solved]Problems deploying applet on: 2012-10-25 01:47:04
Using JOGL 2.0, applet has no warnings in eclipse IDE.
Succesfully, Signed the jar file.

Should I not include the classpath when I make the JAR(from eclipse)?

Is the error in my actual JAVA programming(applet runs fine in eclipse) or am I doing something wrong here?

edit - I am using awt, and running Linux Mint 13 OS.

here's my test link.
http://realchemist.zxq.net/pages/Applets/test.html
And here's the code for the link/deploy.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
<applet code="OrbitalExplorer.orbitalExplorerApp"
      width=258
      height=322
      archive="http://jogamp.org/deployment/util/applet-launcher.jar,
               http://jogamp.org/deployment/webstart/nativewindow.all.jar,
               http://jogamp.org/deployment/webstart/jogl.all.jar,
               http://jogamp.org/deployment/webstart/gluegen-rt.jar,
               http://www.angelfire.com/indie/kcsoft/OrbitalExplorer.jar"
>
   <param name="codebase_lookup" value="false">
   <param name="subapplet.classname" value="orbitalExplorerApp">
   <param name="subapplet.displayname" value="Orbital Explorer Test">
   <param name="noddraw.check" value="true">
   <param name="progressbar" value="true">
   <param name="jnlpNumExtensions" value="1">
   <param name="jnlpExtension1"
          value="http://download.java.net/media/jogl/jsr-231-2.x-webstart/jogl-core.jnlp">
</applet>



11  Java Game APIs & Engines / OpenGL Development / Re: Having problems with JOGL on: 2012-10-21 22:06:19
Nevermind I'm a real dumb dumb head cake face, I forgot to install new drivers for my graphics card. Works like a charm!
12  Java Game APIs & Engines / OpenGL Development / Re: Having problems with JOGL on: 2012-10-21 21:20:03
Stop is not called before the end of the application.

What I mean is the perspective of the scene does not change. If I change the variables of GluLookAt durring operation the scene does not change. Even if I hide the drawing of the object or change the color of the object it only displays the first thing rendered.

Thanks for the advice on the other forum that's where I'm heading next.

I did just find this error on closing the applet:
Info: Nativewindow X11 Error (Thread: XToolkt-Shutdown-Thread): 3 - BadWindow (invalid Window parameter), dpy 0x79b55288, id 3600011, # 787: 4:0 X_DestroyWindow
13  Java Game APIs & Engines / OpenGL Development / [solved]Having problems with JOGL on: 2012-10-21 16:48:08
I used to use JOGL 1.0 for game dev, spent a few years away and now JOGL 2.0 is out. My OS is Linux Mint. I am using the JOGL natives i586 although my OS is i686. using Java 7 Open JDK i386. Getting some weird errors.

I tried running a JOGL2.0 picking example(http://jogamp.org/jogl-demos/src/demos/misc/Picking.java) and the display flashed the renderings correctly for maybe a half second then it went black(set clear color). Also when I resize the frame anything inside of it disappears.

This was all of course after countlessly trying to debug my own scripts. In my own script it seems that the glcanvas never updates the GluLookAt . I'm thinking this might be a java and or jogl error rather then a script error. . Either way any advice is appreciated. Thank you for your time.


If anyone could run my script and tell me if when you click the mouse the black pyramid gets further and further away it would be very appreciated! Otherwise I won't know if it's my install or my code.
Here's my code:
orbitalExplorerApp.java
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
import java.applet.*;
import java.awt.*;
import javax.media.opengl.awt.GLCanvas;
import com.jogamp.opengl.util.Animator;

import javax.media.opengl.GLCapabilities;
import javax.media.opengl.GLProfile;


@SuppressWarnings("serial")
public class orbitalExplorerApp extends Applet{
   private static final long serialVersionUID = 7403003329697278728L;
    protected Animator animator;
    protected GLCanvas glcanvas;
    private orbitalExplorer orbExplorer = new orbitalExplorer();
   
    public void init() {
       setLayout( new BorderLayout() );
       GLProfile profile = GLProfile.get(GLProfile.GL2);
       GLProfile.initSingleton();
          GLCapabilities capabilities = new GLCapabilities(profile);
       
        glcanvas = new GLCanvas(capabilities);
        glcanvas.addGLEventListener(orbExplorer);
        glcanvas.addMouseListener(orbExplorer);
        glcanvas.setBounds(0, 0, 512, 512);
        animator = new Animator(glcanvas);
     
        add(glcanvas, BorderLayout.CENTER);
    }

    public void start() {
       animator.setRunAsFastAsPossible(false);
       animator.start();
    }
   
    public void stop() {
       animator.stop();
    }
   
    public void destroy() {}
}

orbitalExplorer.java
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
import java.awt.event.MouseListener;
import java.awt.event.MouseEvent;

import javax.media.opengl.GL2;
import javax.media.opengl.GLAutoDrawable;
import javax.media.opengl.GLEventListener;
import javax.media.opengl.awt.GLCanvas;
import javax.media.opengl.glu.GLU;

public class orbitalExplorer extends GLCanvas implements GLEventListener, MouseListener{
   private GLU glu = new GLU();
   private GL2 gl;
   
   private Camera3D camera = new Camera3D(-1.0f,0f,-16.0f,//Location X,Y,Z
                                 0f,0f,0f,//Angle X,Y,Z,
                                 2f,//Orbiting Radius
                                 0f,0f,0f);//Focus Position
   private float degreeToRadian = 0.0174532925f;
   

   public void mouseClicked(MouseEvent mouse) {
      camera.z = camera.z - 10.0f;
      System.out.println("camera-z:"+camera.z);//Displays correct camera values on clicking
   }
   public void mousePressed(MouseEvent mouse) {
     
   }

   public void mouseReleased(MouseEvent mouse) {
     
   }
   public void mouseEntered(MouseEvent mouse) {}
   public void mouseExited(MouseEvent mouse) {}
   public void mouseDragged(MouseEvent mouse) {}
   public void mouseMoved(MouseEvent mouse) {}
   public void mouseWheelMoved(MouseEvent mouse) {}

    public void reshape( GLAutoDrawable drawable, int x, int y, int width, int height ) {
       gl = drawable.getGL().getGL2();
        if (height <= 0) // avoid a divide by zero error!
            {height = 1;}
        final float h = (float) width / (float) height;
        gl.glViewport(0, 0, width, height);
        gl.glMatrixMode(GL2.GL_PROJECTION);
        gl.glLoadIdentity();
        glu.gluPerspective(45.0f, h, 1.0f, 100.0f);//20 = LOOK AT DIST
        gl.glMatrixMode(GL2.GL_MODELVIEW);
        gl.glLoadIdentity();
    }

    public void init( GLAutoDrawable drawable ) {
       gl = drawable.getGL().getGL2(); //Set Up GL
       gl.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
       gl.glEnable(GL2.GL_DEPTH_TEST);
       gl.glClearDepth(1.0f);
       gl.glDepthFunc(GL2.GL_LEQUAL);
       gl.glHint(GL2.GL_PERSPECTIVE_CORRECTION_HINT, GL2.GL_NICEST);
    }
       
    public void dispose( GLAutoDrawable drawable ) {}
   
    public void display( GLAutoDrawable drawable ) {
       //Canvas Clearing
       gl = drawable.getGL().getGL2();
       gl.glClear(GL2.GL_COLOR_BUFFER_BIT | GL2.GL_DEPTH_BUFFER_BIT);
        gl.glLoadIdentity();
       
        //Camera Permutations
        glu.gluLookAt(camera.x, camera.y, camera.z,
                    camera.focusx, camera.focusy, camera.focusz,
                    0, 1, 0);
       
       //Rendering Operations
       gl.glPushMatrix();
          gl.glBegin(GL2.GL_TRIANGLES);        // Drawing Using Triangles
              gl.glColor3f(0.0f, 0.0f, 0.0f);     //
              gl.glVertex3f(0.0f, 1.0f, 0.0f);    // Top Of Triangle (Front)
              gl.glVertex3f(-1.0f, -1.0f, 1.0f);  // Left Of Triangle (Front)
              gl.glVertex3f(1.0f, -1.0f, 1.0f);   // Right Of Triangle (Front)
              gl.glVertex3f(0.0f, 1.0f, 0.0f);    // Top Of Triangle (Right)
              gl.glVertex3f(1.0f, -1.0f, 1.0f);   // Left Of Triangle (Right)
              gl.glVertex3f(1.0f, -1.0f, -1.0f);  // Right Of Triangle (Right)
              gl.glVertex3f(0.0f, 1.0f, 0.0f);    // Top Of Triangle (Back)
              gl.glVertex3f(1.0f, -1.0f, -1.0f);  // Left Of Triangle (Back)
              gl.glVertex3f(-1.0f, -1.0f, -1.0f); // Right Of Triangle (Back)
              gl.glVertex3f(0.0f, 1.0f, 0.0f);    // Top Of Triangle (Left)
              gl.glVertex3f(-1.0f, -1.0f, -1.0f); // Left Of Triangle (Left)
              gl.glVertex3f(-1.0f, -1.0f, 1.0f);  // Right Of Triangle (Left)
           gl.glEnd();
        gl.glPopMatrix();
       
        gl.glFlush();
    }

}


Vector3D.java
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
public class Vector3D {
   public float x, y, z;
   public float mag;
   
   public Vector3D(float X, float Y, float Z){
      x = X; y = Y; z = Z;
   }
   
   public Vector3D(){
      x = 0f; y = 0f; z = 0f;
   }
   
   public Vector3D(Vector3D vector){
      x = vector.x; y = vector.y; z = vector.z;
   }
   
   public void setX(float X){x = X;}
   public void setY(float Y){x = Y;}
   public void setZ(float Z){x = Z;}
   
   public void setXYZ(float X,float Y,float Z)
      {x = X; y = Y; z = Z;}
   
   public float magnitude(){
      return (float)Math.sqrt(x*x + y*y + z*z);
   }
   
   public void add(Vector3D vector){
      x += vector.x;
      y += vector.y;
      z += vector.z;
   }
   
   public void subtract(Vector3D vector){
      x -= vector.x;
      y -= vector.y;
      z -= vector.z;
   }
   
   public void scalar(float scalar){
      x = x * scalar;
      y = y * scalar;
      z = z * scalar;
   }
   
   public void divide(float scalar){
      x = x / scalar;
      y = y / scalar;
      z = z / scalar;
   }
   
   public float dotProduct(Vector3D vector){
      return (float) (x * vector.x) + (y * vector.y) + (z * vector.z);      
   }
   
   public Vector3D crossProduct(Vector3D vector){
      float crossX = y * vector.z + vector.y * z;
        float crossY = z * vector.x - vector.z * x;
        float crossZ = x * vector.y - vector.x * y;
        return new Vector3D(crossX, crossY, crossZ);
   }
   
   public void normalize(){
      float mag = magnitude();
      if(mag > 0){ divide(mag); }
   }
   
   public float distance(Vector3D vector){
      float distanceX = x - vector.x,
            distanceY = y - vector.y,
            distanceZ = z - vector.z;
      return (float)Math.sqrt(distanceX * distanceX +
                           distanceY * distanceY +
                           distanceZ * distanceZ);
     
   }
   
   public float angleBetween(Vector3D vector){
      float dot = dotProduct(vector);
      float theta = (float)Math.acos(dot / (magnitude() * vector.magnitude()));
      return theta;
   }

   
}


Camera3D.Java
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
public class Camera3D extends Vector3D{
   public float anglex, angley, anglez;
   public float radius = 1f;
   public float focusx = 0f, focusy = 0f, focusz = 0f;
   
   public Camera3D(float X, float Y, float Z,
         float angleX, float angleY, float angleZ,
         float Radius,
         float focusX, float focusY, float focusZ){
      x = X; y = Y; z = Z;
      anglex = angleX; angley = angleY; anglez = angleZ;
      radius = Radius;
      focusx = focusX; focusy = focusY; focusz = focusZ;
   }  
}
Pages: [1]
 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

toopeicgaming1999 (38 views)
2014-11-26 15:22:04

toopeicgaming1999 (33 views)
2014-11-26 15:20:36

toopeicgaming1999 (8 views)
2014-11-26 15:20:08

SHC (24 views)
2014-11-25 12:00:59

SHC (24 views)
2014-11-25 11:53:45

Norakomi (25 views)
2014-11-25 11:26:43

Gibbo3771 (23 views)
2014-11-24 19:59:16

trollwarrior1 (36 views)
2014-11-22 12:13:56

xFryIx (75 views)
2014-11-13 12:34:49

digdugdiggy (52 views)
2014-11-12 21:11:50
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!