first commit
10745
CS4451/proj2/Examples/al.t
Normal file
BIN
CS4451/proj2/Examples/al.t.gz
Normal file
12571
CS4451/proj2/Examples/ant.t
Normal file
BIN
CS4451/proj2/Examples/ant.t.gz
Normal file
105401
CS4451/proj2/Examples/bunny2.t
Normal file
BIN
CS4451/proj2/Examples/bunny2.t.gz
Normal file
8710
CS4451/proj2/Examples/cow.t
Normal file
BIN
CS4451/proj2/Examples/cow.t.gz
Normal file
6939
CS4451/proj2/Examples/f-16.t
Normal file
BIN
CS4451/proj2/Examples/f-16.t.gz
Normal file
149599
CS4451/proj2/Examples/feline2.t
Normal file
BIN
CS4451/proj2/Examples/feline2.t.gz
Normal file
509
CS4451/proj2/Examples/floppy.t
Normal file
@@ -0,0 +1,509 @@
|
||||
336 170
|
||||
|
||||
0 1 2
|
||||
1 0 3
|
||||
0 2 4
|
||||
5 0 4
|
||||
5 4 6
|
||||
5 6 7
|
||||
5 7 8
|
||||
9 5 8
|
||||
10 11 12
|
||||
13 10 12
|
||||
13 12 14
|
||||
15 13 14
|
||||
15 14 16
|
||||
17 15 16
|
||||
18 17 16
|
||||
19 18 16
|
||||
19 16 11
|
||||
19 11 10
|
||||
19 10 20
|
||||
19 20 21
|
||||
22 23 24
|
||||
25 26 27
|
||||
9 27 28
|
||||
1 3 9
|
||||
1 9 28
|
||||
29 1 28
|
||||
30 29 28
|
||||
30 28 31
|
||||
21 30 31
|
||||
21 31 32
|
||||
21 32 33
|
||||
19 21 33
|
||||
19 33 22
|
||||
19 22 24
|
||||
34 19 24
|
||||
35 36 34
|
||||
35 34 24
|
||||
37 35 24
|
||||
38 20 10
|
||||
39 38 10
|
||||
40 21 20
|
||||
38 40 20
|
||||
41 30 21
|
||||
40 41 21
|
||||
42 29 30
|
||||
41 42 30
|
||||
43 1 29
|
||||
42 43 29
|
||||
44 2 1
|
||||
43 44 1
|
||||
45 4 2
|
||||
44 45 2
|
||||
46 6 4
|
||||
45 46 4
|
||||
47 7 6
|
||||
46 47 6
|
||||
48 8 7
|
||||
47 48 7
|
||||
49 50 8
|
||||
48 49 8
|
||||
51 25 50
|
||||
49 51 50
|
||||
52 26 25
|
||||
51 52 25
|
||||
53 27 26
|
||||
52 53 26
|
||||
54 28 27
|
||||
53 54 27
|
||||
55 31 28
|
||||
54 55 28
|
||||
56 32 31
|
||||
55 56 31
|
||||
57 33 32
|
||||
56 57 32
|
||||
58 22 33
|
||||
57 58 33
|
||||
59 23 22
|
||||
58 59 22
|
||||
60 24 23
|
||||
59 60 23
|
||||
61 37 24
|
||||
60 61 24
|
||||
62 35 37
|
||||
61 62 37
|
||||
63 36 35
|
||||
62 63 35
|
||||
64 34 36
|
||||
63 64 36
|
||||
65 19 34
|
||||
64 65 34
|
||||
66 18 19
|
||||
65 66 19
|
||||
67 17 18
|
||||
66 67 18
|
||||
68 15 17
|
||||
67 68 17
|
||||
69 13 15
|
||||
68 69 15
|
||||
39 10 13
|
||||
69 39 13
|
||||
70 3 0
|
||||
71 70 0
|
||||
72 9 3
|
||||
70 72 3
|
||||
73 5 9
|
||||
72 73 9
|
||||
71 0 5
|
||||
73 71 5
|
||||
74 11 16
|
||||
75 74 16
|
||||
76 12 11
|
||||
74 76 11
|
||||
77 14 12
|
||||
76 77 12
|
||||
75 16 14
|
||||
77 75 14
|
||||
44 43 71
|
||||
70 71 43
|
||||
45 44 71
|
||||
45 71 73
|
||||
46 45 73
|
||||
47 46 73
|
||||
48 47 73
|
||||
48 73 72
|
||||
76 74 39
|
||||
76 39 69
|
||||
77 76 69
|
||||
77 69 68
|
||||
75 77 68
|
||||
75 68 67
|
||||
75 67 66
|
||||
75 66 65
|
||||
74 75 65
|
||||
39 74 65
|
||||
38 39 65
|
||||
40 38 65
|
||||
60 59 58
|
||||
53 52 51
|
||||
53 51 49
|
||||
53 49 48
|
||||
53 48 72
|
||||
54 53 72
|
||||
72 70 43
|
||||
54 72 43
|
||||
54 43 42
|
||||
54 42 41
|
||||
55 54 41
|
||||
55 41 40
|
||||
56 55 40
|
||||
57 56 40
|
||||
57 40 65
|
||||
58 57 65
|
||||
60 58 65
|
||||
60 65 64
|
||||
64 63 62
|
||||
60 64 62
|
||||
60 62 61
|
||||
78 50 25
|
||||
8 50 78
|
||||
79 78 25
|
||||
79 25 27
|
||||
79 27 80
|
||||
81 8 78
|
||||
80 27 82
|
||||
81 9 8
|
||||
82 27 9
|
||||
82 9 83
|
||||
9 81 83
|
||||
84 83 81
|
||||
85 86 87
|
||||
86 88 89
|
||||
85 88 86
|
||||
85 90 88
|
||||
91 90 85
|
||||
89 78 86
|
||||
87 86 78
|
||||
78 79 87
|
||||
85 87 79
|
||||
85 79 80
|
||||
89 81 78
|
||||
91 85 80
|
||||
82 91 80
|
||||
90 91 82
|
||||
88 90 83
|
||||
90 82 83
|
||||
83 84 88
|
||||
89 88 84
|
||||
89 84 81
|
||||
92 93 94
|
||||
92 94 95
|
||||
96 97 98
|
||||
97 96 99
|
||||
97 99 100
|
||||
97 100 101
|
||||
102 103 96
|
||||
104 105 106
|
||||
107 104 106
|
||||
96 98 108
|
||||
102 96 108
|
||||
106 102 108
|
||||
106 108 109
|
||||
107 106 109
|
||||
110 107 109
|
||||
110 109 97
|
||||
101 110 97
|
||||
111 95 94
|
||||
112 111 94
|
||||
113 92 95
|
||||
111 113 95
|
||||
114 93 92
|
||||
113 114 92
|
||||
112 94 93
|
||||
114 112 93
|
||||
115 97 109
|
||||
116 115 109
|
||||
117 98 97
|
||||
115 117 97
|
||||
118 108 98
|
||||
117 118 98
|
||||
116 109 108
|
||||
118 116 108
|
||||
119 99 96
|
||||
120 119 96
|
||||
121 100 99
|
||||
119 121 99
|
||||
122 101 100
|
||||
121 122 100
|
||||
123 110 101
|
||||
122 123 101
|
||||
124 107 110
|
||||
123 124 110
|
||||
125 104 107
|
||||
124 125 107
|
||||
126 105 104
|
||||
125 126 104
|
||||
127 106 105
|
||||
126 127 105
|
||||
128 102 106
|
||||
127 128 106
|
||||
129 103 102
|
||||
128 129 102
|
||||
120 96 103
|
||||
129 120 103
|
||||
112 114 113
|
||||
111 112 113
|
||||
117 115 120
|
||||
119 120 115
|
||||
121 119 115
|
||||
122 121 115
|
||||
120 129 128
|
||||
127 126 125
|
||||
127 125 124
|
||||
118 117 120
|
||||
118 120 128
|
||||
118 128 127
|
||||
116 118 127
|
||||
116 127 124
|
||||
116 124 123
|
||||
115 116 123
|
||||
115 123 122
|
||||
130 131 132
|
||||
133 130 132
|
||||
133 132 134
|
||||
133 134 135
|
||||
133 135 136
|
||||
133 136 137
|
||||
138 137 136
|
||||
139 138 136
|
||||
140 133 137
|
||||
138 140 137
|
||||
141 130 133
|
||||
140 141 133
|
||||
142 131 130
|
||||
141 142 130
|
||||
143 132 131
|
||||
142 143 131
|
||||
144 134 132
|
||||
143 144 132
|
||||
145 135 134
|
||||
144 145 134
|
||||
139 136 135
|
||||
145 139 135
|
||||
143 142 141
|
||||
143 141 140
|
||||
144 143 140
|
||||
145 144 140
|
||||
139 145 140
|
||||
138 139 140
|
||||
146 147 148
|
||||
146 148 149
|
||||
146 149 150
|
||||
151 146 150
|
||||
147 146 152
|
||||
153 147 152
|
||||
154 153 152
|
||||
154 152 155
|
||||
156 154 155
|
||||
156 155 151
|
||||
156 151 150
|
||||
157 156 150
|
||||
158 148 147
|
||||
159 158 147
|
||||
160 149 148
|
||||
158 160 148
|
||||
161 150 149
|
||||
160 161 149
|
||||
162 157 150
|
||||
161 162 150
|
||||
163 156 157
|
||||
162 163 157
|
||||
164 154 156
|
||||
163 164 156
|
||||
165 153 154
|
||||
164 165 154
|
||||
159 147 153
|
||||
165 159 153
|
||||
166 152 146
|
||||
167 166 146
|
||||
168 155 152
|
||||
166 168 152
|
||||
169 151 155
|
||||
168 169 155
|
||||
167 146 151
|
||||
169 167 151
|
||||
158 159 167
|
||||
160 158 167
|
||||
161 160 167
|
||||
161 167 169
|
||||
166 167 159
|
||||
166 159 165
|
||||
166 165 164
|
||||
168 166 164
|
||||
168 164 163
|
||||
169 168 163
|
||||
161 169 163
|
||||
161 163 162
|
||||
|
||||
-33.9228 133.358 -113.18
|
||||
-60.5042 -15.9514 -88.4628
|
||||
-26.0446 156.953 -111.853
|
||||
-36.9026 118.406 -111.158
|
||||
-40.2375 157.044 -132.089
|
||||
-42.7537 133.415 -125.771
|
||||
-44.0468 154.424 -136.412
|
||||
-46.4033 148.354 -137.223
|
||||
-105.804 -149.692 -96.9047
|
||||
-45.7336 118.463 -123.749
|
||||
62.4998 -16.7413 86.9158
|
||||
101.795 117.516 86.5972
|
||||
92.9644 117.572 74.0061
|
||||
96.9595 156.163 63.526
|
||||
95.9442 132.524 71.9834
|
||||
111.703 156.068 84.5473
|
||||
104.775 132.467 84.5745
|
||||
113.861 153.55 88.6739
|
||||
114.059 148.409 91.1087
|
||||
56.6231 -139.782 130.094
|
||||
60.0403 -23.2133 86.1269
|
||||
55.8653 -26.0915 81.3911
|
||||
29.5055 -69.6665 62.1318
|
||||
12.9411 -152.78 73.3751
|
||||
15.4038 -152.795 76.8864
|
||||
-103.113 -158.438 -89.4115
|
||||
-89.2861 -158.527 -69.6974
|
||||
-71.4471 -69.0181 -81.8059
|
||||
-68.376 -61.675 -80.5115
|
||||
-60.3655 -21.9282 -85.7615
|
||||
-57.6089 -25.3628 -80.4
|
||||
-64.2444 -58.8671 -75.8079
|
||||
26.3622 -59.449 53.3785
|
||||
29.3604 -62.6247 58.9755
|
||||
44.9544 -159.389 121.702
|
||||
34.891 -157.712 106.678
|
||||
35.1261 -159.326 107.689
|
||||
16.2075 -157.592 80.0395
|
||||
52.0008 -20.8468 91.7762
|
||||
54.4602 -14.3748 92.5652
|
||||
47.8257 -23.725 87.0404
|
||||
-65.6485 -22.9962 -74.7507
|
||||
-68.405 -19.5617 -80.1122
|
||||
-68.5438 -13.5849 -82.8134
|
||||
-34.0842 159.319 -106.203
|
||||
-48.2771 159.41 -126.44
|
||||
-52.0864 156.79 -130.763
|
||||
-54.4429 150.721 -131.574
|
||||
-113.843 -147.325 -91.2554
|
||||
-113.612 -153.175 -88.476
|
||||
-105.573 -155.542 -94.1253
|
||||
-111.152 -156.072 -83.7622
|
||||
-97.3257 -156.16 -64.0481
|
||||
-79.4866 -66.6516 -76.1565
|
||||
-76.4156 -59.3085 -74.8621
|
||||
-72.284 -56.5006 -70.1586
|
||||
18.3226 -57.0825 59.0279
|
||||
21.3208 -60.2582 64.6248
|
||||
21.4659 -67.2999 67.7812
|
||||
4.90156 -150.413 79.0244
|
||||
7.36426 -150.429 82.5357
|
||||
8.16787 -155.226 85.6889
|
||||
26.8514 -155.346 112.328
|
||||
27.0865 -156.959 113.338
|
||||
36.9148 -157.023 127.351
|
||||
48.5835 -137.415 135.744
|
||||
106.02 150.776 96.7581
|
||||
105.822 155.916 94.3232
|
||||
103.663 158.435 90.1966
|
||||
88.9199 158.529 69.1753
|
||||
-44.9422 120.773 -105.508
|
||||
-41.9623 135.725 -107.531
|
||||
-53.7732 120.83 -118.1
|
||||
-50.7933 135.781 -120.122
|
||||
93.7557 119.882 92.2465
|
||||
96.7356 134.834 90.2239
|
||||
84.9248 119.939 79.6554
|
||||
87.9047 134.891 77.6327
|
||||
-94.4107 -132.631 -87.8383
|
||||
-86.3972 -111.141 -85.436
|
||||
-88.6932 -111.141 -88.7035
|
||||
-93.8879 -111.147 -96.0938
|
||||
-87.1209 -103.252 -89.7708
|
||||
-90.1291 -103.233 -94.0598
|
||||
-91.7064 -111.147 -92.9892
|
||||
-89.1491 -111.007 -88.3832
|
||||
-94.8666 -132.496 -87.5179
|
||||
-86.853 -111.007 -85.1157
|
||||
-92.1623 -111.013 -92.6689
|
||||
-94.3438 -111.013 -95.7734
|
||||
-90.585 -103.099 -93.7395
|
||||
-87.5768 -103.118 -89.4504
|
||||
-67.6717 -31.3513 -90.6974
|
||||
62.7797 -32.1891 95.2996
|
||||
100.116 155.148 69.9573
|
||||
-30.3356 155.985 -116.04
|
||||
-83.5213 -152.778 -62.3874
|
||||
-15.3773 -147.528 32.3897
|
||||
-31.2514 -147.427 9.7564
|
||||
-82.8958 -156.305 -60.02
|
||||
-9.7338 -156.774 44.2941
|
||||
-8.90488 -152.615 43.7314
|
||||
-73.0032 -55.9751 -87.9697
|
||||
-92.2847 -152.722 -74.8822
|
||||
-1.4239 -152.663 54.3978
|
||||
16.2848 -152.777 79.6468
|
||||
35.4386 -56.6715 66.646
|
||||
-0.334856 -147.199 53.6585
|
||||
-15.1194 -66.4828 -1.19339
|
||||
0.754753 -66.5848 21.4399
|
||||
-4.12051 -147.175 48.261
|
||||
-37.0286 157.955 -111.337
|
||||
93.4228 157.118 74.6604
|
||||
-74.3646 -29.3812 -85.9943
|
||||
56.0868 -30.219 100.003
|
||||
-22.0702 -145.558 37.0928
|
||||
-5.93819 -64.6147 26.143
|
||||
-37.9444 -145.456 14.4595
|
||||
-21.8124 -64.5127 3.50967
|
||||
-89.5888 -154.334 -55.317
|
||||
-90.2143 -150.808 -57.6844
|
||||
-16.4268 -154.804 48.9971
|
||||
-15.5978 -150.645 48.4345
|
||||
-10.8135 -145.204 52.9641
|
||||
-7.02781 -145.229 58.3616
|
||||
-8.11686 -150.693 59.1008
|
||||
9.59188 -150.807 84.3498
|
||||
28.7456 -54.7014 71.349
|
||||
-79.6961 -54.005 -83.2667
|
||||
-98.9776 -150.752 -70.1791
|
||||
94.324 155.742 60.083
|
||||
-24.0606 156.502 -108.709
|
||||
-57.9746 -13.6644 -85.6897
|
||||
60.5225 -13.8602 83.0261
|
||||
-58.0177 -20.9512 -82.6986
|
||||
-53.9906 -23.8836 -75.7393
|
||||
52.0347 -24.5645 75.4311
|
||||
57.895 -21.2097 82.3655
|
||||
49.9792 -18.8796 87.9278
|
||||
44.1189 -22.2345 80.9934
|
||||
52.6068 -11.5301 88.5884
|
||||
86.4083 158.072 65.6453
|
||||
-31.9763 158.832 -103.147
|
||||
-65.8903 -11.3344 -80.1274
|
||||
-65.9334 -18.6212 -77.1363
|
||||
-61.9064 -21.5535 -70.177
|
||||
21.1243 -65.3612 48.4294
|
||||
29.0089 -69.9501 61.5723
|
||||
28.7267 -63.6617 58.5365
|
||||
25.6475 -60.3503 52.7673
|
||||
-43.6902 -59.905 -46.0941
|
||||
2.25502 -65.24 21.5257
|
||||
4.78453 -147.347 59.5202
|
||||
11.2833 -158.89 73.6037
|
||||
-68.6304 -158.377 -40.3368
|
||||
-14.0847 -147.226 32.6165
|
||||
-50.7894 -68.858 -52.4465
|
||||
-48.036 -62.338 -51.2593
|
||||
20.7344 -61.3091 64.1526
|
||||
21.0165 -67.5976 67.1884
|
||||
17.6551 -57.9977 58.3834
|
||||
-51.6825 -57.5524 -40.4779
|
||||
-56.0283 -59.9854 -45.6432
|
||||
-58.7818 -66.5054 -46.8304
|
||||
-76.6227 -156.024 -34.7206
|
||||
3.29093 -156.537 79.2199
|
||||
-3.20781 -144.995 65.1363
|
||||
13.1319 -63.0086 54.0455
|
||||
-22.0771 -144.873 38.2326
|
||||
-5.73733 -62.8875 27.1418
|
||||
BIN
CS4451/proj2/Examples/floppy.t.gz
Normal file
145454
CS4451/proj2/Examples/horse2.t
Normal file
BIN
CS4451/proj2/Examples/horse2.t.gz
Normal file
461
CS4451/proj2/Examples/pawn.t
Normal file
@@ -0,0 +1,461 @@
|
||||
304 154
|
||||
|
||||
0 1 2
|
||||
0 2 3
|
||||
0 3 4
|
||||
0 4 5
|
||||
0 5 6
|
||||
0 6 7
|
||||
0 7 8
|
||||
0 8 1
|
||||
1 9 10
|
||||
1 10 2
|
||||
2 10 11
|
||||
2 11 3
|
||||
3 11 12
|
||||
3 12 4
|
||||
4 12 13
|
||||
4 13 5
|
||||
5 13 14
|
||||
5 14 6
|
||||
6 14 15
|
||||
6 15 7
|
||||
7 15 16
|
||||
7 16 8
|
||||
8 16 9
|
||||
8 9 1
|
||||
9 17 18
|
||||
9 18 10
|
||||
10 18 19
|
||||
10 19 11
|
||||
11 19 20
|
||||
11 20 12
|
||||
12 20 21
|
||||
12 21 13
|
||||
13 21 22
|
||||
13 22 14
|
||||
14 22 23
|
||||
14 23 15
|
||||
15 23 24
|
||||
15 24 16
|
||||
16 24 17
|
||||
16 17 9
|
||||
17 25 26
|
||||
17 26 18
|
||||
18 26 27
|
||||
18 27 19
|
||||
19 27 28
|
||||
19 28 20
|
||||
20 28 29
|
||||
20 29 21
|
||||
21 29 30
|
||||
21 30 22
|
||||
22 30 31
|
||||
22 31 23
|
||||
23 31 32
|
||||
23 32 24
|
||||
24 32 25
|
||||
24 25 17
|
||||
25 33 34
|
||||
25 34 26
|
||||
26 34 35
|
||||
26 35 27
|
||||
27 35 36
|
||||
27 36 28
|
||||
28 36 37
|
||||
28 37 29
|
||||
29 37 38
|
||||
29 38 30
|
||||
30 38 39
|
||||
30 39 31
|
||||
31 39 40
|
||||
31 40 32
|
||||
32 40 33
|
||||
32 33 25
|
||||
33 41 42
|
||||
33 42 34
|
||||
34 42 43
|
||||
34 43 35
|
||||
35 43 44
|
||||
35 44 36
|
||||
36 44 45
|
||||
36 45 37
|
||||
37 45 46
|
||||
37 46 38
|
||||
38 46 47
|
||||
38 47 39
|
||||
39 47 48
|
||||
39 48 40
|
||||
40 48 41
|
||||
40 41 33
|
||||
41 49 50
|
||||
41 50 42
|
||||
42 50 51
|
||||
42 51 43
|
||||
43 51 52
|
||||
43 52 44
|
||||
44 52 53
|
||||
44 53 45
|
||||
45 53 54
|
||||
45 54 46
|
||||
46 54 55
|
||||
46 55 47
|
||||
47 55 56
|
||||
47 56 48
|
||||
48 56 49
|
||||
48 49 41
|
||||
49 57 58
|
||||
49 58 50
|
||||
50 58 59
|
||||
50 59 51
|
||||
51 59 60
|
||||
51 60 52
|
||||
52 60 61
|
||||
52 61 53
|
||||
53 61 62
|
||||
53 62 54
|
||||
54 62 63
|
||||
54 63 55
|
||||
55 63 64
|
||||
55 64 56
|
||||
56 64 57
|
||||
56 57 49
|
||||
57 65 66
|
||||
57 66 58
|
||||
58 66 67
|
||||
58 67 59
|
||||
59 67 68
|
||||
59 68 60
|
||||
60 68 69
|
||||
60 69 61
|
||||
61 69 70
|
||||
61 70 62
|
||||
62 70 71
|
||||
62 71 63
|
||||
63 71 72
|
||||
63 72 64
|
||||
64 72 65
|
||||
64 65 57
|
||||
65 73 74
|
||||
65 74 66
|
||||
66 74 75
|
||||
66 75 67
|
||||
67 75 76
|
||||
67 76 68
|
||||
68 76 77
|
||||
68 77 69
|
||||
69 77 78
|
||||
69 78 70
|
||||
70 78 79
|
||||
70 79 71
|
||||
71 79 80
|
||||
71 80 72
|
||||
72 80 73
|
||||
72 73 65
|
||||
73 81 82
|
||||
73 82 74
|
||||
74 82 83
|
||||
74 83 75
|
||||
75 83 84
|
||||
75 84 76
|
||||
76 84 85
|
||||
76 85 77
|
||||
77 85 86
|
||||
77 86 78
|
||||
78 86 87
|
||||
78 87 79
|
||||
79 87 88
|
||||
79 88 80
|
||||
80 88 81
|
||||
80 81 73
|
||||
81 89 90
|
||||
81 90 82
|
||||
82 90 91
|
||||
82 91 83
|
||||
83 91 92
|
||||
83 92 84
|
||||
84 92 93
|
||||
84 93 85
|
||||
85 93 94
|
||||
85 94 86
|
||||
86 94 95
|
||||
86 95 87
|
||||
87 95 96
|
||||
87 96 88
|
||||
88 96 89
|
||||
88 89 81
|
||||
89 97 98
|
||||
89 98 90
|
||||
90 98 99
|
||||
90 99 91
|
||||
91 99 100
|
||||
91 100 92
|
||||
92 100 101
|
||||
92 101 93
|
||||
93 101 102
|
||||
93 102 94
|
||||
94 102 103
|
||||
94 103 95
|
||||
95 103 104
|
||||
95 104 96
|
||||
96 104 97
|
||||
96 97 89
|
||||
97 105 106
|
||||
97 106 98
|
||||
98 106 107
|
||||
98 107 99
|
||||
99 107 108
|
||||
99 108 100
|
||||
100 108 109
|
||||
100 109 101
|
||||
101 109 110
|
||||
101 110 102
|
||||
102 110 111
|
||||
102 111 103
|
||||
103 111 112
|
||||
103 112 104
|
||||
104 112 105
|
||||
104 105 97
|
||||
105 113 114
|
||||
105 114 106
|
||||
106 114 115
|
||||
106 115 107
|
||||
107 115 116
|
||||
107 116 108
|
||||
108 116 117
|
||||
108 117 109
|
||||
109 117 118
|
||||
109 118 110
|
||||
110 118 119
|
||||
110 119 111
|
||||
111 119 120
|
||||
111 120 112
|
||||
112 120 113
|
||||
112 113 105
|
||||
113 121 122
|
||||
113 122 114
|
||||
114 122 123
|
||||
114 123 115
|
||||
115 123 124
|
||||
115 124 116
|
||||
116 124 125
|
||||
116 125 117
|
||||
117 125 126
|
||||
117 126 118
|
||||
118 126 127
|
||||
118 127 119
|
||||
119 127 128
|
||||
119 128 120
|
||||
120 128 121
|
||||
120 121 113
|
||||
121 129 130
|
||||
121 130 122
|
||||
122 130 131
|
||||
122 131 123
|
||||
123 131 132
|
||||
123 132 124
|
||||
124 132 133
|
||||
124 133 125
|
||||
125 133 134
|
||||
125 134 126
|
||||
126 134 135
|
||||
126 135 127
|
||||
127 135 136
|
||||
127 136 128
|
||||
128 136 129
|
||||
128 129 121
|
||||
129 137 138
|
||||
129 138 130
|
||||
130 138 139
|
||||
130 139 131
|
||||
131 139 140
|
||||
131 140 132
|
||||
132 140 141
|
||||
132 141 133
|
||||
133 141 142
|
||||
133 142 134
|
||||
134 142 143
|
||||
134 143 135
|
||||
135 143 144
|
||||
135 144 136
|
||||
136 144 137
|
||||
136 137 129
|
||||
137 145 146
|
||||
137 146 138
|
||||
138 146 147
|
||||
138 147 139
|
||||
139 147 148
|
||||
139 148 140
|
||||
140 148 149
|
||||
140 149 141
|
||||
141 149 150
|
||||
141 150 142
|
||||
142 150 151
|
||||
142 151 143
|
||||
143 151 152
|
||||
143 152 144
|
||||
144 152 145
|
||||
144 145 137
|
||||
145 153 146
|
||||
146 153 147
|
||||
147 153 148
|
||||
148 153 149
|
||||
149 153 150
|
||||
150 153 151
|
||||
151 153 152
|
||||
152 153 145
|
||||
|
||||
0 523 0
|
||||
88.6333 495.08 0
|
||||
62.6732 495.08 62.6732
|
||||
0 495.08 88.6333
|
||||
-62.6732 495.08 62.6732
|
||||
-88.6333 495.08 0
|
||||
-62.6732 495.08 -62.6732
|
||||
0 495.08 -88.6333
|
||||
62.6732 495.08 -62.6732
|
||||
152.845 448.819 0
|
||||
108.077 448.819 108.077
|
||||
0 448.819 152.845
|
||||
-108.077 448.819 108.077
|
||||
-152.845 448.819 0
|
||||
-108.077 448.819 -108.077
|
||||
0 448.819 -152.845
|
||||
108.077 448.819 -108.077
|
||||
173.877 368.699 0
|
||||
122.95 368.699 122.95
|
||||
0 368.699 173.877
|
||||
-122.95 368.699 122.95
|
||||
-173.877 368.699 0
|
||||
-122.95 368.699 -122.95
|
||||
0 368.699 -173.877
|
||||
122.95 368.699 -122.95
|
||||
153.987 282.788 0
|
||||
108.885 282.788 108.885
|
||||
0 282.788 153.987
|
||||
-108.885 282.788 108.885
|
||||
-153.987 282.788 0
|
||||
-108.885 282.788 -108.885
|
||||
0 282.788 -153.987
|
||||
108.885 282.788 -108.885
|
||||
90.2264 218.419 0
|
||||
63.7997 218.419 63.7997
|
||||
0 218.419 90.2264
|
||||
-63.7997 218.419 63.7997
|
||||
-90.2264 218.419 0
|
||||
-63.7997 218.419 -63.7997
|
||||
0 218.419 -90.2264
|
||||
63.7997 218.419 -63.7997
|
||||
5.81111 166.597 0
|
||||
4.10909 166.597 4.10909
|
||||
0 166.597 5.81111
|
||||
-4.10909 166.597 4.10909
|
||||
-5.81111 166.597 0
|
||||
-4.10909 166.597 -4.10909
|
||||
0 166.597 -5.81111
|
||||
4.10909 166.597 -4.10909
|
||||
95.3267 203.067 0
|
||||
67.4063 203.067 67.4063
|
||||
0 203.067 95.3267
|
||||
-67.4063 203.067 67.4063
|
||||
-95.3267 203.067 0
|
||||
-67.4063 203.067 -67.4063
|
||||
0 203.067 -95.3267
|
||||
67.4063 203.067 -67.4063
|
||||
145.057 174.885 0
|
||||
102.571 174.885 102.571
|
||||
0 174.885 145.057
|
||||
-102.571 174.885 102.571
|
||||
-145.057 174.885 0
|
||||
-102.571 174.885 -102.571
|
||||
0 174.885 -145.057
|
||||
102.571 174.885 -102.571
|
||||
181.526 158.309 0
|
||||
128.358 158.309 128.358
|
||||
0 158.309 181.526
|
||||
-128.358 158.309 128.358
|
||||
-181.526 158.309 0
|
||||
-128.358 158.309 -128.358
|
||||
0 158.309 -181.526
|
||||
128.358 158.309 -128.358
|
||||
113.463 109.836 0
|
||||
80.2308 109.836 80.2308
|
||||
0 109.836 113.463
|
||||
-80.2308 109.836 80.2308
|
||||
-113.463 109.836 0
|
||||
-80.2308 109.836 -80.2308
|
||||
0 109.836 -113.463
|
||||
80.2308 109.836 -80.2308
|
||||
74.6572 39.073 0
|
||||
52.7906 39.073 52.7906
|
||||
0 39.073 74.6572
|
||||
-52.7906 39.073 52.7906
|
||||
-74.6572 39.073 0
|
||||
-52.7906 39.073 -52.7906
|
||||
0 39.073 -74.6572
|
||||
52.7906 39.073 -52.7906
|
||||
89.4272 -72.509 0
|
||||
63.2349 -72.509 63.2349
|
||||
0 -72.509 89.4272
|
||||
-63.2349 -72.509 63.2349
|
||||
-89.4272 -72.509 0
|
||||
-63.2349 -72.509 -63.2349
|
||||
0 -72.509 -89.4272
|
||||
63.2349 -72.509 -63.2349
|
||||
133.454 -206.382 0
|
||||
94.3665 -206.382 94.3665
|
||||
0 -206.382 133.454
|
||||
-94.3665 -206.382 94.3665
|
||||
-133.454 -206.382 0
|
||||
-94.3665 -206.382 -94.3665
|
||||
0 -206.382 -133.454
|
||||
94.3665 -206.382 -94.3665
|
||||
173.239 -208.041 0
|
||||
122.498 -208.041 122.498
|
||||
0 -208.041 173.239
|
||||
-122.498 -208.041 122.498
|
||||
-173.239 -208.041 0
|
||||
-122.498 -208.041 -122.498
|
||||
0 -208.041 -173.239
|
||||
122.498 -208.041 -122.498
|
||||
211.366 -206.382 0
|
||||
149.458 -206.382 149.458
|
||||
0 -206.382 211.366
|
||||
-149.458 -206.382 149.458
|
||||
-211.366 -206.382 0
|
||||
-149.458 -206.382 -149.458
|
||||
0 -206.382 -211.366
|
||||
149.458 -206.382 -149.458
|
||||
276.016 -428.512 0
|
||||
195.173 -428.512 195.173
|
||||
0 -428.512 276.016
|
||||
-195.173 -428.512 195.173
|
||||
-276.016 -428.512 0
|
||||
-195.173 -428.512 -195.173
|
||||
0 -428.512 -276.016
|
||||
195.173 -428.512 -195.173
|
||||
229.6 -474.927 0
|
||||
162.352 -474.927 162.352
|
||||
0 -474.927 229.6
|
||||
-162.352 -474.927 162.352
|
||||
-229.6 -474.927 0
|
||||
-162.352 -474.927 -162.352
|
||||
0 -474.927 -229.6
|
||||
162.352 -474.927 -162.352
|
||||
276.016 -519.685 0
|
||||
195.173 -519.685 195.173
|
||||
0 -519.685 276.016
|
||||
-195.173 -519.685 195.173
|
||||
-276.016 -519.685 0
|
||||
-195.173 -519.685 -195.173
|
||||
0 -519.685 -276.016
|
||||
195.173 -519.685 -195.173
|
||||
164.951 -516.369 0
|
||||
116.638 -516.369 116.638
|
||||
0 -516.369 164.951
|
||||
-116.638 -516.369 116.638
|
||||
-164.951 -516.369 0
|
||||
-116.638 -516.369 -116.638
|
||||
0 -516.369 -164.951
|
||||
116.638 -516.369 -116.638
|
||||
0 -523 0
|
||||
BIN
CS4451/proj2/Examples/pawn.t.gz
Normal file
10565
CS4451/proj2/Examples/pig.t
Normal file
BIN
CS4451/proj2/Examples/pig.t.gz
Normal file
7679
CS4451/proj2/Examples/shark.t
Normal file
BIN
CS4451/proj2/Examples/shark.t.gz
Normal file
5262
CS4451/proj2/Examples/toilet.t
Normal file
BIN
CS4451/proj2/Examples/toilet.t.gz
Normal file
2132
CS4451/proj2/Examples/venus.t
Normal file
BIN
CS4451/proj2/Examples/venus.t.gz
Normal file
27104
CS4451/proj2/Examples/whale.t
Normal file
BIN
CS4451/proj2/Examples/whale.t.gz
Normal file
18
CS4451/proj2/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
CC = g++
|
||||
|
||||
# libraries required to compile opengl/glut programs may be system-dependent
|
||||
# this is a setup for a typical install of redhat 9
|
||||
|
||||
LIBOPT = -L/usr/X11R6/lib -lglut -lGLU -lGL -lXmu -lXi -lX11 -lm
|
||||
|
||||
all : prj
|
||||
|
||||
prj : cs4451_a2.o
|
||||
$(CC) -o proj2 cs4451_a2.o $(LIBOPT)
|
||||
|
||||
cs4451_a2.o : cs4451_a2.cpp Makefile
|
||||
$(CC) -I/usr/X11R6/include -c cs4451_a2.cpp
|
||||
|
||||
clean:
|
||||
rm proj2
|
||||
18
CS4451/proj2/Submission/Makefile
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
CC = g++
|
||||
|
||||
# libraries required to compile opengl/glut programs may be system-dependent
|
||||
# this is a setup for a typical install of redhat 9
|
||||
|
||||
LIBOPT = -L/usr/X11R6/lib -lglut -lGLU -lGL -lXmu -lXi -lX11 -lm
|
||||
|
||||
all : prj
|
||||
|
||||
prj : cs4451_a2.o
|
||||
$(CC) -o proj2 cs4451_a2.o $(LIBOPT)
|
||||
|
||||
cs4451_a2.o : cs4451_a2.cpp Makefile
|
||||
$(CC) -I/usr/X11R6/include -c cs4451_a2.cpp
|
||||
|
||||
clean:
|
||||
rm proj2
|
||||
892
CS4451/proj2/Submission/cs4451_a2.cpp
Normal file
@@ -0,0 +1,892 @@
|
||||
|
||||
/* cs4451_a2.cpp */
|
||||
/*
|
||||
* Jose Caban
|
||||
* gtg184g
|
||||
* proj2
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _OS_LINUX_
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
//Windows only needs glut.h care of SGI ;)
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define VPD_MIN 200
|
||||
#define VPD_DEFAULT 800
|
||||
#define VPD_MAX 1024
|
||||
|
||||
enum MENU { MENU_SWITCH_SHADING=0,
|
||||
MENU_ZOOM_IN,
|
||||
MENU_ZOOM_OUT,
|
||||
MENU_POINTS,
|
||||
MENU_LINES,
|
||||
MENU_TRIANGLES,
|
||||
MENU_SWITCH_LIGHT,
|
||||
MENU_SWITCH_CULLING,
|
||||
MENU_TURN_OFF_CULLING,
|
||||
MENU_TURN_ON_CULLING,
|
||||
MENU_RESET_MODELVIEW
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define TWOPI (2.0 * M_PI)
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
//Define the Normal type
|
||||
typedef struct SNormal {
|
||||
GLfloat i;
|
||||
GLfloat j;
|
||||
GLfloat k;
|
||||
} SNormal;
|
||||
|
||||
typedef struct SPoint {
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
} SPoint;
|
||||
|
||||
//Define the Vertex type for use in keeping track of Vertices
|
||||
typedef struct SVertex {
|
||||
SNormal normal;
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
} SVertex;
|
||||
|
||||
//Define the Data structure that will hold all the vertices
|
||||
typedef struct SVertexList {
|
||||
SVertex* vertices;
|
||||
int length;
|
||||
} SVertexList;
|
||||
|
||||
//Define a Triangle (a1,a2,a3 are indices to the SVertexList
|
||||
typedef struct STriangle {
|
||||
SNormal normal;
|
||||
GLint a1,a2,a3;
|
||||
} STriangle;
|
||||
|
||||
typedef struct STriangleList {
|
||||
STriangle* triangles;
|
||||
GLint length;
|
||||
} STriangleList;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Globals
|
||||
|
||||
SVertexList vertexList;
|
||||
STriangleList triList;
|
||||
GLfloat currModelTransform[16];
|
||||
|
||||
GLint wid; /* GLUT window id */
|
||||
GLint vpd = VPD_DEFAULT; /* (square) viewport dimensions */
|
||||
|
||||
GLuint sceneID; /* display list ID */
|
||||
GLuint gouraudID; /* gouraud display list ID */
|
||||
GLuint flatID; /* flat display list ID */
|
||||
|
||||
GLfloat angle1 = 0; /* angles used in animation */
|
||||
GLfloat angle2 = 0;
|
||||
GLfloat dangle1 = 0.57;
|
||||
GLfloat dangle2 = 0.71;
|
||||
|
||||
GLdouble viewDist = 8.0; /* Changes the view distance view */
|
||||
|
||||
GLuint cullMode = GL_BACK;
|
||||
GLboolean worldLight = GL_TRUE;
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//Functions
|
||||
|
||||
/*
|
||||
* Input scanner
|
||||
*/
|
||||
void scanInput(GLvoid);
|
||||
|
||||
/*
|
||||
* Initialize the Light Source
|
||||
*/
|
||||
GLvoid init_lightsource ( GLvoid )
|
||||
{
|
||||
GLfloat light_ambient[] = { .1, .1, .1, 1.0 };
|
||||
GLfloat light_diffuse[] = { .9, .9, .9, 1.0 };
|
||||
GLfloat light_specular[] = { 0, 0, 0, 1.0 };
|
||||
GLfloat light_position[] = { 2.0, 2.0, 2.0, 0.0 };
|
||||
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
||||
glLightf(GL_LIGHT0,GL_CONSTANT_ATTENUATION,1.0);
|
||||
glLightf(GL_LIGHT0,GL_LINEAR_ATTENUATION,0.0);
|
||||
glLightf(GL_LIGHT0,GL_QUADRATIC_ATTENUATION,0.0);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
}
|
||||
|
||||
GLvoid set_material_properties ( GLfloat r, GLfloat g, GLfloat b )
|
||||
{
|
||||
GLfloat mat_specular[4] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
GLfloat mat_ambient_and_diffuse[4] = { 0.5, 0.5, 0.5, 1.0 };
|
||||
GLfloat mat_shininess[1] = { 0.0 };
|
||||
|
||||
mat_specular[0] = mat_ambient_and_diffuse[0] = r;
|
||||
mat_specular[1] = mat_ambient_and_diffuse[1] = g;
|
||||
mat_specular[2] = mat_ambient_and_diffuse[2] = b;
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
|
||||
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_ambient_and_diffuse);
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline void cross(SNormal& dest, SVertex& a, SVertex& b) {
|
||||
dest.i = ( (a.y*b.z) - (a.z*b.y) ); //i
|
||||
dest.j = ( (a.z*b.x) - (a.x*b.z) ); //j
|
||||
dest.k = ( (a.x*b.y) - (a.y*b.x) ); //k
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the scene
|
||||
*
|
||||
*/
|
||||
GLuint init_flat_scene ( )
|
||||
{
|
||||
GLuint sceneList = glGenLists(1);
|
||||
|
||||
SNormal tempNormal;
|
||||
SVertex a1, a2, a3;
|
||||
|
||||
glNewList(sceneList,GL_COMPILE);
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
for (int i = 0; i < triList.length; i++) {
|
||||
|
||||
a1 = vertexList.vertices[triList.triangles[i].a1];
|
||||
a2 = vertexList.vertices[triList.triangles[i].a2];
|
||||
a3 = vertexList.vertices[triList.triangles[i].a3];
|
||||
|
||||
tempNormal = triList.triangles[i].normal;
|
||||
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
|
||||
glVertex3f(a1.x, a1.y, a1.z);
|
||||
glVertex3f(a2.x, a2.y, a2.z);
|
||||
glVertex3f(a3.x, a3.y, a3.z);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
|
||||
return sceneList;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the gouraud scene
|
||||
*/
|
||||
GLuint init_gouraud_scene ( )
|
||||
{
|
||||
GLuint sceneList = glGenLists(1);
|
||||
|
||||
SNormal tempNormal;
|
||||
SVertex a1, a2, a3;
|
||||
|
||||
glNewList(sceneList,GL_COMPILE);
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
for (int i = 0; i < triList.length; i++) {
|
||||
|
||||
a1 = vertexList.vertices[triList.triangles[i].a1];
|
||||
a2 = vertexList.vertices[triList.triangles[i].a2];
|
||||
a3 = vertexList.vertices[triList.triangles[i].a3];
|
||||
|
||||
tempNormal = a1.normal;
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
glVertex3f(a1.x, a1.y, a1.z);
|
||||
|
||||
tempNormal = a2.normal;
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
glVertex3f(a2.x, a2.y, a2.z);
|
||||
|
||||
tempNormal = a3.normal;
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
glVertex3f(a3.x, a3.y, a3.z);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
|
||||
return sceneList;
|
||||
}
|
||||
|
||||
|
||||
GLuint create_scene(GLuint triangleList) {
|
||||
GLuint sceneList = glGenLists(1);
|
||||
|
||||
glNewList(sceneList,GL_COMPILE);
|
||||
|
||||
set_material_properties(1.0,1.0,1.0);
|
||||
|
||||
/* Correctly size the object */
|
||||
assert(vertexList.length > 0);
|
||||
|
||||
SVertex Max;
|
||||
SVertex Min;
|
||||
SVertex Center;
|
||||
|
||||
Max.x = Min.x = vertexList.vertices[0].x;
|
||||
Max.y = Min.y = vertexList.vertices[0].y;
|
||||
Max.z = Min.z = vertexList.vertices[0].z;
|
||||
|
||||
for (int i = 1; i < vertexList.length; i++) {
|
||||
if (vertexList.vertices[i].x > Max.x) {
|
||||
Max.x = vertexList.vertices[i].x;
|
||||
} else if (vertexList.vertices[i].x < Min.x) {
|
||||
Min.x = vertexList.vertices[i].x;
|
||||
}
|
||||
|
||||
if (vertexList.vertices[i].y > Max.y) {
|
||||
Max.y = vertexList.vertices[i].y;
|
||||
} else if (vertexList.vertices[i].y < Min.y) {
|
||||
Min.y = vertexList.vertices[i].y;
|
||||
}
|
||||
|
||||
if (vertexList.vertices[i].z > Max.z) {
|
||||
Max.z = vertexList.vertices[i].z;
|
||||
} else if (vertexList.vertices[i].z < Min.z) {
|
||||
Min.z = vertexList.vertices[i].z;
|
||||
}
|
||||
}
|
||||
|
||||
Center.x = (Max.x + Min.x) / 2.;
|
||||
Center.y = (Max.y + Min.y) / 2.;
|
||||
Center.z = (Max.z + Min.z) / 2.;
|
||||
|
||||
float scaleX, scaleY, scaleZ;
|
||||
scaleX = (Max.x - Min.x) / 2.;
|
||||
scaleY = (Max.y - Min.y) / 2.;
|
||||
scaleZ = (Max.z - Min.z) / 2.;
|
||||
|
||||
float scaleFactor;
|
||||
|
||||
scaleFactor = scaleX > scaleY ? scaleX : scaleY;
|
||||
scaleFactor = scaleZ > scaleFactor ? scaleZ : scaleFactor;
|
||||
scaleFactor = 1. / scaleFactor;
|
||||
|
||||
//printf("ScaleFactor: %f\n",scaleFactor);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0.-(Center.x*scaleFactor),0.-(Center.y*scaleFactor),0.-(Center.z*scaleFactor));
|
||||
glScalef(scaleFactor,scaleFactor,scaleFactor);
|
||||
glCallList(triangleList);
|
||||
glPopMatrix();
|
||||
|
||||
glEndList();
|
||||
|
||||
return sceneList;
|
||||
}
|
||||
|
||||
GLuint create_flat_scene ( )
|
||||
{
|
||||
return create_scene( init_flat_scene() );
|
||||
}
|
||||
|
||||
GLuint create_gouraud_scene ( )
|
||||
{
|
||||
return create_scene( init_gouraud_scene() );
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* redraw the scene */
|
||||
|
||||
GLvoid draw(GLvoid)
|
||||
{
|
||||
/* set the projection matrix */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(viewDist,1.0,15.0,25.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
/* initialize light */
|
||||
if (worldLight) {
|
||||
//World Lighting
|
||||
init_lightsource();
|
||||
glTranslatef(0,0,-20);
|
||||
glMultMatrixf(currModelTransform);
|
||||
} else {
|
||||
//Model Lighting
|
||||
glTranslatef(0,0,-20);
|
||||
glMultMatrixf(currModelTransform);
|
||||
init_lightsource();
|
||||
}
|
||||
|
||||
/* ensure we're drawing to the correct GLUT window */
|
||||
glutSetWindow(wid);
|
||||
|
||||
/* clear the color buffers */
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* DRAW WHAT IS IN THE DISPLAY LIST */
|
||||
glCallList(sceneID);
|
||||
|
||||
/* flush the pipeline */
|
||||
glFlush();
|
||||
|
||||
/* look at our handiwork */
|
||||
glutSwapBuffers();
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* handle mouse events */
|
||||
SPoint oldPoint; //stores the previous point used in the virtual trackball
|
||||
|
||||
GLvoid mouse_button(GLint btn, GLint state, GLint mx, GLint my)
|
||||
{
|
||||
switch( btn ) {
|
||||
case GLUT_LEFT_BUTTON:
|
||||
switch( state ) {
|
||||
case GLUT_DOWN:
|
||||
oldPoint.x = mx;
|
||||
oldPoint.y = my;
|
||||
oldPoint.z = -1;
|
||||
break;
|
||||
case GLUT_UP:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GLUT_MIDDLE_BUTTON:
|
||||
switch( state ) {
|
||||
case GLUT_DOWN:
|
||||
break;
|
||||
case GLUT_UP:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GLUT_RIGHT_BUTTON:
|
||||
switch( state ) {
|
||||
case GLUT_DOWN:
|
||||
break;
|
||||
case GLUT_UP:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void scalePoint(SPoint& p, GLint mx, GLint my) {
|
||||
//scale to -1 and 1
|
||||
float scale = ceil(vpd/2.);
|
||||
p.x = (mx / scale) -1.;
|
||||
p.y = (my / scale) -1.;
|
||||
p.y*=-1.; //handle reversed y
|
||||
|
||||
p.z = 1.-pow(p.x,2)-pow(p.y,2);
|
||||
|
||||
if (p.z < 0) {
|
||||
float under = sqrt((p.x*p.x)+(p.y*p.y));
|
||||
p.x /= under;
|
||||
p.y /= under;
|
||||
p.z = 0;
|
||||
} else {
|
||||
p.z = sqrt(p.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline GLfloat vecLength(SPoint& p) {
|
||||
return sqrt(pow(p.x,2)+pow(p.y,2)+pow(p.z,2));
|
||||
}
|
||||
|
||||
inline GLfloat dot(SPoint &a, SPoint &b) {
|
||||
return (a.x*b.x)+(a.y*b.y)+(a.z*b.z);
|
||||
}
|
||||
|
||||
inline void cross(SPoint &dest, SPoint &a, SPoint &b) {
|
||||
|
||||
dest.x = ( (a.y*b.z) - (a.z*b.y) ); //i
|
||||
dest.y = ( (a.z*b.x) - (a.x*b.z) ); //j
|
||||
dest.z = ( (a.x*b.y) - (a.y*b.x) ); //k
|
||||
}
|
||||
|
||||
inline void calcAngle(GLfloat *newMatrix, GLfloat angle, SPoint& a) {
|
||||
newMatrix[0] = 1.+(1.-cos(angle))*(pow(a.x,2)-1.);
|
||||
newMatrix[1] = a.z*sin(angle) + (1.-cos(angle)) * a.x * a.y;
|
||||
newMatrix[2] = -1. * a.y * sin(angle) + (1.-cos(angle))*a.x*a.z;
|
||||
newMatrix[3] = 0;
|
||||
newMatrix[4] = -1. * a.z * sin(angle) + (1.-cos(angle)) * a.x * a.y;
|
||||
newMatrix[5] = 1. + (1. - cos(angle))*(pow(a.y,2)-1.);
|
||||
newMatrix[6] = a.x * sin(angle) + (1.-cos(angle))*a.y*a.z;
|
||||
newMatrix[7] = 0;
|
||||
newMatrix[8] = a.y * sin(angle) + (1.-cos(angle))*a.x * a.z;
|
||||
newMatrix[9] = -1. * a.x * sin(angle) + (1.-cos(angle))*a.y*a.z;
|
||||
newMatrix[10] = 1. + (1.-cos(angle))*(pow(a.z,2)-1.);
|
||||
newMatrix[11] = newMatrix[12] = newMatrix[13] = newMatrix[14] = 0;
|
||||
newMatrix[15] = 1.;
|
||||
}
|
||||
|
||||
GLvoid button_motion(GLint mx, GLint my)
|
||||
{
|
||||
/* First calculate P */
|
||||
static SPoint v;
|
||||
SPoint p, w, a;
|
||||
|
||||
//Give us the scaled p on the sphere
|
||||
scalePoint(p,mx,my);
|
||||
|
||||
//get the unit vector of p
|
||||
GLfloat length = vecLength(p);
|
||||
if (length==0) {
|
||||
return;
|
||||
} else {
|
||||
w.x = p.x / length;
|
||||
w.y = p.y / length;
|
||||
w.z = p.z / length;
|
||||
}
|
||||
|
||||
//This is the first time the movement has been made
|
||||
if (oldPoint.z == -1) {
|
||||
scalePoint(oldPoint,(int)oldPoint.x,(int)oldPoint.y);
|
||||
|
||||
length = vecLength(oldPoint);
|
||||
if (length==0) {
|
||||
return;
|
||||
} else {
|
||||
v.x = oldPoint.x / length;
|
||||
v.y = oldPoint.y / length;
|
||||
v.z = oldPoint.z / length;
|
||||
}
|
||||
}
|
||||
|
||||
cross(a,oldPoint,p);
|
||||
length = vecLength(a);
|
||||
if (length==0) {
|
||||
return;
|
||||
} else {
|
||||
a.x /= length;
|
||||
a.y /= length;
|
||||
a.z /= length;
|
||||
}
|
||||
|
||||
GLfloat angle = dot(v,w);
|
||||
if (angle > 1) {
|
||||
angle = 1;
|
||||
} else if (angle < -1) {
|
||||
angle = -1;
|
||||
}
|
||||
|
||||
angle = acos(angle);
|
||||
|
||||
/* Perform the rotation calculation */
|
||||
GLfloat newMatrix[16];
|
||||
|
||||
calcAngle(newMatrix,angle,a);
|
||||
|
||||
/* Make OpenGL do our work */
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(newMatrix);
|
||||
glMultMatrixf(currModelTransform);
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX,currModelTransform);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
oldPoint = p;
|
||||
v = w;
|
||||
|
||||
glutPostRedisplay();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GLvoid passive_motion(GLint mx, GLint my)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* handle keyboard events; here, just exit if ESC is hit */
|
||||
|
||||
GLvoid keyboard(GLubyte key, GLint x, GLint y)
|
||||
{
|
||||
switch(key) {
|
||||
case 27: /* ESC */
|
||||
exit(0);
|
||||
case 'w':
|
||||
viewDist -= .1;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 's':
|
||||
viewDist += .1;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'a':
|
||||
currModelTransform[12] -= .01;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'd':
|
||||
currModelTransform[12] += .01;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
GLvoid menu ( int value )
|
||||
{
|
||||
switch(value)
|
||||
{
|
||||
case MENU_SWITCH_SHADING:
|
||||
if (sceneID == gouraudID) {
|
||||
glShadeModel(GL_FLAT);
|
||||
sceneID = flatID;
|
||||
} else {
|
||||
glShadeModel(GL_SMOOTH);
|
||||
sceneID = gouraudID;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_ZOOM_IN:
|
||||
viewDist -= 1.;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_ZOOM_OUT:
|
||||
viewDist += 1.;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_POINTS:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_LINES:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_TRIANGLES:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_SWITCH_CULLING:
|
||||
if (cullMode == GL_FRONT) {
|
||||
glCullFace(GL_BACK);
|
||||
cullMode = GL_BACK;
|
||||
} else {
|
||||
glCullFace(GL_FRONT);
|
||||
cullMode = GL_FRONT;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_TURN_ON_CULLING:
|
||||
glEnable(GL_CULL_FACE);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_TURN_OFF_CULLING:
|
||||
glDisable(GL_CULL_FACE);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_SWITCH_LIGHT:
|
||||
worldLight = !worldLight;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_RESET_MODELVIEW:
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX,currModelTransform);
|
||||
glPopMatrix();
|
||||
glutPostRedisplay();
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* handle resizing the glut window */
|
||||
|
||||
GLvoid reshape(GLint vpw, GLint vph)
|
||||
{
|
||||
glutSetWindow(wid);
|
||||
|
||||
/* maintain a square viewport, not too small, not too big */
|
||||
if( vpw < vph ) vpd = vph;
|
||||
else vpd = vpw;
|
||||
|
||||
if( vpd < VPD_MIN ) vpd = VPD_MIN;
|
||||
if( vpd > VPD_MAX ) vpd = VPD_MAX;
|
||||
|
||||
glViewport(0, 0, vpd, vpd);
|
||||
glutReshapeWindow(vpd, vpd);
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
GLint init_glut(GLint *argc, char **argv)
|
||||
{
|
||||
GLint id;
|
||||
|
||||
glutInit(argc,argv);
|
||||
|
||||
/* size and placement hints to the window system */
|
||||
glutInitWindowSize(vpd, vpd);
|
||||
glutInitWindowPosition(10,10);
|
||||
|
||||
/* double buffered, RGB color mode */
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
|
||||
|
||||
/* create a GLUT window (not drawn until glutMainLoop() is entered) */
|
||||
id = glutCreateWindow("cs4451 assignment 2");
|
||||
|
||||
/* register callbacks */
|
||||
|
||||
/* window size changes */
|
||||
glutReshapeFunc(reshape);
|
||||
|
||||
/* keypress handling when the current window has input focus */
|
||||
glutKeyboardFunc(keyboard);
|
||||
|
||||
/* mouse event handling */
|
||||
glutMouseFunc(mouse_button); /* button press/release */
|
||||
glutMotionFunc(button_motion); /* mouse motion w/ button down */
|
||||
glutPassiveMotionFunc(passive_motion); /* mouse motion with button up */
|
||||
|
||||
/* window obscured/revealed event handler */
|
||||
glutVisibilityFunc(NULL);
|
||||
|
||||
/* handling of keyboard SHIFT, ALT, CTRL keys */
|
||||
glutSpecialFunc(NULL);
|
||||
|
||||
/* what to do when mouse cursor enters/exits the current window */
|
||||
glutEntryFunc(NULL);
|
||||
|
||||
/* what to do on each display loop iteration */
|
||||
glutDisplayFunc(draw);
|
||||
|
||||
/* Create the menu */
|
||||
|
||||
//Create the Zoom Menu
|
||||
GLint zoomMenu = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Zoom In (w)",MENU_ZOOM_IN);
|
||||
glutAddMenuEntry("Zoom Out (s)",MENU_ZOOM_OUT);
|
||||
|
||||
//Create the Render Mode Menu
|
||||
GLint renderMenu = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Points Only",MENU_POINTS);
|
||||
glutAddMenuEntry("Lines Only",MENU_LINES);
|
||||
glutAddMenuEntry("Full Model",MENU_TRIANGLES);
|
||||
|
||||
//Create the Culling Menu
|
||||
GLint cullingMenu = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Switch Culling Mode",MENU_SWITCH_CULLING);
|
||||
glutAddMenuEntry("Turn on Culling",MENU_TURN_ON_CULLING);
|
||||
glutAddMenuEntry("Turn off Culling",MENU_TURN_OFF_CULLING);
|
||||
|
||||
GLint menuID = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Switch Shading Mode",MENU_SWITCH_SHADING);
|
||||
glutAddMenuEntry("Toggle World/Model Relative Light",MENU_SWITCH_LIGHT);
|
||||
|
||||
glutAddSubMenu("Zoom",zoomMenu);
|
||||
glutAddSubMenu("Render", renderMenu);
|
||||
glutAddSubMenu("Culling", cullingMenu);
|
||||
|
||||
glutAddMenuEntry("Reset View Model",MENU_RESET_MODELVIEW);
|
||||
|
||||
glutSetMenu(menuID);
|
||||
|
||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
GLvoid init_opengl(GLvoid)
|
||||
{
|
||||
/* back-face culling on */
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK); /* We want to cull the back */
|
||||
glFrontFace(GL_CW); /* The vertices we get are clockwise */
|
||||
|
||||
/* automatically scale normals to unit length after transformation */
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
/* clear to BLACK */
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
/* Enable depth test */
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
void generateNormals() {
|
||||
|
||||
/* Generate normals for triangles and Vertices */
|
||||
SNormal tempNormal;
|
||||
|
||||
SVertex a1a2, a1a3;
|
||||
SVertex a1, a2, a3;
|
||||
|
||||
for (int i = 0; i < triList.length; i++) {
|
||||
|
||||
a1 = vertexList.vertices[triList.triangles[i].a1];
|
||||
a2 = vertexList.vertices[triList.triangles[i].a2];
|
||||
a3 = vertexList.vertices[triList.triangles[i].a3];
|
||||
|
||||
a1a2.x = a2.x - a1.x;
|
||||
a1a2.y = a2.y - a1.y;
|
||||
a1a2.z = a2.z - a1.z;
|
||||
|
||||
a1a3.x = a3.x - a1.x;
|
||||
a1a3.y = a3.y - a1.y;
|
||||
a1a3.z = a3.z - a1.z;
|
||||
|
||||
cross(tempNormal,a1a2,a1a3);
|
||||
|
||||
tempNormal.i *= -1;
|
||||
tempNormal.j *= -1;
|
||||
tempNormal.k *= -1;
|
||||
|
||||
/* Store the normal for the triangle */
|
||||
triList.triangles[i].normal = tempNormal;
|
||||
|
||||
/* Add this normal to the normal of all the vertices */
|
||||
vertexList.vertices[triList.triangles[i].a1].normal.i += tempNormal.i;
|
||||
vertexList.vertices[triList.triangles[i].a1].normal.j += tempNormal.j;
|
||||
vertexList.vertices[triList.triangles[i].a1].normal.k += tempNormal.k;
|
||||
|
||||
vertexList.vertices[triList.triangles[i].a2].normal.i += tempNormal.i;
|
||||
vertexList.vertices[triList.triangles[i].a2].normal.j += tempNormal.j;
|
||||
vertexList.vertices[triList.triangles[i].a2].normal.k += tempNormal.k;
|
||||
|
||||
vertexList.vertices[triList.triangles[i].a3].normal.i += tempNormal.i;
|
||||
vertexList.vertices[triList.triangles[i].a3].normal.j += tempNormal.j;
|
||||
vertexList.vertices[triList.triangles[i].a3].normal.k += tempNormal.k;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
|
||||
GLint main(GLint argc, char **argv)
|
||||
{
|
||||
|
||||
/* Scan Input */
|
||||
scanInput();
|
||||
generateNormals();
|
||||
|
||||
/* initialize light */
|
||||
init_lightsource();
|
||||
|
||||
/* Initialize the currentTransformation */
|
||||
currModelTransform[0] = 1;
|
||||
currModelTransform[5] = 1;
|
||||
currModelTransform[10] = 1;
|
||||
currModelTransform[15] = 1;
|
||||
|
||||
/* initialize GLUT: register callbacks, etc */
|
||||
wid = init_glut(&argc, argv);
|
||||
|
||||
/* any OpenGL state initialization we need to do */
|
||||
init_opengl();
|
||||
|
||||
/* CREATE THE DISPLAY LIST FOR THE SCENE */
|
||||
|
||||
flatID = create_flat_scene();
|
||||
gouraudID = create_gouraud_scene();
|
||||
|
||||
sceneID = gouraudID;
|
||||
|
||||
glutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void scanInput(GLvoid) {
|
||||
char input[81];
|
||||
char *inputPtr;
|
||||
int i;
|
||||
|
||||
//Get the # of vertices and # of triangles
|
||||
std::cin.getline(input,81);
|
||||
|
||||
triList.length = strtol(input,&inputPtr,0);
|
||||
triList.triangles = (STriangle*)malloc(sizeof(STriangle)*triList.length);
|
||||
|
||||
vertexList.length = strtol(inputPtr,NULL,0);
|
||||
vertexList.vertices = (SVertex*)malloc(sizeof(SVertex)*vertexList.length);
|
||||
|
||||
//Skip over the first newline
|
||||
std::cin.getline(input,81);
|
||||
|
||||
for (i=0; i < triList.length; i++) {
|
||||
std::cin.getline(input,81);
|
||||
|
||||
//get points
|
||||
triList.triangles[i].a1 = strtol(input,&inputPtr,0);
|
||||
triList.triangles[i].a2 = strtol(inputPtr,&inputPtr,0);
|
||||
triList.triangles[i].a3 = strtol(inputPtr,NULL,0);
|
||||
triList.triangles[i].normal.i = 0;
|
||||
triList.triangles[i].normal.j = 0;
|
||||
triList.triangles[i].normal.k = 0;
|
||||
}
|
||||
|
||||
//skip over separation newline
|
||||
std::cin.getline(input,81);
|
||||
|
||||
for (i=0; i < vertexList.length; i++) {
|
||||
std::cin.getline(input,81);
|
||||
|
||||
//get coordinates
|
||||
vertexList.vertices[i].x = strtod(input,&inputPtr);
|
||||
vertexList.vertices[i].y = strtod(inputPtr,&inputPtr);
|
||||
vertexList.vertices[i].z = strtod(inputPtr,NULL);
|
||||
|
||||
vertexList.vertices[i].normal.i = 0;
|
||||
vertexList.vertices[i].normal.j = 0;
|
||||
vertexList.vertices[i].normal.k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
CS4451/proj2/Submission/proj2_submit.tar.gz
Normal file
@@ -0,0 +1,212 @@
|
||||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||
<!-- saved from url=(0053)http://www.students.uwosh.edu/~bradfj23/visualstudio/ -->
|
||||
<?xml version="1.0" encoding="UTF-8"?><HTML xml:lang="en"
|
||||
xmlns="http://www.w3.org/1999/xhtml"><HEAD><TITLE>Using OpenGL and GLUT in Visual Studio .NET 2003</TITLE>
|
||||
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
|
||||
<STYLE type=text/css>BODY {
|
||||
FONT-FAMILY: Arial, Helvetica, sans-serif
|
||||
}
|
||||
IMG {
|
||||
BORDER-RIGHT: medium none; BORDER-TOP: medium none; MARGIN: 5px; BORDER-LEFT: medium none; BORDER-BOTTOM: medium none
|
||||
}
|
||||
LI {
|
||||
MARGIN-BOTTOM: 15px
|
||||
}
|
||||
SPAN {
|
||||
FONT-WEIGHT: normal; FONT-SIZE: smaller
|
||||
}
|
||||
TABLE {
|
||||
BORDER-COLLAPSE: collapse
|
||||
}
|
||||
TD {
|
||||
BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid
|
||||
}
|
||||
TH {
|
||||
BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid
|
||||
}
|
||||
TD {
|
||||
PADDING-RIGHT: 7px; PADDING-LEFT: 7px; PADDING-BOTTOM: 7px; PADDING-TOP: 7px
|
||||
}
|
||||
TT {
|
||||
BACKGROUND-COLOR: #eeeeee
|
||||
}
|
||||
.OS {
|
||||
WIDTH: 25%; BORDER-RIGHT-STYLE: none
|
||||
}
|
||||
.directory {
|
||||
BORDER-LEFT-STYLE: none
|
||||
}
|
||||
.menu LI {
|
||||
MARGIN-BOTTOM: 0px
|
||||
}
|
||||
</STYLE>
|
||||
|
||||
<META content="MSHTML 6.00.2900.2523" name=GENERATOR></HEAD>
|
||||
<BODY>
|
||||
<H1>Using OpenGL & GLUT in Visual Studio .NET 2003</H1>
|
||||
<H2>A Guide to Easier Graphics Programming <20> By <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/">Jordan Bradford</A></H2>
|
||||
<P>Visual Studio .NET is <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/why.html">a fantastic
|
||||
IDE</A>, and with it you can write programs that will run in both Windows and
|
||||
Linux with no fuss. This guide will show you how to set up a Visual Studio
|
||||
project that will do just that, provided it is a pure OpenGL application using
|
||||
GLUT. This guide also assumes Visual Studio .NET 2003 (and/or 2002) is already
|
||||
installed and you are familiar with its use.</P>
|
||||
<H3><A id=contents>Contents</A></H3>
|
||||
<P>Click here for the <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/quick.html">Quick
|
||||
Version</A> of this guide (if you simply need to refresh your memory).</P>
|
||||
<OL class=menu>
|
||||
<LI><A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#step1">Installation</A>
|
||||
(only needs to be done once)
|
||||
<LI><A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#step2">Create a
|
||||
Visual Studio Project</A>
|
||||
<LI><A href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#step3">Add
|
||||
Source Code</A>
|
||||
<LI><A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#step4">Modify
|
||||
Project Properties</A>
|
||||
<LI><A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#step5">Enjoy
|
||||
Visual Studio</A> </LI></OL>
|
||||
<H3><A id=step1>Step 1: Installation (only needs to be done once)</A>
|
||||
<SPAN>back to <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#contents">top
|
||||
↑</A></SPAN></H3>
|
||||
<P>Windows comes with OpenGL, and Visual Studio comes with the OpenGL libraries,
|
||||
but neither of them comes with GLUT. Get the newest version of GLUT here: <A
|
||||
href="http://www.xmission.com/~nate/glut.html">GLUT 3.7.6 for Windows</A>. Put
|
||||
the following files in the following locations:</P>
|
||||
<TABLE>
|
||||
<THEAD>
|
||||
<TR>
|
||||
<TH>File</TH>
|
||||
<TH colSpan=2>Location</TH></TR></THEAD>
|
||||
<TBODY>
|
||||
<TR>
|
||||
<TD rowSpan=2><TT>glut32.dll</TT></TD>
|
||||
<TD class=OS><I>Windows XP | Server 2003</I>:</TD>
|
||||
<TD class=directory><TT>C:\WINDOWS\system\</TT></TD></TR>
|
||||
<TR>
|
||||
<TD class=OS><I>Windows 2000</I>:</TD>
|
||||
<TD class=directory><TT>C:\WINNT\system\</TT></TD></TR>
|
||||
<TR>
|
||||
<TD><TT>glut32.lib</TT></TD>
|
||||
<TD colSpan=2><TT>C:\Program Files\Microsoft Visual Studio .NET
|
||||
2003\Vc7\PlatformSDK\Lib</TT></TD></TR>
|
||||
<TR>
|
||||
<TD><TT>glut32.h</TT></TD>
|
||||
<TD colSpan=2><TT>C:\Program Files\Microsoft Visual Studio .NET
|
||||
2003\Vc7\PlatformSDK\Include\gl</TT></TD></TR></TBODY></TABLE>
|
||||
<P><STRONG>Note:</STRONG><BR>If you plan on giving your program to friends to
|
||||
run using Windows, you must also include the <TT>glut32.dll</TT> file. If they
|
||||
don't have this file in the same directory as your application or in their
|
||||
<TT>C:\WINDOWS\system</TT> folder, the program will not run.</P>
|
||||
<H3><A id=step2>Step 2: Create a Visual Studio Project</A>
|
||||
<SPAN>back to <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#contents">top
|
||||
↑</A></SPAN></H3>
|
||||
<P>Because GLUT was designed to be window system independent <20> it makes its own
|
||||
windows <20> it is better to let GLUT run as a console application than as a native
|
||||
Windows application (which would require <TT>#include <windows.h></TT>).
|
||||
To create an empty console project in Visual Studio, do the following:</P>
|
||||
<OL>
|
||||
<LI>Create a new project ( <TT>File → New → Project...</TT> ). The <TT>New
|
||||
Project</TT> dialog will appear.<BR><IMG
|
||||
style="BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid"
|
||||
height=443 alt="Create a new project"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step2.jpg"
|
||||
width=415>
|
||||
<LI>In the <TT>Project Types:</TT> pane, select <TT>Visual C++ Projects</TT>.
|
||||
Then select <TT>Win32 Console Project</TT> in the <TT>Templates:</TT> pane.
|
||||
Name your project and click <TT>OK</TT>. The <TT>Win32 Application Wizard</TT>
|
||||
dialog will appear.<BR><IMG height=393 alt="Create a Win32 Console Project"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step2a.jpg"
|
||||
width=531>
|
||||
<LI>Click the <TT>Application Settings</TT> tab on the left, and check the
|
||||
<TT>Empty Project</TT> box. Then click <TT>Finish</TT>.<BR><IMG height=437
|
||||
alt="Create an empty Win32 Console Project"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step2b.jpg"
|
||||
width=615><BR>Your empty console project will be created. </LI></OL>
|
||||
<H3><A id=step3>Step 3: Add Source Code</A> <SPAN>back to <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#contents">top
|
||||
↑</A></SPAN></H3>
|
||||
<P>Adding source files to the project should be familiar to you, so a detailed
|
||||
explanation is not necessary. There are two facts you should know, however.</P>
|
||||
<OL>
|
||||
<LI>When you include GLUT in a program, it automatically includes the rest of
|
||||
the OpenGL header files. So explicitly having<BR><BR><TT>#include
|
||||
<GL/gl.h></TT><BR><TT>#include <GL/glu.h></TT><BR><BR>in either
|
||||
Linux or Windows isn't necessary, provided you include GLUT.
|
||||
<LI>Visual Studio can also recognize the forward slash as a directory
|
||||
designation in <TT>#include</TT> directives <20> Windows normally uses a
|
||||
backslash <20> so you shouldn't rewrite your code with one:<BR><BR><TT>#include
|
||||
<GL<STRONG>\</STRONG>glut.h></TT><BR><BR>If you use a backslash in
|
||||
Linux, gcc will complain. </LI></OL>
|
||||
<H3><A id=step4>Step 4: Modify Project Properties</A> <SPAN>back to
|
||||
<A href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#contents">top
|
||||
↑</A></SPAN></H3>
|
||||
<P>Before compiling your project, you need to set up Visual Studio's linker so
|
||||
it knows where to find GLUT. To do this, you must open the <TT>Property
|
||||
Pages</TT> dialog for your project. There are two ways to do this:</P>
|
||||
<OL>
|
||||
<LI>Use Visual Studio's menu option ( <TT>Project → Properties</TT> ).<BR><IMG
|
||||
style="BORDER-RIGHT: black thin solid; BORDER-TOP: black thin solid; BORDER-LEFT: black thin solid; BORDER-BOTTOM: black thin solid"
|
||||
height=363 alt="Use menu: Project -> Properties"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step4_1.jpg"
|
||||
width=453>
|
||||
<LI>Use the <TT>Solution Explorer</TT> located in the upper right corner.
|
||||
Right-click your project's name as shown and select
|
||||
<TT>Properties</TT>.<BR><IMG height=636 alt="Use Solution Explorer"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step4_2.jpg"
|
||||
width=211> </LI></OL>
|
||||
<P>Using either option, the <TT>Property Pages</TT> dialog will open. Once it
|
||||
appears, do the following:</P>
|
||||
<OL>
|
||||
<LI>From the <TT>Configuration:</TT> list box, select <TT>All
|
||||
Configurations</TT>.<BR><IMG height=440 alt="Select All Configurations"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step4a.jpg"
|
||||
width=644>
|
||||
<LI>In the left pane, select the <TT>Linker</TT> subtree and then the
|
||||
<TT>Input</TT> option. Add the given code to the <TT>Additional
|
||||
Dependencies</TT> text box in the right pane. This tells Visual Studio where
|
||||
to find GLUT. (Copy & Paste: <STRONG><TT>opengl32.lib glu32.lib
|
||||
glut32.lib</TT></STRONG> )<BR><IMG height=440 alt="Add libraries"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step4b.jpg"
|
||||
width=644>
|
||||
<LI>This step is optional. If you want to prevent your program from opening a
|
||||
console window in addition to your GLUT window when it is run, select the
|
||||
<TT>Command Line</TT> option in the left pane. Then add the given code to the
|
||||
<TT>Additional Options:</TT> text box.<BR><IMG height=440
|
||||
alt="Disable console window"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/step4c.jpg"
|
||||
width=644><BR>Visual Studio thinks it's still building a normal console
|
||||
application, which is why a console window will appear if you run your program
|
||||
from inside Visual Studio or by double-clicking its icon. The
|
||||
<STRONG><TT>/SUBSYSTEM:WINDOWS</TT></STRONG> command fools Visual Studio into
|
||||
thinking this is a windowed application, which means a console window isn't
|
||||
necessary. However, when Visual Studio makes windowed applications, it wants
|
||||
to start program execution from <TT>WinMain()</TT> or <TT>wWinMain()</TT>,
|
||||
which you haven't defined. Setting the
|
||||
<STRONG><TT>/ENTRY:mainCRTStartup</TT></STRONG> flag tells Visual Studio to
|
||||
start execution at the usual <TT>main()</TT> instead. </LI></OL>
|
||||
<P><STRONG>Note:</STRONG><BR>If you choose to disable the console window,
|
||||
remember that you won't be able to see any console output from your program
|
||||
using <TT>printf()</TT>, <TT>cout</TT>, <TT>cerr</TT>, etc.</P>
|
||||
<H3><A id=step5>Step 5: Enjoy Visual Studio</A> <SPAN>back to <A
|
||||
href="http://www.students.uwosh.edu/~bradfj23/visualstudio/#contents">top
|
||||
↑</A></SPAN></H3>
|
||||
<P>Now your program is ready for development in an excellent IDE while still
|
||||
being portable. Be sure to test your program on a Linux machine before
|
||||
submitting it for grading. Your computer at home is most likely superior to the
|
||||
ones in the lab, so inefficient code might not be apparent.</P>
|
||||
<HR>
|
||||
|
||||
<P>Last Update: April 10, 2004</P>
|
||||
<P><A href="http://validator.w3.org/check/referer"><IMG height=31
|
||||
alt="Valid XHTML 1.1!"
|
||||
src="Using OpenGL and GLUT in Visual Studio _NET 2003_files/valid-xhtml11.png"
|
||||
width=88></A></P></BODY></HTML>
|
||||
|
After Width: | Height: | Size: 57 KiB |
|
After Width: | Height: | Size: 79 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 88 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 60 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
892
CS4451/proj2/cs4451_a2.cpp
Normal file
@@ -0,0 +1,892 @@
|
||||
|
||||
/* cs4451_a2.cpp */
|
||||
/*
|
||||
* Jose Caban
|
||||
* gtg184g
|
||||
* proj2
|
||||
*/
|
||||
|
||||
|
||||
#include <math.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <iostream>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef _OS_LINUX_
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glu.h>
|
||||
#endif
|
||||
|
||||
//Windows only needs glut.h care of SGI ;)
|
||||
#include <GL/glut.h>
|
||||
|
||||
|
||||
#define VPD_MIN 200
|
||||
#define VPD_DEFAULT 800
|
||||
#define VPD_MAX 1024
|
||||
|
||||
enum MENU { MENU_SWITCH_SHADING=0,
|
||||
MENU_ZOOM_IN,
|
||||
MENU_ZOOM_OUT,
|
||||
MENU_POINTS,
|
||||
MENU_LINES,
|
||||
MENU_TRIANGLES,
|
||||
MENU_SWITCH_LIGHT,
|
||||
MENU_SWITCH_CULLING,
|
||||
MENU_TURN_OFF_CULLING,
|
||||
MENU_TURN_ON_CULLING,
|
||||
MENU_RESET_MODELVIEW
|
||||
};
|
||||
|
||||
|
||||
|
||||
#define TWOPI (2.0 * M_PI)
|
||||
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
//Define the Normal type
|
||||
typedef struct SNormal {
|
||||
GLfloat i;
|
||||
GLfloat j;
|
||||
GLfloat k;
|
||||
} SNormal;
|
||||
|
||||
typedef struct SPoint {
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
} SPoint;
|
||||
|
||||
//Define the Vertex type for use in keeping track of Vertices
|
||||
typedef struct SVertex {
|
||||
SNormal normal;
|
||||
GLfloat x;
|
||||
GLfloat y;
|
||||
GLfloat z;
|
||||
} SVertex;
|
||||
|
||||
//Define the Data structure that will hold all the vertices
|
||||
typedef struct SVertexList {
|
||||
SVertex* vertices;
|
||||
int length;
|
||||
} SVertexList;
|
||||
|
||||
//Define a Triangle (a1,a2,a3 are indices to the SVertexList
|
||||
typedef struct STriangle {
|
||||
SNormal normal;
|
||||
GLint a1,a2,a3;
|
||||
} STriangle;
|
||||
|
||||
typedef struct STriangleList {
|
||||
STriangle* triangles;
|
||||
GLint length;
|
||||
} STriangleList;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
//////////////////////////////////////////////////////
|
||||
// Globals
|
||||
|
||||
SVertexList vertexList;
|
||||
STriangleList triList;
|
||||
GLfloat currModelTransform[16];
|
||||
|
||||
GLint wid; /* GLUT window id */
|
||||
GLint vpd = VPD_DEFAULT; /* (square) viewport dimensions */
|
||||
|
||||
GLuint triangleScene; /* display list ID */
|
||||
GLuint gouraudID; /* gouraud display list ID */
|
||||
GLuint flatID; /* flat display list ID */
|
||||
|
||||
GLfloat angle1 = 0; /* angles used in animation */
|
||||
GLfloat angle2 = 0;
|
||||
GLfloat dangle1 = 0.57;
|
||||
GLfloat dangle2 = 0.71;
|
||||
|
||||
GLdouble viewDist = 8.0; /* Changes the view distance view */
|
||||
|
||||
GLuint cullMode = GL_BACK;
|
||||
GLboolean worldLight = GL_TRUE;
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////
|
||||
//Functions
|
||||
|
||||
/*
|
||||
* Input scanner
|
||||
*/
|
||||
void scanInput(GLvoid);
|
||||
|
||||
/*
|
||||
* Initialize the Light Source
|
||||
*/
|
||||
GLvoid init_lightsource ( GLvoid )
|
||||
{
|
||||
GLfloat light_ambient[] = { .1, .1, .1, 1.0 };
|
||||
GLfloat light_diffuse[] = { .9, .9, .9, 1.0 };
|
||||
GLfloat light_specular[] = { 0, 0, 0, 1.0 };
|
||||
GLfloat light_position[] = { 2.0, 2.0, 2.0, 0.0 };
|
||||
|
||||
glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient);
|
||||
glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse);
|
||||
glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular);
|
||||
glLightfv(GL_LIGHT0, GL_POSITION, light_position);
|
||||
glLightf(GL_LIGHT0,GL_CONSTANT_ATTENUATION,1.0);
|
||||
glLightf(GL_LIGHT0,GL_LINEAR_ATTENUATION,0.0);
|
||||
glLightf(GL_LIGHT0,GL_QUADRATIC_ATTENUATION,0.0);
|
||||
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_LIGHT0);
|
||||
}
|
||||
|
||||
GLvoid set_material_properties ( GLfloat r, GLfloat g, GLfloat b )
|
||||
{
|
||||
GLfloat mat_specular[4] = { 0.0, 0.0, 0.0, 1.0 };
|
||||
GLfloat mat_ambient_and_diffuse[4] = { 0.5, 0.5, 0.5, 1.0 };
|
||||
GLfloat mat_shininess[1] = { 0.0 };
|
||||
|
||||
mat_specular[0] = mat_ambient_and_diffuse[0] = r;
|
||||
mat_specular[1] = mat_ambient_and_diffuse[1] = g;
|
||||
mat_specular[2] = mat_ambient_and_diffuse[2] = b;
|
||||
|
||||
glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular);
|
||||
glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess);
|
||||
glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, mat_ambient_and_diffuse);
|
||||
|
||||
}
|
||||
|
||||
|
||||
inline void cross(SNormal& dest, SVertex& a, SVertex& b) {
|
||||
dest.i = ( (a.y*b.z) - (a.z*b.y) ); //i
|
||||
dest.j = ( (a.z*b.x) - (a.x*b.z) ); //j
|
||||
dest.k = ( (a.x*b.y) - (a.y*b.x) ); //k
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the scene
|
||||
*
|
||||
*/
|
||||
GLuint init_flat_scene ( )
|
||||
{
|
||||
GLuint sceneList = glGenLists(1);
|
||||
|
||||
SNormal tempNormal;
|
||||
SVertex a1, a2, a3;
|
||||
|
||||
glNewList(sceneList,GL_COMPILE);
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
for (int i = 0; i < triList.length; i++) {
|
||||
|
||||
a1 = vertexList.vertices[triList.triangles[i].a1];
|
||||
a2 = vertexList.vertices[triList.triangles[i].a2];
|
||||
a3 = vertexList.vertices[triList.triangles[i].a3];
|
||||
|
||||
tempNormal = triList.triangles[i].normal;
|
||||
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
|
||||
glVertex3f(a1.x, a1.y, a1.z);
|
||||
glVertex3f(a2.x, a2.y, a2.z);
|
||||
glVertex3f(a3.x, a3.y, a3.z);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
|
||||
return sceneList;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Initialize the gouraud scene
|
||||
*/
|
||||
GLuint init_gouraud_scene ( )
|
||||
{
|
||||
GLuint sceneList = glGenLists(1);
|
||||
|
||||
SNormal tempNormal;
|
||||
SVertex a1, a2, a3;
|
||||
|
||||
glNewList(sceneList,GL_COMPILE);
|
||||
glBegin(GL_TRIANGLES);
|
||||
|
||||
for (int i = 0; i < triList.length; i++) {
|
||||
|
||||
a1 = vertexList.vertices[triList.triangles[i].a1];
|
||||
a2 = vertexList.vertices[triList.triangles[i].a2];
|
||||
a3 = vertexList.vertices[triList.triangles[i].a3];
|
||||
|
||||
tempNormal = a1.normal;
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
glVertex3f(a1.x, a1.y, a1.z);
|
||||
|
||||
tempNormal = a2.normal;
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
glVertex3f(a2.x, a2.y, a2.z);
|
||||
|
||||
tempNormal = a3.normal;
|
||||
glNormal3f(tempNormal.i, tempNormal.j, tempNormal.k);
|
||||
glVertex3f(a3.x, a3.y, a3.z);
|
||||
}
|
||||
|
||||
glEnd();
|
||||
|
||||
glEndList();
|
||||
|
||||
return sceneList;
|
||||
}
|
||||
|
||||
|
||||
GLuint create_scene(GLuint triangleList) {
|
||||
GLuint sceneList = glGenLists(1);
|
||||
|
||||
glNewList(sceneList,GL_COMPILE);
|
||||
|
||||
set_material_properties(1.0,1.0,1.0);
|
||||
|
||||
/* Correctly size the object */
|
||||
assert(vertexList.length > 0);
|
||||
|
||||
SVertex Max;
|
||||
SVertex Min;
|
||||
SVertex Center;
|
||||
|
||||
Max.x = Min.x = vertexList.vertices[0].x;
|
||||
Max.y = Min.y = vertexList.vertices[0].y;
|
||||
Max.z = Min.z = vertexList.vertices[0].z;
|
||||
|
||||
for (int i = 1; i < vertexList.length; i++) {
|
||||
if (vertexList.vertices[i].x > Max.x) {
|
||||
Max.x = vertexList.vertices[i].x;
|
||||
} else if (vertexList.vertices[i].x < Min.x) {
|
||||
Min.x = vertexList.vertices[i].x;
|
||||
}
|
||||
|
||||
if (vertexList.vertices[i].y > Max.y) {
|
||||
Max.y = vertexList.vertices[i].y;
|
||||
} else if (vertexList.vertices[i].y < Min.y) {
|
||||
Min.y = vertexList.vertices[i].y;
|
||||
}
|
||||
|
||||
if (vertexList.vertices[i].z > Max.z) {
|
||||
Max.z = vertexList.vertices[i].z;
|
||||
} else if (vertexList.vertices[i].z < Min.z) {
|
||||
Min.z = vertexList.vertices[i].z;
|
||||
}
|
||||
}
|
||||
|
||||
Center.x = (Max.x + Min.x) / 2.;
|
||||
Center.y = (Max.y + Min.y) / 2.;
|
||||
Center.z = (Max.z + Min.z) / 2.;
|
||||
|
||||
float scaleX, scaleY, scaleZ;
|
||||
scaleX = (Max.x - Min.x) / 2.;
|
||||
scaleY = (Max.y - Min.y) / 2.;
|
||||
scaleZ = (Max.z - Min.z) / 2.;
|
||||
|
||||
float scaleFactor;
|
||||
|
||||
scaleFactor = scaleX > scaleY ? scaleX : scaleY;
|
||||
scaleFactor = scaleZ > scaleFactor ? scaleZ : scaleFactor;
|
||||
scaleFactor = 1. / scaleFactor;
|
||||
|
||||
//printf("ScaleFactor: %f\n",scaleFactor);
|
||||
|
||||
glPushMatrix();
|
||||
glTranslatef(0.-(Center.x*scaleFactor),0.-(Center.y*scaleFactor),0.-(Center.z*scaleFactor));
|
||||
glScalef(scaleFactor,scaleFactor,scaleFactor);
|
||||
glCallList(triangleList);
|
||||
glPopMatrix();
|
||||
|
||||
glEndList();
|
||||
|
||||
return sceneList;
|
||||
}
|
||||
|
||||
GLuint create_flat_scene ( )
|
||||
{
|
||||
return create_scene( init_flat_scene() );
|
||||
}
|
||||
|
||||
GLuint create_gouraud_scene ( )
|
||||
{
|
||||
return create_scene( init_gouraud_scene() );
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* redraw the scene */
|
||||
|
||||
GLvoid draw(GLvoid)
|
||||
{
|
||||
/* set the projection matrix */
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
glLoadIdentity();
|
||||
gluPerspective(viewDist,1.0,15.0,25.0);
|
||||
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
/* initialize light */
|
||||
if (worldLight) {
|
||||
//World Lighting
|
||||
init_lightsource();
|
||||
glTranslatef(0,0,-20);
|
||||
glMultMatrixf(currModelTransform);
|
||||
} else {
|
||||
//Model Lighting
|
||||
glTranslatef(0,0,-20);
|
||||
glMultMatrixf(currModelTransform);
|
||||
init_lightsource();
|
||||
}
|
||||
|
||||
/* ensure we're drawing to the correct GLUT window */
|
||||
glutSetWindow(wid);
|
||||
|
||||
/* clear the color buffers */
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
/* DRAW WHAT IS IN THE DISPLAY LIST */
|
||||
glCallList(triangleScene);
|
||||
|
||||
/* flush the pipeline */
|
||||
glFlush();
|
||||
|
||||
/* look at our handiwork */
|
||||
glutSwapBuffers();
|
||||
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* handle mouse events */
|
||||
SPoint oldPoint; //stores the previous point used in the virtual trackball
|
||||
|
||||
GLvoid mouse_button(GLint btn, GLint state, GLint mx, GLint my)
|
||||
{
|
||||
switch( btn ) {
|
||||
case GLUT_LEFT_BUTTON:
|
||||
switch( state ) {
|
||||
case GLUT_DOWN:
|
||||
oldPoint.x = mx;
|
||||
oldPoint.y = my;
|
||||
oldPoint.z = -1;
|
||||
break;
|
||||
case GLUT_UP:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GLUT_MIDDLE_BUTTON:
|
||||
switch( state ) {
|
||||
case GLUT_DOWN:
|
||||
break;
|
||||
case GLUT_UP:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case GLUT_RIGHT_BUTTON:
|
||||
switch( state ) {
|
||||
case GLUT_DOWN:
|
||||
break;
|
||||
case GLUT_UP:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
inline void scalePoint(SPoint& p, GLint mx, GLint my) {
|
||||
//scale to -1 and 1
|
||||
float scale = ceil(vpd/2.);
|
||||
p.x = (mx / scale) -1.;
|
||||
p.y = (my / scale) -1.;
|
||||
p.y*=-1.; //handle reversed y
|
||||
|
||||
p.z = 1.-pow(p.x,2)-pow(p.y,2);
|
||||
|
||||
if (p.z < 0) {
|
||||
float under = sqrt((p.x*p.x)+(p.y*p.y));
|
||||
p.x /= under;
|
||||
p.y /= under;
|
||||
p.z = 0;
|
||||
} else {
|
||||
p.z = sqrt(p.z);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
inline GLfloat vecLength(SPoint& p) {
|
||||
return sqrt(pow(p.x,2)+pow(p.y,2)+pow(p.z,2));
|
||||
}
|
||||
|
||||
inline GLfloat dot(SPoint &a, SPoint &b) {
|
||||
return (a.x*b.x)+(a.y*b.y)+(a.z*b.z);
|
||||
}
|
||||
|
||||
inline void cross(SPoint &dest, SPoint &a, SPoint &b) {
|
||||
|
||||
dest.x = ( (a.y*b.z) - (a.z*b.y) ); //i
|
||||
dest.y = ( (a.z*b.x) - (a.x*b.z) ); //j
|
||||
dest.z = ( (a.x*b.y) - (a.y*b.x) ); //k
|
||||
}
|
||||
|
||||
inline void calcAngle(GLfloat *newMatrix, GLfloat angle, SPoint& a) {
|
||||
newMatrix[0] = 1.+(1.-cos(angle))*(pow(a.x,2)-1.);
|
||||
newMatrix[1] = a.z*sin(angle) + (1.-cos(angle)) * a.x * a.y;
|
||||
newMatrix[2] = -1. * a.y * sin(angle) + (1.-cos(angle))*a.x*a.z;
|
||||
newMatrix[3] = 0;
|
||||
newMatrix[4] = -1. * a.z * sin(angle) + (1.-cos(angle)) * a.x * a.y;
|
||||
newMatrix[5] = 1. + (1. - cos(angle))*(pow(a.y,2)-1.);
|
||||
newMatrix[6] = a.x * sin(angle) + (1.-cos(angle))*a.y*a.z;
|
||||
newMatrix[7] = 0;
|
||||
newMatrix[8] = a.y * sin(angle) + (1.-cos(angle))*a.x * a.z;
|
||||
newMatrix[9] = -1. * a.x * sin(angle) + (1.-cos(angle))*a.y*a.z;
|
||||
newMatrix[10] = 1. + (1.-cos(angle))*(pow(a.z,2)-1.);
|
||||
newMatrix[11] = newMatrix[12] = newMatrix[13] = newMatrix[14] = 0;
|
||||
newMatrix[15] = 1.;
|
||||
}
|
||||
|
||||
GLvoid button_motion(GLint mx, GLint my)
|
||||
{
|
||||
/* First calculate P */
|
||||
static SPoint v;
|
||||
SPoint p, w, a;
|
||||
|
||||
//Give us the scaled p on the sphere
|
||||
scalePoint(p,mx,my);
|
||||
|
||||
//get the unit vector of p
|
||||
GLfloat length = vecLength(p);
|
||||
if (length==0) {
|
||||
return;
|
||||
} else {
|
||||
w.x = p.x / length;
|
||||
w.y = p.y / length;
|
||||
w.z = p.z / length;
|
||||
}
|
||||
|
||||
//This is the first time the movement has been made
|
||||
if (oldPoint.z == -1) {
|
||||
scalePoint(oldPoint,(int)oldPoint.x,(int)oldPoint.y);
|
||||
|
||||
length = vecLength(oldPoint);
|
||||
if (length==0) {
|
||||
return;
|
||||
} else {
|
||||
v.x = oldPoint.x / length;
|
||||
v.y = oldPoint.y / length;
|
||||
v.z = oldPoint.z / length;
|
||||
}
|
||||
}
|
||||
|
||||
cross(a,oldPoint,p);
|
||||
length = vecLength(a);
|
||||
if (length==0) {
|
||||
return;
|
||||
} else {
|
||||
a.x /= length;
|
||||
a.y /= length;
|
||||
a.z /= length;
|
||||
}
|
||||
|
||||
GLfloat angle = dot(v,w);
|
||||
if (angle > 1) {
|
||||
angle = 1;
|
||||
} else if (angle < -1) {
|
||||
angle = -1;
|
||||
}
|
||||
|
||||
angle = acos(angle);
|
||||
|
||||
/* Perform the rotation calculation */
|
||||
GLfloat newMatrix[16];
|
||||
|
||||
calcAngle(newMatrix,angle,a);
|
||||
|
||||
/* Make OpenGL do our work */
|
||||
glPushMatrix();
|
||||
glLoadMatrixf(newMatrix);
|
||||
glMultMatrixf(currModelTransform);
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX,currModelTransform);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
|
||||
oldPoint = p;
|
||||
v = w;
|
||||
|
||||
glutPostRedisplay();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
GLvoid passive_motion(GLint mx, GLint my)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* handle keyboard events; here, just exit if ESC is hit */
|
||||
|
||||
GLvoid keyboard(GLubyte key, GLint x, GLint y)
|
||||
{
|
||||
switch(key) {
|
||||
case 27: /* ESC */
|
||||
exit(0);
|
||||
case 'w':
|
||||
viewDist -= .1;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 's':
|
||||
viewDist += .1;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'a':
|
||||
currModelTransform[12] -= .01;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case 'd':
|
||||
currModelTransform[12] += .01;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
GLvoid menu ( int value )
|
||||
{
|
||||
switch(value)
|
||||
{
|
||||
case MENU_SWITCH_SHADING:
|
||||
if (triangleScene == gouraudID) {
|
||||
glShadeModel(GL_FLAT);
|
||||
triangleScene = flatID;
|
||||
} else {
|
||||
glShadeModel(GL_SMOOTH);
|
||||
triangleScene = gouraudID;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_ZOOM_IN:
|
||||
viewDist -= 1.;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_ZOOM_OUT:
|
||||
viewDist += 1.;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_POINTS:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_POINT);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_LINES:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_TRIANGLES:
|
||||
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_SWITCH_CULLING:
|
||||
if (cullMode == GL_FRONT) {
|
||||
glCullFace(GL_BACK);
|
||||
cullMode = GL_BACK;
|
||||
} else {
|
||||
glCullFace(GL_FRONT);
|
||||
cullMode = GL_FRONT;
|
||||
}
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_TURN_ON_CULLING:
|
||||
glEnable(GL_CULL_FACE);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_TURN_OFF_CULLING:
|
||||
glDisable(GL_CULL_FACE);
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_SWITCH_LIGHT:
|
||||
worldLight = !worldLight;
|
||||
glutPostRedisplay();
|
||||
break;
|
||||
case MENU_RESET_MODELVIEW:
|
||||
glPushMatrix();
|
||||
glLoadIdentity();
|
||||
glGetFloatv(GL_MODELVIEW_MATRIX,currModelTransform);
|
||||
glPopMatrix();
|
||||
glutPostRedisplay();
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
/* handle resizing the glut window */
|
||||
|
||||
GLvoid reshape(GLint vpw, GLint vph)
|
||||
{
|
||||
glutSetWindow(wid);
|
||||
|
||||
/* maintain a square viewport, not too small, not too big */
|
||||
if( vpw < vph ) vpd = vph;
|
||||
else vpd = vpw;
|
||||
|
||||
if( vpd < VPD_MIN ) vpd = VPD_MIN;
|
||||
if( vpd > VPD_MAX ) vpd = VPD_MAX;
|
||||
|
||||
glViewport(0, 0, vpd, vpd);
|
||||
glutReshapeWindow(vpd, vpd);
|
||||
|
||||
glutPostRedisplay();
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
GLint init_glut(GLint *argc, char **argv)
|
||||
{
|
||||
GLint id;
|
||||
|
||||
glutInit(argc,argv);
|
||||
|
||||
/* size and placement hints to the window system */
|
||||
glutInitWindowSize(vpd, vpd);
|
||||
glutInitWindowPosition(10,10);
|
||||
|
||||
/* double buffered, RGB color mode */
|
||||
glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH);
|
||||
|
||||
/* create a GLUT window (not drawn until glutMainLoop() is entered) */
|
||||
id = glutCreateWindow("cs4451 assignment 2");
|
||||
|
||||
/* register callbacks */
|
||||
|
||||
/* window size changes */
|
||||
glutReshapeFunc(reshape);
|
||||
|
||||
/* keypress handling when the current window has input focus */
|
||||
glutKeyboardFunc(keyboard);
|
||||
|
||||
/* mouse event handling */
|
||||
glutMouseFunc(mouse_button); /* button press/release */
|
||||
glutMotionFunc(button_motion); /* mouse motion w/ button down */
|
||||
glutPassiveMotionFunc(passive_motion); /* mouse motion with button up */
|
||||
|
||||
/* window obscured/revealed event handler */
|
||||
glutVisibilityFunc(NULL);
|
||||
|
||||
/* handling of keyboard SHIFT, ALT, CTRL keys */
|
||||
glutSpecialFunc(NULL);
|
||||
|
||||
/* what to do when mouse cursor enters/exits the current window */
|
||||
glutEntryFunc(NULL);
|
||||
|
||||
/* what to do on each display loop iteration */
|
||||
glutDisplayFunc(draw);
|
||||
|
||||
/* Create the menu */
|
||||
|
||||
//Create the Zoom Menu
|
||||
GLint zoomMenu = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Zoom In (w)",MENU_ZOOM_IN);
|
||||
glutAddMenuEntry("Zoom Out (s)",MENU_ZOOM_OUT);
|
||||
|
||||
//Create the Render Mode Menu
|
||||
GLint renderMenu = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Points Only",MENU_POINTS);
|
||||
glutAddMenuEntry("Lines Only",MENU_LINES);
|
||||
glutAddMenuEntry("Full Model",MENU_TRIANGLES);
|
||||
|
||||
//Create the Culling Menu
|
||||
GLint cullingMenu = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Switch Culling Mode",MENU_SWITCH_CULLING);
|
||||
glutAddMenuEntry("Turn on Culling",MENU_TURN_ON_CULLING);
|
||||
glutAddMenuEntry("Turn off Culling",MENU_TURN_OFF_CULLING);
|
||||
|
||||
GLint menuID = glutCreateMenu(menu);
|
||||
glutAddMenuEntry("Switch Shading Mode",MENU_SWITCH_SHADING);
|
||||
glutAddMenuEntry("Toggle World/Model Relative Light",MENU_SWITCH_LIGHT);
|
||||
|
||||
glutAddSubMenu("Zoom",zoomMenu);
|
||||
glutAddSubMenu("Render", renderMenu);
|
||||
glutAddSubMenu("Culling", cullingMenu);
|
||||
|
||||
glutAddMenuEntry("Reset View Model",MENU_RESET_MODELVIEW);
|
||||
|
||||
glutSetMenu(menuID);
|
||||
|
||||
glutAttachMenu(GLUT_RIGHT_BUTTON);
|
||||
|
||||
return id;
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
GLvoid init_opengl(GLvoid)
|
||||
{
|
||||
/* back-face culling on */
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK); /* We want to cull the back */
|
||||
glFrontFace(GL_CW); /* The vertices we get are clockwise */
|
||||
|
||||
/* automatically scale normals to unit length after transformation */
|
||||
glEnable(GL_NORMALIZE);
|
||||
|
||||
/* clear to BLACK */
|
||||
glClearColor(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
/* Enable depth test */
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
}
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
void generateNormals() {
|
||||
|
||||
/* Generate normals for triangles and Vertices */
|
||||
SNormal tempNormal;
|
||||
|
||||
SVertex a1a2, a1a3;
|
||||
SVertex a1, a2, a3;
|
||||
|
||||
for (int i = 0; i < triList.length; i++) {
|
||||
|
||||
a1 = vertexList.vertices[triList.triangles[i].a1];
|
||||
a2 = vertexList.vertices[triList.triangles[i].a2];
|
||||
a3 = vertexList.vertices[triList.triangles[i].a3];
|
||||
|
||||
a1a2.x = a2.x - a1.x;
|
||||
a1a2.y = a2.y - a1.y;
|
||||
a1a2.z = a2.z - a1.z;
|
||||
|
||||
a1a3.x = a3.x - a1.x;
|
||||
a1a3.y = a3.y - a1.y;
|
||||
a1a3.z = a3.z - a1.z;
|
||||
|
||||
cross(tempNormal,a1a2,a1a3);
|
||||
|
||||
tempNormal.i *= -1;
|
||||
tempNormal.j *= -1;
|
||||
tempNormal.k *= -1;
|
||||
|
||||
/* Store the normal for the triangle */
|
||||
triList.triangles[i].normal = tempNormal;
|
||||
|
||||
/* Add this normal to the normal of all the vertices */
|
||||
vertexList.vertices[triList.triangles[i].a1].normal.i += tempNormal.i;
|
||||
vertexList.vertices[triList.triangles[i].a1].normal.j += tempNormal.j;
|
||||
vertexList.vertices[triList.triangles[i].a1].normal.k += tempNormal.k;
|
||||
|
||||
vertexList.vertices[triList.triangles[i].a2].normal.i += tempNormal.i;
|
||||
vertexList.vertices[triList.triangles[i].a2].normal.j += tempNormal.j;
|
||||
vertexList.vertices[triList.triangles[i].a2].normal.k += tempNormal.k;
|
||||
|
||||
vertexList.vertices[triList.triangles[i].a3].normal.i += tempNormal.i;
|
||||
vertexList.vertices[triList.triangles[i].a3].normal.j += tempNormal.j;
|
||||
vertexList.vertices[triList.triangles[i].a3].normal.k += tempNormal.k;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------------------------- */
|
||||
|
||||
|
||||
GLint main(GLint argc, char **argv)
|
||||
{
|
||||
|
||||
/* Scan Input */
|
||||
scanInput();
|
||||
generateNormals();
|
||||
|
||||
/* initialize light */
|
||||
init_lightsource();
|
||||
|
||||
/* Initialize the currentTransformation */
|
||||
currModelTransform[0] = 1;
|
||||
currModelTransform[5] = 1;
|
||||
currModelTransform[10] = 1;
|
||||
currModelTransform[15] = 1;
|
||||
|
||||
/* initialize GLUT: register callbacks, etc */
|
||||
wid = init_glut(&argc, argv);
|
||||
|
||||
/* any OpenGL state initialization we need to do */
|
||||
init_opengl();
|
||||
|
||||
/* CREATE THE DISPLAY LIST FOR THE SCENE */
|
||||
|
||||
flatID = create_flat_scene();
|
||||
gouraudID = create_gouraud_scene();
|
||||
|
||||
triangleScene = gouraudID;
|
||||
|
||||
glutMainLoop();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void scanInput(GLvoid) {
|
||||
char input[81];
|
||||
char *inputPtr;
|
||||
int i;
|
||||
|
||||
//Get the # of vertices and # of triangles
|
||||
std::cin.getline(input,81);
|
||||
|
||||
triList.length = strtol(input,&inputPtr,0);
|
||||
triList.triangles = (STriangle*)malloc(sizeof(STriangle)*triList.length);
|
||||
|
||||
vertexList.length = strtol(inputPtr,NULL,0);
|
||||
vertexList.vertices = (SVertex*)malloc(sizeof(SVertex)*vertexList.length);
|
||||
|
||||
//Skip over the first newline
|
||||
std::cin.getline(input,81);
|
||||
|
||||
for (i=0; i < triList.length; i++) {
|
||||
std::cin.getline(input,81);
|
||||
|
||||
//get points
|
||||
triList.triangles[i].a1 = strtol(input,&inputPtr,0);
|
||||
triList.triangles[i].a2 = strtol(inputPtr,&inputPtr,0);
|
||||
triList.triangles[i].a3 = strtol(inputPtr,NULL,0);
|
||||
triList.triangles[i].normal.i = 0;
|
||||
triList.triangles[i].normal.j = 0;
|
||||
triList.triangles[i].normal.k = 0;
|
||||
}
|
||||
|
||||
//skip over separation newline
|
||||
std::cin.getline(input,81);
|
||||
|
||||
for (i=0; i < vertexList.length; i++) {
|
||||
std::cin.getline(input,81);
|
||||
|
||||
//get coordinates
|
||||
vertexList.vertices[i].x = strtod(input,&inputPtr);
|
||||
vertexList.vertices[i].y = strtod(inputPtr,&inputPtr);
|
||||
vertexList.vertices[i].z = strtod(inputPtr,NULL);
|
||||
|
||||
vertexList.vertices[i].normal.i = 0;
|
||||
vertexList.vertices[i].normal.j = 0;
|
||||
vertexList.vertices[i].normal.k = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
CS4451/proj2/proj2.pdf
Normal file
BIN
CS4451/proj2/proj2b.tar.tar
Normal file
BIN
CS4451/proj2/vtrackball.pdf
Normal file
BIN
CS4451/proj2/win32_proj2.ncb
Normal file
21
CS4451/proj2/win32_proj2.sln
Normal file
@@ -0,0 +1,21 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 8.00
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "win32_proj2", "win32_proj2.vcproj", "{FA6D5408-9376-4663-A5C6-52DBAB5F2D65}"
|
||||
ProjectSection(ProjectDependencies) = postProject
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfiguration) = preSolution
|
||||
Debug = Debug
|
||||
Release = Release
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfiguration) = postSolution
|
||||
{FA6D5408-9376-4663-A5C6-52DBAB5F2D65}.Debug.ActiveCfg = Debug|Win32
|
||||
{FA6D5408-9376-4663-A5C6-52DBAB5F2D65}.Debug.Build.0 = Debug|Win32
|
||||
{FA6D5408-9376-4663-A5C6-52DBAB5F2D65}.Release.ActiveCfg = Release|Win32
|
||||
{FA6D5408-9376-4663-A5C6-52DBAB5F2D65}.Release.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityAddIns) = postSolution
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
BIN
CS4451/proj2/win32_proj2.suo
Normal file
143
CS4451/proj2/win32_proj2.vcproj
Normal file
@@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="Windows-1252"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="win32_proj2"
|
||||
ProjectGUID="{FA6D5408-9376-4663-A5C6-52DBAB5F2D65}"
|
||||
Keyword="Win32Proj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory="Debug"
|
||||
IntermediateDirectory="Debug"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories=""
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
|
||||
MinimalRebuild="TRUE"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="5"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib glut32.lib"
|
||||
OutputFile="$(OutDir)/win32_proj2.exe"
|
||||
LinkIncremental="2"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile="$(OutDir)/win32_proj2.pdb"
|
||||
SubSystem="1"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory="Release"
|
||||
IntermediateDirectory="Release"
|
||||
ConfigurationType="1"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="3"
|
||||
GlobalOptimizations="TRUE"
|
||||
InlineFunctionExpansion="2"
|
||||
EnableIntrinsicFunctions="TRUE"
|
||||
FavorSizeOrSpeed="1"
|
||||
OmitFramePointers="TRUE"
|
||||
OptimizeForProcessor="2"
|
||||
OptimizeForWindowsApplication="TRUE"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
|
||||
RuntimeLibrary="4"
|
||||
UsePrecompiledHeader="0"
|
||||
WarningLevel="3"
|
||||
Detect64BitPortabilityProblems="TRUE"
|
||||
DebugInformationFormat="3"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
AdditionalDependencies="opengl32.lib glu32.lib glut32.lib"
|
||||
OutputFile="$(OutDir)/win32_proj2.exe"
|
||||
LinkIncremental="1"
|
||||
GenerateDebugInformation="TRUE"
|
||||
SubSystem="1"
|
||||
OptimizeReferences="2"
|
||||
EnableCOMDATFolding="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
|
||||
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
|
||||
<File
|
||||
RelativePath=".\cs4451_a2.cpp">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl;inc;xsd"
|
||||
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
|
||||
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
|
||||
</Filter>
|
||||
</Files>
|
||||
<Globals>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||