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.


Messages - Tornado7

Pages: 1 2 [3]
31
Support / Loading texture problem while using certificate
« on: June 04, 2004, 05:20:48 pm »
Hi Egon,

I’ve to improve my applet defining a config file where someone can decide what world or another object to load without handling java’s code… I’ve created a config file and I’ve added this code to my applet:
Code: [Select]

    String line;
    String worldValue;
    String tempFile;
    char checkStart;
    File f = null;
    BufferedReader br = null;
   
   
    public void init() {

   
       tempFile="ThreeDSim.cfg";
       f = new File(tempFile);
       
       try{
       
           br = new BufferedReader(new FileReader(f));
           
       }catch(FileNotFoundException fnfe){
        System.out.println("File not found...");        
        fnfe.printStackTrace();
       
        }
       
       try {
           while ((line = br.readLine()) != null) {

         if (line.length()>0) {
           checkStart = line.charAt(0);
   
                  if (checkStart != '*') {
                 
             if (line.startsWith("world")) {
               worldValue=line.substring(6);
                   }
                   
               }
     
           }

    }
   
       } catch (IOException e) {
    e.printStackTrace();
         }

.
.
.


Obviously, when I open my html page the applet doesn’t load because I’m trying to access a file in an applet context. So, I’ve defined a certificate to let the applet to access the file…. using the certificate I can now access the file and reading informations without problems…. But, the problem now is that no texture is visible in my applet (as you know, I’m loading texture one by one in this way:
Code: [Select]
texMan.addTexture("car1.jpg",new Texture(getDocumentBase(),"textures/car1.jpg"));). If is remove the certificate, textures become visible.... but I can’t access the file…. There’s an explanation for this behaviour?

Bye and thanks

32
Support / Interact2D behaviour
« on: May 21, 2004, 02:31:04 pm »
Don't worry....thanks  :D

33
Support / A javascript listening problem
« on: May 21, 2004, 02:30:09 pm »
Ok, it works, thanks a lot  :D

34
Support / A javascript listening problem
« on: May 20, 2004, 12:08:11 pm »
Hi, I hope this is my last problem….. After I’ve got the obj ID, I need to pass this value to a javascript that displays this value in the other side of my web page. So I’ve written the following code:
Code: [Select]


<html>
<head>
<title>ThreeDSim</title>
</head>
<body bgcolor="#000000" text="#FFFFFF" topmargin=0 rightmargin=0 leftmargin=0 marginheight=0 marginwidth=0>
<table>
<tr>
<td>&</td></tr>
<tr>
<td valign="middle" align="left">
<font size="5" face="arial">Road Accident Area</font><br>
<applet name="ThreeDSim"  code="ThreeDSimApplet" width="640" height="480"></applet>
<br>
</td></tr>
<tr>
<td>
 <script type="text/javascript">
    <!--
    var temp = document.applets[0].feritoID;
    document.writeln(temp);
   // -->
  </script>
</td>
</tr>
</table>
</body>
</html>


and it works…. The problem is that the javascript obviously reads the feritoID value just when it’s loaded instead I need that the javascript reads this value whenever I make a click on the applet and so, this value changes. Exist a way to perform this task?

Bye and thanks

35
Support / Interact2D behaviour
« on: May 20, 2004, 10:43:44 am »
Here the results:

theWorld.getObject(120)

returns: com.threed.jpct.Object3D@787c16
theWorld.getObject(120).getName()

returns: object122
I’ve loaded four separate 3ds objs: the first, the second and the third are the selecable objs the fourth is the rest of my world (it can be compared to your level in fps and it’s loaded exactly as is loaded your level). Objcect122 is the rest of my world. Whose is strange is that it behaves as jPCT consider it as a selectable obj, but I have not defined it as selectable.

Bye

36
Support / Interact2D behaviour
« on: May 19, 2004, 05:09:18 pm »
Did it, I’ve solved my problem: no more indesirable obj selection and one istance of the string returned when I select an obj.
The “120” is still here. It appears whenever I click on an obj that I haven’t defined as selectable (I’ve defined 3 selectable obj one that returns id 0, another that returns id 2 and the last that returns id 4, if I select every other obj, the returned value is 120). But, this isn’t a great problem for me because I’ve just to ignore this id using an if condition….. so, thanks another time for your help  :D

37
Support / Interact2D behaviour
« on: May 19, 2004, 02:54:11 pm »
Hi, I’m here again to waste your time… but I’ve another question. I’ve implemented the selection objects function, as I’ve wrote in some previous thread, and I’ve place, as you said,  the following code:

Code: [Select]

SimpleVector ray=Interact2D.reproject2D3D(camera, buffer, mouseX, mouseY);
                     int[] res=Interact2D.pickPolygon(theWorld.getVisibilityList(), ray);

                     if (res!=null) {
                         Object3D pickedObjs=theWorld.getObject(Interact2D.getObjectID(res));
                     }
                     
                     feritoID = Interact2D.getObjectID(res);
                     
                     System.out.println("ID: "+feritoID);


after:

Code: [Select]

 theWorld.renderScene(buffer);


When I run my applet and look in Java Console, I see that it repeats many times the string ID: 120 when I click in the applet on a non-selectable objs (I guess this code is a default code for non-selectable objs) or the string ID: with the selectable obj code. Why it repeats many times this string instead that just one time?
Second question: I need that this string appears on the java console just when I make a click on a obj; I’ve experimented that if I place the mouse’s arrow on the applet window and I use the keyboard keys to move in my scene, when the arrow passes on a selectable obj (without pressing a mouse’s button) appears the string ID: in the java console. Is it possible to prevent this behaviour making string appears just when I press a mouse button?

Bye and thanks a lot
 :)

38
Support / Using mouse in jPCT applet version
« on: May 19, 2004, 11:15:01 am »
No, I haven’t. I’ve implemented this morning, and now they works both. Thanks for your suggestions  :D

39
Support / Using mouse in jPCT applet version
« on: May 18, 2004, 12:02:04 pm »
I’ve tried both solutions: I’ve added  this.enableEvents(AWTEvent.MOUSE_EVENT_MASK); in init method, and I’ve tried the other solution:

I’ve implemented the MouseListener interface:

public class ThreeDSimApplet extends Applet implements Runnable, MouseListener

and I’ve added the required methods:

public void mouseClicked(MouseEvent event) {
   if (event.getButton()==MouseEvent.BUTTON1) {
        mouseX=event.getX();
             mouseY=event.getY();
         
             System.out.println(mouseX+" ," + mouseY);
   }
 }
 
 public void mousePressed(MouseEvent event) {
 }
 
 public void mouseReleased(MouseEvent event) {
 }
 
 public void mouseEntered(MouseEvent event) {
 }

 public void mouseExited(MouseEvent event) {
 }    

in both solution the mouse click now works but…… the keyboard events are disabled…… Is it possible to catch both events?

40
Support / Using mouse in jPCT applet version
« on: May 17, 2004, 11:46:42 am »
I’ve tried the this example following your code:

Code: [Select]

public void processMouseEvent(MouseEvent e) {
     super.processMouseEvent(e);
     if (e.getID()==MouseEvent.MOUSE_CLICKED) {
         System.out.println("I’m pressing the Mouse Click Button");
     }
  }


but, looking in Sun Java Console, nothing happens…. I’m becoming crazy
 :?

41
Support / Using mouse in jPCT applet version
« on: May 14, 2004, 12:02:03 pm »
Hi,

I’m experimenting on using mouse in my jPCT applet following, as trace, your way to map keys in your Bounce applet example; so I’ve initialized a variable:

private boolean click=false;

I’ve definited the following method:

public boolean mouseClick(Event e, int key) {
        ProcessKey(key,true);
        return (true);
 }

in ProcessKey I’ve added the following “case”:

case (MouseEvent.MOUSE_CLICKED):     {wire=event; break;}


where ‘wire’ is the the wireframe mode, here just as example. At last, I’ve added the following ‘if’ in the timer():

if (wire) {
                         wireframe=!wireframe;
                }

but, running the applet, nothing happens (using the 1 key, for example, the wireframe mode works, so the problem is just on the mouse event).
I’ve to add a mouse listener….. or something else?

Bye and thanks
 :)

42
Support / Selectable objects
« on: May 12, 2004, 05:08:42 pm »
Hi,

I’d want to have three selectable objs in my jpct’s scene applet and I need, when I do a mouse’s click on one of these, that some text appears, for example showing his id, on the applet area.
I’ve read the Selection Mode thread where you’ve posted the following code:

SimpleVector ray=Interact2D.reproject2D3D(camera, buffer, mouseX, mouseY);
int[] res=Interact2D.pickPolygon(theWorld.getVisibilityList(), ray);

if (res!=null) {
   Object3D pickedObj=theWorld.getObject(Interact2D.getObjectID(res));
}


I’ve made my objs selectable using the following code:

ferito1.setSelectable(ferito1.MOUSE_SELECTABLE); (where ferito1 is an Object3D).

First question: mouseX, mouseY should contain the x,y value of the mouse on the applet area; I guess I’ve to get these values, isn’t so? If it’s so, using which method?

Second question: pickedObj contains the obj that I’ve selected by a mouse’s click? If it’s so, using the method, getID(), I get this obj’s id?


Bye and thanks  :)

43
Support / Switching renderer in an applet context
« on: May 10, 2004, 07:05:16 pm »
Thank you very much for your help.... I'd have two another little questions; If I decide to use only sw renderer I'll have not, in theory, any compatibility problem?

I've a problem mapping keys to event.... In fps example, using the following code:

case (KeyEvent.VK_X): { // change renderer  (x)
            if (event) {
               switchMode=35;
            }
         break;
}

you've mapped the x small key to the "event" changing renderer; I've use a similar code to use the q small key to rotate the camera in my applet, but, running the applet, it only works if use the capital q (Q) and I don't understand why......

Bye and thanks again

44
Support / Switching renderer in an applet context
« on: May 10, 2004, 04:36:53 pm »
Hi,

Is possible to use the fps’s switching renderer option in a applet context? If it’s so, in which way I can fit the dos command line:

java -Djava.library.path=..\..\lib\lwjgl-0.8\ -cp ..\..\lib\lwjgl-0.8\lwjgl.jar;fps.jar -Xmx100000000 JPCTDemo

into the “html code” that loads the applet?

Bye and thanks for any answers
 :)

45
Support / Problem importing 3ds files into applet
« on: April 29, 2004, 12:02:17 pm »
Hi all,

I'm using jPCT to create an University 3d simulation for medical porpouse; I've created a world using Maya and I've converted the Maya's file into a 3DS file using FBX Converter.
When I load the 3DS file using an stand-alone application, such as FPS, the file is loaded without any problem; Problems occur when I try to load the 3DS scene in a applet, such as Bounce; in fact the Sun Java Console shows the following message:

[ Thu Apr 29 11:20:24 CEST 2004 ] - ERROR: Couldn't read file 3ds\prova.3ds
[ Thu Apr 29 11:20:24 CEST 2004 ] - ERROR: Not a valid 3DS file!
Created 0 triangle-strips for object2 in 1 pass(es)
[ Thu Apr 29 11:20:24 CEST 2004 ] - ERROR: Couldn't build() object! Check if the object is assigned to a world and if the TextureManager has all required textures loaded.

Do you have any explaination about this behaviour? Is it possible that 3DS files don't fit in a web application? If it's so, what other file format should I try? Thanks for any help  :)

Pages: 1 2 [3]