lmolvie(API)
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
初期設定
Normal mode
extern void lmolvieInitNormal(void);
Parallel mode
extern void lmolvieInitParallel(void);
画面表示
Normal mode
extern void lmolvieDisplayNormal(void);
Parallel mode
extern void lmolvieDisplayParallel(void);
画面表示のテスト
extern void lmolvieDisplayTest(void);
再表示
Normal mode
extern void lmolvieReshapeNormal(int width, int height);
Parallel mode
extern void lmolvieReshapeParallel(int width, int height);
アイドル処理
テストメッセージの表示
extern void lmolvieIdleTest(void);
Normal mode
extern void lmolvieIdleNormal(void);
スタティック変数__accelerator(初期値: 0)に依って#視点移動を行います。
| __accelerator | 処理 |
|---|---|
| 1 | 中心に近づく |
| 2 | 中心から離れる |
| それ以外 | 停止(何もしない) |
マウスイベント
クリック
MOUSE_FUNCTIONが定義されているときのみ有効です。
メイン
クリック操作の処理です。(button:対応ボタン、state:状態、x, y:座標)
extern void lmolvieMouse(int button, int state, int x, int y);
#操作モードに依った処理を行います。
| 操作モード | 処理 |
|---|---|
| 0 | lmolvieMouseNormal |
| 1 | lmolvieMouseDrive |
| 2 | lmolvieMouseParallel |
| 3 | lmolvieMouseNormal |
Drive mode時
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 mode時
処理なし
extern void lmolvieMouseParallel(int button, int state, int x, int y);
MultiProtein mode時
処理なし
extern void lmolvieMouseMulti(int button, int state, int x, int y);
ドラッグ
MOTION_FUNCTIONが定義されているときのみ有効です。
メイン
マウスのドラッグ操作による処理です。(x, y:座標)
extern void lmolvieMouseMotion(int x, int y);
#操作モードに依った処理を行います。
| 操作モード | 処理 |
|---|---|
| 0 | lmolvieMouseMotionNormal |
| 1 | lmolvieMouseMotionDrive |
| 2 | lmolvieMouseMotionParallel |
| 3 | lmolvieMouseMotionNormal |
Drive mode時
extern void lmolvieMouseMotionDrive(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 |
|---|---|
| GLUT_LEFT_BUTTON | #視点回転 |
| GLUT_MIDDLE_BUTTON | #視点回転 |
| GLUT_RIGHT_BUTTON | #中心回転 |
Parallel mode時
extern void lmolvieMouseMotionParallel(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 |
|---|---|
| GLUT_LEFT_BUTTON | 物体回転(proteinRotateX, proteinRotateY) |
| GLUT_MIDDLE_BUTTON | #中心移動 |
| GLUT_RIGHT_BUTTON | #中心回転 |
MultiProtein mode時
extern void lmolvieMouseMotionMulti(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 |
|---|---|
| GLUT_LEFT_BUTTON | 物体回転(proteinRotateX, proteinRotateY) |
| GLUT_MIDDLE_BUTTON | #中心移動 |
| GLUT_RIGHT_BUTTON | #中心回転 |
マウス移動
PASSIVEMOTION_FUNCTIONが定義されているときのみ有効です。
メイン
ボタンを押していない状態でのマウス移動による処理です。
extern void lmolvieMousePassiveMotion(int x, int y);
#操作モードに依った処理を行います。
| 操作モード | 処理 |
|---|---|
| 0 | lmolvieMousePassiveMotionNormal |
| 1 | lmolvieMousePassiveMotionDrive |
| 2 | lmolvieMousePassiveMotionParallel |
| 3 | lmolvieMousePassiveMotionNormal |
Drive mode時
処理なし
extern void lmolvieMousePassiveMotionDrive(int x, int y);
Parallel mode時
処理なし
extern void lmolvieMousePassiveMotionParallel(int x, int y);
MultiProtein mode時
処理なし
extern void lmolvieMousePassiveMotionMulti(int x, int y);
キーボードイベント
KEYBOARD_FUNCTIONが定義されているときのみ有効です。
メイン
extern void lmolvieKeyboard(unsigned char pushkey, int x, int y);
#操作モードに依った処理を行います。
| 操作モード | 処理 |
|---|---|
| 0 | lmolvieKeyboardNormal |
| 1 | lmolvieKeyboardDrive |
| 2 | lmolvieKeyboardParallel |
| 3 | lmolvieKeyboardSurface |
| 4 | lmolvieKeyboardMulti |
Normal mode時
extern void lmolvieKeyboardNormal(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| d | Drive mode |
| l | Parallel mode |
| t | Surface mode |
| m | MultiProtein mode(未実装) |
| C | Coaster mode(未実装) |
| c | C switchの切り替え(ON, mainChain, OFF) |
| o | O switchの切り替え(ON, OFF) |
| n | N switchの切り替え(ON, OFF) |
| s | S switchの切り替え(ON, OFF) |
| p | P switchの切り替え(ON, OFF) |
| h | H switchの切り替え(ON, OFF) |
| f | Fe switchの切り替え(ON, OFF) |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| 8 | DistanceFromTarget mode |
| 9 | WireFrame mode |
| ! | Chain mode |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| F | CentreTagの切り替え(ON, OFF) |
| Z | DSN6読み込み(未実装) |
| b | 状態保存(未実装) |
| g | 状態読込(未実装) |
Drive mode時
extern void lmolvieKeyboardDrive(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| n | Normal mode |
| c | check! |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| s | speed change |
MultiProtein mode時
extern void lmolvieKeyboardParallel(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| n | Normal mode |
| d | Drive mode |
| i | PDBデータの読み込み(loadPDB1) |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| F | CentreTagの切り替え(ON, OFF) |
Surface mode時
extern void lmolvieKeyboardSurface(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| n | Normal mode |
| d | Drive mode |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| y | Density +0.1 |
| h | Density -0.1 |
| u | Density +1.0 |
| j | Density -1.0 |
| i | Density +10.0 |
| k | Density -10.0 |
| F | CentreTagの切り替え(ON, OFF) |
操作モードの設定・取得
現在の#操作モードを返します。
extern operationMode operationModeGet(void);
現在の#操作モードをoperationModeに設定します。
extern void operationModeSet(operationMode);
光源
光源の設定
extern void lmolvieLightSet(void);
光源の位置を取得(index=0, 1)
extern GLfloat* get_LightPos(int index);
サウンド
extern void monoSound(float amplitude, float Hz);
Voice(未実装)
extern void lmolvieVoice(void);
境界線
境界線を描画します。
extern void drawContour(contourLinesSet* contour);
スケールバー
スケールバーを切り替えます。(無し, 1nm, 5nm, 10nm)
extern void scaleBarSwitch();
molvieViewer
画面表示
extern void lmolvieViewerDisplay(void);
アイドル処理
処理なし
extern void lmolvieViewerIdle(void);
マウスイベント
クリック
処理なし
extern void lmolvieViewerMouse(int button, int state, int x, int y);
ドラッグ
extern void lmolvieViewerMouseMotion(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 |
|---|---|
| GLUT_LEFT_BUTTON | #中心回転 |
| GLUT_MIDDLE_BUTTON | 処理なし |
| GLUT_RIGHT_BUTTON | #視点回転 |
マウス移動
処理なし
extern void lmolvieViewerMousePassiveMotion(int x, int y);
キーボードイベント
extern void lmolvieViewerKeyboard(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| c | C switchの切り替え(ON, mainChain, OFF) |
| o | O switchの切り替え(ON, OFF) |
| n | N switchの切り替え(ON, OFF) |
| s | S switchの切り替え(ON, OFF) |
| p | P switchの切り替え(ON, OFF) |
| h | H switchの切り替え(ON, OFF) |
| f | Fe switchの切り替え(ON, OFF) |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| 8 | DistanceFromTarget mode |
| 9 | WireFrame mode |
| ! | Chain mode |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| F | CentreTagの切り替え(ON, OFF) |
| b | 状態保存(未実装) |
| g | 状態読込(未実装) |
特殊キーイベント
extern void lmolvieViewerSpecial(int pushkey, int x, int y);
molvieMrcViewer
画面表示
extern void lmolvieMrcViewerDisplay(void);
マウスイベント
クリック
処理なし
extern void lmolvieMrcViewerMouse(int button, int state, int x, int y);
ドラッグ
extern void lmolvieMrcViewerMouseMotion(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 |
|---|---|
| GLUT_LEFT_BUTTON | #中心回転 |
| GLUT_MIDDLE_BUTTON | 処理なし |
| GLUT_RIGHT_BUTTON | #視点回転 |
マウス移動
処理なし
extern void lmolvieMrcViewerMousePassiveMotion(int x, int y);
キーボードイベント
extern void lmolvieMrcViewerKeyboard(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| y | Density +0.1 |
| h | Density -0.1 |
| u | Density +1.0 |
| j | Density -1.0 |
| i | Density +10.0 |
| k | Density -10.0 |
| F | CentreTagの切り替え(ON, OFF) |
molvieProjection
マウスイベント
クリック
処理なし
extern void lmolvieProjectionMouse(int button, int state, int x, int y);
ドラッグ
extern void lmolvieProjectionMouseMotion(int x, int y);
ドラッグ時のボタンpressedButtonに依った処理を行います。
| pressedButton | 処理 |
|---|---|
| GLUT_LEFT_BUTTON | 物体回転(proteinRotateX, proteinRotateY) |
| GLUT_MIDDLE_BUTTON | #中心移動 |
| GLUT_RIGHT_BUTTON | #中心回転 |
マウス移動
処理なし
extern void lmolvieProjectionMousePassiveMotion(int x, int y);
キーボードイベント
extern void lmolvieProjectionKeyboard(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| s | save PPM |
| l | |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| u | テクスチャのスケール+0.01 |
| d | テクスチャのスケール-0.01 |
| g | テクスチャのx座標+0.5 |
| j | テクスチャのx座標-0.5 |
| y | テクスチャのy座標+0.5 |
| h | テクスチャのy座標-0.5 |
| b | テクスチャのz座標+0.5 |
| n | テクスチャのz座標-0.5 |
| i | スケール+0.01 |
| k | スケール-0.01 |
| S | スケールバーの切り替え(無し, 1nm, 5nm, 10nm) |
| p | Parallel mode |
| R | 回転座標(x, y, z)の出力 |
| X | 回転座標xを標準入力で取得 |
| Y | 回転座標yを標準入力で取得 |
| Z | 回転座標zを標準入力で取得 |
molvieDock
画面表示
extern void lmolvieDockDisplay(void);
PDBファイルの描画
extern void displayMultiPDB1();
キーボードイベント
extern void lmolvieDockKeyboard(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| i | PDBデータの読み込み(loadPDB1) |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| c | Protein Change |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| F | CentreTagの切り替え(ON, OFF) |
molvieFlight
画面表示
extern void lmolvieFlightDisplay(void);
アイドル処理
extern void lmolvieFlightIdle(void);
キーボードイベント
extern void lmolvieFlightKeyboard(unsigned char pushkey, int x, int y);
キーpushkeyによる処理を行います。
| pushkey | 処理 |
|---|---|
| q | 終了 |
| c | check! |
| 0 | NoneAtom mode |
| 1 | Atom mode |
| 2 | Number mode |
| 3 | AminoAcid mode |
| 4 | Temperature mode |
| 5 | CStickNumber mode |
| 6 | CStickAminoAcid mode |
| 7 | CStickTemperature mode |
| v | voice! |
| r | camera reset |
| w | 中心に近づく |
| e | 中心から離れる |
| s | speed change |
molvieTest
extern void lmolvieTest(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再計算
Upの長さが1になるように再計算します。
extern void upCalc();
CentreTagの切り替え(ON, OFF)
extern void setCameraCentreTag(int tag);
PDB関連
ファイルfptInからPDBを読み込んで、pdbInへ格納します。
extern void lmolviePDBread(FILE* fptIn);
pdbInを返します。
extern pdbFile* get_pdb(void);
get_pdbで取得したPDBを描画します。
extern GLboolean myDisplayListMakeAtom(void);