Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Topics - trisco

Pages: [1]
1
Support / Suggestion: calcmindistance
« on: November 29, 2009, 11:29:37 pm »
Wouldn't it be easy if the code for calcmindistance would return the distance and the object related to that distance? That would make picking much easier (and less lines of code)

Code: [Select]
public float calcMinDistance(SimpleVector paramSimpleVector1, SimpleVector paramSimpleVector2, float paramFloat)
  {
    Object3D localObject3D = null;
    float f1 = 3.4028235E+38F;
    for (int i = 2; i < this.objectList.size(); ++i)
    {
      localObject3D = this.objectList.elementAt(i);
      if ((!(localObject3D.isPotentialCollider)) || ((!(localObject3D.isMainWorld)) && (localObject3D.oneSectorOnly) && (Config.useFastCollisionDetection) && (localObject3D.hasBoundingBox) && (localObject3D.rayIntersectsAABB(paramSimpleVector1, paramSimpleVector2, true) >= paramFloat)))
        continue;
      float f2 = localObject3D.calcMinDistance(paramSimpleVector1, paramSimpleVector2, paramFloat);
      if (f2 >= f1)
        continue;
      f1 = f2; <- save object
    }    if (f1 != 3.4028235E+38F)
      return f1; <- return array of object and distance
    return 1.0E+012F;
  }

just a suggestion ofcourse

2
Support / compiled objects
« on: November 29, 2009, 06:07:03 pm »
Hey, me again, still doing modifications on that project. Hit a snatch though, whenever I compile an object Interact2d code will give problems (I need to compile the objects to use shaders btw)

For example, following code will still work:

Code: [Select]
//naar 3d coordinaten
    SimpleVector position = new SimpleVector(Interact2D.reproject2D3D(
            camera, buffer, x, y));
   
    //naar world space coordinaten
    position.matMul(camera.getBack().invert3x3());
    position.add(camera.getPosition());
   
    SimpleVector direction = position.calcSub(camera.getPosition()).normalize();
    float distance = world.calcMinDistance(position, direction, 10000);
   
    SimpleVector collisionPoint = new SimpleVector(direction);
    collisionPoint.scalarMul(distance);
    collisionPoint.add(position);
   
    if ((e.getModifiers() & InputEvent.BUTTON1_MASK) == InputEvent.BUTTON1_MASK)
    {
   
    if(distance != Object3D.COLLISION_NONE)
    {



It will report a collision, however, when I request the ID of the polygon that has been hit the result is null
Code: [Select]
position = new SimpleVector(Interact2D.reproject2D3D(
                camera, buffer, x, y));
        int[] is = Interact2D.pickPolygon(world.getVisibilityList(), position, Interact2D.EXCLUDE_NOT_SELECTABLE);
        int t = Interact2D.getObjectID(is);

Any idea what is going wrong?

3
Support / Re: Blox Builder
« on: November 20, 2009, 02:46:22 pm »
This thread is a split from here: http://www.jpct.net/forum2/index.php/topic,1462.0.html


- ATM I called getpixels in the main thead, aka:

Code: [Select]
public void init()
    {
    

        ........        
        new Thread(this).start();
    }

public void paint(Graphics g)
    {        
        super.paint(g);
        
        .....

       // render the world onto the buffer:
       world.renderScene(buffer);
       world.draw(buffer);
       buffer.update();
        ......

        buffer.getPixels();
        buffer.displayGLOnly();

        //output
        rendercanvas.repaint();
}

public void run()
    {
     while (loop)
        {
     if (mouseoverleftturn && mousedown)
         {    
         turnLeft();
         }
         else if (mouseoverrightturn && mousedown)
         {
         turnRight();
         }
    
            this.repaint();
            try
            {
                Thread.sleep(16);
            }
            catch(Exception e)
            {
                //Don't care...
            }
        }
    }

I assume I should move the getPixels() call out of the paint method and into another thread? If I do that, would it be synchronized with the update method of the buffer?

- It was more a general question, atm I load the 3DS file directly from the server, however the 3DS contains references to textures which don't seem to work. But the textures have to be bumpmapped anyway, so I guess I can't just use the loadobject method and expect it to work :). Will have to put some work in that one :D

4
Projects / Blox Builder
« on: November 20, 2009, 01:24:14 pm »
Hey all,

First of all, thanks for this great framework, I started the project in Java3D but quickly became frustrated. This framework made it all a lot easier.
Also thanks Paul for making all the examples, they helped a lot :).

Now, the project I made can be found on http://www.freedownloads.be/bloxsystemsapplet/test.html (temp link, you need a decent resolution to view the applet). It's for a manufacturer of modular stands (for expo's and stuff). You can build and texture stands, save them and order the materials right from the java applet.

It works alright but I have a few questions left:

- for the "request quote" functionality I would like to include a render of the world as an image, however when I call getPixels or getOutputBuffer on the FrameBuffer the entire program freezes. I use the opengl mode with enableGLCanvasRenderer.
- The 3DS file are stored in a mysql database blob field and sent on request to the builder. Can anyone give me any tips on how to load the 3DS file with textures in this way? I thought about making a zip of the 3DS file + textures, download it to the local PC, unzip and load from there. Sounds like a good plan?

Pages: [1]