「lmolvie(API)」の版間の差分
 (→マウス操作)  | 
				 (→API)  | 
				||
| 行77: | 行77: | ||
アイドル時の処理  | アイドル時の処理  | ||
  extern void lmolvieIdleNormal(void);  |   extern void lmolvieIdleNormal(void);  | ||
| − | スタティック変数__accelerator(初期値:   | + | スタティック変数__accelerator(初期値: 0)に依って[[#視点移動]]を行います。  | 
<table border=1>  | <table border=1>  | ||
	<tr>  | 	<tr>  | ||
| 行93: | 行93: | ||
	<tr>  | 	<tr>  | ||
		<td>それ以外</td>  | 		<td>それ以外</td>  | ||
| − | 		<td>  | + | 		<td>停止(何もしない)</td>  | 
	</tr>  | 	</tr>  | ||
</table>  | </table>  | ||
| 行108: | 行108: | ||
  extern void lmolvieReshapeNormal(int width, int height);  |   extern void lmolvieReshapeNormal(int width, int height);  | ||
| − | ===   | + | === マウスイベント ===  | 
====  クリック ====  | ====  クリック ====  | ||
===== メイン =====  | ===== メイン =====  | ||
| 行141: | 行141: | ||
Drive  | Drive  | ||
  extern void lmolvieMouseDrive(int button, int state, int x, int y);  |   extern void lmolvieMouseDrive(int button, int state, int x, int y);  | ||
| + | buttonとstateにより[[#視点移動]]を行います。  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>state</th>  | ||
| + | 		<th>button</th>  | ||
| + | 		<th>処理</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_DOWN</td>  | ||
| + | 		<td>GLUT_LEFT_BUTTON</td>  | ||
| + | 		<td>中心に近づく(__accelerator=1)</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_DOWN</td>  | ||
| + | 		<td>GLUT_RIGHT_BUTTON</td>  | ||
| + | 		<td>中心から離れる(__accelerator=2)</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_DOWN</td>  | ||
| + | 		<td>GLUT_LEFT_BUTTON</td>  | ||
| + | 		<td>停止(__accelerator=0)</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_DOWN</td>  | ||
| + | 		<td>GLUT_RIGHT_BUTTON</td>  | ||
| + | 		<td>停止(__accelerator=0)</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
| + | |||
Parallel  | Parallel  | ||
  extern void lmolvieMouseParallel(int button, int state, int x, int y);  |   extern void lmolvieMouseParallel(int button, int state, int x, int y);  | ||
| + | 処理なし  | ||
| + | |||
Multi  | Multi  | ||
  extern void lmolvieMouseMulti(int button, int state, int x, int y);  |   extern void lmolvieMouseMulti(int button, int state, int x, int y);  | ||
| + | 処理なし  | ||
==== ドラッグ ====  | ==== ドラッグ ====  | ||
| 行178: | 行211: | ||
Drive  | Drive  | ||
  extern void lmolvieMouseMotionDrive(int x, int y);  |   extern void lmolvieMouseMotionDrive(int x, int y);  | ||
| + | ドラッグ時のボタンpressedButtonに依った処理を行います。  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>pressedButton</th>  | ||
| + | 		<th>処理</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_LEFT_BUTTON</td>  | ||
| + | 		<td>[[#視点回転]]</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_MIDDLE_BUTTON</td>  | ||
| + | 		<td>[[#視点回転]]</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_RIGHT_BUTTON</td>  | ||
| + | 		<td>[[#中心回転]]</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
| + | |||
Parallel  | Parallel  | ||
  extern void lmolvieMouseMotionParallel(int x, int y);  |   extern void lmolvieMouseMotionParallel(int x, int y);  | ||
| + | ドラッグ時のボタンpressedButtonに依った処理を行います。  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>pressedButton</th>  | ||
| + | 		<th>処理</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_LEFT_BUTTON</td>  | ||
| + | 		<td>物体回転(proteinRotateX, proteinRotateY)</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_MIDDLE_BUTTON</td>  | ||
| + | 		<td>[[#中心移動]]</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_RIGHT_BUTTON</td>  | ||
| + | 		<td>[[#中心回転]]</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
| + | |||
Multi  | Multi  | ||
  extern void lmolvieMouseMotionMulti(int x, int y);  |   extern void lmolvieMouseMotionMulti(int x, int y);  | ||
| + | ドラッグ時のボタンpressedButtonに依った処理を行います。  | ||
| + | <table border=1>  | ||
| + | 	<tr>  | ||
| + | 		<th>pressedButton</th>  | ||
| + | 		<th>処理</th>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_LEFT_BUTTON</td>  | ||
| + | 		<td>物体回転(proteinRotateX, proteinRotateY)</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_MIDDLE_BUTTON</td>  | ||
| + | 		<td>[[#中心移動]]</td>  | ||
| + | 	</tr>  | ||
| + | 	<tr>  | ||
| + | 		<td>GLUT_RIGHT_BUTTON</td>  | ||
| + | 		<td>[[#中心回転]]</td>  | ||
| + | 	</tr>  | ||
| + | </table>  | ||
| + | <br>  | ||
==== マウス移動 ====  | ==== マウス移動 ====  | ||
| 行215: | 行310: | ||
Drive  | Drive  | ||
  extern void lmolvieMousePassiveMotionDrive(int x, int y);  |   extern void lmolvieMousePassiveMotionDrive(int x, int y);  | ||
| + | 処理なし  | ||
| + | |||
Parallel  | Parallel  | ||
  extern void lmolvieMousePassiveMotionParallel(int x, int y);  |   extern void lmolvieMousePassiveMotionParallel(int x, int y);  | ||
| + | 処理なし  | ||
| + | |||
Multi  | Multi  | ||
  extern void lmolvieMousePassiveMotionMulti(int x, int y);  |   extern void lmolvieMousePassiveMotionMulti(int x, int y);  | ||
| + | 処理なし  | ||
=== キーボード ===  | === キーボード ===  | ||
2015年3月19日 (木) 07:27時点における版
DataExpress/eosOpenGL/src/lmolvieはAPI です。
目次
定数
画面表示モード
typedef enum displayMode{
	none=0,
	atom=1,
	stick=2,
	serial=3,
	residue=4,
	temp=5,
	sticktemp=6,
	stickresidue=7
}displayMode;
操作モード
typedef enum operationMode {
	normal=0,
	drive=1,
	parallel=2,
	surface=3,
	multi=4,
	coaster=5
} operationMode;
構造体
入力・出力・コンフィグ
typedef struct molvieInfo {
    long flagRedirect;
    long flagIn;
    char* In;
    FILE* fptIn;
    
    long flagOut;
    char* Out;
    FILE* fptOut;
    
    long flagconfigFile;
    char* configFile;
    FILE* fptconfigFile;
    
    long flagmode;
    long mode;
    
} molvieInfo;
カメラ設定
typedef struct cameraInfo {
	GLdouble Fovy;
	GLdouble Aspect;
	GLdouble ClipNear;
	GLdouble ClipFar;
	GLdouble Eye[3];
	GLdouble Centre[3];
	GLdouble Up[3];
} cameraInfo;
座標情報
typedef struct Coord {
	GLfloat x;
	GLfloat y;
	GLfloat z;
} Coord; 
API
extern void lmolviePDBread(FILE* fptIn); extern pdbFile* get_pdb(void);
初期設定
extern void lmolvieInitNormal(void);
アイドル処理
テストメッセージの表示
extern void lmolvieIdleTest(void);
アイドル時の処理
extern void lmolvieIdleNormal(void);
スタティック変数__accelerator(初期値: 0)に依って#視点移動を行います。
| __accelerator | 処理 | 
|---|---|
| 1 | 中心に近づく | 
| 2 | 中心から離れる | 
| それ以外 | 停止(何もしない) | 
画面
画面表示のテスト(glutDisplayFuncなどに使用して画面テストを行います。)
extern void lmolvieDisplayTest(void);
通常画面表示
extern void lmolvieDisplayNormal(void);
幅width、高さheightにて再表示します。
extern void lmolvieReshapeNormal(int width, int height);
マウスイベント
クリック
メイン
クリック操作の処理です。(button:対応ボタン、state:状態、x, y:座標)
extern void lmolvieMouse(int button, int state, int x, int y);
#操作モードに依った処理を行います。MOUSE_FUNCTIONが定義されているときのみ有効です。
| 操作モード | 処理 | 
|---|---|
| 0 | lmolvieMouseNormal | 
| 1 | lmolvieMouseDrive | 
| 2 | lmolvieMouseParallel | 
| 3 | lmolvieMouseNormal | 
サブ
Drive
extern void lmolvieMouseDrive(int button, int state, int x, int y);
buttonとstateにより#視点移動を行います。
| state | button | 処理 | 
|---|---|---|
| GLUT_DOWN | GLUT_LEFT_BUTTON | 中心に近づく(__accelerator=1) | 
| GLUT_DOWN | GLUT_RIGHT_BUTTON | 中心から離れる(__accelerator=2) | 
| GLUT_DOWN | GLUT_LEFT_BUTTON | 停止(__accelerator=0) | 
| GLUT_DOWN | GLUT_RIGHT_BUTTON | 停止(__accelerator=0) | 
Parallel
extern void lmolvieMouseParallel(int button, int state, int x, int y);
処理なし
Multi
extern void lmolvieMouseMulti(int button, int state, int x, int y);
処理なし
ドラッグ
メイン
マウスのドラッグ操作による処理です。(x, y:座標)
extern void lmolvieMouseMotion(int x, int y);
#操作モードに依った処理を行います。MOTION_FUNCTIONが定義されているときのみ有効です。
| 操作モード | 処理 | 
|---|---|
| 0 | lmolvieMouseMotionNormal | 
| 1 | lmolvieMouseMotionDrive | 
| 2 | lmolvieMouseMotionParallel | 
| 3 | lmolvieMouseMotionNormal | 
サブ
Drive
extern void lmolvieMouseMotionDrive(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 | 
|---|---|
| GLUT_LEFT_BUTTON | #視点回転 | 
| GLUT_MIDDLE_BUTTON | #視点回転 | 
| GLUT_RIGHT_BUTTON | #中心回転 | 
Parallel
extern void lmolvieMouseMotionParallel(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 | 
|---|---|
| GLUT_LEFT_BUTTON | 物体回転(proteinRotateX, proteinRotateY) | 
| GLUT_MIDDLE_BUTTON | #中心移動 | 
| GLUT_RIGHT_BUTTON | #中心回転 | 
Multi
extern void lmolvieMouseMotionMulti(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 | 
|---|---|
| GLUT_LEFT_BUTTON | 物体回転(proteinRotateX, proteinRotateY) | 
| GLUT_MIDDLE_BUTTON | #中心移動 | 
| GLUT_RIGHT_BUTTON | #中心回転 | 
マウス移動
メイン
ボタンを押していない状態でのマウス移動による処理です。
extern void lmolvieMousePassiveMotion(int x, int y);
#操作モードに依った処理を行います。PASSIVEMOTION_FUNCTIONが定義されているときのみ有効です。
| 操作モード | 処理 | 
|---|---|
| 0 | lmolvieMousePassiveMotionNormal | 
| 1 | lmolvieMousePassiveMotionDrive | 
| 2 | lmolvieMousePassiveMotionParallel | 
| 3 | lmolvieMousePassiveMotionNormal | 
サブ
Drive
extern void lmolvieMousePassiveMotionDrive(int x, int y);
処理なし
Parallel
extern void lmolvieMousePassiveMotionParallel(int x, int y);
処理なし
Multi
extern void lmolvieMousePassiveMotionMulti(int x, int y);
処理なし
キーボード
extern void lmolvieKeyboard(unsigned char pushkey, int x, int y); extern void lmolvieKeyboardNormal(unsigned char pushkey, int x, int y); extern void lmolvieKeyboardDrive(unsigned char pushkey, int x, int y); extern void lmolvieKeyboardParallel(unsigned char pushkey, int x, int y); extern void lmolvieKeyboardSurface(unsigned char pushkey, int x, int y);
extern void lmolvieInitParallel(void); extern void lmolvieDisplayParallel(void); extern void lmolvieReshapeParallel(int width, int height);
操作モードの設定・取得
現在の#操作モードを返します。
extern operationMode operationModeGet(void);
現在の#操作モードをoperationModeに設定します。
extern void operationModeSet(operationMode);
extern void lmolvieLightSet(void); extern GLfloat* get_LightPos(int index);
extern void monoSound(float amplitude, float Hz); extern void lmolvieVoice(void);
extern void drawContour(contourLinesSet* contour);
extern void scaleBarSwitch();
molvieViewer
extern void lmolvieViewerIdle(void); extern void lmolvieViewerKeyboard(unsigned char pushkey, int x, int y); extern void lmolvieViewerSpecial(int pushkey, int x, int y); extern void lmolvieViewerMouse(int button, int state, int x, int y); extern void lmolvieViewerMouseMotion(int x, int y); extern void lmolvieViewerMousePassiveMotion(int x, int y); extern void lmolvieViewerDisplay(void);
molvieMrcViewer
extern void lmolvieMrcViewerKeyboard(unsigned char pushkey, int x, int y); extern void lmolvieMrcViewerMouse(int button, int state, int x, int y); extern void lmolvieMrcViewerMouseMotion(int x, int y); extern void lmolvieMrcViewerMousePassiveMotion(int x, int y); extern void lmolvieMrcViewerDisplay(void);
molvieProjection
extern void lmolvieProjectionKeyboard(unsigned char pushkey, int x, int y); extern void lmolvieProjectionMouse(int button, int state, int x, int y); extern void lmolvieProjectionMouseMotion(int x, int y); extern void lmolvieProjectionMousePassiveMotion(int x, int y);
molvieDock
extern void lmolvieDockKeyboard(unsigned char pushkey, int x, int y); extern void displayMultiPDB1(); extern void lmolvieDockDisplay(void);
molvieFlight
extern void lmolvieFlightKeyboard(unsigned char pushkey, int x, int y); extern void lmolvieFlightDisplay(void); extern void lmolvieFlightIdle(void);
molvieTest
extern void lmolvieTest(void); extern GLboolean myDisplayListMakeAtom(void);
カメラ
中心回転
中心座標をangle[radian]だけ回転します。
extern void myCameraRotateX(GLdouble angle); extern void myCameraRotateY(GLdouble angle); extern void myCameraRotateZ(GLdouble angle);
視点回転
視点座標をangle[radian]だけ回転します。
extern void myCameraEyeRotateX(GLdouble angle); extern void myCameraEyeRotateY(GLdouble angle);
中心移動
中心座標をpanだけマイナスして移動します。
extern void myCameraTranslateX(GLdouble pan); extern void myCameraTranslateY(GLdouble pan); extern void myCameraTranslateZ(GLdouble pan);
視点移動
視点座標を移動します。
extern void moveMyCamera(double movedistance);
movedistanceにより移動方向を選択できます。(移動距離は中心と視点間の1/50)
| movedistance | 移動方向 | 
|---|---|
| 1.0 | 中心に近づく | 
| それ以外 | 中心から離れる | 
座標設定
視点・中心座標をPDBファイルの中心(__pdbCenter)に合わせます。
extern void resetMyCamera();
現在の視点座標を中心座標に設定します。(各座標間が元の1/100となる)
extern void setDriveMyCamera();
視点・中心座標をPDBファイルの中心(__pdbCenter)に合わせます。(各座標間が元の1/100となる)
extern void resetDriveMyCamera();
cameraInfo型のカメラ情報をポインタとして返します。
extern cameraInfo* getMyCamera(void);
Upの長さが1になるように再計算します。
extern void upCalc();
extern void setCameraCentreTag(int tag);