Hi Luis,

Just a very simple example of a rectangle which width you
can change dynamically using a slider:
 
 crds[ 0]=-500.0f;
 crds[ 1]=   0.0f;
 crds[ 2]=-300.0f;
 crds[ 3]= 500.0f;
 crds[ 4]=   0.0f;
 crds[ 5]=-300.0f;
 crds[ 6]=-500.0f;
 crds[ 7]=   0.0f;
 crds[ 8]= 300.0f;
 crds[ 9]= 500.0f;
 crds[10]=   0.0f;
 crds[11]= 300.0f;
 
 for(i=0;i<12;i+=3)
     {
     nrms[i  ]= 0.0f;
     nrms[i+1]=-1.0f;
     nrms[i+2]= 0.0f;
     }
 
 int strl[]=new int[1];
 strl[0]=4;
        
 rect=new TriangleStripArray(4,TriangleStripArray.COORDINATES|
     TriangleStripArray.NORMALS|
     TriangleStripArray.BY_REFERENCE,strl);
 rect.setCoordRefFloat(crds);
 rect.setNormalRefFloat(nrms);
 rect.setCapability(TriangleStripArray.ALLOW_REF_DATA_WRITE);
 
 app=new Appearance();
 ........
 shape=new Shape3D(window,app);
 
 ........
 ........
 
class SliderListener implements ChangeListener
 {
  public void stateChanged(ChangeEvent me)
     {
     JSlider source=(JSlider)me.getSource();
     if(source.getValueIsAdjusting())
       {
       value=(int)slider.getValue();//mind slider here is the name
                                              of the slider dialog
       rect.updateData(new GeometryUpdater()
         {
          public void updateData(Geometry window)
            {
            crds[0]=-value/2.0f;
            crds[6]=-value/2.0f;
            crds[3]= value/2.0f;
            crds[9]= value/2.0f;
            }
         });
       }
    }
 }   
 
Lots of fun with it,
 
Dirk
 
----- Original Message -----
From: Luis Endo
Sent: Tuesday, September 09, 2003 2:38 PM
Subject: [JAVA3D] Simple question - BY_REFERENCE

 
Hi,
 
I'm using BY_REFERENCE to update my objects shape and position. Every class that allows me to update object by reference has been deprecated. For example, in getCoordRef3f the javadoc says that I must use "geometry by-copy for Point3f arrays". I didn't understand that. Can anyone send me an example code with the non-deprecated way for doing this? Thanks in advance.
 
Luis. 
 
 



Desafio AntiZona: participe do jogo de perguntas e respostas que vai dar
1 Renault Clio, computadores, c�meras digitais, videogames e muito mais! =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".
=========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA3D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to