Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 | 1x 91x 91x 91x 91x 1x 91x 91x 91x 91x 1926x 1926x 1926x 1926x 1926x 1926x 1740x 1740x 1926x 1926x 1926x 1926x 1926x 1926x 1926x 1926x 1926x 1926x 1926x 1926x 1926x | import macro from '@kitware/vtk.js/macros'; import vtkCamera from '@kitware/vtk.js/Rendering/Core/Camera'; import vtkMath from '@kitware/vtk.js/Common/Core/Math'; import { vec3, mat4 } from 'gl-matrix'; import type { vtkObject } from '@kitware/vtk.js/interfaces'; // Copied from VTKCamera /** * */ interface ICameraInitialValues { position?: number[]; focalPoint?: number[]; viewUp?: number[]; directionOfProjection?: number[]; parallelProjection?: boolean; useHorizontalViewAngle?: boolean; viewAngle?: number; parallelScale?: number; clippingRange?: number[]; windowCenter?: number[]; viewPlaneNormal?: number[]; useOffAxisProjection?: boolean; screenBottomLeft?: number[]; screenBottomRight?: number[]; screenTopRight?: number[]; freezeFocalPoint?: boolean; physicalTranslation?: number[]; physicalScale?: number; physicalViewUp?: number[]; physicalViewNorth?: number[]; } export interface vtkSlabCamera extends vtkObject { /** * Apply a transform to the camera. * The camera position, focal-point, and view-up are re-calculated * using the transform's matrix to multiply the old points by the new transform. * @param transformMat4 - */ applyTransform(transformMat4: mat4): void; /** * Rotate the camera about the view up vector centered at the focal point. * @param angle - */ azimuth(angle: number): void; /** * * @param bounds - */ computeClippingRange(bounds: number[]): number[]; /** * This method must be called when the focal point or camera position changes */ computeDistance(): void; /** * the provided matrix should include * translation and orientation only * mat is physical to view * @param mat - */ computeViewParametersFromPhysicalMatrix(mat: mat4): void; /** * * @param vmat - */ computeViewParametersFromViewMatrix(vmat: mat4): void; /** * Not implemented yet * @param sourceCamera - */ deepCopy(sourceCamera: vtkSlabCamera): void; /** * Move the position of the camera along the view plane normal. Moving * towards the focal point (e.g., greater than 1) is a dolly-in, moving away * from the focal point (e.g., less than 1) is a dolly-out. * @param amount - */ dolly(amount: number): void; /** * Rotate the camera about the cross product of the negative of the direction of projection and the view up vector, using the focal point as the center of rotation. * @param angle - */ elevation(angle: number): void; /** * Not implemented yet */ getCameraLightTransformMatrix(): void; /** * * @defaultValue [0.01, 1000.01], */ getClippingRange(): number[]; /** * * @defaultValue [0.01, 1000.01], */ getClippingRangeByReference(): number[]; /** * * @param aspect - Camera frustum aspect ratio. * @param nearz - Camera frustum near plane. * @param farz - Camera frustum far plane. */ getCompositeProjectionMatrix( aspect: number, nearz: number, farz: number ): mat4; /** * Get the vector in the direction from the camera position to the focal point. * @defaultValue [0, 0, -1], */ getDirectionOfProjection(): number[]; /** * * @defaultValue [0, 0, -1], */ getDirectionOfProjectionByReference(): number[]; /** * Get the distance from the camera position to the focal point. */ getDistance(): number; /** * * @defaultValue [0, 0, 0] */ getFocalPoint(): number[]; /** * */ getFocalPointByReference(): number[]; /** * * @defaultValue false */ getFreezeFocalPoint(): boolean; setFreezeFocalPoint(freeze: boolean): void; /** * Not implemented yet * @param aspect - Camera frustum aspect ratio. */ getFrustumPlanes(aspect: number): void; /** * Not implemented yet */ getOrientation(): void; /** * Not implemented yet */ getOrientationWXYZ(): void; /** * * @defaultValue false */ getParallelProjection(): boolean; /** * * @defaultValue 1 */ getParallelScale(): number; /** * * @defaultValue 1.0 */ getPhysicalScale(): number; /** * * @param result - */ getPhysicalToWorldMatrix(result: mat4): void; /** * */ getPhysicalTranslation(): number[]; /** * */ getPhysicalTranslationByReference(): number[]; /** * * @defaultValue [0, 0, -1], */ getPhysicalViewNorth(): number[]; /** * */ getPhysicalViewNorthByReference(): number[]; /** * * @defaultValue [0, 1, 0] */ getPhysicalViewUp(): number[]; /** * */ getPhysicalViewUpByReference(): number[]; /** * Get the position of the camera in world coordinates. * @defaultValue [0, 0, 1] */ getPosition(): number[]; /** * */ getPositionByReference(): number[]; /** * * @param aspect - Camera frustum aspect ratio. * @param nearz - Camera frustum near plane. * @param farz - Camera frustum far plane. * @defaultValue null */ getProjectionMatrix(aspect: number, nearz: number, farz: number): null | mat4; /** * Not implemented yet * Get the roll angle of the camera about the direction of projection. */ getRoll(): void; /** * Get top left corner point of the screen. * @defaultValue [-0.5, -0.5, -0.5] */ getScreenBottomLeft(): number[]; /** * * @defaultValue [-0.5, -0.5, -0.5] */ getScreenBottomLeftByReference(): number[]; /** * Get bottom left corner point of the screen * @defaultValue [0.5, -0.5, -0.5] */ getScreenBottomRight(): number[]; /** * * @defaultValue [0.5, -0.5, -0.5] */ getScreenBottomRightByReference(): number[]; /** * * @defaultValue [0.5, 0.5, -0.5] */ getScreenTopRight(): number[]; /** * * @defaultValue [0.5, 0.5, -0.5] */ getScreenTopRightByReference(): number[]; /** * Get the center of the window in viewport coordinates. */ getThickness(): number; /** * Get the value of the UseHorizontalViewAngle instance variable. * @defaultValue false */ getUseHorizontalViewAngle(): boolean; /** * Get use offaxis frustum. * @defaultValue false */ getUseOffAxisProjection(): boolean; /** * Get the camera view angle. * @defaultValue 30 */ getViewAngle(): number; /** * * @defaultValue null */ getViewMatrix(): null | mat4; /** * Get the ViewPlaneNormal. * This vector will point opposite to the direction of projection, * unless you have created a sheared output view using SetViewShear/SetObliqueAngles. * @defaultValue [0, 0, 1] */ getViewPlaneNormal(): number[]; /** * Get the ViewPlaneNormal by reference. */ getViewPlaneNormalByReference(): number[]; /** * Get ViewUp vector. * @defaultValue [0, 1, 0] */ getViewUp(): number[]; /** * Get ViewUp vector by reference. * @defaultValue [0, 1, 0] */ getViewUpByReference(): number[]; /** * Get the center of the window in viewport coordinates. * The viewport coordinate range is ([-1,+1],[-1,+1]). * @defaultValue [0, 0] */ getWindowCenter(): number[]; /** * * @defaultValue [0, 0] */ getWindowCenterByReference(): number[]; /** * * @param result - */ getWorldToPhysicalMatrix(result: mat4): void; /** * * @defaultValue false */ getIsPerformingCoordinateTransformation(status: boolean): void; /** * Recompute the ViewUp vector to force it to be perpendicular to the camera's focalpoint vector. */ orthogonalizeViewUp(): void; /** * * @param ori - */ physicalOrientationToWorldDirection(ori: number[]): any; /** * Rotate the focal point about the cross product of the view up vector and the direction of projection, using the camera's position as the center of rotation. * @param angle - */ pitch(angle: number): void; /** * Rotate the camera about the direction of projection. * @param angle - */ roll(angle: number): void; /** * Set the location of the near and far clipping planes along the direction * of projection. * @param near - * @param far - */ setClippingRange(near: number, far: number): boolean; /** * Set the location of the near and far clipping planes along the direction * of projection. * @param clippingRange - */ setClippingRange(clippingRange: number[]): boolean; /** * * @param clippingRange - */ setClippingRangeFrom(clippingRange: number[]): boolean; /** * used to handle convert js device orientation angles * when you use this method the camera will adjust to the * device orientation such that the physicalViewUp you set * in world coordinates looks up, and the physicalViewNorth * you set in world coorindates will (maybe) point north * * NOTE WARNING - much of the documentation out there on how * orientation works is seriously wrong. Even worse the Chrome * device orientation simulator is completely wrong and should * never be used. OMG it is so messed up. * * how it seems to work on iOS is that the device orientation * is specified in extrinsic angles with a alpha, beta, gamma * convention with axes of Z, X, Y (the code below substitutes * the physical coordinate system for these axes to get the right * modified coordinate system. * @param alpha - * @param beta - * @param gamma - * @param screen - */ setDeviceAngles( alpha: number, beta: number, gamma: number, screen: number ): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setDirectionOfProjection(x: number, y: number, z: number): boolean; /** * * @param distance - */ setDistance(distance: number): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setFocalPoint(x: number, y: number, z: number): boolean; /** * * @param focalPoint - */ setFocalPointFrom(focalPoint: number[]): boolean; /** * Not implement yet * Set the oblique viewing angles. * The first angle, alpha, is the angle (measured from the horizontal) that rays along * the direction of projection will follow once projected onto the 2D screen. * The second angle, beta, is the angle between the view plane and the direction of projection. * This creates a shear transform x' = x + dz*cos(alpha)/tan(beta), y' = dz*sin(alpha)/tan(beta) where dz is the distance of the point from the focal plane. * The angles are (45,90) by default. Oblique projections commonly use (30,63.435). * * @param alpha - * @param beta - */ setObliqueAngles(alpha: number, beta: number): boolean; /** * * @param degrees - * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setOrientationWXYZ(degrees: number, x: number, y: number, z: number): boolean; /** * * @param parallelProjection - */ setParallelProjection(parallelProjection: boolean): boolean; /** * * @param parallelScale - */ setParallelScale(parallelScale: number): boolean; /** * * @param physicalScale - */ setPhysicalScale(physicalScale: number): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setPhysicalTranslation(x: number, y: number, z: number): boolean; /** * * @param physicalTranslation - */ setPhysicalTranslationFrom(physicalTranslation: number[]): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setPhysicalViewNorth(x: number, y: number, z: number): boolean; /** * * @param physicalViewNorth - */ setPhysicalViewNorthFrom(physicalViewNorth: number[]): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setPhysicalViewUp(x: number, y: number, z: number): boolean; /** * * @param physicalViewUp - */ setPhysicalViewUpFrom(physicalViewUp: number[]): boolean; /** * Set the position of the camera in world coordinates. * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setPosition(x: number, y: number, z: number): boolean; /** * * @param mat - */ setProjectionMatrix(mat: mat4): boolean; /** * Set the roll angle of the camera about the direction of projection. * todo Not implemented yet * @param angle - */ setRoll(angle: number): boolean; /** * Set top left corner point of the screen. * * This will be used only for offaxis frustum calculation. * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setScreenBottomLeft(x: number, y: number, z: number): boolean; /** * Set top left corner point of the screen. * * This will be used only for offaxis frustum calculation. * @param screenBottomLeft - */ setScreenBottomLeft(screenBottomLeft: number[]): boolean; /** * * @param screenBottomLeft - */ setScreenBottomLeftFrom(screenBottomLeft: number[]): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setScreenBottomRight(x: number, y: number, z: number): boolean; /** * * @param screenBottomRight - */ setScreenBottomRight(screenBottomRight: number[]): boolean; /** * * @param screenBottomRight - */ setScreenBottomRightFrom(screenBottomRight: number[]): boolean; /** * Set top right corner point of the screen. * * This will be used only for offaxis frustum calculation. * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setScreenTopRight(x: number, y: number, z: number): boolean; /** * Set top right corner point of the screen. * * This will be used only for offaxis frustum calculation. * @param screenTopRight - */ setScreenTopRight(screenTopRight: number[]): boolean; /** * * @param screenTopRight - */ setScreenTopRightFrom(screenTopRight: number[]): boolean; /** * Set the distance between clipping planes. * * This method adjusts the far clipping plane to be set a distance 'thickness' beyond the near clipping plane. * @param thickness - */ setThickness(thickness: number): boolean; /** * * @param thickness - */ setThicknessFromFocalPoint(thickness: number): boolean; /** * * @param useHorizontalViewAngle - */ setUseHorizontalViewAngle(useHorizontalViewAngle: boolean): boolean; /** * Set use offaxis frustum. * * OffAxis frustum is used for off-axis frustum calculations specifically for * stereo rendering. For reference see "High Resolution Virtual Reality", in * Proc. SIGGRAPH '92, Computer Graphics, pages 195-202, 1992. * @param useOffAxisProjection - */ setUseOffAxisProjection(useOffAxisProjection: boolean): boolean; /** * Set the camera view angle, which is the angular height of the camera view measured in degrees. * @param viewAngle - */ setViewAngle(viewAngle: number): boolean; /** * * @param mat - */ setViewMatrix(mat: mat4): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ setViewUp(x: number, y: number, z: number): boolean; /** * * @param viewUp - */ setViewUp(viewUp: number[]): boolean; /** * * @param viewUp - */ setViewUpFrom(viewUp: number[]): boolean; /** * Set the center of the window in viewport coordinates. * The viewport coordinate range is ([-1,+1],[-1,+1]). * This method is for if you have one window which consists of several viewports, or if you have several screens which you want to act together as one large screen * @param x - The x coordinate. * @param y - The y coordinate. */ setWindowCenter(x: number, y: number): boolean; /** * Set the center of the window in viewport coordinates from an array. * @param windowCenter - */ setWindowCenterFrom(windowCenter: number[]): boolean; /** * * @param x - The x coordinate. * @param y - The y coordinate. * @param z - The z coordinate. */ translate(x: number, y: number, z: number): void; /** * Rotate the focal point about the view up vector, using the camera's position as the center of rotation. * @param angle - */ yaw(angle: number): void; /** * In perspective mode, decrease the view angle by the specified factor. * @param factor - */ zoom(factor: number): void; /** * Activate camera clipping customization necessary when doing coordinate transformations * @param status - */ setIsPerformingCoordinateTransformation(status: boolean): void; } const DEFAULT_VALUES = { isPerformingCoordinateTransformation: false, }; /** * Method use to decorate a given object (publicAPI+model) with vtkRenderer characteristics. * * @param publicAPI - object on which methods will be bounds (public) * @param model - object on which data structure will be bounds (protected) * @param initialValues - */ function extend( publicAPI: any, model: any, initialValues: ICameraInitialValues = {} ): void { Object.assign(model, DEFAULT_VALUES, initialValues); vtkCamera.extend(publicAPI, model, initialValues); macro.setGet(publicAPI, model, ['isPerformingCoordinateTransformation']); // Object methods vtkSlabCamera(publicAPI, model); } /** * Method use to create a new instance of vtkCamera with its focal point at the origin, * and position=(0,0,1). The view up is along the y-axis, view angle is 30 degrees, * and the clipping range is (.1,1000). * @param initialValues - for pre-setting some of its content */ const newInstance: (initialValues?: ICameraInitialValues) => vtkSlabCamera = macro.newInstance(extend, 'vtkSlabCamera'); /** * vtkCamera is a virtual camera for 3D rendering. It provides methods * to position and orient the view point and focal point. Convenience * methods for moving about the focal point also are provided. More * complex methods allow the manipulation of the computer graphics model * including view up vector, clipping planes, and camera perspective. */ /** * vtkSlabCamera - A derived class of the core vtkCamera class * * This customization is necesssary because when we do coordinate transformations * we need to set the cRange between [d, d + 0.1], * where d is distance between the camera position and the focal point. * While when we render we set to the clippingRange [0.01, d * 2], * where d is the calculated from the bounds of all the actors. * * @param {*} publicAPI The public API to extend * @param {*} model The private model to extend. */ function vtkSlabCamera(publicAPI, model) { model.classHierarchy.push('vtkSlabCamera'); // Set up private variables and methods const tmpMatrix = mat4.identity(new Float64Array(16) as unknown as mat4); const tmpvec1 = new Float64Array(3) as unknown as vec3; /** * getProjectionMatrix - A fork of vtkCamera's getProjectionMatrix method. * This fork performs most of the same actions, but define crange around * model.distance when doing coordinate transformations. */ publicAPI.getProjectionMatrix = (aspect, nearz, farz) => { const result = mat4.create(); Iif (model.projectionMatrix) { const scale = 1 / model.physicalScale; vec3.set(tmpvec1, scale, scale, scale); mat4.copy(result, model.projectionMatrix); mat4.scale(result, result, tmpvec1); mat4.transpose(result, result); return result; } mat4.identity(tmpMatrix); let cRange0 = model.clippingRange[0]; let cRange1 = model.clippingRange[1]; if (model.isPerformingCoordinateTransformation) { /** * NOTE: this is necessary because we want the coordinate transformation * respect to the view plane (plane orthogonal to the camera and passing to * the focal point). * * When vtk.js computes the coordinate transformations, it simply uses the * camera matrix (no ray casting). * * However for the volume viewport the clipping range is set to be * (-RENDERING_DEFAULTS.MAXIMUM_RAY_DISTANCE, RENDERING_DEFAULTS.MAXIMUM_RAY_DISTANCE). * The clipping range is used in the camera method getProjectionMatrix(). * The projection matrix is used then for viewToWorld/worldToView methods of * the renderer. This means that vkt.js will not return the coordinates of * the point on the view plane (i.e. the depth coordinate will corresponded * to the focal point). * * Therefore the clipping range has to be set to (distance, distance + 0.01), * where now distance is the distance between the camera position and focal * point. This is done internally, in our camera customization when the flag * isPerformingCoordinateTransformation is set to true. */ cRange0 = model.distance; cRange1 = model.distance + 0.1; } const cWidth = cRange1 - cRange0; const cRange = [ cRange0 + ((nearz + 1) * cWidth) / 2.0, cRange0 + ((farz + 1) * cWidth) / 2.0, ]; if (model.parallelProjection) { // set up a rectangular parallelipiped const width = model.parallelScale * aspect; const height = model.parallelScale; const xmin = (model.windowCenter[0] - 1.0) * width; const xmax = (model.windowCenter[0] + 1.0) * width; const ymin = (model.windowCenter[1] - 1.0) * height; const ymax = (model.windowCenter[1] + 1.0) * height; mat4.ortho(tmpMatrix, xmin, xmax, ymin, ymax, cRange[0], cRange[1]); mat4.transpose(tmpMatrix, tmpMatrix); } else Eif (model.useOffAxisProjection) { throw new Error('Off-Axis projection is not supported at this time'); } else { const tmp = Math.tan(vtkMath.radiansFromDegrees(model.viewAngle) / 2.0); let width; let height; if (model.useHorizontalViewAngle === true) { width = cRange0 * tmp; height = (cRange0 * tmp) / aspect; } else { width = cRange0 * tmp * aspect; height = cRange0 * tmp; } const xmin = (model.windowCenter[0] - 1.0) * width; const xmax = (model.windowCenter[0] + 1.0) * width; const ymin = (model.windowCenter[1] - 1.0) * height; const ymax = (model.windowCenter[1] + 1.0) * height; const znear = cRange[0]; const zfar = cRange[1]; tmpMatrix[0] = (2.0 * znear) / (xmax - xmin); tmpMatrix[5] = (2.0 * znear) / (ymax - ymin); tmpMatrix[2] = (xmin + xmax) / (xmax - xmin); tmpMatrix[6] = (ymin + ymax) / (ymax - ymin); tmpMatrix[10] = -(znear + zfar) / (zfar - znear); tmpMatrix[14] = -1.0; tmpMatrix[11] = (-2.0 * znear * zfar) / (zfar - znear); tmpMatrix[15] = 0.0; } mat4.copy(result, tmpMatrix); return result; }; } // ---------------------------------------------------------------------------- // Object factory // ---------------------------------------------------------------------------- // ---------------------------------------------------------------------------- export default { newInstance, extend }; export { newInstance, extend }; |