- removed 0 CR characters - removed 188 trailing whitespaces - replaced 537 tabs with spaceslegacy
| @@ -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]; | int leaf_type = res_side[(isec_base + 2) % 3]; | ||||
| tri_to_process.Pop(); | tri_to_process.Pop(); | ||||
| #if 1 | #if 1 | ||||
| if (m_tree[leaf_idx].m_leaves[leaf_type] == LEAF_CURRENT) | 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); | 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_total = 0; | ||||
| int res_nb[3] = { 0, 0, 0 }; | int res_nb[3] = { 0, 0, 0 }; | ||||
| int res_Leaf[4] = { 0, 0, 0, 0 }; | int res_Leaf[4] = { 0, 0, 0, 0 }; | ||||
| int res_side[4] = { -1, -1, -1, -1 }; | int res_side[4] = { -1, -1, -1, -1 }; | ||||
| while (res_total < TEST_MAX) | while (res_total < TEST_MAX) | ||||
| @@ -66,7 +66,7 @@ sx { return token::T_SCALEX; } | |||||
| sy { return token::T_SCALEY; } | sy { return token::T_SCALEY; } | ||||
| sz { return token::T_SCALEZ; } | sz { return token::T_SCALEZ; } | ||||
| s { return token::T_SCALE; } | s { return token::T_SCALE; } | ||||
| tsw { return token::T_TOGGLESCALEWINDING; } | |||||
| tsw { return token::T_TOGGLESCALEWINDING; } | |||||
| mx { return token::T_MIRRORX; } | mx { return token::T_MIRRORX; } | ||||
| my { return token::T_MIRRORY; } | my { return token::T_MIRRORY; } | ||||
| mz { return token::T_MIRRORZ; } | mz { return token::T_MIRRORZ; } | ||||
| @@ -175,7 +175,7 @@ void EasyMesh::UpdateVertexDict(Array< int, int > &vertex_dict) | |||||
| for (int i = 0; i < m_vert.Count(); i++) | for (int i = 0; i < m_vert.Count(); i++) | ||||
| { | { | ||||
| int CurIdx = FindVertexInDict(i, vertex_dict); | int CurIdx = FindVertexInDict(i, vertex_dict); | ||||
| //go through all vertices and do the match-up. | //go through all vertices and do the match-up. | ||||
| if (CurIdx == -1) | if (CurIdx == -1) | ||||
| { | { | ||||
| @@ -76,7 +76,7 @@ void main(void) | |||||
| vec3 v = vec3(0.0, 0.0, 0.0); | vec3 v = vec3(0.0, 0.0, 0.0); | ||||
| vec3 r = vec3(0.0, 0.0, 0.0); | vec3 r = vec3(0.0, 0.0, 0.0); | ||||
| float sdotn = 0.0; | float sdotn = 0.0; | ||||
| float light_radius_mod = 0.0; | |||||
| float light_radius_mod = 0.0; | |||||
| //Light calculation for directional light | //Light calculation for directional light | ||||
| s = normalize(-in_LightDir); | s = normalize(-in_LightDir); | ||||
| @@ -88,11 +88,11 @@ void main(void) | |||||
| if (sdotn > 0.0) | if (sdotn > 0.0) | ||||
| specular += specular_color * specular_reflect | specular += specular_color * specular_reflect | ||||
| * pow(max(dot(r, v), 0.0), specular_power); | * pow(max(dot(r, v), 0.0), specular_power); | ||||
| //---------- | |||||
| //---------- | |||||
| //Light calculation for point light | //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); | s = normalize(tmpLightDir); | ||||
| v = normalize(-pass_Vertex.xyz); | v = normalize(-pass_Vertex.xyz); | ||||
| r = reflect(-s, pass_TNormal); | r = reflect(-s, pass_TNormal); | ||||
| @@ -102,29 +102,29 @@ void main(void) | |||||
| if (sdotn > 0.0 && light_radius_mod > 0.0) | if (sdotn > 0.0 && light_radius_mod > 0.0) | ||||
| specular += specular_color * min(specular_reflect, light_radius_mod) | specular += specular_color * min(specular_reflect, light_radius_mod) | ||||
| * pow(max(dot(r, v), 0.0), specular_power); | * pow(max(dot(r, v), 0.0), specular_power); | ||||
| //---------- | |||||
| //---------- | |||||
| //Light calculation for cube light | //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); | diffuse += in_Light3_diffuse * min(sdotn, light_radius_mod); | ||||
| //---------- | |||||
| //---------- | |||||
| vec3 light = ambient + diffuse + specular; | vec3 light = ambient + diffuse + specular; | ||||
| @@ -33,7 +33,7 @@ namespace lol | |||||
| bool RayIsectTriangleSide(vec3 const &v0, vec3 const &v1, vec3 const &v2, | bool RayIsectTriangleSide(vec3 const &v0, vec3 const &v1, vec3 const &v2, | ||||
| vec3 const &iP0, vec3 const &iP1, | vec3 const &iP0, vec3 const &iP1, | ||||
| vec3 &iV0, int &iIdx0, vec3 &iV1, int &iIdx1); | 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 const &triV0, vec3 const &triV1, vec3 const &triV2, | ||||
| vec3 &vi); | vec3 &vi); | ||||
| #define RAY_ISECT_NOTHING 0 | #define RAY_ISECT_NOTHING 0 | ||||
| @@ -41,7 +41,7 @@ namespace lol | |||||
| #define RAY_ISECT_NONE 2 | #define RAY_ISECT_NONE 2 | ||||
| #define RAY_ISECT_P0 3 | #define RAY_ISECT_P0 3 | ||||
| #define RAY_ISECT_P1 4 | #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 const &rayP10, vec3 const &rayP11, | ||||
| vec3 &vIsec); | vec3 &vIsec); | ||||
| vec3 ProjPointOnPlane(vec3 const &point, vec3 const &planeP, vec3 const &planeN); | vec3 ProjPointOnPlane(vec3 const &point, vec3 const &planeP, vec3 const &planeN); | ||||
| @@ -53,13 +53,13 @@ namespace lol | |||||
| } | } | ||||
| // Line/triangle : sets vIsec as the intersection point & return true if ok. | // 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 const &triV0, vec3 const &triV1, vec3 const &triV2, | ||||
| vec3 &vIsec) | vec3 &vIsec) | ||||
| { | { | ||||
| vec3 v01, v02, h, v0P, q; | vec3 v01, v02, h, v0P, q; | ||||
| float a, f, triU, triV; | float a, f, triU, triV; | ||||
| // | // | ||||
| v01 = triV1 - triV0; | v01 = triV1 - triV0; | ||||
| v02 = triV2 - triV0; | v02 = triV2 - triV0; | ||||
| @@ -181,7 +181,7 @@ namespace lol | |||||
| } | } | ||||
| //Ray/Line : returns one of the RAY_ISECT_* defines. | //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 const &rayP10, vec3 const &rayP11, | ||||
| vec3 &vIsec) | vec3 &vIsec) | ||||
| { | { | ||||