| .. | .. | 
|---|
| 392 | 392 |          if (CameraPane.ROTATECAMERA) | 
|---|
| 393 | 393 |          { | 
|---|
| 394 | 394 |              double[][] rotate = { { 0,1,0,0 }, { -1,0,0,0}, { 0,0,1,0}, { 0,0,0,1 } }; | 
|---|
| 395 |  | -            double[][] rotate_1 = { { 0,-1,0,0 }, { 1,0,0,0}, { 0,0,1,0}, { 0,0,0,1 } };  | 
|---|
 | 395 | +            //double[][] rotate_1 = { { 0,-1,0,0 }, { 1,0,0,0}, { 0,0,1,0}, { 0,0,0,1 } };  | 
|---|
| 396 | 396 |           | 
|---|
| 397 |  | -            LA.matConcat(rotate, fromScreen, fromScreen);  | 
|---|
| 398 |  | -            LA.matConcat(toScreen, rotate_1, toScreen);  | 
|---|
 | 397 | +            LA.matConcat(fromScreen, rotate, fromScreen);  | 
|---|
 | 398 | +            //LA.matConcat(toScreen, rotate_1, toScreen);  | 
|---|
| 399 | 399 |          } | 
|---|
| 400 | 400 |  		//if (this == CameraPane.lightCamera) | 
|---|
| 401 | 401 |  			//CameraPane.lighttouched = true; | 
|---|
 | 402 | +          | 
|---|
 | 403 | +        LA.matInvert(fromScreen, toScreen);  | 
|---|
| 402 | 404 |      } | 
|---|
| 403 | 405 |   | 
|---|
| 404 | 406 |  //    void Draw(CameraPane display, Object3D /*Composite*/ root, boolean selected) | 
|---|
 
| .. | .. | 
|---|
| 306 | 306 |   | 
|---|
| 307 | 307 |          } | 
|---|
| 308 | 308 |   | 
|---|
 | 309 | +        GrafreeD.Assert(Math.abs(src[0][3]) <= 1E-15);  | 
|---|
 | 310 | +        GrafreeD.Assert(Math.abs(src[1][3]) <= 1E-15);  | 
|---|
 | 311 | +        GrafreeD.Assert(Math.abs(src[2][3]) <= 1E-15);  | 
|---|
 | 312 | +        GrafreeD.Assert(Math.abs(src[3][3] - 1) <= 1E-15);  | 
|---|
 | 313 | +        GrafreeD.Assert(Math.abs(dst[0][3]) <= 1E-15);  | 
|---|
 | 314 | +        GrafreeD.Assert(Math.abs(dst[1][3]) <= 1E-15);  | 
|---|
 | 315 | +        GrafreeD.Assert(Math.abs(dst[2][3]) <= 1E-15);  | 
|---|
 | 316 | +        GrafreeD.Assert(Math.abs(dst[3][3] - 1) <= 1E-15);  | 
|---|
| 309 | 317 |      } | 
|---|
| 310 | 318 |   | 
|---|
| 311 | 319 |      static double toRadians(double degrees) | 
|---|
| .. | .. | 
|---|
| 321 | 329 |           | 
|---|
| 322 | 330 |          for (int j = 0; j < 4; j++) | 
|---|
| 323 | 331 |          { | 
|---|
| 324 |  | -            double[] leftj = left[j];  | 
|---|
 | 332 | +            double[] rightj = right[j];  | 
|---|
| 325 | 333 |              double[] concat = concatTemp[j]; | 
|---|
| 326 | 334 |              for (int i = 0; i < 4; i++) | 
|---|
| 327 | 335 |              { | 
|---|
| 328 | 336 |                  concat[i] = 0; | 
|---|
| 329 | 337 |                  for (int k = 0; k < 4; k++) | 
|---|
| 330 | 338 |                  { | 
|---|
| 331 |  | -                    concat[i] += leftj[k] * right[k][i];  | 
|---|
 | 339 | +                    concat[i] += left[k][i] * rightj[k];  | 
|---|
| 332 | 340 |                  } | 
|---|
| 333 | 341 |              } | 
|---|
| 334 | 342 |          } | 
|---|
| .. | .. | 
|---|
| 345 | 353 |          //xlateTemp[0][3] = dx; | 
|---|
| 346 | 354 |          //xlateTemp[1][3] = dy; | 
|---|
| 347 | 355 |          //xlateTemp[2][3] = dz; | 
|---|
| 348 |  | -        matConcat(mat, xlateTemp, mat);  | 
|---|
 | 356 | +        matConcat(xlateTemp, mat, mat);  | 
|---|
| 349 | 357 |      } | 
|---|
| 350 | 358 |   | 
|---|
| 351 | 359 |      static void matHomogene(double mat[][], double dx, double dy, double dz) | 
|---|
| .. | .. | 
|---|
| 357 | 365 |          //xlateTemp[0][3] = dx; | 
|---|
| 358 | 366 |          //xlateTemp[1][3] = dy; | 
|---|
| 359 | 367 |          //xlateTemp[2][3] = dz; | 
|---|
| 360 |  | -        matConcat(mat, xlateTemp, mat);  | 
|---|
 | 368 | +        matConcat(xlateTemp, mat, mat);  | 
|---|
| 361 | 369 |      } | 
|---|
| 362 | 370 |   | 
|---|
| 363 | 371 |      static void matTranslateInv(double mat[][], double dx, double dy, double dz) | 
|---|
| .. | .. | 
|---|
| 369 | 377 |          //xlateTemp[0][3] = dx; | 
|---|
| 370 | 378 |          //xlateTemp[1][3] = dy; | 
|---|
| 371 | 379 |          //xlateTemp[2][3] = dz; | 
|---|
| 372 |  | -        matConcat(xlateTemp, mat, mat);  | 
|---|
 | 380 | +        matConcat(mat, xlateTemp, mat);  | 
|---|
| 373 | 381 |      } | 
|---|
| 374 | 382 |   | 
|---|
| 375 | 383 |      static void matScale(double mat[][], double sx, double sy, double sz) | 
|---|
| .. | .. | 
|---|
| 378 | 386 |          xlateTemp[0][0] = sx; | 
|---|
| 379 | 387 |          xlateTemp[1][1] = sy; | 
|---|
| 380 | 388 |          xlateTemp[2][2] = sz; | 
|---|
| 381 |  | -        matConcat(mat, xlateTemp, mat);  | 
|---|
 | 389 | +        matConcat(xlateTemp, mat, mat);  | 
|---|
 | 390 | +        //matConcat(mat, xlateTemp, mat);  | 
|---|
| 382 | 391 |      } | 
|---|
| 383 | 392 |   | 
|---|
| 384 | 393 |      static void matXRotate(double mat[][], double radians) | 
|---|
| .. | .. | 
|---|
| 387 | 396 |          rotTemp[1][1] = rotTemp[2][2] = (double) Math.cos(radians); | 
|---|
| 388 | 397 |          rotTemp[2][1] = -(rotTemp[1][2] = (double) Math.sin(radians)); | 
|---|
| 389 | 398 |     //     if (CameraPane.LOCALTRANSFORM) | 
|---|
| 390 |  | -   //         matConcat(rotTemp, mat, mat);  | 
|---|
 | 399 | +            matConcat(rotTemp, mat, mat);  | 
|---|
| 391 | 400 |     //     else | 
|---|
| 392 |  | -            matConcat(mat, rotTemp, mat);  | 
|---|
 | 401 | +   //         matConcat(mat, rotTemp, mat);  | 
|---|
| 393 | 402 |      } | 
|---|
| 394 | 403 |   | 
|---|
| 395 | 404 |      static void matYRotate(double mat[][], double radians) | 
|---|
| .. | .. | 
|---|
| 398 | 407 |          rotTemp[0][0] = rotTemp[2][2] = (double) Math.cos(-radians); | 
|---|
| 399 | 408 |          rotTemp[2][0] = -(rotTemp[0][2] = (double) Math.sin(-radians)); | 
|---|
| 400 | 409 |     //     if (CameraPane.LOCALTRANSFORM) | 
|---|
| 401 |  | -   //         matConcat(rotTemp, mat, mat);  | 
|---|
 | 410 | +            matConcat(rotTemp, mat, mat);  | 
|---|
| 402 | 411 |     //     else | 
|---|
| 403 |  | -            matConcat(mat, rotTemp, mat);  | 
|---|
 | 412 | +   //         matConcat(mat, rotTemp, mat);  | 
|---|
| 404 | 413 |      } | 
|---|
| 405 | 414 |   | 
|---|
| 406 | 415 |      static void matZRotate(double mat[][], double radians) | 
|---|
| .. | .. | 
|---|
| 409 | 418 |          rotTemp[0][0] = rotTemp[1][1] = (double) Math.cos(radians); | 
|---|
| 410 | 419 |          rotTemp[1][0] = -(rotTemp[0][1] = (double) Math.sin(radians)); | 
|---|
| 411 | 420 |     //     if (CameraPane.LOCALTRANSFORM) | 
|---|
| 412 |  | -   //         matConcat(rotTemp, mat, mat);  | 
|---|
 | 421 | +            matConcat(rotTemp, mat, mat);  | 
|---|
| 413 | 422 |     //     else | 
|---|
| 414 |  | -            matConcat(mat, rotTemp, mat);  | 
|---|
 | 423 | +   //         matConcat(mat, rotTemp, mat);  | 
|---|
| 415 | 424 |      } | 
|---|
| 416 | 425 |   | 
|---|
| 417 | 426 |      // Project A onto B | 
|---|
 
| .. | .. | 
|---|
| 29 | 29 |   | 
|---|
| 30 | 30 |      void Fade() | 
|---|
| 31 | 31 |      { | 
|---|
| 32 |  | -        if (true) // currentbones == null || CameraPane.fullreset)  | 
|---|
 | 32 | +        if (currentbones == null || CameraPane.fullreset)  | 
|---|
| 33 | 33 |              return; | 
|---|
| 34 | 34 |           | 
|---|
| 35 | 35 |          cVector temp = new cVector(); | 
|---|
| .. | .. | 
|---|
| 107 | 107 |                          //data[f3 + i] += pos[i] - data[frame3 + i]; | 
|---|
| 108 | 108 |  //                                data[f3 + i] = k*data[f3+i] + (1-k)* | 
|---|
| 109 | 109 |  //                                        currentbones[boneframe3 + i-end]; | 
|---|
| 110 |  | -                        data[f3 + i] = (float)CurveAngle(data[f3+i], currenthip[i], 1-k);  | 
|---|
 | 110 | +//                        data[f3 + i] = (float)CurveAngle(data[f3+i], currenthip[i], 1-k);  | 
|---|
| 111 | 111 |                      } | 
|---|
| 112 | 112 |                       | 
|---|
| 113 | 113 |                      // TODO: translation | 
|---|
| .. | .. | 
|---|
| 225 | 225 |      // before resetting the mocap data. | 
|---|
| 226 | 226 |      void SetGlobalTransform() | 
|---|
| 227 | 227 |      { | 
|---|
| 228 |  | -        SetCurrentBones(frame);  | 
|---|
 | 228 | +        //SetCurrentBones(frame);  | 
|---|
| 229 | 229 |           | 
|---|
| 230 | 230 |          cVector temp = new cVector(); | 
|---|
| 231 | 231 |          cVector pos = new cVector(); | 
|---|
| .. | .. | 
|---|
| 235 | 235 |          double angleYhip = 0; | 
|---|
| 236 | 236 |           | 
|---|
| 237 | 237 |          Object3D hip = get(0); | 
|---|
 | 238 | +          | 
|---|
 | 239 | +        if (hip.get(0).toParent == null)  | 
|---|
 | 240 | +        {  | 
|---|
 | 241 | +            hip.get(0).toParent = LA.newMatrix();  | 
|---|
 | 242 | +            hip.get(0).fromParent = LA.newMatrix();  | 
|---|
 | 243 | +        }  | 
|---|
| 238 | 244 |           | 
|---|
| 239 | 245 |          LA.matConcat(toParent, hip.get(0).toParent, matrix); | 
|---|
| 240 | 246 |          poship.x = matrix[3][0]; | 
|---|
| .. | .. | 
|---|
| 3020 | 3026 |          } | 
|---|
| 3021 | 3027 |      } | 
|---|
| 3022 | 3028 |       | 
|---|
| 3023 |  | -    static int offset = 1; // 5; // 10; // 5; // 100; // skip initial "T"  | 
|---|
 | 3029 | +    // skip initial "T"  | 
|---|
 | 3030 | +    static int offset = 1; // 5; // 10; // 5; // 100;  | 
|---|
| 3024 | 3031 |       | 
|---|
| 3025 | 3032 |      void ReadBVH() | 
|---|
| 3026 | 3033 |      { | 
|---|
| .. | .. | 
|---|
| 3132 | 3139 |          baseframe += step; | 
|---|
| 3133 | 3140 |           | 
|---|
| 3134 | 3141 |          //frame = baseframe; | 
|---|
| 3135 |  | -        frame += step;  | 
|---|
 | 3142 | +        //frame += step;  | 
|---|
| 3136 | 3143 |           | 
|---|
| 3137 | 3144 |  //        if (frame != baseframe) | 
|---|
| 3138 | 3145 |  //        { | 
|---|
| .. | .. | 
|---|
| 3184 | 3191 |                      } | 
|---|
| 3185 | 3192 |                  } | 
|---|
| 3186 | 3193 |              } | 
|---|
 | 3194 | +              | 
|---|
 | 3195 | +            frame = GetFirstFrame();  | 
|---|
| 3187 | 3196 |          } | 
|---|
 | 3197 | +        else  | 
|---|
 | 3198 | +            frame += step;  | 
|---|
| 3188 | 3199 |           | 
|---|
| 3189 | 3200 |   //SetPositionDelta(false); | 
|---|
| 3190 | 3201 |               | 
|---|
| 3191 |  | -        if (frame >= bvh.animation.getNumFrames())  | 
|---|
| 3192 |  | -            //baseframe =  | 
|---|
| 3193 |  | -                    frame = GetFirstFrame(); // 0; // offset; // initial point  | 
|---|
 | 3202 | +//        if (frame >= bvh.animation.getNumFrames())  | 
|---|
 | 3203 | +//            //baseframe =  | 
|---|
 | 3204 | +//                    frame = GetFirstFrame(); // 0; // offset; // initial point  | 
|---|
| 3194 | 3205 |           | 
|---|
| 3195 | 3206 |          //System.err.println("frame = " + frame); | 
|---|
| 3196 | 3207 |          if (lastframe != 0) | 
|---|
 
| .. | .. | 
|---|
| 2194 | 2194 |              { | 
|---|
| 2195 | 2195 |                  Mocap sel = (Mocap) copy.selection.get(0); | 
|---|
| 2196 | 2196 |   | 
|---|
 | 2197 | +                sel.SetCurrentBones(sel.frame);  | 
|---|
 | 2198 | +              | 
|---|
| 2197 | 2199 |                  sel.fullname = fullname; | 
|---|
| 2198 | 2200 |   | 
|---|
| 2199 | 2201 |                  if (changename) | 
|---|
| .. | .. | 
|---|
| 2245 | 2247 |          { | 
|---|
| 2246 | 2248 |              Mocap sel = (Mocap) select; | 
|---|
| 2247 | 2249 |   | 
|---|
 | 2250 | +            sel.SetCurrentBones(sel.frame);  | 
|---|
 | 2251 | +              | 
|---|
| 2248 | 2252 |              File file = new File(fullname); | 
|---|
| 2249 | 2253 |   | 
|---|
| 2250 | 2254 |              //       Mocap mocap = new Mocap("Mocap" + file.getName()); | 
|---|