From 3749d3edfd4a9706169eed11a6ef12cf6aba3686 Mon Sep 17 00:00:00 2001 From: kearwood Date: Thu, 12 Apr 2012 22:18:38 +0000 Subject: [PATCH] Light transformation, rotation, and scaling is now imported correctly from FBX files --HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4042 --- KREngine/KREngine/Classes/KRResource+fbx.cpp | 17 ++++++++++------- objview/Classes/KRObjViewViewController.mm | 2 ++ 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/KREngine/KREngine/Classes/KRResource+fbx.cpp b/KREngine/KREngine/Classes/KRResource+fbx.cpp index 52e1401..da8d083 100644 --- a/KREngine/KREngine/Classes/KRResource+fbx.cpp +++ b/KREngine/KREngine/Classes/KRResource+fbx.cpp @@ -596,12 +596,15 @@ void LoadLight(KRNode *parent_node, std::vector &resources, KFbxNo // KFbxLight::eQUADRATIC - attenuation of 1/d^2 // KFbxLight::eCUBIC - attenuation of - KFbxVector4 light_translation = pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET); - KFbxVector4 light_rotation = pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); - KFbxVector4 light_scaling = pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET); + KFbxVector4 v4; // Default translation values + v4 = pNode->LclTranslation.Get(); + + //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; @@ -633,9 +636,9 @@ void LoadLight(KRNode *parent_node, std::vector &resources, KFbxNo } if(new_light) { - fbxDouble3 local_rotation = pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); - fbxDouble3 local_translation = pNode->GetGeometricTranslation(KFbxNode::eSOURCE_SET); - fbxDouble3 local_scale = pNode->GetGeometricScaling(KFbxNode::eSOURCE_SET); + fbxDouble3 local_rotation = pNode->LclRotation.Get(); // pNode->GetGeometricRotation(KFbxNode::eSOURCE_SET); + fbxDouble3 local_translation = pNode->LclTranslation.Get(); // pNode->GetGeometricTranslation(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->setLocalTranslation(KRVector3(local_translation[0], local_translation[1], local_translation[2])); new_light->setLocalScale(KRVector3(local_scale[0], local_scale[1], local_scale[2])); diff --git a/objview/Classes/KRObjViewViewController.mm b/objview/Classes/KRObjViewViewController.mm index 55b70bc..65bc69c 100644 --- a/objview/Classes/KRObjViewViewController.mm +++ b/objview/Classes/KRObjViewViewController.mm @@ -184,6 +184,8 @@ CFTimeInterval frame_start_time = CACurrentMediaTime(); NSAutoreleasePool *framePool = [[NSAutoreleasePool alloc] init]; + + CFTimeInterval time = [displayLink timestamp]; float deltaTime = (time - _lastTime); _lastTime = time;