From 7e4da3d634bb061efa87212832b108667cfa49d5 Mon Sep 17 00:00:00 2001 From: Lolbot Date: Thu, 17 Jan 2013 23:16:52 +0000 Subject: [PATCH] fixed 27 files out of 2315: - removed 0 CR characters - removed 188 trailing whitespaces - replaced 537 tabs with spaces --- src/easymesh/csgbsp.cpp | 4 +-- src/easymesh/easymesh-scanner.l | 2 +- src/easymesh/easymesh.cpp | 2 +- src/easymesh/shiny.lolfx | 52 ++++++++++++++++----------------- src/lol/math/geometry.h | 4 +-- src/math/geometry.cpp | 6 ++-- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/src/easymesh/csgbsp.cpp b/src/easymesh/csgbsp.cpp index 965ff7cd..5066fe90 100644 --- a/src/easymesh/csgbsp.cpp +++ b/src/easymesh/csgbsp.cpp @@ -139,7 +139,7 @@ void CsgBsp::AddTriangleToTree(int const &tri_idx, vec3 const &tri_v0, vec3 cons int leaf_type = res_side[(isec_base + 2) % 3]; tri_to_process.Pop(); - + #if 1 if (m_tree[leaf_idx].m_leaves[leaf_type] == LEAF_CURRENT) Leaf_to_add.Push(leaf_type, leaf_idx, v[((isec_base + 2) % 3)], isec_v[v_idx1], isec_v[v_idx0], -1); @@ -498,7 +498,7 @@ int CsgBsp::TestTriangleToTree(vec3 const &tri_v0, vec3 const &tri_v1, vec3 cons int res_total = 0; int res_nb[3] = { 0, 0, 0 }; - + int res_Leaf[4] = { 0, 0, 0, 0 }; int res_side[4] = { -1, -1, -1, -1 }; while (res_total < TEST_MAX) diff --git a/src/easymesh/easymesh-scanner.l b/src/easymesh/easymesh-scanner.l index e6cb5caa..40e51e84 100644 --- a/src/easymesh/easymesh-scanner.l +++ b/src/easymesh/easymesh-scanner.l @@ -66,7 +66,7 @@ sx { return token::T_SCALEX; } sy { return token::T_SCALEY; } sz { return token::T_SCALEZ; } s { return token::T_SCALE; } -tsw { return token::T_TOGGLESCALEWINDING; } +tsw { return token::T_TOGGLESCALEWINDING; } mx { return token::T_MIRRORX; } my { return token::T_MIRRORY; } mz { return token::T_MIRRORZ; } diff --git a/src/easymesh/easymesh.cpp b/src/easymesh/easymesh.cpp index 8b956e1d..fcc4c7d1 100644 --- a/src/easymesh/easymesh.cpp +++ b/src/easymesh/easymesh.cpp @@ -175,7 +175,7 @@ void EasyMesh::UpdateVertexDict(Array< int, int > &vertex_dict) for (int i = 0; i < m_vert.Count(); i++) { int CurIdx = FindVertexInDict(i, vertex_dict); - + //go through all vertices and do the match-up. if (CurIdx == -1) { diff --git a/src/easymesh/shiny.lolfx b/src/easymesh/shiny.lolfx index 26d453f8..54b05154 100644 --- a/src/easymesh/shiny.lolfx +++ b/src/easymesh/shiny.lolfx @@ -76,7 +76,7 @@ void main(void) vec3 v = vec3(0.0, 0.0, 0.0); vec3 r = vec3(0.0, 0.0, 0.0); float sdotn = 0.0; - float light_radius_mod = 0.0; + float light_radius_mod = 0.0; //Light calculation for directional light s = normalize(-in_LightDir); @@ -88,11 +88,11 @@ void main(void) if (sdotn > 0.0) specular += specular_color * specular_reflect * pow(max(dot(r, v), 0.0), specular_power); - //---------- - + //---------- + //Light calculation for point light - vec3 tmpLightDir = (in_View * in_Light2_Pos).xyz - pass_Vertex.xyz; - light_radius_mod = max(0.0, 1.0 - (length(tmpLightDir) / in_Light2_Radius)); + vec3 tmpLightDir = (in_View * in_Light2_Pos).xyz - pass_Vertex.xyz; + light_radius_mod = max(0.0, 1.0 - (length(tmpLightDir) / in_Light2_Radius)); s = normalize(tmpLightDir); v = normalize(-pass_Vertex.xyz); r = reflect(-s, pass_TNormal); @@ -102,29 +102,29 @@ void main(void) if (sdotn > 0.0 && light_radius_mod > 0.0) specular += specular_color * min(specular_reflect, light_radius_mod) * pow(max(dot(r, v), 0.0), specular_power); - //---------- - + //---------- + //Light calculation for cube light - vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz; - vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner); - vec3 new_LightDir = Local_Vertex - Proj_Vertex; - - vec3 light_radius = max(vec3(0.0,0.0,0.0), vec3(1.0,1.0,1.0) - abs(new_LightDir / in_Light3_Size_Outer)); - light_radius_mod = min(light_radius.x, min(light_radius.y, light_radius.z)); - - if (length(new_LightDir) == 0.0) - sdotn = 1.0; - else - { - new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); - sdotn = max(dot(new_LightDir, pass_TNormal), 0.0); - r = reflect(-new_LightDir, pass_TNormal); - if (sdotn > 0.0 && light_radius_mod > 0.0) - specular += specular_color * min(specular_reflect, light_radius_mod) - * pow(max(dot(r, v), 0.0), specular_power); - } + vec3 Local_Vertex = (in_Inv_View * pass_Vertex).xyz - (in_Light3_Pos).xyz; + vec3 Proj_Vertex = clamp(Local_Vertex.xyz, -in_Light3_Size_Inner, in_Light3_Size_Inner); + vec3 new_LightDir = Local_Vertex - Proj_Vertex; + + vec3 light_radius = max(vec3(0.0,0.0,0.0), vec3(1.0,1.0,1.0) - abs(new_LightDir / in_Light3_Size_Outer)); + light_radius_mod = min(light_radius.x, min(light_radius.y, light_radius.z)); + + if (length(new_LightDir) == 0.0) + sdotn = 1.0; + else + { + new_LightDir = normalize((in_View * vec4(Proj_Vertex + in_Light3_Pos.xyz,1.0)).xyz - pass_Vertex.xyz); + sdotn = max(dot(new_LightDir, pass_TNormal), 0.0); + r = reflect(-new_LightDir, pass_TNormal); + if (sdotn > 0.0 && light_radius_mod > 0.0) + specular += specular_color * min(specular_reflect, light_radius_mod) + * pow(max(dot(r, v), 0.0), specular_power); + } diffuse += in_Light3_diffuse * min(sdotn, light_radius_mod); - //---------- + //---------- vec3 light = ambient + diffuse + specular; diff --git a/src/lol/math/geometry.h b/src/lol/math/geometry.h index 8b1cb83c..50eff445 100644 --- a/src/lol/math/geometry.h +++ b/src/lol/math/geometry.h @@ -33,7 +33,7 @@ namespace lol bool RayIsectTriangleSide(vec3 const &v0, vec3 const &v1, vec3 const &v2, vec3 const &iP0, vec3 const &iP1, vec3 &iV0, int &iIdx0, vec3 &iV1, int &iIdx1); - bool RayIsectTriangle(vec3 const &rayP, vec3 const &rayD, + bool RayIsectTriangle(vec3 const &rayP, vec3 const &rayD, vec3 const &triV0, vec3 const &triV1, vec3 const &triV2, vec3 &vi); #define RAY_ISECT_NOTHING 0 @@ -41,7 +41,7 @@ namespace lol #define RAY_ISECT_NONE 2 #define RAY_ISECT_P0 3 #define RAY_ISECT_P1 4 - int RayIsectRay(vec3 const &rayP00, vec3 const &rayP01, + int RayIsectRay(vec3 const &rayP00, vec3 const &rayP01, vec3 const &rayP10, vec3 const &rayP11, vec3 &vIsec); vec3 ProjPointOnPlane(vec3 const &point, vec3 const &planeP, vec3 const &planeN); diff --git a/src/math/geometry.cpp b/src/math/geometry.cpp index ff1f6535..12d448bc 100644 --- a/src/math/geometry.cpp +++ b/src/math/geometry.cpp @@ -53,13 +53,13 @@ namespace lol } // Line/triangle : sets vIsec as the intersection point & return true if ok. - bool RayIsectTriangle(vec3 const &rayP, vec3 const &rayD, + bool RayIsectTriangle(vec3 const &rayP, vec3 const &rayD, vec3 const &triV0, vec3 const &triV1, vec3 const &triV2, vec3 &vIsec) { vec3 v01, v02, h, v0P, q; float a, f, triU, triV; - + // v01 = triV1 - triV0; v02 = triV2 - triV0; @@ -181,7 +181,7 @@ namespace lol } //Ray/Line : returns one of the RAY_ISECT_* defines. - int RayIsectRay(vec3 const &rayP00, vec3 const &rayP01, + int RayIsectRay(vec3 const &rayP00, vec3 const &rayP01, vec3 const &rayP10, vec3 const &rayP11, vec3 &vIsec) {