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