From a70df621b29eccb622ca0dd8e3a5e74a43317bd7 Mon Sep 17 00:00:00 2001 From: Kelly Date: Mon, 17 Mar 2014 23:44:51 -0700 Subject: [PATCH 1/2] fixed the Point Light Flare positioning --HG-- branch : nfb --- KREngine/kraken/KRPointLight.cpp | 4 ++-- KREngine/kraken_standard_assets_ios/Shaders/flare.vsh | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/KREngine/kraken/KRPointLight.cpp b/KREngine/kraken/KRPointLight.cpp index 8ce2f07..f998ae6 100644 --- a/KREngine/kraken/KRPointLight.cpp +++ b/KREngine/kraken/KRPointLight.cpp @@ -57,10 +57,10 @@ void KRPointLight::render(KRCamera *pCamera, std::vector &point_ KRVector3 light_position = getLocalTranslation(); float influence_radius = m_decayStart - sqrt(m_intensity * 0.01f) / sqrt(KRLIGHT_MIN_INFLUENCE); - + KRMat4 sphereModelMatrix = KRMat4(); - sphereModelMatrix.scale(influence_radius); sphereModelMatrix.translate(light_position.x, light_position.y, light_position.z); + sphereModelMatrix.scale(influence_radius); if(viewport.visible(getBounds())) { // Cull out any lights not within the view frustrum diff --git a/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh b/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh index fc0c4d4..b52bc75 100644 --- a/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh +++ b/KREngine/kraken_standard_assets_ios/Shaders/flare.vsh @@ -38,5 +38,5 @@ varying mediump vec2 texCoord; void main() { texCoord = vertex_uv; - gl_Position = mvp_matrix * vec4(0.0, 0.0, 0.0, 1.0) + vec4(vertex_uv.x * viewport.w / viewport.z * 2.0 - 1.0, vertex_uv.y * 2.0 - 1.0, 0.0, 0.0) * flare_size; + gl_Position = mvp_matrix * vec4(0.0, 0.0, 0.0, 1.0) + vec4(vertex_uv.x * viewport.w / viewport.z * 2.0 - 0.75, vertex_uv.y * 2.0 - 1.0, 0.0, 0.0) * flare_size; } From e5959799571c6b2cb7db2f06eeeadb67e24db802 Mon Sep 17 00:00:00 2001 From: "admin8onf@admin8onfs-pro.nfbonf.nfb.ca" Date: Mon, 17 Mar 2014 23:47:18 -0700 Subject: [PATCH 2/2] A minor hack to prevent the Directional light from incorrectly inheriting the Post_rotation from the FBX scene. (if we can figure out where the post rotation is exported from, the hack can be removed) --HG-- branch : nfb --- KREngine/kraken/KRResource+fbx.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/KREngine/kraken/KRResource+fbx.cpp b/KREngine/kraken/KRResource+fbx.cpp index 0c87e14..95b66e5 100644 --- a/KREngine/kraken/KRResource+fbx.cpp +++ b/KREngine/kraken/KRResource+fbx.cpp @@ -926,7 +926,8 @@ void LoadNode(FbxScene* pFbxScene, KRNode *parent_node, FbxGeometryConverter *pG KRVector3 node_pre_rotation, node_post_rotation; if(rotation_active) { node_pre_rotation = KRVector3(pre_rotation[0], pre_rotation[1], pre_rotation[2]) / 180.0 * M_PI; - node_post_rotation = KRVector3(post_rotation[0], post_rotation[1], post_rotation[2]) / 180.0 * M_PI; + // node_post_rotation = KRVector3(post_rotation[0], post_rotation[1], post_rotation[2]) / 180.0 * M_PI; + //&KRF HACK removing this line (above) to prevent the post rotation from corrupting the default light values; the FBX is importing a post rotation and setting it to -90 degrees } else { node_pre_rotation = KRVector3::Zero(); node_post_rotation = KRVector3::Zero();