Changeset 13466 for OpenSceneGraph/trunk/src/osgPlugins/fbx/fbxRLight.cpp
 Timestamp:
 01/27/15 16:07:53 (3 days ago)
 Files:

 1 modified
Legend:
 Unmodified
 Added
 Removed

OpenSceneGraph/trunk/src/osgPlugins/fbx/fbxRLight.cpp
r13464 r13466 11 11 #include "fbxReader.h" 12 12 13 osgDB::ReaderWriter::ReadResult OsgFbxReader::readFbxLight( KFbxNode* pNode, int& nLightCount)13 osgDB::ReaderWriter::ReadResult OsgFbxReader::readFbxLight(FbxNode* pNode, int& nLightCount) 14 14 { 15 const KFbxLight* fbxLight = KFbxCast<KFbxLight>(pNode>GetNodeAttribute());15 const FbxLight* fbxLight = FbxCast<FbxLight>(pNode>GetNodeAttribute()); 16 16 17 17 if (!fbxLight) … … 23 23 osg::LightSource* osgLightSource = new osg::LightSource; 24 24 25 osgLightSource>setLight(osgLight); 25 26 osgLight>setLightNum(nLightCount++); 26 osgLightSource>setLight(osgLight);27 27 28 KFbxLight::ELightType fbxLightType = fbxLight>LightType.IsValid() ?29 fbxLight>LightType.Get() : KFbxLight::ePOINT;28 FbxLight::EType fbxLightType = fbxLight>LightType.IsValid() ? 29 fbxLight>LightType.Get() : FbxLight::ePoint; 30 30 31 osgLight>setPosition(osg::Vec4(0,0,0,fbxLightType != KFbxLight::eDIRECTIONAL));31 osgLight>setPosition(osg::Vec4(0,0,0,fbxLightType != FbxLight::eDirectional)); 32 32 33 if (fbxLightType == KFbxLight::eSPOT)33 if (fbxLightType == FbxLight::eSpot) 34 34 { 35 double coneAngle = fbxLight> ConeAngle.IsValid() ? fbxLight>ConeAngle.Get() : 45.0;36 double hotSpot = fbxLight> HotSpot.IsValid() ? fbxLight>HotSpot.Get() : 45.0;35 double coneAngle = fbxLight>OuterAngle.Get(); 36 double hotSpot = fbxLight>InnerAngle.Get(); 37 37 const float MIN_HOTSPOT = 0.467532f; 38 38 … … 40 40 41 41 //Approximate the hotspot using the GL light exponent. 42 // This formula maps a hotspot of 180 to exponent 0 (uniform light42 // This formula maps a hotspot of 180 to exponent 0 (uniform light 43 43 // distribution) and a hotspot of 45 to exponent 1 (effective light 44 44 // intensity is attenuated by the cosine of the angle between the … … 57 57 switch (fbxLight>DecayType.Get()) 58 58 { 59 case KFbxLight::eNONE:59 case FbxLight::eNone: 60 60 break; 61 case KFbxLight::eLINEAR:61 case FbxLight::eLinear: 62 62 osgLight>setLinearAttenuation(fbxDecayStart); 63 63 break; 64 case KFbxLight::eQUADRATIC:65 case KFbxLight::eCUBIC:64 case FbxLight::eQuadratic: 65 case FbxLight::eCubic: 66 66 osgLight>setQuadraticAttenuation(fbxDecayStart); 67 67 break; … … 73 73 if (fbxLight>Color.IsValid()) 74 74 { 75 fbxDouble3 fbxColor = fbxLight>Color.Get();75 FbxDouble3 fbxColor = fbxLight>Color.Get(); 76 76 osgDiffuseSpecular.set( 77 77 static_cast<float>(fbxColor[0]), … … 85 85 if (fbxLight>ShadowColor.IsValid()) 86 86 { 87 fbxDouble3 fbxShadowColor = fbxLight>ShadowColor.Get();87 FbxDouble3 fbxShadowColor = fbxLight>ShadowColor.Get(); 88 88 osgAmbient.set( 89 89 static_cast<float>(fbxShadowColor[0]),