3D raindrops

Standard

Here’s somewhat a 3D remake of the previous 2D version of the raindrop

Here are the codes

Since it’s in 3D it requires different libraries, from iGeo to load Rhino3D files, to a modified JBullet library as physics library.

It still uses PeasyCam though.

Advertisements

7 thoughts on “3D raindrops

  1. Dan

    Hello, great work! I was wondering if you could explain how you were able to use iGeo to import rhino files, yet also use peasycam to create your own GUI? Any help would be much appreciated!

    • Hi Dan, firstly I’d apologize if I remembered it incorrectly, since I coded this at least a year ago.

      Unfortunately, you can’t use IGeo and PeasyCam in tandem directly out of the box, Since IGeo supplants PeasyCam’s camera functionalities. What I did was:
      1. First load rhino file using IGeo, e.g. IG.open(“surface3.3dm”);

      2. Get the surfaces out of this IG object ( ISurface raw_surfaces = IG.surfaces(); )

      3. Here’s the complicated part, in my Surface class, I’m using this method: void generateMeshVertices( ISurface surf ), which I used to create a mesh (a list of IVec) from the ISurface object.

      4. This newly created mesh is used later on by OpenGL code to draw the mesh, and JBullet’s BvhTriangleMeshShape class to create a mesh surface with physics / collision detection capabilities.

      5. Since now it’s just normal OpenGL drawings, it’s completely controllable using PeasyCam !

      Try to download the code and play with it.

  2. Dan

    Thank you, I do have one quick question. I have almost got the code working after installing the jbullet library – but I get an error message saying “cannot convert from IVec to IGLTriangles” when this bit of code is run below (from void generateMeshVerticies). Any ideas?

    /* trim is a hole on a surface, spent 8 hours finding the math term for hole on a surface */
    surface_graph.initWithTrim();

    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    // ERROR HAPPENS HERE…
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
    IGLTriangles triangles = surface_graph.triangles;
    ///////////////////////////////////////////////////////////////////////////////////////////////////////////////

    IVec [] vertices = triangles.pts;
    mesh = new ArrayList();

    totalTriangles = triangles.triangleNum();
    totalVerts = vertices.length;

    for ( IVec vertex : vertices ) {
    maximum = Util.getMax( maximum, vertex );
    minimum = Util.getMin( minimum, vertex );
    mesh.add( vertex );
    }

    Many thanks for the help,
    Dan

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s