- Timestamp:
- 03/21/12 18:36:20 (14 months ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/src/osgPlugins/dae/daeRSceneObjects.cpp
r12791 r13041 2 2 * Copyright 2006 Sony Computer Entertainment Inc. 3 3 * 4 * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this 4 * Licensed under the SCEA Shared Source License, Version 1.0 (the "License"); you may not use this 5 5 * file except in compliance with the License. You may obtain a copy of the License at: 6 6 * http://research.scea.com/scea_shared_source_license.html 7 7 * 8 * Unless required by applicable law or agreed to in writing, software distributed under the License 9 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 10 * implied. See the License for the specific language governing permissions and limitations under the 11 * License. 8 * Unless required by applicable law or agreed to in writing, software distributed under the License 9 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 10 * implied. See the License for the specific language governing permissions and limitations under the 11 * License. 12 12 */ 13 13 … … 43 43 OSG_WARN << "Expected element 'ActiveSwitchSet' not found" << std::endl; 44 44 } 45 45 46 46 any = daeSafeCast<domAny>(teq->getChild("ValueLists")); 47 47 if (any) … … 60 60 cdom::tokenize(child->getValue(), " ", stringValues); 61 61 cdom::tokenIter iter = stringValues.begin(); 62 62 63 63 while (iter != stringValues.end()) 64 64 { … … 66 66 ++iter; 67 67 } 68 68 69 69 msw->setValueList(currChild, values); 70 70 } … … 157 157 OSG_WARN << "Expected element 'LoopMode' not found" << std::endl; 158 158 } 159 159 160 160 int begin=0; 161 161 any = daeSafeCast< domAny >(teq->getChild("IntervalBegin")); … … 168 168 OSG_WARN << "Expected element 'IntervalBegin' not found" << std::endl; 169 169 } 170 170 171 171 int end=-1; 172 172 any = daeSafeCast< domAny >(teq->getChild("IntervalEnd")); … … 192 192 OSG_WARN << "Expected element 'DurationSpeed' not found" << std::endl; 193 193 } 194 194 195 195 int nreps = -1; 196 196 any = daeSafeCast< domAny >(teq->getChild("DurationNReps")); … … 267 267 std::list<std::string> stringValues; 268 268 osg::LOD::MinMaxPair minMaxPair; 269 269 270 270 cdom::tokenize(child->getValue(), " ", stringValues); 271 271 cdom::tokenIter iter = stringValues.begin(); 272 272 273 273 if (iter != stringValues.end()) 274 274 { … … 335 335 domLight::domTechnique_common::domSpot *spot; 336 336 337 if ( dlight->getTechnique_common() == NULL || 337 if ( dlight->getTechnique_common() == NULL || 338 338 dlight->getTechnique_common()->getContents().getCount() == 0 ) 339 339 { … … 350 350 // Enable this OpenGL light 351 351 _rootStateSet->setMode(GL_LIGHT0 + _numlights++, osg::StateAttribute::ON); 352 352 353 353 // Set ambient of lightmodel to zero 354 354 // Ambient lights are added as separate lights with only an ambient term 355 355 osg::LightModel* lightmodel = new osg::LightModel; 356 356 lightmodel->setAmbientIntensity(osg::Vec4(0.0f,0.0f,0.0f,1.0f)); 357 _rootStateSet->setAttributeAndModes(lightmodel, osg::StateAttribute::ON); 357 _rootStateSet->setAttributeAndModes(lightmodel, osg::StateAttribute::ON); 358 358 359 359 osg::LightSource* lightsource = new osg::LightSource(); … … 371 371 if ( ambient != NULL ) 372 372 { 373 if ( ambient->getColor() == NULL ) 373 if ( ambient->getColor() == NULL ) 374 374 { 375 375 OSG_WARN << "Invalid content for ambient light" << std::endl; … … 378 378 379 379 light->setAmbient( osg::Vec4( ambient->getColor()->getValue()[0], 380 ambient->getColor()->getValue()[1], 380 ambient->getColor()->getValue()[1], 381 381 ambient->getColor()->getValue()[2], 1.0f ) ); 382 382 light->setDiffuse( osg::Vec4( 0, 0, 0, 0)); 383 383 light->setSpecular( osg::Vec4( 0, 0, 0, 0)); 384 384 385 385 // Tell OpenGL to make it a directional light (w=0) 386 386 light->setPosition( osg::Vec4(0,0,0,0)); … … 388 388 else if ( directional != NULL ) 389 389 { 390 if ( directional->getColor() == NULL ) 390 if ( directional->getColor() == NULL ) 391 391 { 392 392 OSG_WARN << "Invalid content for directional light" << std::endl; … … 394 394 } 395 395 light->setAmbient( osg::Vec4( 0, 0, 0, 0)); 396 light->setDiffuse( osg::Vec4( directional->getColor()->getValue()[0], 397 directional->getColor()->getValue()[1], 396 light->setDiffuse( osg::Vec4( directional->getColor()->getValue()[0], 397 directional->getColor()->getValue()[1], 398 398 directional->getColor()->getValue()[2], 1.0f ) ); 399 399 light->setSpecular( osg::Vec4( directional->getColor()->getValue()[0], 400 directional->getColor()->getValue()[1], 400 directional->getColor()->getValue()[1], 401 401 directional->getColor()->getValue()[2], 1.0f ) ); 402 402 403 403 light->setDirection(osg::Vec3(0,0,-1)); 404 404 … … 408 408 else if ( point != NULL ) 409 409 { 410 if ( point->getColor() == NULL ) 410 if ( point->getColor() == NULL ) 411 411 { 412 412 OSG_WARN << "Invalid content for point light" << std::endl; … … 414 414 } 415 415 light->setAmbient( osg::Vec4( 0, 0, 0, 0)); 416 light->setDiffuse( osg::Vec4( point->getColor()->getValue()[0], 417 point->getColor()->getValue()[1], 416 light->setDiffuse( osg::Vec4( point->getColor()->getValue()[0], 417 point->getColor()->getValue()[1], 418 418 point->getColor()->getValue()[2], 1.0f ) ); 419 light->setSpecular( osg::Vec4( point->getColor()->getValue()[0], 420 point->getColor()->getValue()[1], 419 light->setSpecular( osg::Vec4( point->getColor()->getValue()[0], 420 point->getColor()->getValue()[1], 421 421 point->getColor()->getValue()[2], 1.0f ) ); 422 422 … … 451 451 else if ( spot != NULL ) 452 452 { 453 if ( spot->getColor() == NULL ) 453 if ( spot->getColor() == NULL ) 454 454 { 455 455 OSG_WARN << "Invalid content for spot light" << std::endl; … … 457 457 } 458 458 light->setAmbient( osg::Vec4( 0, 0, 0, 0)); 459 light->setDiffuse( osg::Vec4( spot->getColor()->getValue()[0], 460 spot->getColor()->getValue()[1], 459 light->setDiffuse( osg::Vec4( spot->getColor()->getValue()[0], 460 spot->getColor()->getValue()[1], 461 461 spot->getColor()->getValue()[2], 1.0f ) ); 462 light->setSpecular( osg::Vec4( spot->getColor()->getValue()[0], 463 spot->getColor()->getValue()[1], 462 light->setSpecular( osg::Vec4( spot->getColor()->getValue()[0], 463 spot->getColor()->getValue()[1], 464 464 spot->getColor()->getValue()[2], 1.0f ) ); 465 465 … … 558 558 pOsgCameraView->setFieldOfView(pXfov->getValue()); 559 559 pOsgCameraView->setFieldOfViewMode(osg::CameraView::HORIZONTAL); 560 560 561 561 if (pAspectRatio) 562 562 { … … 570 570 pOsgCameraView->setFieldOfViewMode(osg::CameraView::HORIZONTAL); 571 571 } 572 else 572 else 573 573 { 574 574 // <xfov> … … 605 605 else if (pDomOrthographic) 606 606 { 607 // <orthographic> 607 // <orthographic> 608 608 // 1 <xmag>, <ymag>, <xmag> and <ymag>, <xmag> and <aspect_ratio>, <ymag> and <aspect_ratio> 609 609 // 1 <znear> 610 610 // 1 <zfar> 611 611 612 612 //domTargetableFloat *pXmag = daeSafeCast< domTargetableFloat >(pDomOrthographic->getXmag()); 613 613 //domTargetableFloat *pYmag = daeSafeCast< domTargetableFloat >(pDomOrthographic->getYmag()); … … 618 618 619 619 //domTargetableFloat *pZnear = daeSafeCast< domTargetableFloat >(pDomOrthographic->getZnear()); 620 //domTargetableFloat *pZfar = daeSafeCast< domTargetableFloat >(pDomOrthographic->getZfar()); 620 //domTargetableFloat *pZfar = daeSafeCast< domTargetableFloat >(pDomOrthographic->getZfar()); 621 621 622 622 // TODO The current osg::CameraView does not support storage of near far
