home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 1996 June / PCPRO_696.ISO / plugins / wirl3d / data.1 / VRCObject.class (.txt) < prev    next >
Encoding:
Java Class File  |  1996-03-04  |  4.9 KB  |  231 lines

  1. class VRCObject extends VRCBase implements Runnable {
  2.    public String Name = new String();
  3.    // $FF: renamed from: id int
  4.    public int field_0;
  5.    private boolean active;
  6.    private boolean KeepRunning;
  7.    public float[] fPosVal = new float[3];
  8.    public float[] fTranVal = new float[3];
  9.    public float[] fRotVal = new float[6];
  10.    public int[] rgb = new int[3];
  11.    private static String VRML = new String("VRML");
  12.    public String sCoord = new String();
  13.  
  14.    public VRCObject(String sName, int iActiveWnd) {
  15.       super.ActiveHWND = iActiveWnd;
  16.       this.Name = sName;
  17.       this.getPtr();
  18.    }
  19.  
  20.    public VRCObject() {
  21.       this.active = true;
  22.    }
  23.  
  24.    public void run() {
  25.       this.KeepRunning = true;
  26.  
  27.       while(this.KeepRunning) {
  28.       }
  29.  
  30.    }
  31.  
  32.    public void setName(String sName) {
  33.       this.Name = sName;
  34.       this.getPtr();
  35.    }
  36.  
  37.    public int getPtr() {
  38.       char[] szName = new char[20];
  39.       this.Name.getChars(0, this.Name.length(), szName, 0);
  40.       this.field_0 = ((VRCBase)this).VRCObjectGetPtr(super.ActiveHWND, szName);
  41.       if (this.field_0 > 0) {
  42.          this.active = true;
  43.       }
  44.  
  45.       return this.field_0;
  46.    }
  47.  
  48.    public int Init(int iObj, int iWind) {
  49.       this.field_0 = iObj;
  50.       super.ActiveHWND = iWind;
  51.       char[] szName = new char[20];
  52.       ((VRCBase)this).Java_VRCGetName(this.field_0, szName);
  53.       this.Name = new String(szName);
  54.       return 1;
  55.    }
  56.  
  57.    public void deactivate() {
  58.       this.active = false;
  59.       this.KeepRunning = false;
  60.    }
  61.  
  62.    public void destroy() {
  63.       this.active = false;
  64.       this.KeepRunning = false;
  65.    }
  66.  
  67.    public void setColor(int[] lrgb) {
  68.       if (this.active) {
  69.          ((VRCBase)this).Java_VRCObjectSetColor(super.ActiveHWND, this.field_0, VRCBase.VRC_ATTR_COLOR, lrgb);
  70.       }
  71.  
  72.       this.getColor();
  73.    }
  74.  
  75.    public void getColor() {
  76.       if (this.active) {
  77.          ((VRCBase)this).Java_VRCObjectGetColor(super.ActiveHWND, this.field_0, VRCBase.VRC_ATTR_COLOR, this.rgb);
  78.       }
  79.  
  80.    }
  81.  
  82.    public void convertToVRMLPosCoords(float[] fPosTemp) {
  83.       this.fPosVal[0] = fPosTemp[0];
  84.       this.fPosVal[1] = fPosTemp[2];
  85.       this.fPosVal[2] = -fPosTemp[1];
  86.    }
  87.  
  88.    public void convertFromVRMLPosCoords(float[] fPosTemp) {
  89.       fPosTemp[0] = this.fPosVal[0];
  90.       fPosTemp[1] = -this.fPosVal[2];
  91.       fPosTemp[2] = this.fPosVal[1];
  92.    }
  93.  
  94.    public void convertFromVRMLRotCoords(float[] fRotTemp) {
  95.       fRotTemp[0] = this.fRotVal[0];
  96.       fRotTemp[1] = -this.fRotVal[2];
  97.       fRotTemp[2] = this.fRotVal[1];
  98.       fRotTemp[3] = this.fRotVal[3];
  99.       fRotTemp[4] = this.fRotVal[4];
  100.       fRotTemp[5] = -this.fRotVal[5];
  101.    }
  102.  
  103.    public void convertToVRMLRotCoords(float[] fRotTemp) {
  104.       this.fRotVal[0] = fRotTemp[0];
  105.       this.fRotVal[1] = fRotTemp[2];
  106.       this.fRotVal[2] = -fRotTemp[1];
  107.       this.fRotVal[3] = fRotTemp[3];
  108.       this.fRotVal[4] = fRotTemp[4];
  109.       this.fRotVal[5] = -fRotTemp[5];
  110.    }
  111.  
  112.    public void convertFromRelVRMLRotCoords(float[] fRotTemp) {
  113.       fRotTemp[0] = this.fRotVal[0];
  114.       fRotTemp[1] = -this.fRotVal[2];
  115.       fRotTemp[2] = this.fRotVal[1];
  116.       fRotTemp[3] = this.fRotVal[3];
  117.       fRotTemp[4] = -this.fRotVal[5];
  118.       fRotTemp[5] = this.fRotVal[4];
  119.    }
  120.  
  121.    public void getPosition() {
  122.       float[] fPosTemp = new float[3];
  123.       if (this.active) {
  124.          ((VRCBase)this).Java_VRCObjectGetPosition(super.ActiveHWND, this.field_0, VRCBase.VRC_ATTR_POSITION, fPosTemp);
  125.       }
  126.  
  127.       this.convertToVRMLPosCoords(fPosTemp);
  128.    }
  129.  
  130.    public void getRotation() {
  131.       float[] fRotTemp = new float[6];
  132.       if (this.active) {
  133.          ((VRCBase)this).Java_VRCObjectGetRotation(super.ActiveHWND, this.field_0, VRCBase.VRC_ATTR_ROTATION, fRotTemp);
  134.       }
  135.  
  136.       this.convertToVRMLRotCoords(fRotTemp);
  137.    }
  138.  
  139.    public void getPositionRel(int l, int m) {
  140.       float[] fPosTemp = new float[3];
  141.       if (this.active) {
  142.          ((VRCBase)this).Java_VRCObjectGetPositionRel(l, m, fPosTemp);
  143.       }
  144.  
  145.       this.convertToVRMLPosCoords(fPosTemp);
  146.    }
  147.  
  148.    public void RotateRel(float[] fRotTemp) {
  149.       float[] fRotTemp1 = new float[6];
  150.       fRotTemp1[0] = fRotTemp[0];
  151.       fRotTemp1[1] = fRotTemp[1];
  152.       fRotTemp1[2] = fRotTemp[2];
  153.       fRotTemp1[3] = fRotTemp[3];
  154.       fRotTemp1[4] = fRotTemp[4];
  155.       fRotTemp1[5] = fRotTemp[5];
  156.       this.fRotVal[0] = fRotTemp1[0];
  157.       this.fRotVal[1] = fRotTemp1[1];
  158.       this.fRotVal[2] = fRotTemp1[2];
  159.       this.fRotVal[3] = fRotTemp1[3];
  160.       this.fRotVal[4] = fRotTemp1[4];
  161.       this.fRotVal[5] = fRotTemp1[5];
  162.       this.convertFromRelVRMLRotCoords(fRotTemp1);
  163.       if (this.active) {
  164.          ((VRCBase)this).Java_VRCObjectRotateRel2(super.ActiveHWND, this.field_0, fRotTemp1);
  165.       }
  166.  
  167.    }
  168.  
  169.    public void Rotate(int x, int y, int z, int delta_x, int delta_y) {
  170.       if (this.active) {
  171.          ((VRCBase)this).VRCObjectRotateRel2D(super.ActiveHWND, this.field_0, delta_x, delta_y, x, y, z);
  172.       }
  173.  
  174.       if (this.active) {
  175.          ((VRCBase)this).VRCObjectRotateRel2D(super.ActiveHWND, this.field_0, 0, 0, 1, 1, 1);
  176.       }
  177.  
  178.    }
  179.  
  180.    public void Spin(float[] fRotTemp) {
  181.       float[] fRotTemp1 = new float[6];
  182.       fRotTemp1[0] = fRotTemp[0];
  183.       fRotTemp1[1] = fRotTemp[1];
  184.       fRotTemp1[2] = fRotTemp[2];
  185.       fRotTemp1[3] = fRotTemp[3];
  186.       fRotTemp1[4] = fRotTemp[4];
  187.       fRotTemp1[5] = fRotTemp[5];
  188.       this.fRotVal[0] = fRotTemp1[0];
  189.       this.fRotVal[1] = fRotTemp1[1];
  190.       this.fRotVal[2] = fRotTemp1[2];
  191.       this.fRotVal[3] = fRotTemp1[3];
  192.       this.fRotVal[4] = fRotTemp1[4];
  193.       this.fRotVal[5] = fRotTemp1[5];
  194.       this.convertFromRelVRMLRotCoords(fRotTemp1);
  195.       if (this.active) {
  196.          ((VRCBase)this).Java_VRCObjectRotateRel(super.ActiveHWND, this.field_0, fRotTemp);
  197.       }
  198.  
  199.    }
  200.  
  201.    public void Translate(float[] fPosTemp) {
  202.       float[] fPosTemp1 = new float[3];
  203.       fPosTemp1[0] = fPosTemp[0];
  204.       fPosTemp1[1] = fPosTemp[1];
  205.       fPosTemp1[2] = fPosTemp[2];
  206.       this.fPosVal[0] = fPosTemp[0];
  207.       this.fPosVal[1] = fPosTemp[1];
  208.       this.fPosVal[2] = fPosTemp[2];
  209.       this.convertFromVRMLPosCoords(fPosTemp);
  210.       if (this.active) {
  211.          ((VRCBase)this).Java_VRCObjectTranslate(super.ActiveHWND, this.field_0, fPosTemp);
  212.       }
  213.  
  214.    }
  215.  
  216.    public void TranslateRel(float[] fPosTemp) {
  217.       float[] fPosTemp1 = new float[3];
  218.       fPosTemp1[0] = fPosTemp[0];
  219.       fPosTemp1[1] = fPosTemp[1];
  220.       fPosTemp1[2] = fPosTemp[2];
  221.       this.fPosVal[0] = fPosTemp[0];
  222.       this.fPosVal[1] = fPosTemp[1];
  223.       this.fPosVal[2] = fPosTemp[2];
  224.       this.convertFromVRMLPosCoords(fPosTemp1);
  225.       if (this.active) {
  226.          ((VRCBase)this).Java_VRCObjectTranslateRel(super.ActiveHWND, this.field_0, fPosTemp1);
  227.       }
  228.  
  229.    }
  230. }
  231.