Changeset 10412
- Timestamp:
- 06/25/09 15:31:48 (4 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/cfg/ConfigParser.y
r7602 r10412 143 143 144 144 config : entries 145 ;145 ; 146 146 147 147 entries : entry | entries entry 148 ;148 ; 149 149 150 150 entry : visual | render_surface | camera | input_area | camera_group | stereo_param | system_params 151 ;151 ; 152 152 153 153 system_params : system_param | system_params system_param … … 184 184 185 185 camera : PRTOKEN_CAMERA name 186 {187 cfg->beginCamera( $2 );188 }189 '{' camera_attributes '}'190 {191 cfg->endCamera();192 };186 { 187 cfg->beginCamera( $2 ); 188 } 189 '{' camera_attributes '}' 190 { 191 cfg->endCamera(); 192 }; 193 193 194 194 camera_attributes : camera_attribute | camera_attributes camera_attribute 195 ;195 ; 196 196 197 197 camera_attribute : 198 /* EMPTY */199 | PRTOKEN_RENDER_SURFACE name ';'200 {201 cfg->setCameraRenderSurface( $2 );202 }203 | render_surface204 {205 cfg->setCameraRenderSurface();206 }207 | PRTOKEN_PROJECTION_RECT real real real real ';'208 {209 cfg->setCameraProjectionRectangle( $2, $3, $4, $5 );210 }211 | PRTOKEN_SHARELENS bool ';'212 {213 cfg->setCameraShareLens( $2 );214 }198 /* EMPTY */ 199 | PRTOKEN_RENDER_SURFACE name ';' 200 { 201 cfg->setCameraRenderSurface( $2 ); 202 } 203 | render_surface 204 { 205 cfg->setCameraRenderSurface(); 206 } 207 | PRTOKEN_PROJECTION_RECT real real real real ';' 208 { 209 cfg->setCameraProjectionRectangle( $2, $3, $4, $5 ); 210 } 211 | PRTOKEN_SHARELENS bool ';' 212 { 213 cfg->setCameraShareLens( $2 ); 214 } 215 215 | PRTOKEN_SHAREVIEW bool ';' 216 216 { … … 221 221 cfg->setCameraClearColor( $2, $3, $4, $5 ); 222 222 } 223 | lens224 | camera_offset225 ;223 | lens 224 | camera_offset 225 ; 226 226 227 227 camera_offset : PRTOKEN_OFFSET '{' 228 {229 cfg->beginCameraOffset();230 }231 camera_offset_attributes '}'232 {233 cfg->endCameraOffset();234 }235 ;228 { 229 cfg->beginCameraOffset(); 230 } 231 camera_offset_attributes '}' 232 { 233 cfg->endCameraOffset(); 234 } 235 ; 236 236 237 237 camera_offset_attributes : camera_offset_attribute | camera_offset_attributes camera_offset_attribute 238 ;238 ; 239 239 240 240 camera_offset_attribute : 241 PRTOKEN_SHEAR real real ';'242 {243 cfg->shearCameraOffset( $2, $3 );244 }245 | PRTOKEN_ROTATE real real real real ';'246 {247 cfg->rotateCameraOffset( $2, $3, $4, $5 );248 }249 | PRTOKEN_TRANSLATE real real real ';'250 {251 cfg->translateCameraOffset( $2, $3, $4 );252 }253 | PRTOKEN_SCALE real real real ';'254 {255 cfg->scaleCameraOffset( $2, $3, $4 );256 }257 | PRTOKEN_METHOD offset_multiply_method ';'258 {259 cfg->setCameraOffsetMultiplyMethod( (Producer::Camera::Offset::MultiplyMethod)$2 );260 }261 ;241 PRTOKEN_SHEAR real real ';' 242 { 243 cfg->shearCameraOffset( $2, $3 ); 244 } 245 | PRTOKEN_ROTATE real real real real ';' 246 { 247 cfg->rotateCameraOffset( $2, $3, $4, $5 ); 248 } 249 | PRTOKEN_TRANSLATE real real real ';' 250 { 251 cfg->translateCameraOffset( $2, $3, $4 ); 252 } 253 | PRTOKEN_SCALE real real real ';' 254 { 255 cfg->scaleCameraOffset( $2, $3, $4 ); 256 } 257 | PRTOKEN_METHOD offset_multiply_method ';' 258 { 259 cfg->setCameraOffsetMultiplyMethod( (Producer::Camera::Offset::MultiplyMethod)$2 ); 260 } 261 ; 262 262 263 263 offset_multiply_method: … … 267 267 268 268 lens : PRTOKEN_LENS '{' lens_attributes '}' 269 ;269 ; 270 270 271 271 lens_attributes : lens_attribute | lens_attributes lens_attribute 272 ;272 ; 273 273 274 274 lens_attribute : 275 /* Empty */276 | PRTOKEN_ORTHO real real real real real real ';'277 {278 cfg->setCameraOrtho( $2, $3, $4, $5, $6, $7 );279 }280 | PRTOKEN_ORTHO real real real real real real real real ';'281 {282 cfg->setCameraOrtho( $2, $3, $4, $5, $6, $7, $8, $9 );283 }284 | PRTOKEN_PERSPECTIVE real real real real ';'285 {286 cfg->setCameraPerspective( $2, $3, $4, $5 );287 }288 | PRTOKEN_PERSPECTIVE real real real real real real ';'289 {290 cfg->setCameraPerspective( $2, $3, $4, $5, $6, $7 );291 }292 | PRTOKEN_FRUSTUM real real real real real real ';'293 {294 cfg->setCameraFrustum( $2, $3, $4, $5, $6, $7 );295 }296 | PRTOKEN_FRUSTUM real real real real real real real real ';'297 {298 cfg->setCameraFrustum( $2, $3, $4, $5, $6, $7, $8, $9 );299 }300 | PRTOKEN_SHEAR real real ';'301 {302 cfg->setCameraLensShear( $2, $3 );303 }304 ;275 /* Empty */ 276 | PRTOKEN_ORTHO real real real real real real ';' 277 { 278 cfg->setCameraOrtho( $2, $3, $4, $5, $6, $7 ); 279 } 280 | PRTOKEN_ORTHO real real real real real real real real ';' 281 { 282 cfg->setCameraOrtho( $2, $3, $4, $5, $6, $7, $8, $9 ); 283 } 284 | PRTOKEN_PERSPECTIVE real real real real ';' 285 { 286 cfg->setCameraPerspective( $2, $3, $4, $5 ); 287 } 288 | PRTOKEN_PERSPECTIVE real real real real real real ';' 289 { 290 cfg->setCameraPerspective( $2, $3, $4, $5, $6, $7 ); 291 } 292 | PRTOKEN_FRUSTUM real real real real real real ';' 293 { 294 cfg->setCameraFrustum( $2, $3, $4, $5, $6, $7 ); 295 } 296 | PRTOKEN_FRUSTUM real real real real real real real real ';' 297 { 298 cfg->setCameraFrustum( $2, $3, $4, $5, $6, $7, $8, $9 ); 299 } 300 | PRTOKEN_SHEAR real real ';' 301 { 302 cfg->setCameraLensShear( $2, $3 ); 303 } 304 ; 305 305 306 306 render_surface : PRTOKEN_RENDER_SURFACE name 307 {308 cfg->beginRenderSurface( $2 );309 }310 '{' render_surface_attributes '}'311 {312 cfg->endRenderSurface();313 }314 ;307 { 308 cfg->beginRenderSurface( $2 ); 309 } 310 '{' render_surface_attributes '}' 311 { 312 cfg->endRenderSurface(); 313 } 314 ; 315 315 316 316 render_surface_attributes : 317 317 render_surface_attribute 318 318 | render_surface_attributes render_surface_attribute 319 ;319 ; 320 320 321 321 render_surface_attribute : 322 /* Empty */323 | PRTOKEN_VISUAL name ';'324 {325 cfg->setRenderSurfaceVisualChooser( $2 );326 }327 | visual328 {329 cfg->setRenderSurfaceVisualChooser();330 }331 | PRTOKEN_WINDOW_RECT intparam intparam intparam intparam ';'332 {333 cfg->setRenderSurfaceWindowRectangle( $2, $3, $4, $5 );334 }322 /* Empty */ 323 | PRTOKEN_VISUAL name ';' 324 { 325 cfg->setRenderSurfaceVisualChooser( $2 ); 326 } 327 | visual 328 { 329 cfg->setRenderSurfaceVisualChooser(); 330 } 331 | PRTOKEN_WINDOW_RECT intparam intparam intparam intparam ';' 332 { 333 cfg->setRenderSurfaceWindowRectangle( $2, $3, $4, $5 ); 334 } 335 335 | PRTOKEN_INPUT_RECT floatparam floatparam floatparam floatparam ';' 336 336 { 337 337 cfg->setRenderSurfaceInputRectangle( $2, $3, $4, $5 ); 338 338 } 339 | PRTOKEN_HOSTNAME name ';'340 {341 cfg->setRenderSurfaceHostName( std::string($2) );342 }343 | PRTOKEN_DISPLAY intparam ';'344 {345 cfg->setRenderSurfaceDisplayNum( $2 );346 }347 | PRTOKEN_SCREEN intparam ';'348 {349 cfg->setRenderSurfaceScreen( $2 );350 }351 | PRTOKEN_BORDER bool ';'352 {353 cfg->setRenderSurfaceBorder( $2 );354 }339 | PRTOKEN_HOSTNAME name ';' 340 { 341 cfg->setRenderSurfaceHostName( std::string($2) ); 342 } 343 | PRTOKEN_DISPLAY intparam ';' 344 { 345 cfg->setRenderSurfaceDisplayNum( $2 ); 346 } 347 | PRTOKEN_SCREEN intparam ';' 348 { 349 cfg->setRenderSurfaceScreen( $2 ); 350 } 351 | PRTOKEN_BORDER bool ';' 352 { 353 cfg->setRenderSurfaceBorder( $2 ); 354 } 355 355 | PRTOKEN_CUSTOM_FULL_SCREEN_RECTANGLE intparam intparam intparam intparam ';' 356 356 { … … 374 374 cfg->setRenderSurfaceRenderToTextureMode( (Producer::RenderSurface::RenderToTextureMode)$2 ); 375 375 } 376 ;376 ; 377 377 378 378 drawableType: … … 389 389 390 390 visual : PRTOKEN_VISUAL name 391 {392 cfg->beginVisual( $2 );393 }394 '{' visual_attributes '}'395 {396 cfg->endVisual();397 }398 399 | PRTOKEN_VISUAL400 {401 cfg->beginVisual();402 }403 '{' visual_attributes '}'404 {405 cfg->endVisual();406 }407 ;391 { 392 cfg->beginVisual( $2 ); 393 } 394 '{' visual_attributes '}' 395 { 396 cfg->endVisual(); 397 } 398 399 | PRTOKEN_VISUAL 400 { 401 cfg->beginVisual(); 402 } 403 '{' visual_attributes '}' 404 { 405 cfg->endVisual(); 406 } 407 ; 408 408 409 409 410 410 visual_attributes : visual_attribute | visual_attributes ',' visual_attribute 411 ;411 ; 412 412 visual_attribute : 413 PRTOKEN_SET_SIMPLE414 {415 cfg->setVisualSimpleConfiguration();416 }417 | PRTOKEN_VISUAL_ID hex_integer418 {419 cfg->setVisualByID( $2 );420 }421 422 | PRTOKEN_BUFFER_SIZE intparam423 {424 cfg->addVisualAttribute( VisualChooser::BufferSize, $2 );425 }426 | PRTOKEN_LEVEL intparam427 {428 cfg->addVisualAttribute( VisualChooser::Level, $2 );429 }430 431 | PRTOKEN_RGBA432 {433 cfg->addVisualAttribute( VisualChooser::RGBA );434 }435 | PRTOKEN_DOUBLEBUFFER436 {437 cfg->addVisualAttribute( VisualChooser::DoubleBuffer );438 }439 | PRTOKEN_STEREO440 {441 cfg->addVisualAttribute( VisualChooser::Stereo );442 }443 | PRTOKEN_AUX_BUFFERS intparam444 {445 cfg->addVisualAttribute( VisualChooser::AuxBuffers, $2 );446 }447 | PRTOKEN_RED_SIZE intparam448 {449 cfg->addVisualAttribute( VisualChooser::RedSize, $2 );450 }451 452 | PRTOKEN_GREEN_SIZE intparam453 {454 cfg->addVisualAttribute( VisualChooser::GreenSize, $2 );455 }456 457 | PRTOKEN_BLUE_SIZE intparam458 {459 cfg->addVisualAttribute( VisualChooser::BlueSize, $2 );460 }461 | PRTOKEN_ALPHA_SIZE intparam462 {463 cfg->addVisualAttribute( VisualChooser::AlphaSize, $2 );464 }465 | PRTOKEN_DEPTH_SIZE intparam466 {467 cfg->addVisualAttribute( VisualChooser::DepthSize, $2 );468 }469 | PRTOKEN_STENCIL_SIZE intparam470 {471 cfg->addVisualAttribute( VisualChooser::StencilSize, $2 );472 }473 | PRTOKEN_ACCUM_RED_SIZE intparam474 {475 cfg->addVisualAttribute( VisualChooser::AccumRedSize, $2 );476 }477 | PRTOKEN_ACCUM_GREEN_SIZE intparam478 {479 cfg->addVisualAttribute( VisualChooser::AccumGreenSize, $2 );480 }481 | PRTOKEN_ACCUM_BLUE_SIZE intparam482 {483 cfg->addVisualAttribute( VisualChooser::AccumBlueSize, $2 );484 }485 | PRTOKEN_ACCUM_ALPHA_SIZE intparam486 {487 cfg->addVisualAttribute( VisualChooser::AccumAlphaSize, $2 );488 }489 | PRTOKEN_SAMPLES intparam490 {491 cfg->addVisualAttribute( VisualChooser::Samples, $2 );492 } 493 | PRTOKEN_SAMPLE_BUFFERS494 {495 cfg->addVisualAttribute( VisualChooser::SampleBuffers );496 }497 | intparam intparam498 {499 cfg->addVisualExtendedAttribute( $1, $2 );500 }501 ;413 PRTOKEN_SET_SIMPLE 414 { 415 cfg->setVisualSimpleConfiguration(); 416 } 417 | PRTOKEN_VISUAL_ID hex_integer 418 { 419 cfg->setVisualByID( $2 ); 420 } 421 422 | PRTOKEN_BUFFER_SIZE intparam 423 { 424 cfg->addVisualAttribute( VisualChooser::BufferSize, $2 ); 425 } 426 | PRTOKEN_LEVEL intparam 427 { 428 cfg->addVisualAttribute( VisualChooser::Level, $2 ); 429 } 430 431 | PRTOKEN_RGBA 432 { 433 cfg->addVisualAttribute( VisualChooser::RGBA ); 434 } 435 | PRTOKEN_DOUBLEBUFFER 436 { 437 cfg->addVisualAttribute( VisualChooser::DoubleBuffer ); 438 } 439 | PRTOKEN_STEREO 440 { 441 cfg->addVisualAttribute( VisualChooser::Stereo ); 442 } 443 | PRTOKEN_AUX_BUFFERS intparam 444 { 445 cfg->addVisualAttribute( VisualChooser::AuxBuffers, $2 ); 446 } 447 | PRTOKEN_RED_SIZE intparam 448 { 449 cfg->addVisualAttribute( VisualChooser::RedSize, $2 ); 450 } 451 452 | PRTOKEN_GREEN_SIZE intparam 453 { 454 cfg->addVisualAttribute( VisualChooser::GreenSize, $2 ); 455 } 456 457 | PRTOKEN_BLUE_SIZE intparam 458 { 459 cfg->addVisualAttribute( VisualChooser::BlueSize, $2 ); 460 } 461 | PRTOKEN_ALPHA_SIZE intparam 462 { 463 cfg->addVisualAttribute( VisualChooser::AlphaSize, $2 ); 464 } 465 | PRTOKEN_DEPTH_SIZE intparam 466 { 467 cfg->addVisualAttribute( VisualChooser::DepthSize, $2 ); 468 } 469 | PRTOKEN_STENCIL_SIZE intparam 470 { 471 cfg->addVisualAttribute( VisualChooser::StencilSize, $2 ); 472 } 473 | PRTOKEN_ACCUM_RED_SIZE intparam 474 { 475 cfg->addVisualAttribute( VisualChooser::AccumRedSize, $2 ); 476 } 477 | PRTOKEN_ACCUM_GREEN_SIZE intparam 478 { 479 cfg->addVisualAttribute( VisualChooser::AccumGreenSize, $2 ); 480 } 481 | PRTOKEN_ACCUM_BLUE_SIZE intparam 482 { 483 cfg->addVisualAttribute( VisualChooser::AccumBlueSize, $2 ); 484 } 485 | PRTOKEN_ACCUM_ALPHA_SIZE intparam 486 { 487 cfg->addVisualAttribute( VisualChooser::AccumAlphaSize, $2 ); 488 } 489 | PRTOKEN_SAMPLES intparam 490 { 491 cfg->addVisualAttribute( VisualChooser::Samples, $2 ); 492 } 493 | PRTOKEN_SAMPLE_BUFFERS 494 { 495 cfg->addVisualAttribute( VisualChooser::SampleBuffers ); 496 } 497 | intparam intparam 498 { 499 cfg->addVisualExtendedAttribute( $1, $2 ); 500 } 501 ; 502 502 503 503 input_area : PRTOKEN_INPUT_AREA 504 { cfg->beginInputArea(); }505 '{' input_area_entries '}'506 { cfg->endInputArea(); }507 ;504 { cfg->beginInputArea(); } 505 '{' input_area_entries '}' 506 { cfg->endInputArea(); } 507 ; 508 508 509 509 input_area_entries : input_area_entry | input_area_entries input_area_entry 510 ;510 ; 511 511 512 512 input_area_entry : 513 PRTOKEN_RENDER_SURFACE name ';'514 {515 cfg->addInputAreaEntry( $2 );516 }517 ;513 PRTOKEN_RENDER_SURFACE name ';' 514 { 515 cfg->addInputAreaEntry( $2 ); 516 } 517 ; 518 518 519 519 real : PRTOKEN_FLOAT 520 {521 $$ = atof(flexer->YYText());522 }523 | PRTOKEN_INTEGER524 {525 $$ = atof(flexer->YYText());526 }527 ;520 { 521 $$ = atof(flexer->YYText()); 522 } 523 | PRTOKEN_INTEGER 524 { 525 $$ = atof(flexer->YYText()); 526 } 527 ; 528 528 529 529 530 530 floatparam : PRTOKEN_FLOAT 531 {532 $$ = atof(flexer->YYText());533 }534 ;531 { 532 $$ = atof(flexer->YYText()); 533 } 534 ; 535 535 536 536 intparam : PRTOKEN_INTEGER 537 {538 $$ = atoi( flexer->YYText() );539 }540 ;537 { 538 $$ = atoi( flexer->YYText() ); 539 } 540 ; 541 541 542 542 name : PRTOKEN_QUOTED_STRING 543 {544 $$ = strdup( flexer->YYText() );545 }546 ;543 { 544 $$ = strdup( flexer->YYText() ); 545 } 546 ; 547 547 548 548 string : PRTOKEN_QUOTED_STRING 549 {550 $$ = strdup( flexer->YYText() );551 }552 ;549 { 550 $$ = strdup( flexer->YYText() ); 551 } 552 ; 553 553 554 554 555 555 hex_integer : PRTOKEN_HEX_INTEGER 556 {557 int n;558 sscanf( flexer->YYText(), "0x%x", &n );559 $$ = n;560 }561 ;556 { 557 int n; 558 sscanf( flexer->YYText(), "0x%x", &n ); 559 $$ = n; 560 } 561 ; 562 562 563 563 bool : PRTOKEN_TRUE { $$ = true;} | PRTOKEN_FALSE { $$ = false; } 564 ;564 ; 565 565 566 566 %% … … 569 569 { 570 570 fprintf( stderr, 571 "CameraConfig::parseFile(\"%s\") : %s - Line %d at or before \"%s\"\n",572 fileName.c_str(),573 errmsg,571 "CameraConfig::parseFile(\"%s\") : %s - Line %d at or before \"%s\"\n", 572 fileName.c_str(), 573 errmsg, 574 574 flexer->lineno(), 575 575 flexer->YYText() );
