Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (109)
games submitted by our members
Games in WIP (536)
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  Java Game APIs & Engines / Java 3D / Re: Java3d not totally dead on: 2012-02-04 19:50:53
I had the issue that picking via a PickCone with multiple objects in the Cone and then trying to get all hits delivered me a ArrayIndexOutOfBoundsException.
I don't have a small example for that issue and not even the big code of my game because i changed the way i checked if i have targets in a 90 degree area (not a cone any more) via good old angle mathematics and the stored positions of the gangers (=targets).
2  Java Game APIs & Engines / Java 3D / Re: Java 3d Loaders on: 2012-02-04 19:39:15
Thx! Cool
3  Java Game APIs & Engines / Java 3D / Re: Texture is not applied to OBJ model properly on: 2012-01-28 20:16:15
You have to set TextureCoordinates or let them generate by the engine for you (which doesn't produce good results most of the time).
Here is a simple method for generating an appearance object with a given texture:

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  
   /**
    * Generate Apperance with given texture
    * @param withTexCoordGeneration
    * @param texture
    * @param wrapTexture
    * @return Appearance
    */

   private Appearance generateAppearanceWithTexture(Texture2D texture, boolean withTexCoordGeneration) {
      // Create the appearance that will use the texture
     Appearance appearance = new Appearance();
      appearance.setTexture(texture);

      // If TexCoordGeneration is wanted then have it
     if (withTexCoordGeneration) {
         TexCoordGeneration texCoordGeneration = new TexCoordGeneration(TexCoordGeneration.NORMAL_MAP,
               TexCoordGeneration.TEXTURE_COORDINATE_2);
         appearance.setTexCoordGeneration(texCoordGeneration);
      }

      // Define how the texture will be mapped onto the surface
     // by creating the appropriate texture attributes
     TextureAttributes textAttr = new TextureAttributes();
      textAttr.setTextureMode(TextureAttributes.REPLACE);

      PolygonAttributes polygonAttributes = new PolygonAttributes();
      polygonAttributes.setCullFace(PolygonAttributes.CULL_NONE);
      appearance.setPolygonAttributes(polygonAttributes);

      appearance.setTextureAttributes(textAttr);
      return appearance;
   }


Or another example which generates a quadarray (for a plane) with setting the TexCoodinates manually (see the .setTextureCoordinate() calls):
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  
   /**
    * Generate a QuadArray (for a plane) by giving the side of a cuboid and the dimension for all 3
    * directions
    * @param side
    * @param x
    * @param y
    * @param z
    * @param texCoordPoint (if null then TexCoords for full size will be set)
    * @return QuadArray
    */

   public static final QuadArray makePlaneForCuboid(int side, float x, float y, float z, Point2f texCoordPoint) {
      QuadArray plane = new QuadArray(24, GeometryArray.COORDINATES | QuadArray.TEXTURE_COORDINATE_2);

      Point3f pa = new Point3f(-1.0f * x, 1.0f * y, 1.0f * z); // = upper corner
     Point3f pb = new Point3f(-1.0f * x, -1.0f * y, 1.0f * z);
      Point3f pc = new Point3f(1.0f * x, -1.0f * y, 1.0f * z);
      Point3f pd = new Point3f(1.0f * x, 1.0f * y, 1.0f * z);
      Point3f pe = new Point3f(-1.0f * x, 1.0f * y, -1.0f * z);
      Point3f pf = new Point3f(-1.0f * x, -1.0f * y, -1.0f * z);
      Point3f pg = new Point3f(1.0f * x, -1.0f * y, -1.0f * z); // = lower corner
     Point3f ph = new Point3f(1.0f * x, 1.0f * y, -1.0f * z);

      switch (side) {
      case 1:
         plane.setCoordinate(0, pa);
         plane.setCoordinate(1, pb);
         plane.setCoordinate(2, pc);
         plane.setCoordinate(3, pd);
         break;

      case 2:
         plane.setCoordinate(0, pe);
         plane.setCoordinate(1, pf);
         plane.setCoordinate(2, pg);
         plane.setCoordinate(3, ph);
         break;

      case 3:
         plane.setCoordinate(0, pe);
         plane.setCoordinate(1, pf);
         plane.setCoordinate(2, pb);
         plane.setCoordinate(3, pa);
         break;

      case 4:
         plane.setCoordinate(0, pd);
         plane.setCoordinate(1, pc);
         plane.setCoordinate(2, pg);
         plane.setCoordinate(3, ph);
         break;

      case 5:
         plane.setCoordinate(0, pe);
         plane.setCoordinate(1, pa);
         plane.setCoordinate(2, pd);
         plane.setCoordinate(3, ph);
         break;

      case 6:
         plane.setCoordinate(0, pf);
         plane.setCoordinate(1, pb);
         plane.setCoordinate(2, pc);
         plane.setCoordinate(3, pg);
         break;

      default:
         plane.setCoordinate(0, pa);
         plane.setCoordinate(1, pb);
         plane.setCoordinate(2, pc);
         plane.setCoordinate(3, pd);
         break;
      }

      if (texCoordPoint == null) {
        plane.setTextureCoordinate(0, 0, new TexCoord2f(0f, 1f));
        plane.setTextureCoordinate(0, 1, new TexCoord2f(0f, 0f));
        plane.setTextureCoordinate(0, 2, new TexCoord2f(1f, 0f));
        plane.setTextureCoordinate(0, 3, new TexCoord2f(1f, 1f));
      } else {
        plane.setTextureCoordinate(0, 0, new TexCoord2f(0f, texCoordPoint.y));
        plane.setTextureCoordinate(0, 1, new TexCoord2f(0f, 0f));
        plane.setTextureCoordinate(0, 2, new TexCoord2f(texCoordPoint.x, 0f));
        plane.setTextureCoordinate(0, 3, new TexCoord2f(texCoordPoint.x, texCoordPoint.y));
      }

      return plane;
   }

4  Java Game APIs & Engines / Java 3D / Re: Java3d not totally dead on: 2012-01-28 20:06:38
Great!
I am writing a game with Java 3d V 1.5.2 at the moment and i experienced some problems with the "picking" stuff.
5  Java Game APIs & Engines / Java 3D / Java 3d Loaders on: 2012-01-28 20:05:30
Hi everybody,

i am implementing the game "Necromunda" (see Games Workshop Homepage) with Java 3d and the progress is fine so far.
BUT: i am using free 3d models which i load into my screne and there are only very few loaders which are any good at loading a model with textures. I had some success with some models in .3ds and .obj but most models will be loaded without textures.
I even tried a little modification of existing models with blender but most times i export the stuff as .obj or .3ds i can't load it into my scene so it is complete with textures and all vertices.

Now comes my question:
Do you know any good loaders?
Or a good way of exporting a model from blender so it can be loaded into Java 3d?

I tried the Raida loaders and a .3ds loader from a sourceforge project so far...
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.

CogWheelz (18 views)
2014-07-30 21:08:39

Riven (25 views)
2014-07-29 18:09:19

Riven (15 views)
2014-07-29 18:08:52

Dwinin (12 views)
2014-07-29 10:59:34

E.R. Fleming (33 views)
2014-07-29 03:07:13

E.R. Fleming (12 views)
2014-07-29 03:06:25

pw (43 views)
2014-07-24 01:59:36

Riven (43 views)
2014-07-23 21:16:32

Riven (30 views)
2014-07-23 21:07:15

Riven (31 views)
2014-07-23 20:56:16
List of Learning Resources
by SilverTiger
2014-07-31 18:29:50

List of Learning Resources
by SilverTiger
2014-07-31 18:26:06

List of Learning Resources
by SilverTiger
2014-07-31 13:54:12

HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54
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!