Geant4 Cross Reference |
1 // 1 // 2 // ******************************************* 2 // ******************************************************************** 3 // * License and Disclaimer 3 // * License and Disclaimer * 4 // * 4 // * * 5 // * The Geant4 software is copyright of th 5 // * The Geant4 software is copyright of the Copyright Holders of * 6 // * the Geant4 Collaboration. It is provided 6 // * the Geant4 Collaboration. It is provided under the terms and * 7 // * conditions of the Geant4 Software License 7 // * conditions of the Geant4 Software License, included in the file * 8 // * LICENSE and available at http://cern.ch/ 8 // * LICENSE and available at http://cern.ch/geant4/license . These * 9 // * include a list of copyright holders. 9 // * include a list of copyright holders. * 10 // * 10 // * * 11 // * Neither the authors of this software syst 11 // * Neither the authors of this software system, nor their employing * 12 // * institutes,nor the agencies providing fin 12 // * institutes,nor the agencies providing financial support for this * 13 // * work make any representation or warran 13 // * work make any representation or warranty, express or implied, * 14 // * regarding this software system or assum 14 // * regarding this software system or assume any liability for its * 15 // * use. Please see the license in the file 15 // * use. Please see the license in the file LICENSE and URL above * 16 // * for the full disclaimer and the limitatio 16 // * for the full disclaimer and the limitation of liability. * 17 // * 17 // * * 18 // * This code implementation is the result 18 // * This code implementation is the result of the scientific and * 19 // * technical work of the GEANT4 collaboratio 19 // * technical work of the GEANT4 collaboration. * 20 // * By using, copying, modifying or distri 20 // * By using, copying, modifying or distributing the software (or * 21 // * any work based on the software) you ag 21 // * any work based on the software) you agree to acknowledge its * 22 // * use in resulting scientific publicati 22 // * use in resulting scientific publications, and indicate your * 23 // * acceptance of all terms of the Geant4 Sof 23 // * acceptance of all terms of the Geant4 Software license. * 24 // ******************************************* 24 // ******************************************************************** 25 // 25 // >> 26 #ifdef G4VIS_BUILD_OI_DRIVER 26 27 27 /*----------------------------HEPVis---------- 28 /*----------------------------HEPVis----------------------------------------*/ 28 /* 29 /* */ 29 /* Node: SoMarkerSet 30 /* Node: SoMarkerSet */ 30 /* Author: Guy Barrand 31 /* Author: Guy Barrand */ 31 /* 32 /* */ 32 /*-------------------------------------------- 33 /*--------------------------------------------------------------------------*/ 33 34 34 // this : 35 // this : 35 #include <HEPVis/nodes/SoMarkerSet.h> 36 #include <HEPVis/nodes/SoMarkerSet.h> 36 37 37 #include <Inventor/errors/SoDebugError.h> 38 #include <Inventor/errors/SoDebugError.h> 38 #include <Inventor/misc/SoState.h> 39 #include <Inventor/misc/SoState.h> 39 #include <Inventor/actions/SoGLRenderAction.h> 40 #include <Inventor/actions/SoGLRenderAction.h> 40 #include <Inventor/nodes/SoPointSet.h> 41 #include <Inventor/nodes/SoPointSet.h> 41 42 42 #include <Inventor/elements/SoCoordinateElemen 43 #include <Inventor/elements/SoCoordinateElement.h> 43 #include <Inventor/elements/SoCacheElement.h> 44 #include <Inventor/elements/SoCacheElement.h> 44 #include <Inventor/elements/SoLazyElement.h> 45 #include <Inventor/elements/SoLazyElement.h> 45 46 46 #include <HEPVis/SbGL.h> 47 #include <HEPVis/SbGL.h> 47 #include <HEPVis/actions/SoGL2PSAction.h> 48 #include <HEPVis/actions/SoGL2PSAction.h> 48 49 49 static void drawMarker(SoAction*,int); 50 static void drawMarker(SoAction*,int); 50 static GLubyte* getBitmap(int,int,char []); 51 static GLubyte* getBitmap(int,int,char []); 51 52 52 /* 53 /* 53 " x " 54 " x " 54 " x " 55 " x " 55 "xxxxx" 56 "xxxxx" 56 " x " 57 " x " 57 " x " 58 " x " 58 59 59 Should produce bitmap : 60 Should produce bitmap : 60 0x20,0x20,0xf8,0x20,0x20 61 0x20,0x20,0xf8,0x20,0x20 61 62 62 The rows will be rendered down to top ; firs 63 The rows will be rendered down to top ; first row at bottom, last at top. 63 In the below, '-' means that glBitmap will m 64 In the below, '-' means that glBitmap will move the pointer to next byte. 64 65 65 32103210 32103210 32103210 32103210 32103210 66 32103210 32103210 32103210 32103210 32103210 66 ..1..--- ..1..--- 11111--- ..1..--- ..1..--- 67 ..1..--- ..1..--- 11111--- ..1..--- ..1..--- 67 68 68 0x20 0x20 0xf8 0x20 0x20 69 0x20 0x20 0xf8 0x20 0x20 69 */ 70 */ 70 71 71 ////////////////////////////////////////////// 72 /////////////////////////////////////////////////////////////// 72 /// 5 5 ////////////////////////////////////// 73 /// 5 5 /////////////////////////////////////////////////////// 73 ////////////////////////////////////////////// 74 /////////////////////////////////////////////////////////////// 74 static char plus_5_5[] = { 75 static char plus_5_5[] = { 75 " x " 76 " x " 76 " x " 77 " x " 77 "xxxxx" 78 "xxxxx" 78 " x " 79 " x " 79 " x " 80 " x " 80 }; 81 }; 81 static char asterisk_5_5[] = { 82 static char asterisk_5_5[] = { 82 "x x x" 83 "x x x" 83 " xxx " 84 " xxx " 84 " x " 85 " x " 85 " xxx " 86 " xxx " 86 "x x x" 87 "x x x" 87 }; 88 }; 88 static char cross_5_5[] = { 89 static char cross_5_5[] = { 89 "x x" 90 "x x" 90 " x x " 91 " x x " 91 " x " 92 " x " 92 " x x " 93 " x x " 93 "x x" 94 "x x" 94 }; 95 }; 95 static char star_5_5[] = { 96 static char star_5_5[] = { 96 "x x x" 97 "x x x" 97 " xxx " 98 " xxx " 98 "xxxxx" 99 "xxxxx" 99 " xxx " 100 " xxx " 100 "x x x" 101 "x x x" 101 }; 102 }; 102 static char circle_line_5_5[] = { 103 static char circle_line_5_5[] = { 103 " xxx " 104 " xxx " 104 "x x" 105 "x x" 105 "x x" 106 "x x" 106 "x x" 107 "x x" 107 " xxx " 108 " xxx " 108 }; 109 }; 109 static char circle_filled_5_5[] = { 110 static char circle_filled_5_5[] = { 110 " xxx " 111 " xxx " 111 "xxxxx" 112 "xxxxx" 112 "xxxxx" 113 "xxxxx" 113 "xxxxx" 114 "xxxxx" 114 " xxx " 115 " xxx " 115 }; 116 }; 116 static char triangle_up_line_5_5[] = { //OpenG 117 static char triangle_up_line_5_5[] = { //OpenGL will draw with y reversed. 117 "xxxxx" 118 "xxxxx" 118 " x x " 119 " x x " 119 " x x " 120 " x x " 120 " x " 121 " x " 121 " x " 122 " x " 122 }; 123 }; 123 static char triangle_up_filled_5_5[] = { 124 static char triangle_up_filled_5_5[] = { 124 "xxxxx" 125 "xxxxx" 125 " xxx " 126 " xxx " 126 " xxx " 127 " xxx " 127 " x " 128 " x " 128 " x " 129 " x " 129 }; 130 }; 130 static char triangle_down_line_5_5[] = { 131 static char triangle_down_line_5_5[] = { 131 " x " 132 " x " 132 " x " 133 " x " 133 " x x " 134 " x x " 134 " x x " 135 " x x " 135 "xxxxx" 136 "xxxxx" 136 }; 137 }; 137 static char triangle_down_filled_5_5[] = { 138 static char triangle_down_filled_5_5[] = { 138 " x " 139 " x " 139 " x " 140 " x " 140 " xxx " 141 " xxx " 141 " xxx " 142 " xxx " 142 "xxxxx" 143 "xxxxx" 143 }; 144 }; 144 static char david_star_line_5_5[] = { 145 static char david_star_line_5_5[] = { 145 " x " 146 " x " 146 "xxxxx" 147 "xxxxx" 147 " x x " 148 " x x " 148 "xxxxx" 149 "xxxxx" 149 " x " 150 " x " 150 }; 151 }; 151 static char david_star_filled_5_5[] = { 152 static char david_star_filled_5_5[] = { 152 " x " 153 " x " 153 "xxxxx" 154 "xxxxx" 154 " xxx " 155 " xxx " 155 "xxxxx" 156 "xxxxx" 156 " x " 157 " x " 157 }; 158 }; 158 static char swiss_cross_line_5_5[] = { 159 static char swiss_cross_line_5_5[] = { 159 " xxx " 160 " xxx " 160 "xx xx" 161 "xx xx" 161 "x x" 162 "x x" 162 "xx xx" 163 "xx xx" 163 " xxx " 164 " xxx " 164 }; 165 }; 165 static char swiss_cross_filled_5_5[] = { 166 static char swiss_cross_filled_5_5[] = { 166 " xxx " 167 " xxx " 167 "xxxxx" 168 "xxxxx" 168 "xxxxx" 169 "xxxxx" 169 "xxxxx" 170 "xxxxx" 170 " xxx " 171 " xxx " 171 }; 172 }; 172 static char diamond_line_5_5[] = { 173 static char diamond_line_5_5[] = { 173 " x " 174 " x " 174 " x x " 175 " x x " 175 "x x" 176 "x x" 176 " x x " 177 " x x " 177 " x " 178 " x " 178 }; 179 }; 179 static char diamond_filled_5_5[] = { 180 static char diamond_filled_5_5[] = { 180 " x " 181 " x " 181 " xxx " 182 " xxx " 182 "xxxxx" 183 "xxxxx" 183 " xxx " 184 " xxx " 184 " x " 185 " x " 185 }; 186 }; 186 static char square_line_5_5[] = { 187 static char square_line_5_5[] = { 187 "xxxxx" 188 "xxxxx" 188 "x x" 189 "x x" 189 "x x" 190 "x x" 190 "x x" 191 "x x" 191 "xxxxx" 192 "xxxxx" 192 }; 193 }; 193 static char square_filled_5_5[] = { 194 static char square_filled_5_5[] = { 194 "xxxxx" 195 "xxxxx" 195 "xxxxx" 196 "xxxxx" 196 "xxxxx" 197 "xxxxx" 197 "xxxxx" 198 "xxxxx" 198 "xxxxx" 199 "xxxxx" 199 }; 200 }; 200 ////////////////////////////////////////////// 201 /////////////////////////////////////////////////////////////// 201 /// 7 7 ////////////////////////////////////// 202 /// 7 7 /////////////////////////////////////////////////////// 202 ////////////////////////////////////////////// 203 /////////////////////////////////////////////////////////////// 203 static char plus_7_7[] = { 204 static char plus_7_7[] = { 204 " x " 205 " x " 205 " x " 206 " x " 206 " x " 207 " x " 207 "xxxxxxx" 208 "xxxxxxx" 208 " x " 209 " x " 209 " x " 210 " x " 210 " x " 211 " x " 211 }; 212 }; 212 static char asterisk_7_7[] = { 213 static char asterisk_7_7[] = { 213 "x x x" 214 "x x x" 214 " x x x " 215 " x x x " 215 " xxx " 216 " xxx " 216 " x " 217 " x " 217 " xxx " 218 " xxx " 218 " x x x " 219 " x x x " 219 "x x x" 220 "x x x" 220 }; 221 }; 221 static char cross_7_7[] = { 222 static char cross_7_7[] = { 222 "x x" 223 "x x" 223 " x x " 224 " x x " 224 " xxx " 225 " xxx " 225 " x " 226 " x " 226 " xxx " 227 " xxx " 227 " x x " 228 " x x " 228 "x x" 229 "x x" 229 }; 230 }; 230 static char star_7_7[] = { 231 static char star_7_7[] = { 231 "x x x" 232 "x x x" 232 " x x x " 233 " x x x " 233 " xxx " 234 " xxx " 234 "xxxxxxx" 235 "xxxxxxx" 235 " xxx " 236 " xxx " 236 " x x x " 237 " x x x " 237 "x x x" 238 "x x x" 238 }; 239 }; 239 static char circle_line_7_7[] = { 240 static char circle_line_7_7[] = { 240 " xxxxx " 241 " xxxxx " 241 "x x" 242 "x x" 242 "x x" 243 "x x" 243 "x x" 244 "x x" 244 "x x" 245 "x x" 245 "x x" 246 "x x" 246 " xxxxx " 247 " xxxxx " 247 }; 248 }; 248 static char circle_filled_7_7[] = { 249 static char circle_filled_7_7[] = { 249 " xxxxx " 250 " xxxxx " 250 "xxxxxxx" 251 "xxxxxxx" 251 "xxxxxxx" 252 "xxxxxxx" 252 "xxxxxxx" 253 "xxxxxxx" 253 "xxxxxxx" 254 "xxxxxxx" 254 "xxxxxxx" 255 "xxxxxxx" 255 " xxxxx " 256 " xxxxx " 256 }; 257 }; 257 static char triangle_up_line_7_7[] = { //OpenG 258 static char triangle_up_line_7_7[] = { //OpenGL will draw with y reversed. 258 "xxxxxxx" 259 "xxxxxxx" 259 " x x " 260 " x x " 260 " x x " 261 " x x " 261 " x x " 262 " x x " 262 " x x " 263 " x x " 263 " x " 264 " x " 264 " x " 265 " x " 265 }; 266 }; 266 static char triangle_up_filled_7_7[] = { 267 static char triangle_up_filled_7_7[] = { 267 "xxxxxxx" 268 "xxxxxxx" 268 " xxxxx " 269 " xxxxx " 269 " xxxxx " 270 " xxxxx " 270 " xxx " 271 " xxx " 271 " xxx " 272 " xxx " 272 " x " 273 " x " 273 " x " 274 " x " 274 }; 275 }; 275 static char triangle_down_line_7_7[] = { 276 static char triangle_down_line_7_7[] = { 276 " x " 277 " x " 277 " x " 278 " x " 278 " x x " 279 " x x " 279 " x x " 280 " x x " 280 " x x " 281 " x x " 281 " x x " 282 " x x " 282 "xxxxxxx" 283 "xxxxxxx" 283 }; 284 }; 284 static char triangle_down_filled_7_7[] = { 285 static char triangle_down_filled_7_7[] = { 285 " x " 286 " x " 286 " x " 287 " x " 287 " xxx " 288 " xxx " 288 " xxx " 289 " xxx " 289 " xxxxx " 290 " xxxxx " 290 " xxxxx " 291 " xxxxx " 291 "xxxxxxx" 292 "xxxxxxx" 292 }; 293 }; 293 static char david_star_line_7_7[] = { 294 static char david_star_line_7_7[] = { 294 " x " 295 " x " 295 "xxxxxxx" 296 "xxxxxxx" 296 " x x " 297 " x x " 297 " x x " 298 " x x " 298 " x x " 299 " x x " 299 "xxxxxxx" 300 "xxxxxxx" 300 " x " 301 " x " 301 }; 302 }; 302 static char david_star_filled_7_7[] = { 303 static char david_star_filled_7_7[] = { 303 " x " 304 " x " 304 "xxxxxxx" 305 "xxxxxxx" 305 " xxxxx " 306 " xxxxx " 306 " xxx " 307 " xxx " 307 " xxxxx " 308 " xxxxx " 308 "xxxxxxx" 309 "xxxxxxx" 309 " x " 310 " x " 310 }; 311 }; 311 static char swiss_cross_line_7_7[] = { 312 static char swiss_cross_line_7_7[] = { 312 " xxx " 313 " xxx " 313 " x x " 314 " x x " 314 "xxx xxx" 315 "xxx xxx" 315 "x x" 316 "x x" 316 "xxx xxx" 317 "xxx xxx" 317 " x x " 318 " x x " 318 " xxx " 319 " xxx " 319 }; 320 }; 320 static char swiss_cross_filled_7_7[] = { 321 static char swiss_cross_filled_7_7[] = { 321 " xxx " 322 " xxx " 322 " xxx " 323 " xxx " 323 "xxxxxxx" 324 "xxxxxxx" 324 "xxxxxxx" 325 "xxxxxxx" 325 "xxxxxxx" 326 "xxxxxxx" 326 " xxx " 327 " xxx " 327 " xxx " 328 " xxx " 328 }; 329 }; 329 static char diamond_line_7_7[] = { 330 static char diamond_line_7_7[] = { 330 " x " 331 " x " 331 " x x " 332 " x x " 332 " x x " 333 " x x " 333 "x x" 334 "x x" 334 " x x " 335 " x x " 335 " x x " 336 " x x " 336 " x " 337 " x " 337 }; 338 }; 338 static char diamond_filled_7_7[] = { 339 static char diamond_filled_7_7[] = { 339 " x " 340 " x " 340 " xxx " 341 " xxx " 341 " xxxxx " 342 " xxxxx " 342 "xxxxxxx" 343 "xxxxxxx" 343 " xxxxx " 344 " xxxxx " 344 " xxx " 345 " xxx " 345 " x " 346 " x " 346 }; 347 }; 347 static char square_line_7_7[] = { 348 static char square_line_7_7[] = { 348 "xxxxxxx" 349 "xxxxxxx" 349 "x x" 350 "x x" 350 "x x" 351 "x x" 351 "x x" 352 "x x" 352 "x x" 353 "x x" 353 "x x" 354 "x x" 354 "xxxxxxx" 355 "xxxxxxx" 355 }; 356 }; 356 static char square_filled_7_7[] = { 357 static char square_filled_7_7[] = { 357 "xxxxxxx" 358 "xxxxxxx" 358 "xxxxxxx" 359 "xxxxxxx" 359 "xxxxxxx" 360 "xxxxxxx" 360 "xxxxxxx" 361 "xxxxxxx" 361 "xxxxxxx" 362 "xxxxxxx" 362 "xxxxxxx" 363 "xxxxxxx" 363 "xxxxxxx" 364 "xxxxxxx" 364 }; 365 }; 365 366 366 ////////////////////////////////////////////// 367 /////////////////////////////////////////////////////////////// 367 /// 9 9 ////////////////////////////////////// 368 /// 9 9 /////////////////////////////////////////////////////// 368 ////////////////////////////////////////////// 369 /////////////////////////////////////////////////////////////// 369 static char plus_9_9[] = { 370 static char plus_9_9[] = { 370 " x " 371 " x " 371 " x " 372 " x " 372 " x " 373 " x " 373 " x " 374 " x " 374 "xxxxxxxxx" 375 "xxxxxxxxx" 375 " x " 376 " x " 376 " x " 377 " x " 377 " x " 378 " x " 378 " x " 379 " x " 379 }; 380 }; 380 static char asterisk_9_9[] = { 381 static char asterisk_9_9[] = { 381 "x x x" 382 "x x x" 382 " x x x " 383 " x x x " 383 " x x x " 384 " x x x " 384 " xxx " 385 " xxx " 385 " x " 386 " x " 386 " xxx " 387 " xxx " 387 " x x x " 388 " x x x " 388 " x x x " 389 " x x x " 389 "x x x" 390 "x x x" 390 }; 391 }; 391 static char cross_9_9[] = { 392 static char cross_9_9[] = { 392 "x x" 393 "x x" 393 " x x " 394 " x x " 394 " x x " 395 " x x " 395 " x x " 396 " x x " 396 " x " 397 " x " 397 " x x " 398 " x x " 398 " x x " 399 " x x " 399 " x x " 400 " x x " 400 "x x" 401 "x x" 401 }; 402 }; 402 static char star_9_9[] = { 403 static char star_9_9[] = { 403 "x x x" 404 "x x x" 404 " x x x " 405 " x x x " 405 " x x x " 406 " x x x " 406 " xxx " 407 " xxx " 407 "xxxxxxxxx" 408 "xxxxxxxxx" 408 " xxx " 409 " xxx " 409 " x x x " 410 " x x x " 410 " x x x " 411 " x x x " 411 "x x x" 412 "x x x" 412 }; 413 }; 413 static char circle_line_9_9[] = { 414 static char circle_line_9_9[] = { 414 " xxx " 415 " xxx " 415 " xx xx " 416 " xx xx " 416 " x x " 417 " x x " 417 "x x" 418 "x x" 418 "x x" 419 "x x" 419 "x x" 420 "x x" 420 " x x " 421 " x x " 421 " xx xx " 422 " xx xx " 422 " xxx " 423 " xxx " 423 }; 424 }; 424 static char circle_filled_9_9[] = { 425 static char circle_filled_9_9[] = { 425 " xxx " 426 " xxx " 426 " xxxxxxx " 427 " xxxxxxx " 427 " xxxxxxx " 428 " xxxxxxx " 428 "xxxxxxxxx" 429 "xxxxxxxxx" 429 "xxxxxxxxx" 430 "xxxxxxxxx" 430 "xxxxxxxxx" 431 "xxxxxxxxx" 431 " xxxxxxx " 432 " xxxxxxx " 432 " xxxxxxx " 433 " xxxxxxx " 433 " xxx " 434 " xxx " 434 }; 435 }; 435 static char triangle_up_line_9_9[] = { //OpenG 436 static char triangle_up_line_9_9[] = { //OpenGL will draw with y reversed. 436 "xxxxxxxxx" 437 "xxxxxxxxx" 437 " x x " 438 " x x " 438 " x x " 439 " x x " 439 " x x " 440 " x x " 440 " x x " 441 " x x " 441 " x x " 442 " x x " 442 " x x " 443 " x x " 443 " x " 444 " x " 444 " x " 445 " x " 445 }; 446 }; 446 static char triangle_up_filled_9_9[] = { 447 static char triangle_up_filled_9_9[] = { 447 "xxxxxxxxx" 448 "xxxxxxxxx" 448 " xxxxxxx " 449 " xxxxxxx " 449 " xxxxxxx " 450 " xxxxxxx " 450 " xxxxx " 451 " xxxxx " 451 " xxxxx " 452 " xxxxx " 452 " xxx " 453 " xxx " 453 " xxx " 454 " xxx " 454 " x " 455 " x " 455 " x " 456 " x " 456 }; 457 }; 457 static char triangle_down_line_9_9[] = { 458 static char triangle_down_line_9_9[] = { 458 " x " 459 " x " 459 " x " 460 " x " 460 " x x " 461 " x x " 461 " x x " 462 " x x " 462 " x x " 463 " x x " 463 " x x " 464 " x x " 464 " x x " 465 " x x " 465 " x x " 466 " x x " 466 "xxxxxxxxx" 467 "xxxxxxxxx" 467 }; 468 }; 468 static char triangle_down_filled_9_9[] = { 469 static char triangle_down_filled_9_9[] = { 469 " x " 470 " x " 470 " x " 471 " x " 471 " xxx " 472 " xxx " 472 " xxx " 473 " xxx " 473 " xxxxx " 474 " xxxxx " 474 " xxxxx " 475 " xxxxx " 475 " xxxxxxx " 476 " xxxxxxx " 476 " xxxxxxx " 477 " xxxxxxx " 477 "xxxxxxxxx" 478 "xxxxxxxxx" 478 }; 479 }; 479 static char david_star_line_9_9[] = { 480 static char david_star_line_9_9[] = { 480 " x " 481 " x " 481 " x x " 482 " x x " 482 "xxxxxxxxx" 483 "xxxxxxxxx" 483 " x x " 484 " x x " 484 " x x " 485 " x x " 485 " x x " 486 " x x " 486 "xxxxxxxxx" 487 "xxxxxxxxx" 487 " x x " 488 " x x " 488 " x " 489 " x " 489 }; 490 }; 490 static char david_star_filled_9_9[] = { 491 static char david_star_filled_9_9[] = { 491 " x " 492 " x " 492 " xxx " 493 " xxx " 493 "xxxxxxxxx" 494 "xxxxxxxxx" 494 " xxxxxxx " 495 " xxxxxxx " 495 " xxxxx " 496 " xxxxx " 496 " xxxxxxx " 497 " xxxxxxx " 497 "xxxxxxxxx" 498 "xxxxxxxxx" 498 " xxx " 499 " xxx " 499 " x " 500 " x " 500 }; 501 }; 501 static char swiss_cross_line_9_9[] = { 502 static char swiss_cross_line_9_9[] = { 502 " xxx " 503 " xxx " 503 " x x " 504 " x x " 504 " x x " 505 " x x " 505 "xxxx xxxx" 506 "xxxx xxxx" 506 "x x" 507 "x x" 507 "xxxx xxxx" 508 "xxxx xxxx" 508 " x x " 509 " x x " 509 " x x " 510 " x x " 510 " xxx " 511 " xxx " 511 }; 512 }; 512 static char swiss_cross_filled_9_9[] = { 513 static char swiss_cross_filled_9_9[] = { 513 " xxx " 514 " xxx " 514 " xxx " 515 " xxx " 515 " xxx " 516 " xxx " 516 "xxxxxxxxx" 517 "xxxxxxxxx" 517 "xxxxxxxxx" 518 "xxxxxxxxx" 518 "xxxxxxxxx" 519 "xxxxxxxxx" 519 " xxx " 520 " xxx " 520 " xxx " 521 " xxx " 521 " xxx " 522 " xxx " 522 }; 523 }; 523 static char diamond_line_9_9[] = { 524 static char diamond_line_9_9[] = { 524 " x " 525 " x " 525 " x x " 526 " x x " 526 " x x " 527 " x x " 527 " x x " 528 " x x " 528 "x x" 529 "x x" 529 " x x " 530 " x x " 530 " x x " 531 " x x " 531 " x x " 532 " x x " 532 " x " 533 " x " 533 }; 534 }; 534 static char diamond_filled_9_9[] = { 535 static char diamond_filled_9_9[] = { 535 " x " 536 " x " 536 " xxx " 537 " xxx " 537 " xxxxx " 538 " xxxxx " 538 " xxxxxxx " 539 " xxxxxxx " 539 "xxxxxxxxx" 540 "xxxxxxxxx" 540 " xxxxxxx " 541 " xxxxxxx " 541 " xxxxx " 542 " xxxxx " 542 " xxx " 543 " xxx " 543 " x " 544 " x " 544 }; 545 }; 545 static char square_line_9_9[] = { 546 static char square_line_9_9[] = { 546 "xxxxxxxxx" 547 "xxxxxxxxx" 547 "x x" 548 "x x" 548 "x x" 549 "x x" 549 "x x" 550 "x x" 550 "x x" 551 "x x" 551 "x x" 552 "x x" 552 "x x" 553 "x x" 553 "x x" 554 "x x" 554 "xxxxxxxxx" 555 "xxxxxxxxx" 555 }; 556 }; 556 static char square_filled_9_9[] = { 557 static char square_filled_9_9[] = { 557 "xxxxxxxxx" 558 "xxxxxxxxx" 558 "xxxxxxxxx" 559 "xxxxxxxxx" 559 "xxxxxxxxx" 560 "xxxxxxxxx" 560 "xxxxxxxxx" 561 "xxxxxxxxx" 561 "xxxxxxxxx" 562 "xxxxxxxxx" 562 "xxxxxxxxx" 563 "xxxxxxxxx" 563 "xxxxxxxxx" 564 "xxxxxxxxx" 564 "xxxxxxxxx" 565 "xxxxxxxxx" 565 "xxxxxxxxx" 566 "xxxxxxxxx" 566 }; 567 }; 567 568 568 static char* sFigures[54] = { 569 static char* sFigures[54] = { 569 plus_5_5, //0 570 plus_5_5, //0 570 asterisk_5_5, 571 asterisk_5_5, 571 cross_5_5, 572 cross_5_5, 572 star_5_5, 573 star_5_5, 573 circle_line_5_5, 574 circle_line_5_5, 574 circle_filled_5_5, 575 circle_filled_5_5, 575 triangle_up_line_5_5, 576 triangle_up_line_5_5, 576 triangle_up_filled_5_5, 577 triangle_up_filled_5_5, 577 triangle_down_line_5_5, 578 triangle_down_line_5_5, 578 triangle_down_filled_5_5, 579 triangle_down_filled_5_5, 579 david_star_line_5_5, 580 david_star_line_5_5, 580 david_star_filled_5_5, 581 david_star_filled_5_5, 581 swiss_cross_line_5_5, 582 swiss_cross_line_5_5, 582 swiss_cross_filled_5_5, 583 swiss_cross_filled_5_5, 583 diamond_line_5_5, 584 diamond_line_5_5, 584 diamond_filled_5_5, 585 diamond_filled_5_5, 585 square_line_5_5, 586 square_line_5_5, 586 square_filled_5_5, //17 587 square_filled_5_5, //17 587 plus_7_7, 588 plus_7_7, 588 asterisk_7_7, 589 asterisk_7_7, 589 cross_7_7, 590 cross_7_7, 590 star_7_7, 591 star_7_7, 591 circle_line_7_7, 592 circle_line_7_7, 592 circle_filled_7_7, 593 circle_filled_7_7, 593 triangle_up_line_7_7, 594 triangle_up_line_7_7, 594 triangle_up_filled_7_7, 595 triangle_up_filled_7_7, 595 triangle_down_line_7_7, 596 triangle_down_line_7_7, 596 triangle_down_filled_7_7, 597 triangle_down_filled_7_7, 597 david_star_line_7_7, 598 david_star_line_7_7, 598 david_star_filled_7_7, 599 david_star_filled_7_7, 599 swiss_cross_line_7_7, 600 swiss_cross_line_7_7, 600 swiss_cross_filled_7_7, 601 swiss_cross_filled_7_7, 601 diamond_line_7_7, 602 diamond_line_7_7, 602 diamond_filled_7_7, 603 diamond_filled_7_7, 603 square_line_7_7, 604 square_line_7_7, 604 square_filled_7_7, //35 605 square_filled_7_7, //35 605 plus_9_9, 606 plus_9_9, 606 asterisk_9_9, 607 asterisk_9_9, 607 cross_9_9, 608 cross_9_9, 608 star_9_9, 609 star_9_9, 609 circle_line_9_9, 610 circle_line_9_9, 610 circle_filled_9_9, 611 circle_filled_9_9, 611 triangle_up_line_9_9, 612 triangle_up_line_9_9, 612 triangle_up_filled_9_9, 613 triangle_up_filled_9_9, 613 triangle_down_line_9_9, 614 triangle_down_line_9_9, 614 triangle_down_filled_9_9, 615 triangle_down_filled_9_9, 615 david_star_line_9_9, 616 david_star_line_9_9, 616 david_star_filled_9_9, 617 david_star_filled_9_9, 617 swiss_cross_line_9_9, 618 swiss_cross_line_9_9, 618 swiss_cross_filled_9_9, 619 swiss_cross_filled_9_9, 619 diamond_line_9_9, 620 diamond_line_9_9, 620 diamond_filled_9_9, 621 diamond_filled_9_9, 621 square_line_9_9, 622 square_line_9_9, 622 square_filled_9_9 //53 623 square_filled_9_9 //53 623 }; 624 }; 624 625 625 SO_NODE_SOURCE(HEPVis_SoMarkerSet) 626 SO_NODE_SOURCE(HEPVis_SoMarkerSet) 626 ////////////////////////////////////////////// 627 ////////////////////////////////////////////////////////////////////////////// 627 void HEPVis_SoMarkerSet::initClass ( 628 void HEPVis_SoMarkerSet::initClass ( 628 ) 629 ) 629 ////////////////////////////////////////////// 630 ////////////////////////////////////////////////////////////////////////////// 630 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 631 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 631 { 632 { 632 static bool first = true; << 633 SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPointSet,"PointSet"); 633 if (first) { << 634 first = false; << 635 SO_NODE_INIT_CLASS(HEPVis_SoMarkerSet,SoPo << 636 } << 637 } 634 } 638 ////////////////////////////////////////////// 635 ////////////////////////////////////////////////////////////////////////////// 639 HEPVis_SoMarkerSet::HEPVis_SoMarkerSet ( 636 HEPVis_SoMarkerSet::HEPVis_SoMarkerSet ( 640 ) 637 ) 641 ////////////////////////////////////////////// 638 ////////////////////////////////////////////////////////////////////////////// 642 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 639 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 643 { 640 { 644 SO_NODE_CONSTRUCTOR(HEPVis_SoMarkerSet); 641 SO_NODE_CONSTRUCTOR(HEPVis_SoMarkerSet); 645 642 646 SO_NODE_ADD_FIELD(markerIndex,(CROSS_5_5)); 643 SO_NODE_ADD_FIELD(markerIndex,(CROSS_5_5)); 647 } 644 } 648 ////////////////////////////////////////////// 645 ////////////////////////////////////////////////////////////////////////////// 649 HEPVis_SoMarkerSet::~HEPVis_SoMarkerSet ( 646 HEPVis_SoMarkerSet::~HEPVis_SoMarkerSet ( 650 ) 647 ) 651 ////////////////////////////////////////////// 648 ////////////////////////////////////////////////////////////////////////////// 652 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 649 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 653 { 650 { 654 } 651 } 655 ////////////////////////////////////////////// 652 ////////////////////////////////////////////////////////////////////////////// 656 void HEPVis_SoMarkerSet::GLRender ( 653 void HEPVis_SoMarkerSet::GLRender ( 657 SoGLRenderAction* aAction 654 SoGLRenderAction* aAction 658 ) 655 ) 659 ////////////////////////////////////////////// 656 ////////////////////////////////////////////////////////////////////////////// 660 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 657 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 661 { 658 { 662 SoState* state = aAction->getState(); 659 SoState* state = aAction->getState(); 663 660 664 const SoCoordinateElement* coordinateElement 661 const SoCoordinateElement* coordinateElement = 665 SoCoordinateElement::getInstance(state); 662 SoCoordinateElement::getInstance(state); 666 if(coordinateElement==NULL) return; 663 if(coordinateElement==NULL) return; 667 664 668 if(aAction->isOfType(SoGL2PSAction::getClass 665 if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) { 669 SoCacheElement::invalidate(state); 666 SoCacheElement::invalidate(state); 670 } 667 } 671 668 672 const SbColor& color = SoLazyElement::getDif 669 const SbColor& color = SoLazyElement::getDiffuse(aAction->getState(),0); 673 float red,green,blue; 670 float red,green,blue; 674 color.getValue(red,green,blue); 671 color.getValue(red,green,blue); 675 672 676 int mark = markerIndex[0]; 673 int mark = markerIndex[0]; 677 674 678 int starti = startIndex.getValue(); 675 int starti = startIndex.getValue(); 679 int pointn = numPoints.getValue(); 676 int pointn = numPoints.getValue(); 680 int pointi; 677 int pointi; 681 678 682 glPushAttrib( (GLbitfield)(GL_CURRENT_BIT | 679 glPushAttrib( (GLbitfield)(GL_CURRENT_BIT | GL_ENABLE_BIT)); 683 glDisable(GL_LIGHTING); 680 glDisable(GL_LIGHTING); 684 glColor3f(red,green,blue); 681 glColor3f(red,green,blue); 685 682 686 #ifdef WIN32 683 #ifdef WIN32 687 //WIN32 : depth test is out over bitmap ! 684 //WIN32 : depth test is out over bitmap ! 688 glDisable(GL_DEPTH_TEST); 685 glDisable(GL_DEPTH_TEST); 689 #endif 686 #endif 690 687 691 glPixelStorei(GL_UNPACK_ALIGNMENT,1); 688 glPixelStorei(GL_UNPACK_ALIGNMENT,1); 692 for(pointi=starti;pointi<pointn;pointi++){ 689 for(pointi=starti;pointi<pointn;pointi++){ 693 const SbVec3f& vec = coordinateElement->ge 690 const SbVec3f& vec = coordinateElement->get3(pointi); 694 glRasterPos3f(vec[0],vec[1],vec[2]); 691 glRasterPos3f(vec[0],vec[1],vec[2]); 695 // Do a push, pop to correct a deffect of 692 // Do a push, pop to correct a deffect of Mesa-3.1. 696 // If not, further line drawing will have 693 // If not, further line drawing will have bad colors. 697 // The glPopAttrib will compell a reinitia 694 // The glPopAttrib will compell a reinitialisation of 698 // some internal Mesa state. 695 // some internal Mesa state. 699 //glPushAttrib(GL_ALL_ATTRIB_BITS); 696 //glPushAttrib(GL_ALL_ATTRIB_BITS); 700 //glPopAttrib(); 697 //glPopAttrib(); 701 // 698 // 702 drawMarker(aAction,mark); 699 drawMarker(aAction,mark); 703 } 700 } 704 701 705 glPopAttrib(); 702 glPopAttrib(); 706 } 703 } 707 ////////////////////////////////////////////// 704 ////////////////////////////////////////////////////////////////////////////// 708 void drawMarker( 705 void drawMarker( 709 SoAction* aAction 706 SoAction* aAction 710 ,int aStyle 707 ,int aStyle 711 ) 708 ) 712 ////////////////////////////////////////////// 709 ////////////////////////////////////////////////////////////////////////////// 713 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 710 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 714 { 711 { 715 GLsizei w = 0,h = 0; 712 GLsizei w = 0,h = 0; 716 GLfloat xorig = 0,yorig = 0; 713 GLfloat xorig = 0,yorig = 0; 717 GLfloat xmove = 0,ymove = 0; 714 GLfloat xmove = 0,ymove = 0; 718 715 719 if((aStyle>=0)&&(aStyle<18)) { 716 if((aStyle>=0)&&(aStyle<18)) { 720 w = h = 5; 717 w = h = 5; 721 xorig = yorig = 2; 718 xorig = yorig = 2; 722 GLubyte* bitmap = getBitmap(w,h,sFigures[a 719 GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]); 723 glBitmap(w,h,xorig,yorig,0.,0.,bitmap); 720 glBitmap(w,h,xorig,yorig,0.,0.,bitmap); 724 delete [] bitmap; 721 delete [] bitmap; 725 } else if((aStyle>=18)&&(aStyle<36)) { 722 } else if((aStyle>=18)&&(aStyle<36)) { 726 w = h = 7; 723 w = h = 7; 727 xorig = yorig = 3; 724 xorig = yorig = 3; 728 GLubyte* bitmap = getBitmap(w,h,sFigures[a 725 GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]); 729 glBitmap(w,h,xorig,yorig,0.,0.,bitmap); 726 glBitmap(w,h,xorig,yorig,0.,0.,bitmap); 730 delete [] bitmap; 727 delete [] bitmap; 731 } else if((aStyle>=36)&&(aStyle<54)) { 728 } else if((aStyle>=36)&&(aStyle<54)) { 732 w = h = 9; 729 w = h = 9; 733 xorig = yorig = 4; 730 xorig = yorig = 4; 734 GLubyte* bitmap = getBitmap(w,h,sFigures[a 731 GLubyte* bitmap = getBitmap(w,h,sFigures[aStyle]); 735 glBitmap(w,h,xorig,yorig,0.,0.,bitmap); 732 glBitmap(w,h,xorig,yorig,0.,0.,bitmap); 736 delete [] bitmap; 733 delete [] bitmap; 737 } else { 734 } else { 738 return; 735 return; 739 } 736 } 740 737 741 if(aAction->isOfType(SoGL2PSAction::getClass 738 if(aAction->isOfType(SoGL2PSAction::getClassTypeId())) { 742 ((SoGL2PSAction*)aAction)->addBitmap(w,h,x 739 ((SoGL2PSAction*)aAction)->addBitmap(w,h,xorig,yorig,xmove,ymove); 743 } 740 } 744 741 745 } 742 } 746 ////////////////////////////////////////////// 743 ////////////////////////////////////////////////////////////////////////////// 747 GLubyte* getBitmap( 744 GLubyte* getBitmap( 748 int aW 745 int aW 749 ,int aH 746 ,int aH 750 ,char aFigure[] 747 ,char aFigure[] 751 ) 748 ) 752 ////////////////////////////////////////////// 749 ////////////////////////////////////////////////////////////////////////////// 753 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 750 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// 754 { 751 { 755 int index = 0; 752 int index = 0; 756 GLubyte* bitmap = new GLubyte[aW * aH + 1]; 753 GLubyte* bitmap = new GLubyte[aW * aH + 1]; 757 int ichar = 0; 754 int ichar = 0; 758 int ibit = 0; 755 int ibit = 0; 759 unsigned char byte = 0; 756 unsigned char byte = 0; 760 for ( int row = 0; row < aH; row++ ){ 757 for ( int row = 0; row < aH; row++ ){ 761 for ( int col = 0; col < aW; col++){ 758 for ( int col = 0; col < aW; col++){ 762 unsigned char c = aFigure[ichar]; 759 unsigned char c = aFigure[ichar]; 763 ichar++; 760 ichar++; 764 if(c==' ') { 761 if(c==' ') { 765 ibit++; 762 ibit++; 766 } else { 763 } else { 767 byte += (1<<(7-ibit)); 764 byte += (1<<(7-ibit)); 768 ibit++; 765 ibit++; 769 } 766 } 770 if(ibit==8) { 767 if(ibit==8) { 771 //unsigned char h = byte / 16; 768 //unsigned char h = byte / 16; 772 //unsigned char l = byte % 16; 769 //unsigned char l = byte % 16; 773 //printf("0x%x%x\n",h,l); 770 //printf("0x%x%x\n",h,l); 774 bitmap[index] = byte; 771 bitmap[index] = byte; 775 index++; 772 index++; 776 ibit = 0; 773 ibit = 0; 777 byte = 0; 774 byte = 0; 778 } 775 } 779 776 780 } 777 } 781 if(ibit!=8) { //Jump to next byte. 778 if(ibit!=8) { //Jump to next byte. 782 //unsigned char h = byte / 16; 779 //unsigned char h = byte / 16; 783 //unsigned char l = byte % 16; 780 //unsigned char l = byte % 16; 784 //printf("0x%x%x\n",h,l); 781 //printf("0x%x%x\n",h,l); 785 bitmap[index] = byte; 782 bitmap[index] = byte; 786 index++; 783 index++; 787 ibit = 0; 784 ibit = 0; 788 byte = 0; 785 byte = 0; 789 } 786 } 790 } 787 } 791 return bitmap; 788 return bitmap; 792 } 789 } >> 790 >> 791 #endif 793 792