| 
 | Generated by diff2html.pl © Yves Bailly, MandrakeSoft S.A. 2001, Ryohei Morita 2007 diff2html.pl is licensed under the GNU GPL. | 
| ../11-03/ic2-CommonHeaders.h | ic2-CommonHeaders.h | |||
|---|---|---|---|---|
| 93 lines 2887 bytes Last modified : Mon Nov 19 12:40:45 2012 | 97 lines 2972 bytes Last modified : Mon Nov 19 18:48:31 2012 | |||
| 1 | // Keisanki Joron 2 (Introduction to Computing II) | 1 | // Keisanki Joron 2 (Introduction to Computing II) | |
| 2 | // Dept. of Engineering Systems, University of Tsukuba | 2 | // Dept. of Engineering Systems, University of Tsukuba | |
| 3 | // [UTF-8 / Unix] | 3 | // [UTF-8 / Unix] | |
| 4 | // 計算機序論2・実習 (筑波大学工学システム学類) | 4 | // 計算機序論2・実習 (筑波大学工学システム学類) | |
| 5 | 5 | |||
| 6 | // 2012/11/19a kameda[at]iit.tsukuba.ac.jp | 6 | // 2012/11/19a kameda[at]iit.tsukuba.ac.jp | |
| 7 | // 11.02. プログラム統合 | 7 | // 11.04. ポリゴン表示 | |
| 8 | 8 | |||
| 9 | // *********************************************************************** | 9 | // *********************************************************************** | |
| 10 | // CommonHeaders.h : common header files ********************************* | 10 | // CommonHeaders.h : common header files ********************************* | |
| 11 | 11 | |||
| 12 | // +++-------------------------------------------------- | 12 | // +++-------------------------------------------------- | |
| 13 | // どの部分ソースでも利用する可能性が高いライブラリ(関数)に | 13 | // どの部分ソースでも利用する可能性が高いライブラリ(関数)に | |
| 14 | // 相当するヘッダファイル | 14 | // 相当するヘッダファイル | |
| 15 | // +++-------------------------------------------------- | 15 | // +++-------------------------------------------------- | |
| 16 | 16 | |||
| 17 | #include <stdio.h> // printf() | 17 | #include <stdio.h> // printf() | |
| 18 | #include <stdlib.h> // exit(), calloc(), free() | 18 | #include <stdlib.h> // exit(), calloc(), free() | |
| 19 | #include <GL/glut.h> // gl*(), glut*() | 19 | #include <GL/glut.h> // gl*(), glut*() | |
| 20 | 20 | |||
| 21 | // +++-------------------------------------------------- | 21 | // +++-------------------------------------------------- | |
| 22 | // マクロ | 22 | // マクロ | |
| 23 | // +++-------------------------------------------------- | 23 | // +++-------------------------------------------------- | |
| 24 | 24 | |||
| 25 | #define IC2DEFAULTMODEL "ic2_DefaultModel.txt" | 25 | #define IC2DEFAULTMODEL "ic2_DefaultModel.txt" | |
| 26 | 26 | |||
| 27 | // +++-------------------------------------------------- | 27 | // +++-------------------------------------------------- | |
| 28 | // 構造体 | 28 | // 構造体 | |
| 29 | // +++-------------------------------------------------- | 29 | // +++-------------------------------------------------- | |
| 30 | 30 | |||
| 31 | // +---------------------------------------------------- | 31 | // +---------------------------------------------------- | |
| 32 | // 1つの点の3次元位置のための構造体 | 32 | // 1つの点の3次元位置のための構造体 | |
| 33 | // +---------------------------------------------------- | 33 | // +---------------------------------------------------- | |
| 34 | struct ic2POINT { | 34 | struct ic2POINT { | |
| 35 | float x; | 35 | float x; | |
| 36 | float y; | 36 | float y; | |
| 37 | float z; | 37 | float z; | |
| 38 | }; | 38 | }; | |
| 39 | 39 | |||
| 40 | // +---------------------------------------------------- | 40 | // +---------------------------------------------------- | |
| 41 | // RGB反射率のための構造体 | 41 | // RGB反射率のための構造体 | |
| 42 | // +---------------------------------------------------- | 42 | // +---------------------------------------------------- | |
| 43 | struct ic2COLOR { | 43 | struct ic2COLOR { | |
| 44 | float r; | 44 | float r; | |
| 45 | float g; | 45 | float g; | |
| 46 | float b; | 46 | float b; | |
| 47 | }; | 47 | }; | |
| 48 | 48 | |||
| 49 | // +---------------------------------------------------- | 49 | // +---------------------------------------------------- | |
| 50 | // 1つの三角形パッチのための構造体 | 50 | // 1つの三角形パッチのための構造体 | |
| 51 | // 次の三角形パッチへのポインタを持つ。 | 51 | // 次の三角形パッチへのポインタを持つ。 | |
| 52 | // +---------------------------------------------------- | 52 | // +---------------------------------------------------- | |
| 53 | struct ic2PATCH { | 53 | struct ic2PATCH { | |
| 54 | struct ic2POINT s; // 頂点s | 54 | struct ic2POINT s; // 頂点s | |
| 55 | struct ic2POINT t; // 頂点t | 55 | struct ic2POINT t; // 頂点t | |
| 56 | struct ic2POINT u; // 頂点u | 56 | struct ic2POINT u; // 頂点u | |
| 57 | struct ic2COLOR c; // 色の強度 (通常は0.0 - 1.0) | 57 | struct ic2COLOR c; // 色の強度 (通常は0.0 - 1.0) | |
| 58 | struct ic2PATCH *next; // 次の三角形パッチへのポインタ | 58 | struct ic2PATCH *next; // 次の三角形パッチへのポインタ | |
| 59 | }; | 59 | }; | |
| 60 | 60 | |||
| 61 | // +++-------------------------------------------------- | 61 | // +++-------------------------------------------------- | |
| 62 | // この授業で作った関数のプロトタイプ | 62 | // この授業で作った関数のプロトタイプ | |
| 63 | // +++-------------------------------------------------- | 63 | // +++-------------------------------------------------- | |
| 64 | 64 | |||
| 65 | // 07-04-Callback.c | 65 | // 07-04-Callback.c | |
| 66 | void ic2_timerhandler(int keynumber); | 66 | void ic2_timerhandler(int keynumber); | |
| 67 | void ic2_NormalKeyInput(unsigned char key, int x, int y); | 67 | void ic2_NormalKeyInput(unsigned char key, int x, int y); | |
| 68 | 68 | |||
| 69 | // 07-03-EmbededObjects.c | 69 | // 07-03-EmbededObjects.c | |
| 70 | void ic2_OpenGLLogo (float s); | 70 | void ic2_OpenGLLogo (float s); | |
| 71 | 71 | |||
| 72 | // 07-03-Initialization.c | 72 | // 07-03-Initialization.c | |
| 73 | void ic2_BootWindow (char winname[]); | 73 | void ic2_BootWindow (char winname[]); | |
| 74 | 74 | |||
| 75 | // 09-01-Projection.c | 75 | // 09-01-Projection.c | |
| 76 | void ic2_SetUpCamera_Ortho (void); | 76 | void ic2_SetUpCamera_Ortho (void); | |
| 77 | void ic2_SetUpCamera_Perspective (void); | 77 | void ic2_SetUpCamera_Perspective (void); | |
| 78 | 78 | |||
| 79 | // 07-03-Rendering.c | 79 | // 07-03-Rendering.c | |
| 80 | void ic2_DrawFrame (void); | 80 | void ic2_DrawFrame (void); | |
| 81 | 81 | |||
| 82 | // 08-01 | 82 | // 08-01 | |
| 83 | void ic2_ShowMATRIX (char *str); | 83 | void ic2_ShowMATRIX (char *str); | |
| 84 | 84 | |||
| 85 | // 10-02-ReadModel.c | 85 | // 10-02-ReadModel.c | |
| 86 | int ic2_ReadModel(char *, struct ic2PATCH **); | 86 | int ic2_ReadModel(char *, struct ic2PATCH **); | |
| 87 | 87 | |||
| 88 | // 11-04-FileObjects.c | |||
| 89 | int ic2_DrawModel(void); | |||
| 90 | ||||
| 88 | // +++-------------------------------------------------- | 91 | // +++-------------------------------------------------- | |
| 89 | // この授業で使う大域変数の外部宣言 | 92 | // この授業で使う大域変数の外部宣言 | |
| 90 | // +++-------------------------------------------------- | 93 | // +++-------------------------------------------------- | |
| 91 | 94 | |||
| 92 | // 07-05-MainFunction.c | 95 | // 11-04-MainFunction.c | |
| 93 | extern float logoscale; | 96 | extern float logoscale; | |
| 97 | extern struct ic2PATCH *firstpatchptr; |