home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 March / VPR9703A.ISO / VPR_DATA / DOGA / SOURCES / POLYEDIT.LZH / MODEL / VIEWLIB.C < prev    next >
C/C++ Source or Header  |  1996-06-05  |  17KB  |  691 lines

  1. /*
  2.  *    画面制御
  3.  *
  4.  *        Copyright T.Kobayashi    1994.6.26
  5.  */
  6.  
  7. #include <stdio.h>
  8. #include <stdlib.h>
  9. #include <assert.h>
  10.  
  11. #include "poly.h"
  12. #include "view.h"
  13. #include "graph.h"
  14. #include "input.h"
  15. #include "menu.h"
  16. #include "ml.h"
  17. #include "matclass.h"
  18. #include "strclass.h"
  19.  
  20. #include "verconv.h"
  21.  
  22. static    char    *SysConstName[] = {
  23.     "WIN_XY",
  24.     "WIN_YZ",
  25.     "WIN_ZX",
  26.     "WIN_PERS",
  27.     "WIN_ALL",
  28.     "LINE_OR",
  29.     "LINE_XOR",
  30.     "OVERWRITE",
  31.     "CLEAR",
  32.     NULL
  33. };
  34.  
  35. static    IntData        SysConst[] = {
  36.     { TYPE_INT,        0,        VIEW_XY,        },
  37.     { TYPE_INT,        0,        VIEW_YZ,        },
  38.     { TYPE_INT,        0,        VIEW_ZX,        },
  39.     { TYPE_INT,        0,        VIEW_PERS,        },
  40.     { TYPE_INT,        0,        VIEW_ALL,        },
  41.     { TYPE_INT,        0,        OR_COLOR,        },
  42.     { TYPE_INT,        0,        CURSOR_COLOR,    },
  43.     { TYPE_BOOLEAN,    0,        FALSE,            },
  44.     { TYPE_BOOLEAN,    0,        TRUE,            },
  45. };
  46.  
  47. static    int        MatrixClassID ;
  48. static    int        VectorClassID ;
  49. static    int        StringClassID ;
  50.  
  51. static    int        FuncMouseWindow( int, int, DataStruct* );
  52. static    int        FuncGet3DCursor( int, int, DataStruct* );
  53. static    int        Set3DCursor( int, int, DataStruct* );
  54. static    int        Get2DCursor( int, int, DataStruct* );
  55. static    int        Update( int, int, DataStruct* );
  56. static    int        UpdatePers( int, int, DataStruct* );
  57. static    int        DrawCurrent( int, int, DataStruct* );
  58. static    int        DrawLine( int, int, DataStruct* );
  59. static    int        DrawLine2D( int, int, DataStruct* );
  60. static    int        DrawBox( int, int, DataStruct* );
  61. static    int        DrawBox2D( int, int, DataStruct* );
  62. static    int        Clear( int, int, DataStruct* );
  63. static    int        SetWindow( int, int, DataStruct* );
  64. static    int        SetVisibleVector( int, int, DataStruct* );
  65. static    int        SetVisiblePolyVector( int, int, DataStruct* );
  66. static    int        SetVisibleVertex( int, int, DataStruct* );
  67. static    int        SetCenter( int, int, DataStruct* );
  68. static    int        SetZoom( int, int, DataStruct* );
  69. static    int        SetPers( int, int, DataStruct* );
  70. static    int        SetGrid( int, int, DataStruct* );
  71. static    int        SetConv( int, int, DataStruct* );
  72. static    int        DrawText( int, int, DataStruct* );
  73. static    int        FuncPersAngle( int, int, DataStruct* );
  74. static    int        FuncViewWidth( int, int, DataStruct* );
  75. static    int        FuncViewHeight( int, int, DataStruct* );
  76. static    int        FuncDrawInvisible( int, int, DataStruct* );
  77. static    int        FuncViewCursor( int, int, DataStruct* );
  78. static    int        FuncDrawFrontOnly( int, int, DataStruct* );
  79.  
  80. void    ViewLibInit()
  81. {
  82.     int        i ;
  83.  
  84.     MatrixClassID = ClassName( "Matrix" );
  85.     VectorClassID = ClassName( "Vector" );
  86.     StringClassID = ClassName( "String" );
  87.  
  88.     for( i = 0 ; SysConstName[i] != NULL ; i++ )
  89.     {
  90.         NewConst( SysConstName[i], (DataStruct*)&SysConst[i] );
  91.     }
  92.  
  93.     NewFunction( 0,                "MouseWindow", FuncMouseWindow );
  94.     NewFunction( 0,                "Cursor", FuncGet3DCursor );
  95.     NewFunction( VertexClassID, "Cursor", Set3DCursor );
  96.     NewFunction( VectorClassID, "Cursor", Set3DCursor );
  97.     NewFunction( 0,                "Cursor2D", Get2DCursor );
  98.     NewFunction( 0,                "Update", Update );
  99.     NewFunction( 0,                "UpdatePers", UpdatePers );
  100.     NewFunction( 0,                "DrawCurrent", DrawCurrent );
  101.     NewFunction( VertexClassID,    "DrawLine", DrawLine );
  102.     NewFunction( 0,                "DrawLine2D", DrawLine2D );
  103.     NewFunction( VertexClassID,    "DrawBox", DrawBox );
  104.     NewFunction( 0,                "DrawBox2D", DrawBox2D );
  105.     NewFunction( 0,                "Clear", Clear );
  106.     NewFunction( 0,                "SetWindow", SetWindow );
  107.     NewFunction( 0,                "Window", SetWindow );
  108.     NewFunction( 0,                "VisibleVector", SetVisibleVector );
  109.     NewFunction( 0,                "VisiblePolyVector", SetVisiblePolyVector );
  110.     NewFunction( 0,                "VisibleVertex", SetVisibleVertex );
  111.     NewFunction( 0,                "SetCenter", SetCenter );
  112.     NewFunction( 0,                "Center", SetCenter );
  113.     NewFunction( 0,                "SetZoom", SetZoom );
  114.     NewFunction( MatrixClassID,    "SetPers", SetPers );
  115.     NewFunction( 0,                "SetGrid", SetGrid );
  116.     NewFunction( MatrixClassID,    "SetConv", SetConv );
  117.     NewFunction( StringClassID,    "DrawText", DrawText );
  118.     NewFunction( 0,                "PersAngle", FuncPersAngle );
  119.     NewFunction( 0,                "ViewWidth", FuncViewWidth );
  120.     NewFunction( 0,                "ViewHeight", FuncViewHeight );
  121.     NewFunction( 0,                "DrawInvisible", FuncDrawInvisible);
  122.     NewFunction( 0,                "DrawFrontOnly", FuncDrawFrontOnly);
  123.     NewFunction( 0,                "ViewCursor", FuncViewCursor);
  124. }
  125.  
  126. /*    マウスのあるウインドウの読み出し*/
  127. static    int        FuncMouseWindow( ident, args, buf )
  128. int        ident ;
  129. int        args ;
  130. DataStruct    *buf ;
  131. {
  132.     ArgCheck( "MouseWindow", args, buf, TYPE_NOASN );
  133.  
  134.     StackPushInt( MouseWindow( MouseX, MouseY ) );
  135.     return RETURN_RETURN ;
  136. }
  137.  
  138. /*    3Dカーソル位置の読み出し        */
  139. static    int        FuncGet3DCursor( ident, args, buf )
  140. int        ident ;
  141. int        args ;
  142. DataStruct    *buf ;
  143. {
  144.     int        x, y, z ;
  145.     VertexClass    *ver ;
  146.  
  147.     ArgCheck( "Cursor", args, buf, TYPE_NOASN );
  148.  
  149.     ver = (VertexClass*)ObjectAlloc( sizeof( VertexClass ), VertexClassID );
  150.     memset(&ver->ver, 0, sizeof(Vertex));
  151.  
  152.     Get3DCursor( &x, &y, &z );
  153.     ver->ver.x = x ;
  154.     ver->ver.y = y ;
  155.     ver->ver.z = z ;
  156.     ver->dtype = POLY_SIMPLE ;
  157.  
  158.     buf = StackAlloc( 1 );
  159.     buf->type = TYPE_OBJECT ;
  160.     buf->od.ptr = (Object*)ver ;
  161.  
  162.     return RETURN_RETURN ;
  163. }
  164.  
  165. /*    3Dカーソルの設定    */
  166. static    int        Set3DCursor( ident, args, buf )
  167. int        ident ;
  168. int        args ;
  169. DataStruct    *buf ;
  170. {
  171.     VertexClass    *ver ;
  172.  
  173.     ArgCheck( "Vertex:Cursor", args, buf, TYPE_OBJECT, TYPE_NOASN );
  174.  
  175.     if (ObjectCheck(buf, VertexClassID)) {
  176.         ver = (VertexClass*)buf[0].od.ptr ;
  177.         ViewSet3DCursorPos( ver->ver.x, ver->ver.y, ver->ver.z );
  178.  
  179.         buf = StackAlloc( 1 );
  180.         buf->type = TYPE_OBJECT ;
  181.         buf->od.ptr = ObjectCopy( (Object*)ver );
  182.     } else if (ObjectCheck(buf, VectorClassID)) {
  183.         VectorClass *vec;
  184.         vec = (VectorClass*)buf[0].od.ptr ;
  185.         ViewSet3DCursorPos( vec->vec.x, vec->vec.y, vec->vec.z );
  186.  
  187.         ver = (VertexClass*)ObjectAlloc( sizeof( VertexClass ), VertexClassID );
  188.         memset(&ver->ver, 0, sizeof(Vertex));
  189.  
  190.         ver->ver.x = vec->vec.x ;
  191.         ver->ver.y = vec->vec.y ;
  192.         ver->ver.z = vec->vec.z ;
  193.         ver->dtype = POLY_SIMPLE ;
  194.  
  195.         buf = StackAlloc( 1 );
  196.         buf->type = TYPE_OBJECT ;
  197.         buf->od.ptr = (Object*)ver ;
  198.     }
  199.  
  200.     DrawCursorPos();
  201.  
  202.     return RETURN_RETURN ;
  203. }
  204.  
  205. /*    2Dカーソル位置の読み出し        */
  206. static    int        Get2DCursor( ident, args, buf )
  207. int        ident ;
  208. int        args ;
  209. DataStruct    *buf ;
  210. {
  211.     int scr[2];
  212.     Vertex v;
  213.     ArgCheck( "Cursor2D", args, buf, TYPE_ARRAY, TYPE_NOASN );
  214.  
  215.     if ( buf[0].ad.size < 2 )
  216.         ExecError( "引数配列のサイズが不正です。( Get2DCursor )" );
  217.  
  218.     buf = buf[0].ad.ary ;
  219.     buf[0].type = buf[1].type = TYPE_INT ;
  220. #if 0
  221.     buf[0].id.i = PersMx ;
  222.     buf[1].id.i = PersMy ;
  223. #else
  224.     v.x = Mx;
  225.     v.y = My;
  226.     v.z = Mz;
  227.     ToScreenPers(scr, &v);
  228.  
  229.     buf[0].id.i =   (( scr[0] - WinPers.x - WinPers.h / 2 ) << CURSOR_2D_SHIFT) / WinPers.h ;
  230.     buf[1].id.i = - (( scr[1] - WinPers.y - WinPers.v / 2 ) << CURSOR_2D_SHIFT) / WinPers.h ;
  231. #endif
  232.     return RETURN_VOID ;
  233. }
  234.  
  235. /*    3面図の再描画    */
  236. static    int        Update( ident, args, buf )
  237. int        ident ;
  238. int        args ;
  239. DataStruct    *buf ;
  240. {
  241.     if (args == 1) {
  242.         ArgCheck( "Update", args, buf, TYPE_BOOLEAN, TYPE_NOASN );
  243.         ViewLineAll( 0, 0, 4096, 4096, buf[0].ld.l );
  244.     } else {
  245.         int orgdraw;
  246.         ArgCheck( "Update", args, buf, TYPE_BOOLEAN, TYPE_INT, TYPE_NOASN );
  247.         orgdraw = ViewMode;
  248.         ViewMode &= buf[1].id.i;
  249.         ViewLineAll( 0, 0, 4096, 4096, buf[0].ld.l );
  250.         ViewMode = orgdraw;
  251.  
  252.     }
  253.     return RETURN_VOID ;
  254. }
  255.  
  256. /*    透視図の再描画    */
  257. static    int        UpdatePers( ident, args, buf )
  258. int        ident ;
  259. int        args ;
  260. DataStruct    *buf ;
  261. {
  262.     ArgCheck( "UpdatePers", args, buf, TYPE_BOOLEAN, TYPE_NOASN );
  263.  
  264.     ViewLinePersAll( buf[0].ld.l );
  265.  
  266.     return RETURN_VOID ;
  267. }
  268.  
  269. /*    カレントポリゴンを表示    */
  270. static    int        DrawCurrent( ident, args, buf )
  271. int        ident ;
  272. int        args ;
  273. DataStruct    *buf ;
  274. {
  275.     int osel;
  276.     osel = CurrentPoly->select;
  277.     if (args > 0) {
  278.         ArgCheck( "UpdatePers", args, buf, TYPE_BOOLEAN|TYPE_INT, TYPE_NOASN );
  279.         CurrentPoly->select = buf[0].id.i;
  280.     }
  281.     ViewCurrent();
  282.     CurrentPoly->select = osel;
  283.     return RETURN_VOID ;
  284. }
  285.  
  286. /*    3Dラインの表示    */
  287. static    int        DrawLine( ident, args, buf )
  288. int        ident ;
  289. int        args ;
  290. DataStruct    *buf ;
  291. {
  292.     int            color ;
  293.     VertexClass    *v1, *v2 ;
  294.  
  295.     if ( args == 2 )
  296.     {
  297.         ArgCheck( "DrawLine", args, buf, TYPE_OBJECT, TYPE_OBJECT, TYPE_NOASN );
  298.         color = CURSOR_COLOR ;
  299.     }
  300.     else
  301.     {
  302.         ArgCheck( "DrawLine", args, buf, TYPE_OBJECT, TYPE_OBJECT, TYPE_INT, TYPE_NOASN );
  303.         color = buf[2].id.i ;
  304.     }
  305.  
  306.     v1 = (VertexClass*)buf[0].od.ptr ;
  307.     v2 = (VertexClass*)buf[1].od.ptr ;
  308.  
  309.     ViewLine3D( &v1->ver, &v2->ver, color );
  310.  
  311.     return RETURN_VOID ;
  312. }
  313.  
  314. /*    2Dラインの表示    */
  315. static    int        DrawLine2D( ident, args, buf )
  316. int        ident ;
  317. int        args ;
  318. DataStruct    *buf ;
  319. {
  320.     ArgCheck( "DrawLine2D", args, buf, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_NOASN );
  321.  
  322.     ViewLine2D( buf[0].id.i, buf[1].id.i, buf[2].id.i, buf[3].id.i, CURSOR_COLOR );
  323.     return RETURN_VOID ;
  324. }
  325.  
  326. /*    3Dボックスの表示    */
  327. static    int        DrawBox( ident, args, buf )
  328. int        ident ;
  329. int        args ;
  330. DataStruct    *buf ;
  331. {
  332.     VertexClass    *v1, *v2 ;
  333.  
  334.     if ( args < 2 )
  335.         ExecError( "引数の数が不正です。( Vertex:DrawBox )" );
  336.  
  337.     if ( buf[1].type != TYPE_OBJECT || ObjectCheck( &buf[1], VertexClassID ) == FALSE )
  338.         ExecError( "引数の型が不正です。( Vertex:DrawBox )" );
  339.  
  340.     v1 = (VertexClass*)buf[0].od.ptr ;
  341.     v2 = (VertexClass*)buf[1].od.ptr ;
  342.  
  343.     if ( args == 2 )
  344.     {
  345.         Matrix    mat ;
  346.         MatUnit( mat );
  347.         ViewBox( &v1->ver, &v2->ver, mat );
  348.     }
  349.     else
  350.     {
  351.         int        matid ;
  352.         matid = ClassName( "Matrix" );
  353.         if ( buf[2].type != TYPE_OBJECT || ObjectCheck( &buf[2], MatrixClassID ) == FALSE )
  354.             ExecError( "引数の型が不正です。( Vertex:DrawBox )" );
  355.         ViewBox( &v1->ver, &v2->ver, ((MatrixClass*)buf[2].od.ptr)->mat );
  356.     }
  357.  
  358.     return RETURN_VOID ;
  359. }
  360.  
  361. /*    2Dボックスの表示    */
  362. static    int        DrawBox2D( ident, args, buf )
  363. int        ident ;
  364. int        args ;
  365. DataStruct    *buf ;
  366. {
  367.     ArgCheck( "DrawBox2D", args, buf, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_INT, TYPE_NOASN );
  368.  
  369.     ViewBox2D( buf[0].id.i, buf[1].id.i, buf[2].id.i, buf[3].id.i );
  370.     return RETURN_VOID ;
  371. }
  372.  
  373. /*    表示画面クリア    */
  374. static    int        Clear( ident, args, buf )
  375. int        ident ;
  376. int        args ;
  377. DataStruct    *buf ;
  378. {
  379.     if (args > 0) {
  380.         ArgCheck( "Clear", args, buf, TYPE_INT|TYPE_BOOLEAN, TYPE_NOASN );
  381.         if (buf[0].id.i) {
  382.             ViewClear( TMP_COLOR );
  383.         } else {
  384.             ViewClear(-1);
  385.         }
  386.     } else {
  387.         ArgCheck( "Clear", args, buf, TYPE_NOASN );
  388.         ViewClear( TMP_COLOR );
  389.     }
  390.     return RETURN_VOID ;
  391. }
  392.  
  393.  
  394. /*    表示ウインドウの設定    */
  395. static    int        SetWindow( ident, args, buf )
  396. int        ident ;
  397. int        args ;
  398. DataStruct    *buf ;
  399. {
  400.     if (args == 0) {
  401.         StackPushInt(ViewMode);
  402.         return RETURN_RETURN;
  403.     } else {
  404.         ArgCheck( "SetWindow", args, buf, TYPE_INT, TYPE_NOASN );
  405.         ViewCursor( OFF );
  406.         ViewSetWindow( buf[0].id.i );
  407.         ViewFrame();
  408.         ViewLineAll( 0, 0, 4096, 4096, TRUE );
  409.         ViewCursor( ON );
  410.         return RETURN_VOID ;
  411.     }
  412. }
  413.  
  414. /*    法線ベクトル表示モードの設定    */
  415. static    int        SetVisibleVector( ident, args, buf )
  416. int        ident ;
  417. int        args ;
  418. DataStruct    *buf ;
  419. {
  420.     int v;
  421.     v = VisibleVector;
  422.     if (args > 0) {
  423.         ArgCheck( "SetVisibleVector", args, buf, TYPE_INT, TYPE_NOASN );
  424.         VisibleVector = buf[0].id.i ;
  425.     }
  426.     StackPushInt( v );
  427.     return RETURN_RETURN ;
  428. }
  429.  
  430. /*    面法線ベクトル表示モードの設定    */
  431. static    int        SetVisiblePolyVector( ident, args, buf )
  432. int        ident ;
  433. int        args ;
  434. DataStruct    *buf ;
  435. {
  436.     int v;
  437.     v = VisiblePolyVector;
  438.     if (args > 0) {
  439.         ArgCheck( "SetVisiblePolyVector", args, buf, TYPE_INT, TYPE_NOASN );
  440.         VisiblePolyVector = buf[0].id.i ;
  441.     }
  442.     StackPushInt( v );
  443.     return RETURN_RETURN ;
  444. }
  445.  
  446. /*    頂点表示モードの設定    */
  447. static    int        SetVisibleVertex( ident, args, buf )
  448. int        ident ;
  449. int        args ;
  450. DataStruct    *buf ;
  451. {
  452.     int v;
  453.     v = VisibleVertex;
  454.     if (args > 0) {
  455.         ArgCheck( "SetVisibleVertex", args, buf, TYPE_INT, TYPE_NOASN );
  456.         VisibleVertex = buf[0].id.i ;
  457.     }
  458.     StackPushInt( v );
  459.     return RETURN_RETURN ;
  460. }
  461.  
  462. /*    表示位置の設定    */
  463. static    int        SetCenter( ident, args, buf )
  464. int        ident ;
  465. int        args ;
  466. DataStruct    *buf ;
  467. {
  468.     int        x, y, z, vx, vy, vz, u, v ;
  469.     VertexClass    *ver ;
  470.  
  471.     if ( args == 0 )
  472.     {
  473.         ver = (VertexClass*)ObjectAlloc( sizeof( VertexClass ), VertexClassID );
  474.         memset(&ver->ver, 0, sizeof(Vertex));
  475.         ver->dtype = POLY_SIMPLE ;
  476.         ver->ver.x = Cx ;
  477.         ver->ver.y = Cy ;
  478.         ver->ver.z = Cz ;
  479.         buf = StackAlloc( 1 );
  480.         buf->type = TYPE_OBJECT ;
  481.         buf->od.ptr = (Object*)ver ;
  482.         return RETURN_RETURN ;
  483.     }
  484.     else
  485.     {
  486.         if ( ConvVertex( &x, &y, &z, &vx, &vy, &vz, &u, &v, buf ) ) {
  487.             ViewCursorPers( PERS_CURSOR_OFF    );
  488.             ViewSetCenter( x, y, z );
  489.             ViewCursorPers( PERS_CURSOR_3D );
  490.         } else
  491.             ExecError( "型が不正です。(SetCenter)" );
  492.         return RETURN_VOID ;
  493.     }
  494. }
  495.  
  496. /*    ズーム値の設定    */
  497. static    int        SetZoom( ident, args, buf )
  498. int        ident ;
  499. int        args ;
  500. DataStruct    *buf ;
  501. {
  502.     int        move ;
  503.  
  504.     if ( args == 1 )
  505.     {
  506.         ArgCheck( "SetZoom", args, buf, TYPE_INT, TYPE_NOASN );
  507.         move = 0 ;
  508.     }
  509.     else
  510.     {
  511.         ArgCheck( "SetZoom", args, buf, TYPE_INT, TYPE_INT, TYPE_NOASN );
  512.         move = buf[1].id.i ;
  513.         printf( "move : %d\n", move );
  514.     }
  515.  
  516.     ViewCursorPers( PERS_CURSOR_OFF    );
  517.     ViewSetZoom( buf[0].id.i, move );
  518.     ViewCursorPers( PERS_CURSOR_3D );
  519.  
  520.     return RETURN_VOID ;
  521. }
  522.  
  523. /*    透視図の設定    */
  524. static    int        SetPers( ident, args, buf )
  525. int        ident ;
  526. int        args ;
  527. DataStruct    *buf ;
  528. {
  529.     ArgCheck( "SetPers", args, buf, TYPE_OBJECT, TYPE_NOASN );
  530.  
  531.     ViewCursorPers( PERS_CURSOR_OFF );
  532.     ViewSetPers( ((MatrixClass*)buf[0].od.ptr)->mat );
  533.     ViewLinePersAll( TRUE );
  534.     ViewCursorPers( PERS_CURSOR_3D );
  535.  
  536.     return RETURN_VOID ;
  537. }
  538.  
  539. /*    グリッドの設定    */
  540. static    int        SetGrid( ident, args, buf )
  541. int        ident ;
  542. int        args ;
  543. DataStruct    *buf ;
  544. {
  545.     ArgCheck( "SetGrid", args, buf, TYPE_INT, TYPE_INT, TYPE_NOASN );
  546.     ViewSetGrid( buf[0].id.i, buf[1].id.i );
  547.     return RETURN_VOID ;
  548. }
  549.  
  550. /*    3面図の変換設定    */
  551. static    int        SetConv( ident, args, buf )
  552. int        ident ;
  553. int        args ;
  554. DataStruct    *buf ;
  555. {
  556.     ArgCheck( "SetConv", args, buf, TYPE_OBJECT, TYPE_NOASN );
  557.  
  558.     ViewCursorPers( PERS_CURSOR_OFF );
  559.     ViewSetConv( ((MatrixClass*)buf[0].od.ptr)->mat );
  560.     ViewCursorPers( PERS_CURSOR_3D );
  561.  
  562.     return RETURN_VOID ;
  563. }
  564.  
  565. /*    3面図の変換設定    */
  566. static    int        DrawText( ident, args, buf )
  567. int        ident ;
  568. int        args ;
  569. DataStruct    *buf ;
  570. {
  571.     int        x, y, atr ;
  572.  
  573.     atr = ( args < 4 ) ? 0x0f : buf[4].id.i ;
  574.     y = ( args < 3 ) ? 20 : buf[4].id.i ;
  575.     x = ( args < 2 ) ? 0 : buf[4].id.i ;
  576.  
  577.     graph_puts( ((StringClass*)buf[2].od.ptr)->str, x, y, atr );
  578.  
  579.     return RETURN_VOID ;
  580. }
  581.  
  582. /*    透視図の画角設定    */
  583. static    int        FuncPersAngle( ident, args, buf )
  584. int        ident ;
  585. int        args ;
  586. DataStruct    *buf ;
  587. {
  588.     int angle;
  589.     if (args > 0) {
  590.         ArgCheck( "PersAngle", args, buf, TYPE_INT, TYPE_NOASN );
  591.         angle = PersAngle(buf->id.i);
  592. #if 0
  593.         ViewCursorPers( PERS_CURSOR_OFF );
  594.         ViewLinePersAll( TRUE );
  595.         ViewCursorPers( PERS_CURSOR_3D );
  596. #endif
  597.     } else {
  598.         angle = PersAngle(0);
  599.     }
  600.     StackPushInt( angle );
  601.     return RETURN_RETURN ;
  602. }
  603.  
  604.  
  605. static    int        FuncViewWidth( ident, args, buf )
  606. int        ident ;
  607. int        args ;
  608. DataStruct    *buf ;
  609. {
  610.     ArgCheck( "ViewWidth", args, buf, TYPE_INT, TYPE_NOASN );
  611.     switch (buf[0].id.i) {
  612.     case VIEW_XY:
  613.         StackPushInt( WinXY.h * ZoomMinus / ZoomPlus );
  614.         break;
  615.     case VIEW_YZ:
  616.         StackPushInt( WinYZ.h  * ZoomMinus / ZoomPlus);
  617.         break;
  618.     case VIEW_ZX:
  619.         StackPushInt( WinZX.h  * ZoomMinus / ZoomPlus);
  620.         break;
  621.     case VIEW_PERS:
  622.         StackPushInt( WinPers.h  * ZoomMinus / ZoomPlus);
  623.         break;
  624.     }
  625.     return RETURN_RETURN ;
  626. }
  627.  
  628. static    int        FuncViewHeight( ident, args, buf )
  629. int        ident ;
  630. int        args ;
  631. DataStruct    *buf ;
  632. {
  633.     ArgCheck( "ViewHeight", args, buf, TYPE_INT, TYPE_NOASN );
  634.     switch (buf[0].id.i) {
  635.     case VIEW_XY:
  636.         StackPushInt( WinXY.v * ZoomMinus / ZoomPlus );
  637.         break;
  638.     case VIEW_YZ:
  639.         StackPushInt( WinYZ.v * ZoomMinus / ZoomPlus );
  640.         break;
  641.     case VIEW_ZX:
  642.         StackPushInt( WinZX.v * ZoomMinus / ZoomPlus );
  643.         break;
  644.     case VIEW_PERS:
  645.         StackPushInt( WinPers.v * ZoomMinus / ZoomPlus );
  646.         break;
  647.     }
  648.     return RETURN_RETURN ;
  649. }
  650.  
  651. static    int        FuncDrawInvisible( ident, args, buf )
  652. int        ident ;
  653. int        args ;
  654. DataStruct    *buf ;
  655. {
  656.     if (args > 0) {
  657.         ArgCheck( "DrawInvisible", args, buf, TYPE_INT|TYPE_BOOLEAN, TYPE_NOASN );
  658.         InvisibleDraw = buf[0].id.i;
  659.     }
  660.     StackPushInt( InvisibleDraw );
  661.     return RETURN_RETURN ;
  662. }
  663.  
  664. static    int        FuncDrawFrontOnly( ident, args, buf )
  665. int        ident ;
  666. int        args ;
  667. DataStruct    *buf ;
  668. {
  669.     if (args > 0) {
  670.         ArgCheck( "DrawFrontOnly", args, buf, TYPE_INT|TYPE_BOOLEAN, TYPE_NOASN );
  671.         DrawFrontOnlyFlag= buf[0].id.i;
  672.     }
  673.     StackPushInt( DrawFrontOnlyFlag );
  674.     return RETURN_RETURN ;
  675. }
  676.  
  677. static    int        FuncViewCursor( ident, args, buf )
  678. int        ident ;
  679. int        args ;
  680. DataStruct    *buf ;
  681. {
  682.     if (args > 0) {
  683.         ArgCheck( "ViewCursor", args, buf, TYPE_INT|TYPE_BOOLEAN, TYPE_NOASN );
  684.         ViewCursor(buf[0].id.i);
  685.     }
  686.     StackPushInt( Mstat );
  687.     return RETURN_RETURN ;
  688. }
  689.  
  690.  
  691.