Light transformation, rotation, and scaling is now imported correctly from FBX files

--HG--
extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4042
This commit is contained in:
kearwood
2012-04-12 22:18:38 +00:00
parent f847b89f5a
commit 3749d3edfd
2 changed files with 12 additions and 7 deletions

View File

@@ -596,12 +596,15 @@ void LoadLight(KRNode *parent_node, std::vector<KRResource *> &resources, KFbxNo
// KFbxLight::eQUADRATIC - attenuation of 1/d^2 // KFbxLight::eQUADRATIC - attenuation of 1/d^2
// KFbxLight::eCUBIC - attenuation of // KFbxLight::eCUBIC - attenuation of
KFbxVector4 light_translation = pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET); KFbxVector4 v4; // Default translation values
KFbxVector4 light_rotation = pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); v4 = pNode->LclTranslation.Get();
KFbxVector4 light_scaling = pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET);
//KFbxVector4 light_translation = pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET);
//KFbxVector4 light_rotation = pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET);
//KFbxVector4 light_scaling = pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET);
KRVector3 translation = KRVector3(light_translation[0], light_translation[1], light_translation[2]); //KRVector3 translation = KRVector3(light_translation[0], light_translation[1], light_translation[2]);
KRLight *new_light = NULL; KRLight *new_light = NULL;
@@ -633,9 +636,9 @@ void LoadLight(KRNode *parent_node, std::vector<KRResource *> &resources, KFbxNo
} }
if(new_light) { if(new_light) {
fbxDouble3 local_rotation = pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); fbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET);
fbxDouble3 local_translation = pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET); fbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET);
fbxDouble3 local_scale = pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET); fbxDouble3 local_scale = pNode->LclScaling.Get(); // pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET);
new_light->setLocalRotation(KRVector3(local_rotation[0], local_rotation[1], local_rotation[2])); new_light->setLocalRotation(KRVector3(local_rotation[0], local_rotation[1], local_rotation[2]));
new_light->setLocalTranslation(KRVector3(local_translation[0], local_translation[1], local_translation[2])); new_light->setLocalTranslation(KRVector3(local_translation[0], local_translation[1], local_translation[2]));
new_light->setLocalScale(KRVector3(local_scale[0], local_scale[1], local_scale[2])); new_light->setLocalScale(KRVector3(local_scale[0], local_scale[1], local_scale[2]));

View File

@@ -184,6 +184,8 @@
CFTimeInterval frame_start_time = CACurrentMediaTime(); CFTimeInterval frame_start_time = CACurrentMediaTime();
NSAutoreleasePool *framePool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool *framePool = [[NSAutoreleasePool alloc] init];
CFTimeInterval time = [displayLink timestamp]; CFTimeInterval time = [displayLink timestamp];
float deltaTime = (time - _lastTime); float deltaTime = (time - _lastTime);
_lastTime = time; _lastTime = time;