Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (475)
Games in Android Showcase (106)
games submitted by our members
Games in WIP (529)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Any Extrusion Library which can work with Xith  (Read 2162 times)
0 Members and 1 Guest are viewing this topic.
Offline khangharoth

Junior Member




There is more to life than JAVA...But Java Rocks


« Posted 2006-03-28 11:57:29 »

hi i want to  extrude 2D contour (polyline)  on a 3D path (polyline) .
Can i do this by using Xith ?
Any suggestions are welcome as i have tried my best on net and found one library written in C.


Thier is   "GLE Tubing and Extrusion Library" in C ,does anyone know its implementation in java which can run on Jogl .
 also ShapeShifter is a re-write of the GLE library in Java but it runs on magician so i think i have to understand the algorithm and write on top of Jogl.

Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #1 - Posted 2006-03-28 12:47:38 »

Interesting topic.

Can you post also the links to the mentioned projects?

Yuri

Yuri Vl. Gushchin
JProof Group
Offline khangharoth

Junior Member




There is more to life than JAVA...But Java Rocks


« Reply #2 - Posted 2006-03-28 12:55:23 »

Link for the C library is    http://linas.org/gle/
and its implementation on Java is ShapeShifter which you can download from  http://www.filegate.net/pdnjava/   file shapesh.zip.
but the problem is its based on Magician binding

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Zer Gut Shnitzel

Senior Newbie





« Reply #3 - Posted 2006-03-29 20:50:03 »

Try JGeom, it will allow you to play with NURBS representations you can do extrude as well I think they call it rail or something in this library, you will have to tesellate the NURBS geometry to Xith vertices/normals etc as I am not sure if JGeom have tesselation available.
Offline Yuri Vl. Gushchin

Senior Member




Speak Java!


« Reply #4 - Posted 2006-03-30 09:40:02 »

...or we try to add NURBS rendering to Xith3D... we will see what is possible.

Yuri

Yuri Vl. Gushchin
JProof Group
Offline Zer Gut Shnitzel

Senior Newbie





« Reply #5 - Posted 2006-03-31 09:33:10 »

JGeom has pretty good implementation of NURBS and Subdivision surfaces already, so on  Xith there should be a good and efficient tesselation implemented rather than reimplementing the NURBS, SUbdivs from scratch. Another interesting thing would be playing with mapping coordinates for this geometry. I am not sure if JGeom already has some of that stuff in there, I know they have a utility API that interfaces with Java3D but its licensed.
Offline khangharoth

Junior Member




There is more to life than JAVA...But Java Rocks


« Reply #6 - Posted 2006-04-03 08:15:21 »

will try it out...how about adding some base functionality in Xith .
        What i have in mind is to able to specify a  convex closed ploygon on a plane and depth upto which it should be extruded.
I have wriiten a small class for it ,please give your input to improve this.

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  
import javax.vecmath.Point3f;
import com.xith3d.scenegraph.GeometryArray;
import com.xith3d.scenegraph.Shape3D;
import com.xith3d.scenegraph.TriangleStripArray;

/**
 * @author ksingh2
 *
 */

public class GeometryExtruder extends Shape3D {

   private float extrusonLength;

   public GeometryExtruder(float length, Point3f[] coordsArray) {
      super();
      this.extrusonLength = length;
      int [b]numLayers [/b]= 8;
      float depthShift = -this.extrusonLength/numLayers;
      Point3f point;
      Point3f[] coords = new Point3f[1+numLayers*(2*coordsArray.length+1)];
      int counter = 0;
     
     
      for (int j = 0; j < numLayers; j++) {
         for (int i = 0; i < coordsArray.length; i++) {
            if(j==0){
            point = new Point3f(coordsArray[i]);
           
            coords[counter++] = point;
            }else{
               coords[counter++] =coords[(j-1)*(coordsArray.length*2+1)+i*2+1];
            }
           
            point = new Point3f(coordsArray[i].x, coordsArray[i].y,coordsArray[i].z + depthShift);  
           
            coords[counter++] = point;
         }
         coords[counter++] =coords[j*(coordsArray.length*2+1)];
         for(int i=0;i<coordsArray.length;i++){
            coordsArray[i].z= coordsArray[i].z+depthShift;
         }
      }
      coords[counter++]=coords[(numLayers-1)*(coordsArray.length*2+1)+1];
      TriangleStripArray qa = null;
      int flags = GeometryArray.COORDINATES;
      qa = new TriangleStripArray(coords.length, flags,
            new int[] { coords.length });
      qa.setCoordinates(0, coords);
      super.setGeometry(qa);
   }

}


It takes arguments :
1. Point3f[] coordsArray :vertices of convex polygon in  XY  Plane 
                                                                                 ex: To draw a extruded pentagon    Point  a=(0,0,0),
                                                                                                                                                Point  b=(3,0,0),
                                                                                                                                                Point  c=(4,2,0),
                                                                                                                                               Point  a=(0,4,0)
2. float length :length in Z axis upto which this pentagon should be extruded.

Variable numlength is just variable to specify in how many layers this pentagon should be extruded.
                                       

Offline khangharoth

Junior Member




There is more to life than JAVA...But Java Rocks


« Reply #7 - Posted 2006-04-04 14:32:22 »

Can anyone give me link to basic documentation about Splines ,Nerbs etc and how to use them .....
and code sample implementing them for creating geomerty willl be great.
I am totally new to these concepts ....
I tried myself on net but was not able to find basic working examples only theoritical discussions.thanks for the help

Offline Zer Gut Shnitzel

Senior Newbie





« Reply #8 - Posted 2006-04-05 07:46:21 »

Hi here is an idea how to do a NURB Spline with JGeom
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
private NurbsCurve nc;

// Create a Curve by defining some control points in space

CurveCreator cc = new CurveCreator(3);
cc.addControlPoint(new Point3f(0,0,0));
cc.addControlPoint(new Point3f(1,2,0));
cc.addControlPoint(new Point3f(2,0,0));
cc.addControlPoint(new Point3f(3,3,0));
     
nc = cc.getActual();


In order to draw your curve you need to extract some discrete information that you can use. Most of the time it will be points in space, same concept applies for NURBS surfaces you just have to be much smarter about selecting points on the surface. In this case we will go along the curve function (NURBS is parametrized from 0 to 1 so if you do a point on curve with 0.5 it will give you a point in space that cuts the curve in half (length wise).

1  
2  
3  
4  
for(float i = 0f; i < 1; i = i + lineQuality)
{
   Point3f currPt = nc.pointOnCurve(i);
}


If you put these points into array and then if you connect them with straight lines you will end up with an approximation of the curve (NURBS in this case) if you do a more detailed curve sampling you will end up with smoother representation.

Now if you want to do your own implementation of curves of any sort you can find a lot of information on the following site: http://www.realtimerendering.com/  under curves and surfaces section there is a bunch of links to different concepts, there must be some coding examples in there.

Hope that this helps a bit
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

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

The first screenshot will be displayed as a thumbnail.

ctomni231 (31 views)
2014-07-18 06:55:21

Zero Volt (27 views)
2014-07-17 23:47:54

danieldean (23 views)
2014-07-17 23:41:23

MustardPeter (24 views)
2014-07-16 23:30:00

Cero (39 views)
2014-07-16 00:42:17

Riven (41 views)
2014-07-14 18:02:53

OpenGLShaders (28 views)
2014-07-14 16:23:47

Riven (28 views)
2014-07-14 11:51:35

quew8 (25 views)
2014-07-13 13:57:52

SHC (61 views)
2014-07-12 17:50:04
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

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!