From aadc5c840ceec39db4314d38a9fa48f10cab6dbb Mon Sep 17 00:00:00 2001 From: kearwood Date: Fri, 6 Apr 2012 01:07:23 +0000 Subject: [PATCH] Reversed recent shader changes that broke specular Implementation of deferred rendering in progress --HG-- extra : convert_revision : svn%3A7752d6cf-9f14-4ad2-affc-04f1e67b81a5/trunk%4030 --- KREngine/KREngine/Classes/KRResource+fbx.cpp | 14 ++++++++++++++ KREngine/KREngine/Shaders/ObjectShader.fsh | 4 ++-- objview/Classes/KRObjViewGLView.mm | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/KREngine/KREngine/Classes/KRResource+fbx.cpp b/KREngine/KREngine/Classes/KRResource+fbx.cpp index 92f1d4c..4b0fd53 100644 --- a/KREngine/KREngine/Classes/KRResource+fbx.cpp +++ b/KREngine/KREngine/Classes/KRResource+fbx.cpp @@ -555,6 +555,20 @@ void LoadMesh(std::vector &resources, KFbxGeometryConverter *pGeom void LoadLight(std::vector &resources, KFbxNode* pNode) { KFbxLight* pLight = (KFbxLight*) pNode->GetNodeAttribute(); const char *szName = pNode->GetName(); + + fbxDouble3 light_color = pLight->Color.Get(); + fbxDouble1 light_intensity = pLight->Intensity.Get(); + fbxDouble1 light_hotspot = pLight->HotSpot.Get(); // light inner cone angle (in degrees). Also know as the HotSpot + fbxDouble1 light_coneangle = pLight->ConeAngle.Get(); // light outer cone angle (in degrees). Also known as the Falloff + KFbxLight::EDecayType light_decaytype = pLight->DecayType.Get(); // decay type + fbxDouble1 light_decaystart = pLight->DecayStart.Get(); // decay start distance + + +// KFbxLight::eNONE - does not attenuate with distance +// KFbxLight::eLINEAR - attenuation of 1/d +// KFbxLight::eQUADRATIC - attenuation of 1/d^2 +// KFbxLight::eCUBIC - attenuation of + switch(pLight->LightType.Get()) { case KFbxLight::ePOINT: resources.push_back(new KRPointLight(szName)); diff --git a/KREngine/KREngine/Shaders/ObjectShader.fsh b/KREngine/KREngine/Shaders/ObjectShader.fsh index 366e8ac..6a0ec9a 100644 --- a/KREngine/KREngine/Shaders/ObjectShader.fsh +++ b/KREngine/KREngine/Shaders/ObjectShader.fsh @@ -109,9 +109,9 @@ void main() #if ENABLE_PER_PIXEL == 1 mediump float lamberFactor = max(0.0,dot(lightVec, normal)); mediump float specularFactor = 0.0; - //if(material_shininess > 0.0) { + if(material_shininess > 0.0) { specularFactor = max(0.0,pow(dot(halfVec,normal), material_shininess)); - //} + } #endif #if HAS_DIFFUSE_MAP == 1 diff --git a/objview/Classes/KRObjViewGLView.mm b/objview/Classes/KRObjViewGLView.mm index 7352f16..8415e62 100644 --- a/objview/Classes/KRObjViewGLView.mm +++ b/objview/Classes/KRObjViewGLView.mm @@ -128,6 +128,8 @@ //m_scene.addInstance(pModelManager->getModel("ballroom"), KRMat4()); //m_scene.addInstance(pModelManager->getModel("HoganCombined"), KRMat4()); //m_scene.addInstance(pModelManager->getModel("polySurface12848"), KRMat4(), "PillarLightmap2k"); + //m_scene.addInstance(pModelManager->getModel("Wall2"), KRMat4(), "Wall2_lightmap"); + std::map models = pModelManager->getModels(); for(std::map::iterator itr=models.begin(); itr != models.end(); itr++) { std::string lightmap = (*itr).first;