这是一个小demo,读取物体的顶点坐标值生成3D图像。
三个物体顶点坐标文件。
1 Vertices: 486 2 -0.106 1.593 2.272 3 -0.106 2.036 2.228 4 -0.193 2.028 2.228 5 -0.276 2.002 2.228 6 -0.353 1.961 2.228 7 -0.420 1.906 2.228 8 -0.475 1.839 2.228 9 -0.516 1.763 2.228 10 -0.541 1.679 2.228 11 -0.550 1.593 2.228 12 -0.541 1.506 2.228 13 -0.516 1.423 2.228 14 -0.475 1.347 2.228 15 -0.420 1.280 2.228 16 -0.353 1.224 2.228 17 -0.276 1.183 2.228 18 -0.193 1.158 2.228 19 -0.106 1.150 2.228 20 -0.020 1.158 2.228 21 0.063 1.183 2.228 22 0.140 1.224 2.228 23 0.207 1.280 2.228 24 0.262 1.347 2.228 25 0.303 1.423 2.228 26 0.328 1.506 2.228 27 0.337 1.593 2.228 28 0.328 1.679 2.228 29 0.303 1.763 2.228 30 0.262 1.839 2.228 31 0.207 1.906 2.228 32 0.140 1.961 2.228 33 0.063 2.002 2.228 34 -0.020 2.028 2.228 35 -0.106 2.462 2.099 36 -0.276 2.446 2.099 37 -0.439 2.396 2.099 38 -0.589 2.316 2.099 39 -0.721 2.208 2.099 40 -0.829 2.076 2.099 41 -0.910 1.926 2.099 42 -0.959 1.763 2.099 43 -0.976 1.593 2.099 44 -0.959 1.423 2.099 45 -0.910 1.260 2.099 46 -0.829 1.110 2.099 47 -0.721 0.978 2.099 48 -0.589 0.870 2.099 49 -0.439 0.790 2.099 50 -0.276 0.740 2.099 51 -0.106 0.724 2.099 52 0.063 0.740 2.099 53 0.226 0.790 2.099 54 0.377 0.870 2.099 55 0.508 0.978 2.099 56 0.616 1.110 2.099 57 0.697 1.260 2.099 58 0.746 1.423 2.099 59 0.763 1.593 2.099 60 0.746 1.763 2.099 61 0.697 1.926 2.099 62 0.616 2.076 2.099 63 0.508 2.208 2.099 64 0.377 2.316 2.099 65 0.226 2.396 2.099 66 0.063 2.446 2.099 67 -0.106 2.855 1.889 68 -0.353 2.831 1.889 69 -0.589 2.759 1.889 70 -0.808 2.642 1.889 71 -0.999 2.485 1.889 72 -1.156 2.294 1.889 73 -1.273 2.076 1.889 74 -1.344 1.839 1.889 75 -1.369 1.593 1.889 76 -1.344 1.347 1.889 77 -1.273 1.110 1.889 78 -1.156 0.892 1.889 79 -0.999 0.700 1.889 80 -0.808 0.544 1.889 81 -0.589 0.427 1.889 82 -0.353 0.355 1.889 83 -0.106 0.331 1.889 84 0.140 0.355 1.889 85 0.377 0.427 1.889 86 0.595 0.544 1.889 87 0.786 0.700 1.889 88 0.943 0.892 1.889 89 1.060 1.110 1.889 90 1.131 1.347 1.889 91 1.156 1.593 1.889 92 1.131 1.839 1.889 93 1.060 2.076 1.889 94 0.943 2.294 1.889 95 0.786 2.485 1.889 96 0.595 2.642 1.889 97 0.377 2.759 1.889 98 0.140 2.831 1.889 99 -0.106 3.199 1.606 100 -0.420 3.168 1.606 101 -0.721 3.077 1.606 102 -0.999 2.929 1.606 103 -1.242 2.729 1.606 104 -1.442 2.485 1.606 105 -1.591 2.208 1.606 106 -1.682 1.906 1.606 107 -1.713 1.593 1.606 108 -1.682 1.280 1.606 109 -1.591 0.978 1.606 110 -1.442 0.700 1.606 111 -1.242 0.457 1.606 112 -0.999 0.257 1.606 113 -0.721 0.109 1.606 114 -0.420 0.017 1.606 115 -0.106 -0.013 1.606 116 0.207 0.017 1.606 117 0.508 0.109 1.606 118 0.786 0.257 1.606 119 1.029 0.457 1.606 120 1.229 0.700 1.606 121 1.378 0.978 1.606 122 1.469 1.280 1.606 123 1.500 1.593 1.606 124 1.469 1.906 1.606 125 1.378 2.208 1.606 126 1.229 2.485 1.606 127 1.029 2.729 1.606 128 0.786 2.929 1.606 129 0.508 3.077 1.606 130 0.207 3.168 1.606 131 -0.106 3.482 1.262 132 -0.475 3.446 1.262 133 -0.829 3.338 1.262 134 -1.156 3.164 1.262 135 -1.442 2.929 1.262 136 -1.677 2.642 1.262 137 -1.852 2.316 1.262 138 -1.959 1.961 1.262 139 -1.995 1.593 1.262 140 -1.959 1.224 1.262 141 -1.852 0.870 1.262 142 -1.677 0.544 1.262 143 -1.442 0.257 1.262 144 -1.156 0.022 1.262 145 -0.829 -0.152 1.262 146 -0.475 -0.260 1.262 147 -0.106 -0.296 1.262 148 0.262 -0.260 1.262 149 0.616 -0.152 1.262 150 0.943 0.022 1.262 151 1.229 0.257 1.262 152 1.464 0.544 1.262 153 1.639 0.870 1.262 154 1.746 1.224 1.262 155 1.782 1.593 1.262 156 1.746 1.961 1.262 157 1.639 2.316 1.262 158 1.464 2.642 1.262 159 1.229 2.929 1.262 160 0.943 3.164 1.262 161 0.616 3.338 1.262 162 0.262 3.446 1.262 163 -0.106 3.692 0.869 164 -0.516 3.651 0.869 165 -0.910 3.532 0.869 166 -1.273 3.338 0.869 167 -1.591 3.077 0.869 168 -1.852 2.759 0.869 169 -2.046 2.396 0.869 170 -2.165 2.002 0.869 171 -2.205 1.593 0.869 172 -2.165 1.183 0.869 173 -2.046 0.790 0.869 174 -1.852 0.427 0.869 175 -1.591 0.109 0.869 176 -1.273 -0.152 0.869 177 -0.910 -0.346 0.869 178 -0.516 -0.466 0.869 179 -0.106 -0.506 0.869 180 0.303 -0.466 0.869 181 0.697 -0.346 0.869 182 1.060 -0.152 0.869 183 1.378 0.109 0.869 184 1.639 0.427 0.869 185 1.833 0.790 0.869 186 1.952 1.183 0.869 187 1.992 1.593 0.869 188 1.952 2.002 0.869 189 1.833 2.396 0.869 190 1.639 2.759 0.869 191 1.378 3.077 0.869 192 1.060 3.338 0.869 193 0.697 3.532 0.869 194 0.303 3.651 0.869 195 -0.106 3.821 0.443 196 -0.541 3.778 0.443 197 -0.959 3.651 0.443 198 -1.344 3.446 0.443 199 -1.682 3.168 0.443 200 -1.959 2.831 0.443 201 -2.165 2.446 0.443 202 -2.292 2.028 0.443 203 -2.335 1.593 0.443 204 -2.292 1.158 0.443 205 -2.165 0.740 0.443 206 -1.959 0.355 0.443 207 -1.682 0.017 0.443 208 -1.344 -0.260 0.443 209 -0.959 -0.466 0.443 210 -0.541 -0.592 0.443 211 -0.106 -0.635 0.443 212 0.328 -0.592 0.443 213 0.746 -0.466 0.443 214 1.131 -0.260 0.443 215 1.469 0.017 0.443 216 1.746 0.355 0.443 217 1.952 0.740 0.443 218 2.079 1.158 0.443 219 2.122 1.593 0.443 220 2.079 2.028 0.443 221 1.952 2.446 0.443 222 1.746 2.831 0.443 223 1.469 3.168 0.443 224 1.131 3.446 0.443 225 0.746 3.651 0.443 226 0.328 3.778 0.443 227 -0.106 3.865 -0.000 228 -0.550 3.821 -0.000 229 -0.976 3.692 -0.000 230 -1.369 3.482 -0.000 231 -1.713 3.199 -0.000 232 -1.995 2.855 -0.000 233 -2.205 2.462 -0.000 234 -2.335 2.036 -0.000 235 -2.378 1.593 -0.000 236 -2.335 1.150 -0.000 237 -2.205 0.724 -0.000 238 -1.995 0.331 -0.000 239 -1.713 -0.013 -0.000 240 -1.369 -0.296 -0.000 241 -0.976 -0.506 -0.000 242 -0.550 -0.635 -0.000 243 -0.106 -0.679 -0.000 244 0.337 -0.635 -0.000 245 0.763 -0.506 -0.000 246 1.156 -0.296 -0.000 247 1.500 -0.013 -0.000 248 1.782 0.331 -0.000 249 1.992 0.724 -0.000 250 2.122 1.150 -0.000 251 2.165 1.593 -0.000 252 2.122 2.036 -0.000 253 1.992 2.462 -0.000 254 1.782 2.855 -0.000 255 1.500 3.199 -0.000 256 1.156 3.482 -0.000 257 0.763 3.692 -0.000 258 0.337 3.821 -0.000 259 -0.106 3.821 -0.443 260 -0.541 3.778 -0.443 261 -0.959 3.651 -0.443 262 -1.344 3.446 -0.443 263 -1.682 3.168 -0.443 264 -1.959 2.831 -0.443 265 -2.165 2.446 -0.443 266 -2.292 2.028 -0.443 267 -2.335 1.593 -0.443 268 -2.292 1.158 -0.443 269 -2.165 0.740 -0.443 270 -1.959 0.355 -0.443 271 -1.682 0.017 -0.443 272 -1.344 -0.260 -0.443 273 -0.959 -0.466 -0.443 274 -0.541 -0.592 -0.443 275 -0.106 -0.635 -0.443 276 0.328 -0.592 -0.443 277 0.746 -0.466 -0.443 278 1.131 -0.260 -0.443 279 1.469 0.017 -0.443 280 1.746 0.355 -0.443 281 1.952 0.740 -0.443 282 2.079 1.158 -0.443 283 2.122 1.593 -0.443 284 2.079 2.028 -0.443 285 1.952 2.446 -0.443 286 1.746 2.831 -0.443 287 1.469 3.168 -0.443 288 1.131 3.446 -0.443 289 0.746 3.651 -0.443 290 0.328 3.778 -0.443 291 -0.106 3.692 -0.869 292 -0.516 3.651 -0.869 293 -0.910 3.532 -0.869 294 -1.273 3.338 -0.869 295 -1.591 3.077 -0.869 296 -1.852 2.759 -0.869 297 -2.046 2.396 -0.869 298 -2.165 2.002 -0.869 299 -2.205 1.593 -0.869 300 -2.165 1.183 -0.869 301 -2.046 0.790 -0.869 302 -1.852 0.427 -0.869 303 -1.591 0.109 -0.869 304 -1.273 -0.152 -0.869 305 -0.910 -0.346 -0.869 306 -0.516 -0.466 -0.869 307 -0.106 -0.506 -0.869 308 0.303 -0.466 -0.869 309 0.697 -0.346 -0.869 310 1.060 -0.152 -0.869 311 1.378 0.109 -0.869 312 1.639 0.427 -0.869 313 1.833 0.790 -0.869 314 1.952 1.183 -0.869 315 1.992 1.593 -0.869 316 1.952 2.002 -0.869 317 1.833 2.396 -0.869 318 1.639 2.759 -0.869 319 1.378 3.077 -0.869 320 1.060 3.338 -0.869 321 0.697 3.532 -0.869 322 0.303 3.651 -0.869 323 -0.106 3.482 -1.262 324 -0.475 3.446 -1.262 325 -0.829 3.338 -1.262 326 -1.156 3.164 -1.262 327 -1.442 2.929 -1.262 328 -1.677 2.642 -1.262 329 -1.852 2.316 -1.262 330 -1.959 1.961 -1.262 331 -1.995 1.593 -1.262 332 -1.959 1.224 -1.262 333 -1.852 0.870 -1.262 334 -1.677 0.544 -1.262 335 -1.442 0.257 -1.262 336 -1.156 0.022 -1.262 337 -0.829 -0.152 -1.262 338 -0.475 -0.260 -1.262 339 -0.106 -0.296 -1.262 340 0.262 -0.260 -1.262 341 0.616 -0.152 -1.262 342 0.943 0.022 -1.262 343 1.229 0.257 -1.262 344 1.464 0.544 -1.262 345 1.639 0.870 -1.262 346 1.746 1.224 -1.262 347 1.782 1.593 -1.262 348 1.746 1.961 -1.262 349 1.639 2.316 -1.262 350 1.464 2.642 -1.262 351 1.229 2.929 -1.262 352 0.943 3.164 -1.262 353 0.616 3.338 -1.262 354 0.262 3.446 -1.262 355 -0.106 3.199 -1.606 356 -0.420 3.168 -1.606 357 -0.721 3.077 -1.606 358 -0.999 2.929 -1.606 359 -1.242 2.729 -1.606 360 -1.442 2.485 -1.606 361 -1.591 2.208 -1.606 362 -1.682 1.906 -1.606 363 -1.713 1.593 -1.606 364 -1.682 1.280 -1.606 365 -1.591 0.978 -1.606 366 -1.442 0.700 -1.606 367 -1.242 0.457 -1.606 368 -0.999 0.257 -1.606 369 -0.721 0.109 -1.606 370 -0.420 0.017 -1.606 371 -0.106 -0.013 -1.606 372 0.207 0.017 -1.606 373 0.508 0.109 -1.606 374 0.786 0.257 -1.606 375 1.029 0.457 -1.606 376 1.229 0.700 -1.606 377 1.378 0.978 -1.606 378 1.469 1.280 -1.606 379 1.500 1.593 -1.606 380 1.469 1.906 -1.606 381 1.378 2.208 -1.606 382 1.229 2.485 -1.606 383 1.029 2.729 -1.606 384 0.786 2.929 -1.606 385 0.508 3.077 -1.606 386 0.207 3.168 -1.606 387 -0.106 2.855 -1.889 388 -0.353 2.831 -1.889 389 -0.589 2.759 -1.889 390 -0.808 2.642 -1.889 391 -0.999 2.485 -1.889 392 -1.156 2.294 -1.889 393 -1.273 2.076 -1.889 394 -1.344 1.839 -1.889 395 -1.369 1.593 -1.889 396 -1.344 1.347 -1.889 397 -1.273 1.110 -1.889 398 -1.156 0.892 -1.889 399 -0.999 0.700 -1.889 400 -0.808 0.544 -1.889 401 -0.589 0.427 -1.889 402 -0.353 0.355 -1.889 403 -0.106 0.331 -1.889 404 0.140 0.355 -1.889 405 0.377 0.427 -1.889 406 0.595 0.544 -1.889 407 0.786 0.700 -1.889 408 0.943 0.892 -1.889 409 1.060 1.110 -1.889 410 1.131 1.347 -1.889 411 1.156 1.593 -1.889 412 1.131 1.839 -1.889 413 1.060 2.076 -1.889 414 0.943 2.294 -1.889 415 0.786 2.485 -1.889 416 0.595 2.642 -1.889 417 0.377 2.759 -1.889 418 0.140 2.831 -1.889 419 -0.106 2.462 -2.099 420 -0.276 2.446 -2.099 421 -0.439 2.396 -2.099 422 -0.589 2.316 -2.099 423 -0.721 2.208 -2.099 424 -0.829 2.076 -2.099 425 -0.910 1.926 -2.099 426 -0.959 1.763 -2.099 427 -0.976 1.593 -2.099 428 -0.959 1.423 -2.099 429 -0.910 1.260 -2.099 430 -0.829 1.110 -2.099 431 -0.721 0.978 -2.099 432 -0.589 0.870 -2.099 433 -0.439 0.790 -2.099 434 -0.276 0.740 -2.099 435 -0.106 0.724 -2.099 436 0.063 0.740 -2.099 437 0.226 0.790 -2.099 438 0.377 0.870 -2.099 439 0.508 0.978 -2.099 440 0.616 1.110 -2.099 441 0.697 1.260 -2.099 442 0.746 1.423 -2.099 443 0.763 1.593 -2.099 444 0.746 1.763 -2.099 445 0.697 1.926 -2.099 446 0.616 2.076 -2.099 447 0.508 2.208 -2.099 448 0.377 2.316 -2.099 449 0.226 2.396 -2.099 450 0.063 2.446 -2.099 451 -0.106 2.036 -2.228 452 -0.193 2.028 -2.228 453 -0.276 2.002 -2.228 454 -0.353 1.961 -2.228 455 -0.420 1.906 -2.228 456 -0.475 1.839 -2.228 457 -0.516 1.763 -2.228 458 -0.541 1.679 -2.228 459 -0.550 1.593 -2.228 460 -0.541 1.506 -2.228 461 -0.516 1.423 -2.228 462 -0.475 1.347 -2.228 463 -0.420 1.280 -2.228 464 -0.353 1.224 -2.228 465 -0.276 1.183 -2.228 466 -0.193 1.158 -2.228 467 -0.106 1.150 -2.228 468 -0.020 1.158 -2.228 469 0.063 1.183 -2.228 470 0.140 1.224 -2.228 471 0.207 1.280 -2.228 472 0.262 1.347 -2.228 473 0.303 1.423 -2.228 474 0.328 1.506 -2.228 475 0.337 1.593 -2.228 476 0.328 1.679 -2.228 477 0.303 1.763 -2.228 478 0.262 1.839 -2.228 479 0.207 1.906 -2.228 480 0.140 1.961 -2.228 481 0.063 2.002 -2.228 482 -0.020 2.028 -2.228 483 -0.106 1.593 -2.272 484 0.140 1.961 -2.228 485 0.063 2.002 -2.228 486 -0.020 2.028 -2.228 487 -0.106 1.593 -2.272
Sphere
1 Vertices: 486 2 -0.033 0.000 2.344 3 -0.033 -0.144 2.318 4 -0.033 -0.271 2.245 5 -0.033 -0.366 2.133 6 -0.033 -0.416 1.995 7 -0.033 -0.416 1.848 8 -0.033 -0.366 1.711 9 -0.033 -0.271 1.598 10 -0.033 -0.144 1.525 11 -0.033 0.000 1.499 12 -0.033 0.144 1.525 13 -0.033 0.271 1.598 14 -0.033 0.366 1.711 15 -0.033 0.416 1.848 16 -0.033 0.416 1.995 17 -0.033 0.366 2.133 18 -0.033 0.271 2.245 19 -0.033 0.144 2.318 20 0.498 0.000 2.282 21 0.492 -0.144 2.257 22 0.475 -0.271 2.186 23 0.449 -0.366 2.076 24 0.417 -0.416 1.942 25 0.383 -0.416 1.800 26 0.351 -0.366 1.666 27 0.326 -0.271 1.556 28 0.309 -0.144 1.485 29 0.303 0.000 1.460 30 0.309 0.144 1.485 31 0.326 0.271 1.556 32 0.351 0.366 1.666 33 0.383 0.416 1.800 34 0.417 0.416 1.942 35 0.449 0.366 2.076 36 0.475 0.271 2.186 37 0.492 0.144 2.257 38 0.999 0.000 2.099 39 0.988 -0.144 2.076 40 0.955 -0.271 2.011 41 0.905 -0.366 1.911 42 0.843 -0.416 1.787 43 0.777 -0.416 1.656 44 0.715 -0.366 1.533 45 0.665 -0.271 1.433 46 0.632 -0.144 1.367 47 0.620 0.000 1.345 48 0.632 0.144 1.367 49 0.665 0.271 1.433 50 0.715 0.366 1.533 51 0.777 0.416 1.656 52 0.843 0.416 1.787 53 0.905 0.366 1.911 54 0.955 0.271 2.011 55 0.988 0.144 2.076 56 1.446 0.000 1.806 57 1.429 -0.144 1.786 58 1.382 -0.271 1.730 59 1.310 -0.366 1.644 60 1.221 -0.416 1.538 61 1.127 -0.416 1.426 62 1.038 -0.366 1.321 63 0.966 -0.271 1.235 64 0.919 -0.144 1.178 65 0.903 0.000 1.159 66 0.919 0.144 1.178 67 0.966 0.271 1.235 68 1.038 0.366 1.321 69 1.127 0.416 1.426 70 1.221 0.416 1.538 71 1.310 0.366 1.644 72 1.382 0.271 1.730 73 1.429 0.144 1.786 74 1.812 0.000 1.417 75 1.792 -0.144 1.402 76 1.733 -0.271 1.358 77 1.643 -0.366 1.291 78 1.532 -0.416 1.209 79 1.415 -0.416 1.121 80 1.304 -0.366 1.039 81 1.214 -0.271 0.972 82 1.155 -0.144 0.928 83 1.135 0.000 0.913 84 1.155 0.144 0.928 85 1.214 0.271 0.972 86 1.304 0.366 1.039 87 1.415 0.416 1.121 88 1.532 0.416 1.209 89 1.643 0.366 1.291 90 1.733 0.271 1.358 91 1.792 0.144 1.402 92 2.079 0.000 0.955 93 2.056 -0.144 0.945 94 1.988 -0.271 0.916 95 1.885 -0.366 0.871 96 1.759 -0.416 0.817 97 1.624 -0.416 0.758 98 1.498 -0.366 0.704 99 1.394 -0.271 0.659 100 1.327 -0.144 0.630 101 1.304 0.000 0.620 102 1.327 0.144 0.630 103 1.394 0.271 0.659 104 1.498 0.366 0.704 105 1.624 0.416 0.758 106 1.759 0.416 0.817 107 1.885 0.366 0.871 108 1.988 0.271 0.916 109 2.056 0.144 0.945 110 2.232 0.000 0.443 111 2.207 -0.144 0.439 112 2.135 -0.271 0.426 113 2.024 -0.366 0.406 114 1.889 -0.416 0.383 115 1.744 -0.416 0.357 116 1.609 -0.366 0.333 117 1.498 -0.271 0.314 118 1.426 -0.144 0.301 119 1.401 0.000 0.297 120 1.426 0.144 0.301 121 1.498 0.271 0.314 122 1.609 0.366 0.333 123 1.744 0.416 0.357 124 1.889 0.416 0.383 125 2.024 0.366 0.406 126 2.135 0.271 0.426 127 2.207 0.144 0.439 128 2.263 -0.000 -0.090 129 2.238 -0.144 -0.089 130 2.165 -0.271 -0.084 131 2.053 -0.366 -0.078 132 1.915 -0.416 -0.070 133 1.769 -0.416 -0.061 134 1.631 -0.366 -0.053 135 1.519 -0.271 -0.047 136 1.446 -0.144 -0.042 137 1.420 0.000 -0.041 138 1.446 0.144 -0.042 139 1.519 0.271 -0.047 140 1.631 0.366 -0.053 141 1.769 0.416 -0.061 142 1.915 0.416 -0.070 143 2.053 0.366 -0.078 144 2.165 0.271 -0.084 145 2.238 0.144 -0.089 146 2.171 -0.000 -0.616 147 2.146 -0.144 -0.609 148 2.076 -0.271 -0.588 149 1.968 -0.366 -0.555 150 1.836 -0.416 -0.516 151 1.696 -0.416 -0.474 152 1.564 -0.366 -0.434 153 1.456 -0.271 -0.402 154 1.386 -0.144 -0.381 155 1.362 0.000 -0.374 156 1.386 0.144 -0.381 157 1.456 0.271 -0.402 158 1.564 0.366 -0.434 159 1.696 0.416 -0.474 160 1.836 0.416 -0.516 161 1.968 0.366 -0.555 162 2.076 0.271 -0.588 163 2.146 0.144 -0.609 164 1.959 -0.000 -1.106 165 1.937 -0.144 -1.094 166 1.873 -0.271 -1.057 167 1.776 -0.366 -1.001 168 1.657 -0.416 -0.932 169 1.530 -0.416 -0.859 170 1.411 -0.366 -0.790 171 1.313 -0.271 -0.733 172 1.250 -0.144 -0.697 173 1.228 0.000 -0.684 174 1.250 0.144 -0.697 175 1.313 0.271 -0.733 176 1.411 0.366 -0.790 177 1.530 0.416 -0.859 178 1.657 0.416 -0.932 179 1.776 0.366 -1.001 180 1.873 0.271 -1.057 181 1.937 0.144 -1.094 182 1.640 -0.000 -1.535 183 1.622 -0.144 -1.517 184 1.568 -0.271 -1.467 185 1.487 -0.366 -1.390 186 1.386 -0.416 -1.295 187 1.280 -0.416 -1.195 188 1.179 -0.366 -1.100 189 1.098 -0.271 -1.023 190 1.044 -0.144 -0.973 191 1.026 0.000 -0.955 192 1.044 0.144 -0.973 193 1.098 0.271 -1.023 194 1.179 0.366 -1.100 195 1.280 0.416 -1.195 196 1.386 0.416 -1.295 197 1.487 0.366 -1.390 198 1.568 0.271 -1.467 199 1.622 0.144 -1.517 200 1.231 -0.000 -1.878 201 1.217 -0.144 -1.857 202 1.177 -0.271 -1.795 203 1.115 -0.366 -1.702 204 1.039 -0.416 -1.586 205 0.959 -0.416 -1.464 206 0.883 -0.366 -1.349 207 0.821 -0.271 -1.255 208 0.781 -0.144 -1.194 209 0.767 0.000 -1.172 210 0.781 0.144 -1.194 211 0.821 0.271 -1.255 212 0.883 0.366 -1.349 213 0.959 0.416 -1.464 214 1.039 0.416 -1.586 215 1.115 0.366 -1.702 216 1.177 0.271 -1.795 217 1.217 0.144 -1.857 218 0.754 -0.000 -2.118 219 0.745 -0.144 -2.094 220 0.720 -0.271 -2.025 221 0.682 -0.366 -1.919 222 0.634 -0.416 -1.790 223 0.584 -0.416 -1.652 224 0.537 -0.366 -1.523 225 0.499 -0.271 -1.417 226 0.474 -0.144 -1.348 227 0.465 -0.000 -1.324 228 0.474 0.144 -1.348 229 0.499 0.271 -1.417 230 0.537 0.366 -1.523 231 0.584 0.416 -1.652 232 0.634 0.416 -1.790 233 0.682 0.366 -1.919 234 0.720 0.271 -2.025 235 0.745 0.144 -2.094 236 0.234 -0.000 -2.241 237 0.231 -0.144 -2.215 238 0.223 -0.271 -2.143 239 0.210 -0.366 -2.031 240 0.194 -0.416 -1.894 241 0.177 -0.416 -1.749 242 0.161 -0.366 -1.612 243 0.148 -0.271 -1.500 244 0.139 -0.144 -1.427 245 0.136 -0.000 -1.402 246 0.139 0.144 -1.427 247 0.148 0.271 -1.500 248 0.161 0.366 -1.612 249 0.177 0.416 -1.749 250 0.194 0.416 -1.894 251 0.210 0.366 -2.031 252 0.223 0.271 -2.143 253 0.231 0.144 -2.215 254 -0.300 -0.000 -2.241 255 -0.297 -0.144 -2.215 256 -0.288 -0.271 -2.143 257 -0.275 -0.366 -2.031 258 -0.259 -0.416 -1.894 259 -0.242 -0.416 -1.749 260 -0.226 -0.366 -1.612 261 -0.213 -0.271 -1.500 262 -0.205 -0.144 -1.427 263 -0.202 -0.000 -1.402 264 -0.205 0.144 -1.427 265 -0.213 0.271 -1.500 266 -0.226 0.366 -1.612 267 -0.242 0.416 -1.749 268 -0.259 0.416 -1.894 269 -0.275 0.366 -2.031 270 -0.288 0.271 -2.143 271 -0.297 0.144 -2.215 272 -0.820 -0.000 -2.118 273 -0.811 -0.144 -2.094 274 -0.786 -0.271 -2.025 275 -0.747 -0.366 -1.919 276 -0.700 -0.416 -1.790 277 -0.650 -0.416 -1.652 278 -0.603 -0.366 -1.523 279 -0.565 -0.271 -1.417 280 -0.539 -0.144 -1.348 281 -0.531 -0.000 -1.324 282 -0.539 0.144 -1.348 283 -0.565 0.271 -1.417 284 -0.603 0.366 -1.523 285 -0.650 0.416 -1.652 286 -0.700 0.416 -1.790 287 -0.747 0.366 -1.919 288 -0.786 0.271 -2.025 289 -0.811 0.144 -2.094 290 -1.297 -0.000 -1.878 291 -1.283 -0.144 -1.857 292 -1.243 -0.271 -1.795 293 -1.181 -0.366 -1.702 294 -1.105 -0.416 -1.586 295 -1.025 -0.416 -1.464 296 -0.949 -0.366 -1.349 297 -0.887 -0.271 -1.255 298 -0.847 -0.144 -1.194 299 -0.833 0.000 -1.172 300 -0.847 0.144 -1.194 301 -0.887 0.271 -1.255 302 -0.949 0.366 -1.349 303 -1.025 0.416 -1.464 304 -1.105 0.416 -1.586 305 -1.181 0.366 -1.702 306 -1.243 0.271 -1.795 307 -1.283 0.144 -1.857 308 -1.706 -0.000 -1.535 309 -1.687 -0.144 -1.517 310 -1.634 -0.271 -1.467 311 -1.552 -0.366 -1.390 312 -1.452 -0.416 -1.295 313 -1.345 -0.416 -1.195 314 -1.245 -0.366 -1.100 315 -1.164 -0.271 -1.023 316 -1.110 -0.144 -0.973 317 -1.092 0.000 -0.955 318 -1.110 0.144 -0.973 319 -1.164 0.271 -1.023 320 -1.245 0.366 -1.100 321 -1.345 0.416 -1.195 322 -1.452 0.416 -1.295 323 -1.552 0.366 -1.390 324 -1.634 0.271 -1.467 325 -1.687 0.144 -1.517 326 -2.025 -0.000 -1.106 327 -2.003 -0.144 -1.094 328 -1.939 -0.271 -1.057 329 -1.842 -0.366 -1.001 330 -1.723 -0.416 -0.932 331 -1.596 -0.416 -0.859 332 -1.476 -0.366 -0.790 333 -1.379 -0.271 -0.733 334 -1.316 -0.144 -0.697 335 -1.294 0.000 -0.684 336 -1.316 0.144 -0.697 337 -1.379 0.271 -0.733 338 -1.476 0.366 -0.790 339 -1.596 0.416 -0.859 340 -1.723 0.416 -0.932 341 -1.842 0.366 -1.001 342 -1.939 0.271 -1.057 343 -2.003 0.144 -1.094 344 -2.236 -0.000 -0.616 345 -2.212 -0.144 -0.609 346 -2.142 -0.271 -0.588 347 -2.034 -0.366 -0.555 348 -1.902 -0.416 -0.516 349 -1.762 -0.416 -0.474 350 -1.630 -0.366 -0.434 351 -1.522 -0.271 -0.402 352 -1.452 -0.144 -0.381 353 -1.427 0.000 -0.374 354 -1.452 0.144 -0.381 355 -1.522 0.271 -0.402 356 -1.630 0.366 -0.434 357 -1.762 0.416 -0.474 358 -1.902 0.416 -0.516 359 -2.034 0.366 -0.555 360 -2.142 0.271 -0.588 361 -2.212 0.144 -0.609 362 -2.329 -0.000 -0.090 363 -2.304 -0.144 -0.089 364 -2.230 -0.271 -0.084 365 -2.118 -0.366 -0.078 366 -1.981 -0.416 -0.070 367 -1.834 -0.416 -0.061 368 -1.697 -0.366 -0.053 369 -1.585 -0.271 -0.047 370 -1.512 -0.144 -0.042 371 -1.486 0.000 -0.041 372 -1.512 0.144 -0.042 373 -1.585 0.271 -0.047 374 -1.697 0.366 -0.053 375 -1.834 0.416 -0.061 376 -1.981 0.416 -0.070 377 -2.118 0.366 -0.078 378 -2.230 0.271 -0.084 379 -2.304 0.144 -0.089 380 -2.298 0.000 0.443 381 -2.273 -0.144 0.439 382 -2.201 -0.271 0.426 383 -2.090 -0.366 0.406 384 -1.954 -0.416 0.383 385 -1.810 -0.416 0.357 386 -1.674 -0.366 0.333 387 -1.564 -0.271 0.314 388 -1.492 -0.144 0.301 389 -1.466 0.000 0.297 390 -1.492 0.144 0.301 391 -1.564 0.271 0.314 392 -1.674 0.366 0.333 393 -1.810 0.416 0.357 394 -1.954 0.416 0.383 395 -2.090 0.366 0.406 396 -2.201 0.271 0.426 397 -2.273 0.144 0.439 398 -2.145 0.000 0.955 399 -2.121 -0.144 0.945 400 -2.054 -0.271 0.916 401 -1.951 -0.366 0.871 402 -1.825 -0.416 0.817 403 -1.690 -0.416 0.758 404 -1.563 -0.366 0.704 405 -1.460 -0.271 0.659 406 -1.393 -0.144 0.630 407 -1.370 0.000 0.620 408 -1.393 0.144 0.630 409 -1.460 0.271 0.659 410 -1.563 0.366 0.704 411 -1.690 0.416 0.758 412 -1.825 0.416 0.817 413 -1.951 0.366 0.871 414 -2.054 0.271 0.916 415 -2.121 0.144 0.945 416 -1.878 0.000 1.417 417 -1.857 -0.144 1.402 418 -1.799 -0.271 1.358 419 -1.709 -0.366 1.291 420 -1.598 -0.416 1.209 421 -1.480 -0.416 1.121 422 -1.370 -0.366 1.039 423 -1.280 -0.271 0.972 424 -1.221 -0.144 0.928 425 -1.201 0.000 0.913 426 -1.221 0.144 0.928 427 -1.280 0.271 0.972 428 -1.370 0.366 1.039 429 -1.480 0.416 1.121 430 -1.598 0.416 1.209 431 -1.709 0.366 1.291 432 -1.799 0.271 1.358 433 -1.857 0.144 1.402 434 -1.511 0.000 1.806 435 -1.495 -0.144 1.786 436 -1.448 -0.271 1.730 437 -1.376 -0.366 1.644 438 -1.287 -0.416 1.538 439 -1.193 -0.416 1.426 440 -1.104 -0.366 1.321 441 -1.032 -0.271 1.235 442 -0.985 -0.144 1.178 443 -0.969 0.000 1.159 444 -0.985 0.144 1.178 445 -1.032 0.271 1.235 446 -1.104 0.366 1.321 447 -1.193 0.416 1.426 448 -1.287 0.416 1.538 449 -1.376 0.366 1.644 450 -1.448 0.271 1.730 451 -1.495 0.144 1.786 452 -1.065 0.000 2.099 453 -1.054 -0.144 2.076 454 -1.021 -0.271 2.011 455 -0.970 -0.366 1.911 456 -0.909 -0.416 1.787 457 -0.843 -0.416 1.656 458 -0.781 -0.366 1.533 459 -0.731 -0.271 1.433 460 -0.698 -0.144 1.367 461 -0.686 0.000 1.345 462 -0.698 0.144 1.367 463 -0.731 0.271 1.433 464 -0.781 0.366 1.533 465 -0.843 0.416 1.656 466 -0.909 0.416 1.787 467 -0.970 0.366 1.911 468 -1.021 0.271 2.011 469 -1.054 0.144 2.076 470 -0.563 0.000 2.282 471 -0.557 -0.144 2.257 472 -0.541 -0.271 2.186 473 -0.515 -0.366 2.076 474 -0.483 -0.416 1.942 475 -0.449 -0.416 1.800 476 -0.417 -0.366 1.666 477 -0.391 -0.271 1.556 478 -0.374 -0.144 1.485 479 -0.369 0.000 1.460 480 -0.374 0.144 1.485 481 -0.391 0.271 1.556 482 -0.417 0.366 1.666 483 -0.449 0.416 1.800 484 -0.483 0.416 1.942 485 -0.515 0.366 2.076 486 -0.541 0.271 2.186 487 -0.557 0.144 2.257
Torus
Vertices: 486 -0.000 0.000 2.000 -0.000 -0.267 2.000 -0.000 -0.533 2.000 -0.000 -0.800 2.000 -0.000 -1.067 2.000 -0.000 -1.333 2.000 -0.000 -1.600 2.000 -0.000 -1.867 2.000 -0.000 -2.133 2.000 -0.000 -2.400 2.000 -0.000 -2.667 2.000 -0.000 -2.933 2.000 -0.000 -3.200 2.000 -0.000 -3.467 2.000 -0.000 -3.733 2.000 -0.000 -4.000 2.000 -0.000 -4.000 1.595 -0.000 -3.733 1.595 -0.000 -3.467 1.595 -0.000 -3.200 1.595 -0.000 -2.933 1.595 -0.000 -2.667 1.595 -0.000 -2.400 1.595 -0.000 -2.133 1.595 -0.000 -1.867 1.595 -0.000 -1.600 1.595 -0.000 -1.333 1.595 -0.000 -1.067 1.595 -0.000 -0.800 1.595 -0.000 -0.533 1.595 -0.000 -0.267 1.595 -0.000 0.000 1.595 0.813 0.000 1.827 0.813 -0.267 1.827 0.813 -0.533 1.827 0.813 -0.800 1.827 0.813 -1.067 1.827 0.813 -1.333 1.827 0.813 -1.600 1.827 0.813 -1.867 1.827 0.813 -2.133 1.827 0.813 -2.400 1.827 0.813 -2.667 1.827 0.813 -2.933 1.827 0.813 -3.200 1.827 0.813 -3.467 1.827 0.813 -3.733 1.827 0.813 -4.000 1.827 0.649 -4.000 1.458 0.649 -3.733 1.458 0.649 -3.467 1.458 0.649 -3.200 1.458 0.649 -2.933 1.458 0.649 -2.667 1.458 0.649 -2.400 1.458 0.649 -2.133 1.458 0.649 -1.867 1.458 0.649 -1.600 1.458 0.649 -1.333 1.458 0.649 -1.067 1.458 0.649 -0.800 1.458 0.649 -0.533 1.458 0.649 -0.267 1.458 0.649 0.000 1.458 1.486 0.000 1.338 1.486 -0.267 1.338 1.486 -0.533 1.338 1.486 -0.800 1.338 1.486 -1.067 1.338 1.486 -1.333 1.338 1.486 -1.600 1.338 1.486 -1.867 1.338 1.486 -2.133 1.338 1.486 -2.400 1.338 1.486 -2.667 1.338 1.486 -2.933 1.338 1.486 -3.200 1.338 1.486 -3.467 1.338 1.486 -3.733 1.338 1.486 -4.000 1.338 1.186 -4.000 1.068 1.186 -3.733 1.068 1.186 -3.467 1.068 1.186 -3.200 1.068 1.186 -2.933 1.068 1.186 -2.667 1.068 1.186 -2.400 1.068 1.186 -2.133 1.068 1.186 -1.867 1.068 1.186 -1.600 1.068 1.186 -1.333 1.068 1.186 -1.067 1.068 1.186 -0.800 1.068 1.186 -0.533 1.068 1.186 -0.267 1.068 1.186 0.000 1.068 1.902 0.000 0.618 1.902 -0.267 0.618 1.902 -0.533 0.618 1.902 -0.800 0.618 1.902 -1.067 0.618 1.902 -1.333 0.618 1.902 -1.600 0.618 1.902 -1.867 0.618 1.902 -2.133 0.618 1.902 -2.400 0.618 1.902 -2.667 0.618 1.902 -2.933 0.618 1.902 -3.200 0.618 1.902 -3.467 0.618 1.902 -3.733 0.618 1.902 -4.000 0.618 1.517 -4.000 0.493 1.517 -3.733 0.493 1.517 -3.467 0.493 1.517 -3.200 0.493 1.517 -2.933 0.493 1.517 -2.667 0.493 1.517 -2.400 0.493 1.517 -2.133 0.493 1.517 -1.867 0.493 1.517 -1.600 0.493 1.517 -1.333 0.493 1.517 -1.067 0.493 1.517 -0.800 0.493 1.517 -0.533 0.493 1.517 -0.267 0.493 1.517 0.000 0.493 1.989 -0.000 -0.209 1.989 -0.267 -0.209 1.989 -0.533 -0.209 1.989 -0.800 -0.209 1.989 -1.067 -0.209 1.989 -1.333 -0.209 1.989 -1.600 -0.209 1.989 -1.867 -0.209 1.989 -2.133 -0.209 1.989 -2.400 -0.209 1.989 -2.667 -0.209 1.989 -2.933 -0.209 1.989 -3.200 -0.209 1.989 -3.467 -0.209 1.989 -3.733 -0.209 1.989 -4.000 -0.209 1.587 -4.000 -0.167 1.587 -3.733 -0.167 1.587 -3.467 -0.167 1.587 -3.200 -0.167 1.587 -2.933 -0.167 1.587 -2.667 -0.167 1.587 -2.400 -0.167 1.587 -2.133 -0.167 1.587 -1.867 -0.167 1.587 -1.600 -0.167 1.587 -1.333 -0.167 1.587 -1.067 -0.167 1.587 -0.800 -0.167 1.587 -0.533 -0.167 1.587 -0.267 -0.167 1.587 -0.000 -0.167 1.732 -0.000 -1.000 1.732 -0.267 -1.000 1.732 -0.533 -1.000 1.732 -0.800 -1.000 1.732 -1.067 -1.000 1.732 -1.333 -1.000 1.732 -1.600 -1.000 1.732 -1.867 -1.000 1.732 -2.133 -1.000 1.732 -2.400 -1.000 1.732 -2.667 -1.000 1.732 -2.933 -1.000 1.732 -3.200 -1.000 1.732 -3.467 -1.000 1.732 -3.733 -1.000 1.732 -4.000 -1.000 1.382 -4.000 -0.798 1.382 -3.733 -0.798 1.382 -3.467 -0.798 1.382 -3.200 -0.798 1.382 -2.933 -0.798 1.382 -2.667 -0.798 1.382 -2.400 -0.798 1.382 -2.133 -0.798 1.382 -1.867 -0.798 1.382 -1.600 -0.798 1.382 -1.333 -0.798 1.382 -1.067 -0.798 1.382 -0.800 -0.798 1.382 -0.533 -0.798 1.382 -0.267 -0.798 1.382 -0.000 -0.798 1.176 -0.000 -1.618 1.176 -0.267 -1.618 1.176 -0.533 -1.618 1.176 -0.800 -1.618 1.176 -1.067 -1.618 1.176 -1.333 -1.618 1.176 -1.600 -1.618 1.176 -1.867 -1.618 1.176 -2.133 -1.618 1.176 -2.400 -1.618 1.176 -2.667 -1.618 1.176 -2.933 -1.618 1.176 -3.200 -1.618 1.176 -3.467 -1.618 1.176 -3.733 -1.618 1.176 -4.000 -1.618 0.938 -4.000 -1.291 0.938 -3.733 -1.291 0.938 -3.467 -1.291 0.938 -3.200 -1.291 0.938 -2.933 -1.291 0.938 -2.667 -1.291 0.938 -2.400 -1.291 0.938 -2.133 -1.291 0.938 -1.867 -1.291 0.938 -1.600 -1.291 0.938 -1.333 -1.291 0.938 -1.067 -1.291 0.938 -0.800 -1.291 0.938 -0.533 -1.291 0.938 -0.267 -1.291 0.938 -0.000 -1.291 0.416 -0.000 -1.956 0.416 -0.267 -1.956 0.416 -0.533 -1.956 0.416 -0.800 -1.956 0.416 -1.067 -1.956 0.416 -1.333 -1.956 0.416 -1.600 -1.956 0.416 -1.867 -1.956 0.416 -2.133 -1.956 0.416 -2.400 -1.956 0.416 -2.667 -1.956 0.416 -2.933 -1.956 0.416 -3.200 -1.956 0.416 -3.467 -1.956 0.416 -3.733 -1.956 0.416 -4.000 -1.956 0.332 -4.000 -1.561 0.332 -3.733 -1.561 0.332 -3.467 -1.561 0.332 -3.200 -1.561 0.332 -2.933 -1.561 0.332 -2.667 -1.561 0.332 -2.400 -1.561 0.332 -2.133 -1.561 0.332 -1.867 -1.561 0.332 -1.600 -1.561 0.332 -1.333 -1.561 0.332 -1.067 -1.561 0.332 -0.800 -1.561 0.332 -0.533 -1.561 0.332 -0.267 -1.561 0.332 -0.000 -1.561 -0.416 -0.000 -1.956 -0.416 -0.267 -1.956 -0.416 -0.533 -1.956 -0.416 -0.800 -1.956 -0.416 -1.067 -1.956 -0.416 -1.333 -1.956 -0.416 -1.600 -1.956 -0.416 -1.867 -1.956 -0.416 -2.133 -1.956 -0.416 -2.400 -1.956 -0.416 -2.667 -1.956 -0.416 -2.933 -1.956 -0.416 -3.200 -1.956 -0.416 -3.467 -1.956 -0.416 -3.733 -1.956 -0.416 -4.000 -1.956 -0.332 -4.000 -1.561 -0.332 -3.733 -1.561 -0.332 -3.467 -1.561 -0.332 -3.200 -1.561 -0.332 -2.933 -1.561 -0.332 -2.667 -1.561 -0.332 -2.400 -1.561 -0.332 -2.133 -1.561 -0.332 -1.867 -1.561 -0.332 -1.600 -1.561 -0.332 -1.333 -1.561 -0.332 -1.067 -1.561 -0.332 -0.800 -1.561 -0.332 -0.533 -1.561 -0.332 -0.267 -1.561 -0.332 -0.000 -1.561 -1.176 -0.000 -1.618 -1.176 -0.267 -1.618 -1.176 -0.533 -1.618 -1.176 -0.800 -1.618 -1.176 -1.067 -1.618 -1.176 -1.333 -1.618 -1.176 -1.600 -1.618 -1.176 -1.867 -1.618 -1.176 -2.133 -1.618 -1.176 -2.400 -1.618 -1.176 -2.667 -1.618 -1.176 -2.933 -1.618 -1.176 -3.200 -1.618 -1.176 -3.467 -1.618 -1.176 -3.733 -1.618 -1.176 -4.000 -1.618 -0.938 -4.000 -1.291 -0.938 -3.733 -1.291 -0.938 -3.467 -1.291 -0.938 -3.200 -1.291 -0.938 -2.933 -1.291 -0.938 -2.667 -1.291 -0.938 -2.400 -1.291 -0.938 -2.133 -1.291 -0.938 -1.867 -1.291 -0.938 -1.600 -1.291 -0.938 -1.333 -1.291 -0.938 -1.067 -1.291 -0.938 -0.800 -1.291 -0.938 -0.533 -1.291 -0.938 -0.267 -1.291 -0.938 -0.000 -1.291 -1.732 -0.000 -1.000 -1.732 -0.267 -1.000 -1.732 -0.533 -1.000 -1.732 -0.800 -1.000 -1.732 -1.067 -1.000 -1.732 -1.333 -1.000 -1.732 -1.600 -1.000 -1.732 -1.867 -1.000 -1.732 -2.133 -1.000 -1.732 -2.400 -1.000 -1.732 -2.667 -1.000 -1.732 -2.933 -1.000 -1.732 -3.200 -1.000 -1.732 -3.467 -1.000 -1.732 -3.733 -1.000 -1.732 -4.000 -1.000 -1.382 -4.000 -0.798 -1.382 -3.733 -0.798 -1.382 -3.467 -0.798 -1.382 -3.200 -0.798 -1.382 -2.933 -0.798 -1.382 -2.667 -0.798 -1.382 -2.400 -0.798 -1.382 -2.133 -0.798 -1.382 -1.867 -0.798 -1.382 -1.600 -0.798 -1.382 -1.333 -0.798 -1.382 -1.067 -0.798 -1.382 -0.800 -0.798 -1.382 -0.533 -0.798 -1.382 -0.267 -0.798 -1.382 -0.000 -0.798 -1.989 -0.000 -0.209 -1.989 -0.267 -0.209 -1.989 -0.533 -0.209 -1.989 -0.800 -0.209 -1.989 -1.067 -0.209 -1.989 -1.333 -0.209 -1.989 -1.600 -0.209 -1.989 -1.867 -0.209 -1.989 -2.133 -0.209 -1.989 -2.400 -0.209 -1.989 -2.667 -0.209 -1.989 -2.933 -0.209 -1.989 -3.200 -0.209 -1.989 -3.467 -0.209 -1.989 -3.733 -0.209 -1.989 -4.000 -0.209 -1.587 -4.000 -0.167 -1.587 -3.733 -0.167 -1.587 -3.467 -0.167 -1.587 -3.200 -0.167 -1.587 -2.933 -0.167 -1.587 -2.667 -0.167 -1.587 -2.400 -0.167 -1.587 -2.133 -0.167 -1.587 -1.867 -0.167 -1.587 -1.600 -0.167 -1.587 -1.333 -0.167 -1.587 -1.067 -0.167 -1.587 -0.800 -0.167 -1.587 -0.533 -0.167 -1.587 -0.267 -0.167 -1.587 -0.000 -0.167 -1.902 0.000 0.618 -1.902 -0.267 0.618 -1.902 -0.533 0.618 -1.902 -0.800 0.618 -1.902 -1.067 0.618 -1.902 -1.333 0.618 -1.902 -1.600 0.618 -1.902 -1.867 0.618 -1.902 -2.133 0.618 -1.902 -2.400 0.618 -1.902 -2.667 0.618 -1.902 -2.933 0.618 -1.902 -3.200 0.618 -1.902 -3.467 0.618 -1.902 -3.733 0.618 -1.902 -4.000 0.618 -1.517 -4.000 0.493 -1.517 -3.733 0.493 -1.517 -3.467 0.493 -1.517 -3.200 0.493 -1.517 -2.933 0.493 -1.517 -2.667 0.493 -1.517 -2.400 0.493 -1.517 -2.133 0.493 -1.517 -1.867 0.493 -1.517 -1.600 0.493 -1.517 -1.333 0.493 -1.517 -1.067 0.493 -1.517 -0.800 0.493 -1.517 -0.533 0.493 -1.517 -0.267 0.493 -1.517 0.000 0.493 -1.486 0.000 1.338 -1.486 -0.267 1.338 -1.486 -0.533 1.338 -1.486 -0.800 1.338 -1.486 -1.067 1.338 -1.486 -1.333 1.338 -1.486 -1.600 1.338 -1.486 -1.867 1.338 -1.486 -2.133 1.338 -1.486 -2.400 1.338 -1.486 -2.667 1.338 -1.486 -2.933 1.338 -1.486 -3.200 1.338 -1.486 -3.467 1.338 -1.486 -3.733 1.338 -1.486 -4.000 1.338 -1.186 -4.000 1.068 -1.186 -3.733 1.068 -1.186 -3.467 1.068 -1.186 -3.200 1.068 -1.186 -2.933 1.068 -1.186 -2.667 1.068 -1.186 -2.400 1.068 -1.186 -2.133 1.068 -1.186 -1.867 1.068 -1.186 -1.600 1.068 -1.186 -1.333 1.068 -1.186 -1.067 1.068 -1.186 -0.800 1.068 -1.186 -0.533 1.068 -1.186 -0.267 1.068 -1.186 0.000 1.068 -0.813 0.000 1.827 -0.813 -0.267 1.827 -0.813 -0.533 1.827 -0.813 -0.800 1.827 -0.813 -1.067 1.827 -0.813 -1.333 1.827 -0.813 -1.600 1.827 -0.813 -1.867 1.827 -0.813 -2.133 1.827 -0.813 -2.400 1.827 -0.813 -2.667 1.827 -0.813 -2.933 1.827 -0.813 -3.200 1.827 -0.813 -3.467 1.827 -0.813 -3.733 1.827 -0.813 -4.000 1.827 -0.649 -4.000 1.458 -0.649 -3.733 1.458 -0.649 -3.467 1.458 -0.649 -3.200 1.458 -0.649 -2.933 1.458 -0.649 -2.667 1.458 -0.649 -2.400 1.458 -0.649 -2.133 1.458 -0.649 -1.867 1.458 -0.649 -1.600 1.458 -0.649 -1.333 1.458 -0.649 -1.067 1.458 -0.649 -0.800 1.458 -0.649 -0.533 1.458 -0.649 -0.267 1.458 -0.649 0.000 1.458 -0.649 -1.333 1.458 -0.649 -1.067 1.458 -0.649 -0.800 1.458 -0.649 -0.533 1.458 -0.649 -0.267 1.458 -0.649 0.000 1.458
Tube
DrawGLScene()函数中,循环中每次都会计算两个点之间的距离再进行绘制。
1 VERTEX calculate(int i) // Calculates movement of points during morphing 2 { 3 VERTEX a; 4 a.x = (sour->points[i].x - dest->points[i].x) / steps; 5 a.y = (sour->points[i].y - dest->points[i].y) / steps; 6 a.z = (sour->points[i].z - dest->points[i].z) / steps; 7 return a; 8 }
而下面这段代码是为了让每个morph在转换时看起来更加的流畅和美感,即在转换时增加更多的点。
1 glColor3f(0.0f, 0.5f, 1.0f); 2 tx -= 2 * q.x; 3 ty -= 2 * q.y; 4 tz -= 2 * q.z; 5 glVertex3f(tx, ty, tz); 6 7 glColor3f(0.0f, 0.0f, 1.0f); 8 tx -= 2 * q.x; 9 ty -= 2 * q.y; 10 tz -= 2 * q.z; 11 glVertex3f(tx, ty, tz);
演示图:
下面为代码,同样修改部分位于双行星号内。
1 #include <windows.h> 2 #include <stdio.h> 3 #include <stdlib.h> 4 #include <math.h> 5 #include <string.h> 6 #include <gl/glew.h> 7 #include <gl/glut.h> 8 #pragma comment(lib, "legacy_stdio_definitions.lib") 9 10 /* 11 * Every OpenGL program is linked to a Rendering Context. 12 * A Rendering Context is what links OpenGL calls to the Device Context. 13 * In order for your program to draw to a Window you need to create a Device Context. 14 * The DC connects the Window to the GDI (Graphics Device Interface). 15 */ 16 17 HGLRC hRC = NULL; // Permanent rendering context 18 HDC hDC = NULL; // Private GDI device context 19 HWND hWnd = NULL; // Holds our window handle 20 HINSTANCE hInstance; // Holds the instance of the application 21 22 /* 23 * It‘s important to make this global so that each procedure knows if 24 * the program is running in fullscreen mode or not. 25 */ 26 27 bool keys[256]; // Array used for the keyboard routine 28 bool active = TRUE; // Window active flag set to TRUE by default 29 bool fullscreen = TRUE; // Fullscreen flag set to fullscreen mode by default 30 /******************************************************************************************************************************************/ 31 /******************************************************************************************************************************************/ 32 GLfloat xrot, yrot, zrot; 33 GLfloat xspeed, yspeed, zspeed; 34 GLfloat cx, cy, cz = -15.0f; 35 36 int key = 1; // Used to make sure same morph key is not pressed 37 int step = 0; // Step counter 38 int steps = 200; // Maximum number of steps 39 bool morph = false; 40 41 typedef struct { // 3D points 42 float x, y, z; 43 } VERTEX; 44 45 typedef struct { // Object 46 int vertices; 47 VERTEX* points; 48 } OBJECT; 49 50 int maxver; // Will eventually hold the maximum number of vertices 51 OBJECT morph1, morph2, morph3, morph4; // 4 morphable object 52 OBJECT helper; // Helper objext 53 OBJECT* sour; // Sour object 54 OBJECT* dest; // Dest object 55 56 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); // Declaration for WndProc 57 58 void objallocate(OBJECT* k, int n) 59 { 60 k->points = (VERTEX*)malloc(sizeof(VERTEX) * n); 61 } 62 63 void objfree(OBJECT* k) 64 { 65 free(k->points); 66 } 67 68 void readstr(FILE* f, char* string) 69 { 70 do { 71 fgets(string, 255, f); 72 } while ((string[0] == ‘/‘) || (string[0] == ‘\n‘)); 73 } 74 75 void objload(char* name, OBJECT* k) 76 { 77 int ver; // Will hold vertices count 78 float rx, ry, rz; // Hold vertex X, Y & Z position 79 FILE* filein; 80 char oneline[255]; 81 82 filein = fopen(name, "rt"); 83 readstr(filein, oneline); 84 sscanf(oneline, "Vertices: %d\n", &ver); 85 k->vertices = ver; 86 objallocate(k, ver); 87 for (int i = 0; i < ver; ++i) { 88 readstr(filein, oneline); 89 sscanf(oneline, "%f %f %f", &rx, &ry, &rz); 90 k->points[i].x = rx; 91 k->points[i].y = ry; 92 k->points[i].z = rz; 93 } 94 fclose(filein); 95 96 if (ver > maxver) 97 maxver = ver; 98 } 99 100 VERTEX calculate(int i) // Calculates movement of points during morphing 101 { 102 VERTEX a; 103 a.x = (sour->points[i].x - dest->points[i].x) / steps; 104 a.y = (sour->points[i].y - dest->points[i].y) / steps; 105 a.z = (sour->points[i].z - dest->points[i].z) / steps; 106 return a; 107 } 108 109 GLvoid ReSizeGLScene(GLsizei width, GLsizei height) // Resize and initialize the GL window 110 { 111 if (height == 0) { // Prevent a divide by zero by 112 height = 1; // Making height equal one 113 } 114 115 glViewport(0, 0, width, height); // Reset the current viewport 116 117 /* 118 * The following lines set the screen up for a perspective view. 119 * Meaning things in the distance get smaller. This creates a realistic looking scene. 120 * The perspective is calculated with a 45 degree viewing angle based on 121 * the windows width and height. The 0.1f, 100.0f is the starting point and 122 * ending point for how deep we can draw into the screen. 123 * 124 * The projection matrix is responsible for adding perspective to our scene. 125 * glLoadIdentity() restores the selected matrix to it‘s original state. 126 * The modelview matrix is where our object information is stored. 127 * Lastly we reset the modelview matrix. 128 */ 129 130 glMatrixMode(GL_PROJECTION); // Select the projection matrix 131 glLoadIdentity(); // Reset the projection matrix 132 133 // Calculate the aspect ratio of the window 134 gluPerspective(45.0f, (GLfloat)width / (GLfloat)height, 0.1f, 100.0f); 135 // glOrtho(0.0f, width, height, 0.0f, -1.0f, 1.0f); // Create orhto 640X480 view (0, 0, at the top) 136 137 glMatrixMode(GL_MODELVIEW); // Seclet the modelview matrix 138 glLoadIdentity(); // Reset the modelview matrix 139 } 140 141 int InitGL(GLvoid) // All setup for OpenGL goes here 142 { 143 glBlendFunc(GL_SRC_ALPHA, GL_ONE); // Set the blending function for translucency 144 glClearColor(0.0f, 0.0f, 0.0f, 0.5f); // Black background 145 glClearDepth(1.0f); // Depth buffer setup 146 glDepthFunc(GL_LESS); // The type of depth test to do 147 glEnable(GL_DEPTH_TEST); 148 glShadeModel(GL_SMOOTH); // Enables smooth color shading 149 glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NEAREST); 150 151 maxver = 0; 152 objload("sphere.txt", &morph1); // Sphere 153 objload("torus.txt", &morph2); // Torus 154 objload("tube.txt", &morph3); // Tube 155 objallocate(&morph4, 486); // Manually reserver Ram for a 4th 468 vertices object 156 157 for (int i = 0; i < 486; ++i) { 158 morph4.points[i].x = ((float)(rand() % 14000) / 1000) - 7; 159 morph4.points[i].y = ((float)(rand() % 14000) / 1000) - 7; 160 morph4.points[i].z = ((float)(rand() % 14000) / 1000) - 7; 161 } 162 163 objload("sphere.txt", &helper); 164 sour = dest = &morph1; 165 166 return TRUE; 167 } 168 /* 169 * For now all we will do is clear the screen to the color we previously decided on, 170 * clear the depth buffer and reset the scene. We wont draw anything yet. 171 */ 172 void DrawGLScene(GLvoid) // Here‘s where we do all the drawing 173 { 174 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 175 glLoadIdentity(); 176 177 glTranslatef(cx, cy, cz); 178 glRotatef(xrot, 1.0f, 0.0f, 0.0f); 179 glRotatef(yrot, 0.0f, 1.0f, 0.0f); 180 glRotatef(zrot, 0.0f, 0.0f, 1.0f); 181 182 xrot += xspeed; 183 yrot += yspeed; 184 zrot += zspeed; 185 186 GLfloat tx, ty, tz; // Temp 187 VERTEX q; // Holds returned calculated values for one vertex 188 189 glBegin(GL_POINTS); 190 for (int i = 0; i < morph1.vertices; ++i) { 191 if (morph) { 192 q = calculate(i); 193 } 194 else { 195 q.x = q.y = q.z = 0; 196 } 197 helper.points[i].x -= q.x; 198 helper.points[i].y -= q.y; 199 helper.points[i].z -= q.z; 200 tx = helper.points[i].x; 201 ty = helper.points[i].y; 202 tz = helper.points[i].z; 203 204 glColor3f(0.0f, 1.0f, 1.0f); 205 glVertex3f(tx, ty, tz); 206 207 glColor3f(0.0f, 0.5f, 1.0f); 208 tx -= 2 * q.x; 209 ty -= 2 * q.y; 210 tz -= 2 * q.z; 211 glVertex3f(tx, ty, tz); 212 213 glColor3f(0.0f, 0.0f, 1.0f); 214 tx -= 2 * q.x; 215 ty -= 2 * q.y; 216 tz -= 2 * q.z; 217 glVertex3f(tx, ty, tz); 218 } 219 glEnd(); 220 221 if (morph && step <= steps) 222 step++; 223 else { 224 morph = false; 225 sour = dest; 226 step = 0; 227 } 228 } 229 /* 230 * The job of KillGLWindow() is to release the Rendering Context, 231 * the Device Context and finally the Window Handle. 232 */ 233 234 GLvoid KillGLWindow(GLvoid) // Properly kill the window 235 { 236 objfree(&morph1); 237 objfree(&morph2); 238 objfree(&morph3); 239 objfree(&morph4); 240 objfree(&helper); 241 /******************************************************************************************************************************************/ 242 /******************************************************************************************************************************************/ 243 244 if (fullscreen) { // Are we in fullscreen mode 245 246 /* 247 * We use ChangeDisplaySettings(NULL,0) to return us to our original desktop. 248 * After we‘ve switched back to the desktop we make the cursor visible again. 249 */ 250 251 ChangeDisplaySettings(NULL, 0); // if so switch back to the desktop 252 ShowCursor(TRUE); // Show mouse pointer 253 } 254 255 if (hRC) { // Do we have a rendering context 256 if (!wglMakeCurrent(NULL, NULL)) { // Are we able to release the DC and RC contexts 257 MessageBox(NULL, "Release of DC and RC failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); 258 } 259 260 if (!wglDeleteContext(hRC)) { // Are we able to delete the RC 261 MessageBox(NULL, "Release rendering context failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); 262 hRC = NULL; // Set RC to NULL 263 } 264 265 if (hDC && !ReleaseDC(hWnd, hDC)) { // Are we able to release the DC 266 MessageBox(NULL, "Release device context failed.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); 267 hDC = NULL; // Set DC to NULL 268 } 269 if (hWnd && !DestroyWindow(hWnd)) { // Are we able to destroy the window 270 MessageBox(NULL, "Could not release hWnd.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); 271 hWnd = NULL; // Set hWnd to NULL 272 } 273 274 if (!UnregisterClass("OpenGL", hInstance)) { // Are we able to unregister class 275 MessageBox(NULL, "Could not register class.", "SHUTDOWN ERROR", MB_OK | MB_ICONINFORMATION); 276 hInstance = NULL; // Set hInstance to NULL 277 } 278 } 279 } 280 281 /* 282 * The next section of code creates our OpenGL Window. 283 */ 284 285 BOOL CreateGLWindow(char* title, int width, int height, int bits, bool fullscreenflag) 286 { 287 /* 288 * Find a pixel format that matches the one we want 289 */ 290 GLuint PixelFormat; // Holds the result after serching for a match 291 292 /* 293 * Before you create a window, you MUST register a Class for the window 294 */ 295 WNDCLASS wc; // Windows class structure 296 297 /* 298 * dwExStyle and dwStyle will store the Extended and normal Window Style Information. 299 */ 300 DWORD dwExStyle; // Window extend style 301 DWORD dwStyle; // Window style 302 303 RECT WindowRect; // Grabs rectangle upper left/lower right values 304 WindowRect.left = (long)0; // Set left value to 0 305 WindowRect.right = (long)width; // Set right value to requested width 306 WindowRect.top = (long)0; // Set top value to 0 307 WindowRect.bottom = (long)height; // Set bottom value to requested height 308 309 fullscreen = fullscreenflag; // Set the global fullscreen flag 310 311 /* 312 * The style CS_HREDRAW and CS_VREDRAW force the Window to redraw whenever it is resized. 313 * CS_OWNDC creates a private DC for the Window. Meaning the DC is not shared across applications. 314 * WndProc is the procedure that watches for messages in our program. 315 * No extra Window data is used so we zero the two fields. Then we set the instance. 316 * Next we set hIcon to NULL meaning we don‘t want an ICON in the Window, 317 * and for a mouse pointer we use the standard arrow. The background color doesn‘t matter 318 * (we set that in GL). We don‘t want a menu in this Window so we set it to NULL, 319 * and the class name can be any name you want. I‘ll use "OpenGL" for simplicity. 320 */ 321 hInstance = GetModuleHandle(NULL); // Grab an instance for our window 322 wc.style = CS_HREDRAW | CS_VREDRAW | CS_OWNDC; // Redraw on move, and own DC for window 323 wc.lpfnWndProc = (WNDPROC)WndProc; // WndProc handles message 324 wc.cbClsExtra = 0; // No extra window date 325 wc.cbWndExtra = 0; // No extra window date 326 wc.hInstance = hInstance; // set the instance 327 wc.hIcon = LoadIcon(NULL, IDI_WINLOGO); // Load the default icon 328 wc.hCursor = LoadCursor(NULL, IDC_ARROW); // Load the arrow pointer 329 wc.hbrBackground = NULL; // No background requried for GL 330 wc.lpszMenuName = NULL; // We don‘t want a menu 331 wc.lpszClassName = "OpenGL"; // set the class name 332 333 if (!RegisterClass(&wc)) { // Attempt to register the window class 334 MessageBox(NULL, "Failed to register the window class.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 335 return FALSE; // Exit and return false 336 } 337 338 if (fullscreen) { // attempt fullsreen model 339 340 /* 341 T* here are a few very important things you should keep in mind when switching to full screen mode. 342 * Make sure the width and height that you use in fullscreen mode is the same as 343 * the width and height you plan to use for your window, and most importantly, 344 * set fullscreen mode BEFORE you create your window. 345 */ 346 DEVMODE dmScreenSettings; // Device mode 347 memset(&dmScreenSettings, 0, sizeof(dmScreenSettings)); // Make sure memory‘s cleared 348 dmScreenSettings.dmSize = sizeof(dmScreenSettings); // Size of devmode structure 349 dmScreenSettings.dmPelsWidth = width; // Select window width 350 dmScreenSettings.dmPelsHeight = height; // Select window height 351 dmScreenSettings.dmBitsPerPel = bits; // Select bits per pixel 352 dmScreenSettings.dmFields = DM_BITSPERPEL | DM_PELSWIDTH | DM_PELSHEIGHT; 353 354 /* 355 * In the line below ChangeDisplaySettings tries to switch to a mode that matches 356 * what we stored in dmScreenSettings. I use the parameter CDS_FULLSCREEN when switching modes, 357 * because it‘s supposed to remove the start bar at the bottom of the screen, 358 * plus it doesn‘t move or resize the windows on your desktop when you switch to 359 * fullscreen mode and back. 360 */ 361 //Try to set selected mode and get results. Note: CDS_FULLSCREEN gets rid of start bar 362 if (ChangeDisplaySettings(&dmScreenSettings, CDS_FULLSCREEN) != DISP_CHANGE_SUCCESSFUL) { 363 //If the mode fails, offer two options. Quit or run in a window 364 if (MessageBox(NULL, "The requested fullscreen mode is not supported by\n your video card. Use" 365 "windowed mode instead?", "GL", MB_YESNO | MB_ICONEXCLAMATION) == IDYES) 366 { 367 fullscreen = FALSE; // Select windowed mode (fullscreen=FLASE) 368 } 369 else { 370 // Pop up a message box letting user know the programe is closing. 371 MessageBox(NULL, "Program will now close.", "ERROR", MB_OK | MB_ICONSTOP); 372 return FALSE; // Exit and return FALSE 373 } 374 } 375 } 376 377 if (fullscreen) { // Are we still in fullscreen mode 378 379 /* 380 * If we are still in fullscreen mode we‘ll set the extended style to WS_EX_APPWINDOW, 381 * which force a top level window down to the taskbar once our window is visible. 382 * For the window style we‘ll create a WS_POPUP window. 383 * This type of window has no border around it, making it perfect for fullscreen mode. 384 385 * Finally, we disable the mouse pointer. If your program is not interactive, 386 * it‘s usually nice to disable the mouse pointer when in fullscreen mode. It‘s up to you though. 387 */ 388 dwExStyle = WS_EX_APPWINDOW; // Window extended style 389 dwStyle = WS_POPUP; // Window style 390 ShowCursor(FALSE); // Hide mosue pointer 391 } 392 else { 393 394 /* 395 * If we‘re using a window instead of fullscreen mode, 396 * we‘ll add WS_EX_WINDOWEDGE to the extended style. This gives the window a more 3D look. 397 * For style we‘ll use WS_OVERLAPPEDWINDOW instead of WS_POPUP. 398 * WS_OVERLAPPEDWINDOW creates a window with a title bar, sizing border, 399 * window menu, and minimize / maximize buttons. 400 */ 401 dwExStyle = WS_EX_APPWINDOW | WS_EX_WINDOWEDGE; // Window extended style 402 dwStyle = WS_OVERLAPPEDWINDOW; // Window style 403 } 404 405 /* 406 * By using the AdjustWindowRectEx command none of our OpenGL scene will be covered up by the borders, 407 * instead, the window will be made larger to account for the pixels needed to draw the window border. 408 * In fullscreen mode, this command has no effect. 409 */ 410 AdjustWindowRectEx(&WindowRect, dwStyle, FALSE, dwExStyle); // Adjust window to true resqusted 411 412 /* 413 * WS_CLIPSIBLINGS and WS_CLIPCHILDREN are both REQUIRED for OpenGL to work properly. 414 * These styles prevent other windows from drawing over or into our OpenGL Window. 415 */ 416 if (!(hWnd = CreateWindowEx(dwExStyle, // Extended style for the window 417 "OpenGL", // Class name 418 title, // Window title 419 WS_CLIPSIBLINGS | // Requried window style 420 WS_CLIPCHILDREN | // Requried window style 421 dwStyle, // Select window style 422 0, 0, // Window position 423 WindowRect.right - WindowRect.left, // Calculate adjusted window width 424 WindowRect.bottom - WindowRect.top, // Calculate adjusted window height 425 NULL, // No parent window 426 NULL, // No menu 427 hInstance, // Instance 428 NULL))) // Don‘t pass anything to WM_CREATE 429 { 430 KillGLWindow(); //Reset the display 431 MessageBox(NULL, "Window creation error.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 432 return FALSE; // Retrurn FALSE; 433 } 434 435 /* 436 * aside from the stencil buffer and the (slow) accumulation buffer 437 */ 438 static PIXELFORMATDESCRIPTOR pfd = // pfd tells windows how we want things to be 439 { 440 sizeof(PIXELFORMATDESCRIPTOR), // Size of this pixel format descriptor 441 1, // Version number 442 PFD_DRAW_TO_WINDOW | // Format must support window 443 PFD_SUPPORT_OPENGL | // Format must support OpenGL 444 PFD_DOUBLEBUFFER, // Must support double buffer 445 PFD_TYPE_RGBA, // Request an RGBA format 446 bits, // Select our color depth 447 0, 0, 0, 0, 0, 0, // Color bits ignored 448 0, // No alpha buffer 449 0, // shift bit ignored 450 0, // No accumulation buffer 451 0, 0, 0, 0, // Accumulation bits ignored 452 16, // 16Bits Z_Buffer (depth buffer) 453 0, // No stencil buffer 454 0, // No auxiliary buffer 455 PFD_MAIN_PLANE, // Main drawing layer 456 0, // Reserved 457 0, 0, 0 // Layer makes ignored 458 }; 459 460 if (!(hDC = GetDC(hWnd))) { // Did we get a device context 461 KillGLWindow(); // Reset the display 462 MessageBox(NULL, "Can‘t create a GL device context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 463 return FALSE; // Return FALSE 464 } 465 466 if (!(PixelFormat = ChoosePixelFormat(hDC, &pfd))) { // Did window find a matching pixel format 467 KillGLWindow(); // Reset the display 468 MessageBox(NULL, "Can‘t find a suitable pixelformat.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 469 return FALSE; // Return FALSE; 470 } 471 472 if (!SetPixelFormat(hDC, PixelFormat, &pfd)) { // Are we able to set the pixel format 473 KillGLWindow(); // Reset the display 474 MessageBox(NULL, "Can‘t set the pixelformat.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 475 return FALSE; // Return FALSE; 476 } 477 478 if (!(hRC = wglCreateContext(hDC))) { // Are we able to rendering context 479 KillGLWindow(); // Reset the display 480 MessageBox(NULL, "Can‘t create a GL rendering context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 481 return FALSE; // Return FASLE; 482 } 483 484 if (!wglMakeCurrent(hDC, hRC)) { // Try to activate the rendering context 485 KillGLWindow(); // Reset the display 486 MessageBox(NULL, "Can‘t activate the GL rendering context.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 487 return FALSE; // Return FALSE 488 } 489 490 /* 491 * ReSizeGLScene passing the screen width and height to set up our perspective OpenGL screen. 492 */ 493 ShowWindow(hWnd, SW_SHOW); // Show the window 494 SetForegroundWindow(hWnd); // slightly higher priority 495 SetFocus(hWnd); // Sets keyboard focus to the window 496 ReSizeGLScene(width, height); // Set up our perspective GL screen 497 498 /* 499 * we can set up lighting, textures, and anything else that needs to be setup in InitGL(). 500 */ 501 if (!InitGL()) { // Initialize our newly created GL window 502 KillGLWindow(); // Reset the display 503 MessageBox(NULL, "Initialize Failed.", "ERROR", MB_OK | MB_ICONEXCLAMATION); 504 return FALSE; // Return FALSE 505 } 506 return TRUE; 507 } 508 509 LRESULT CALLBACK WndProc(HWND hWnd, // Handle for this window 510 UINT uMsg, // Message for this window 511 WPARAM wParam, // Additional message information 512 LPARAM lParam) // Additional message information 513 { 514 switch (uMsg) { // Check for window message 515 case WM_ACTIVATE: { // Check minimization state 516 if (!HIWORD(wParam)) { 517 active = TRUE; // Program is active 518 } 519 else { 520 active = FALSE; // Program is no longer active 521 } 522 return 0; // Return to the message loop 523 } 524 case WM_SYSCOMMAND: { // Intercept system commands 525 switch (wParam) { // Check system calls 526 case SC_SCREENSAVE: // Screensaver trying to start 527 case SC_MONITORPOWER: // Monitor trying to enter powersave 528 return 0; // Prevent form happening 529 } 530 break; // Exit 531 } 532 case WM_CLOSE: { // Did we receive a close message 533 PostQuitMessage(0); // Send a quit message 534 return 0; 535 } 536 case WM_KEYDOWN: { // Is a key being held down 537 keys[wParam] = TRUE; // if so, mark it as TRUE 538 return 0; // Jump back 539 } 540 case WM_KEYUP: { // Has a key been released 541 keys[wParam] = FALSE; // if so, mark it as FALSE 542 return 0; // Jump back 543 } 544 case WM_SIZE: { // Resize the OpenGL window 545 ReSizeGLScene(LOWORD(lParam), HIWORD(lParam)); // LoWord = width HiWord = height 546 return 0; // Jump back 547 } 548 } 549 return DefWindowProc(hWnd, uMsg, wParam, lParam); // Pass all unhandled message to DefWindwProc 550 } 551 552 int WINAPI WinMain(HINSTANCE hInstance, // Instance 553 HINSTANCE hPrevInstance, // Previous instance 554 LPSTR lpCmdLine, // Command line parameters 555 int nCmdShow) // Window show state 556 { 557 MSG msg; // Window message structure 558 BOOL done = FALSE; // Bool variable to exit loop 559 // Ask the user which screen mode they prefer 560 if (MessageBox(NULL, "Would you like to run in fullscreen mode?", 561 "Start fullscreen?", MB_YESNO | MB_ICONQUESTION) == IDNO) 562 { 563 fullscreen = FALSE; // Window mode 564 } 565 // Create our OpenGL window 566 if (!CreateGLWindow("3D Shapes", 640, 480, 16, fullscreen)) { // (Modified) 567 return 0; // Quit if window was not create 568 } 569 /******************************************************************************************************************************************/ 570 /******************************************************************************************************************************************/ 571 572 while (!done) { // Loop that runs until donw = TRUE 573 if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { // Is there a message wating 574 if (msg.message == WM_QUIT) { // Havw we received a quit message 575 done = TRUE; // if so done = TRUE 576 } 577 else { // If not, deal with window message 578 TranslateMessage(&msg); // Translate message 579 DispatchMessage(&msg); // Dispatch message 580 } 581 } 582 else { 583 // Draw the scene. Watch for ESC key and quit message from DrawGLScene() 584 if (active) { // Program active 585 if (keys[VK_ESCAPE]) { // Was ESC pressed 586 done = TRUE; // ESC signalled a quit 587 } 588 else { // Not time to quit, update screen 589 DrawGLScene(); // Draw scene 590 SwapBuffers(hDC); // Swap buffers (double buffering) 591 } 592 } 593 594 if (keys[VK_PRIOR]) zspeed += 0.0001f; 595 if (keys[VK_NEXT]) zspeed -= 0.0001f; 596 if (keys[VK_DOWN]) xspeed += 0.0001f; 597 if (keys[VK_UP]) xspeed -= 0.0001f; 598 if (keys[VK_RIGHT]) yspeed += 0.0001f; 599 if (keys[VK_LEFT]) yspeed -= 0.0001f; 600 if (keys[‘Q‘]) cz -= 0.001f; 601 if (keys[‘Z‘]) cz += 0.001f; 602 if (keys[‘W‘]) cy += 0.001f; 603 if (keys[‘S‘]) cy -= 0.001f; 604 if (keys[‘D‘]) cx += 0.001f; 605 if (keys[‘A‘]) cx -= 0.001f; 606 if (keys[‘1‘] && (key != 1) && !morph) { key = 1; morph = true; dest = &morph1; } 607 if (keys[‘2‘] && (key != 2) && !morph) { key = 2; morph = true; dest = &morph2; } 608 if (keys[‘3‘] && (key != 3) && !morph) { key = 3; morph = true; dest = &morph3; } 609 if (keys[‘4‘] && (key != 4) && !morph) { key = 4; morph = true; dest = &morph4; } 610 611 /* 612 * It allows us to press the F1 key to switch from fullscreen mode to 613 * windowed mode or windowed mode to fullscreen mode. 614 */ 615 if (keys[VK_F1]) { // Is F1 being pressed 616 keys[VK_F1] = FALSE; // If so make key FASLE 617 KillGLWindow(); // Kill our current window 618 fullscreen = !fullscreen; // Toggle fullscreen / window mode 619 //Recreate our OpenGL window(modified) 620 if (!CreateGLWindow("3D Shapes", 640, 480, 16, fullscreen)) { 621 return 0; // Quit if window was not create 622 } 623 } 624 } 625 } 626 // Shutdown 627 KillGLWindow(); // Kill the window 628 return (msg.wParam); // Exit the program 629 } 630 /******************************************************************************************************************************************/ 631 /******************************************************************************************************************************************/
Thanks for Nehe‘s tutorials, this is his home.
时间: 2024-10-13 19:42:16