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