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
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);
マウスイベント
クリック
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 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);