示例#1
0
 private void mouseToWorldCoord(
     int x,
     int y,
     int[] viewport,
     float[] proj,
     Load2Dfloat data,
     Tiledboard board,
     boolean heightctrl) {
   posx = (proj[1] - proj[0]) / viewport[2] * (x - viewport[0]) + proj[0];
   posy = (-proj[3] + proj[2]) / viewport[3] * (y - viewport[1]) + proj[3];
   System.out.println("light " + posx + " " + posy);
   // scene.setlightpos(0, (float)posx, (float)posy);
   double rad = Math.acos(posx / Math.sqrt(posx * posx + posy * posy));
   if (posy < 0) rad = 2 * Math.PI - rad;
   double r = Math.sqrt(32);
   scene.setlightpospolar(0, r, rad);
   scene.setlightdirectionrotate(rad);
   // 高さ自動調整
   // float heighttmp=0;
   // if(heightctrl)heighttmp = mouseToHeight(posx, posy, data, board);
   // scene.setLightCircleLookOutside(posx,posy,height+heighttmp,angle,1,1,scene.lightCount());
   posx = (double) x / viewport[2] * 2 * Math.PI;
   posx = 2 * Math.PI * 0.8;
   // scene.setLightCircleLookInside(posx, height);
 }
示例#2
0
 private double getdatafrombuffer(FloatBuffer fb, int index) {
   return Math.sqrt(Math.pow(fb.get(4 * index + 2), 2) + Math.pow(fb.get(4 * index + 3), 2))
       * 0.05;
 }