diff options
Diffstat (limited to 'Magic2/Editor.cpp')
-rw-r--r-- | Magic2/Editor.cpp | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/Magic2/Editor.cpp b/Magic2/Editor.cpp index 24ac589..0f1aa4b 100644 --- a/Magic2/Editor.cpp +++ b/Magic2/Editor.cpp @@ -53,7 +53,7 @@ static float project_u(Vec3& v, int style) case 1: return v.x; // FRONT case 2: return v.z; // SIDE } - + return v.x; } @@ -64,7 +64,7 @@ static float project_v(Vec3& v, int style) case 1: return -v.z; // FRONT case 2: return -v.y; // SIDE } - + return -v.y; } @@ -88,7 +88,7 @@ static float project_u_cylindrical(Vec3& v, int axis) // SIDE case 2: return (float) atan2(v.z, v.y); // SIDE } - + return project_u(v, axis); } @@ -99,7 +99,7 @@ static float project_v_cylindrical(Vec3& v, int axis) case 1: return v.y; // FRONT case 2: return v.x; // SIDE } - + return project_v(v, axis); } @@ -137,7 +137,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, Poly* poly = iter.value(); for (int i = 0; i < poly->nverts; i++) { int v = poly->verts[i]; - + float u0 = project_u(loc[v], axis); float v0 = project_v(loc[v], axis); @@ -151,7 +151,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, float base_u = 0.0f; float base_v = 0.0f; - + if (max_u != min_u) base_u = 1.0f / (max_u - min_u); if (max_v != min_v) base_v = 1.0f / (max_v - min_v); @@ -160,7 +160,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, // assign texture id and coordinates: while (++iter) { Poly* poly = iter.value(); - + poly->material = material; if (mapping == MAP_NONE) @@ -179,7 +179,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, if (flip) vset->tv[v] = (1.0f - base_v * (project_v(loc[v], axis) - min_v)) * scale_v; - else + else vset->tv[v] = (project_v(loc[v], axis) - min_v) * scale_v * base_v; } else { @@ -190,7 +190,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, if (flip) vset->tu[v] = (1.0f - base_v * (project_v(loc[v], axis) - min_v)) * scale_v; - else + else vset->tu[v] = (project_v(loc[v], axis) - min_v) * scale_v * base_v; } } @@ -208,7 +208,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, if (flip) vset->tv[v] = scale_v * (float) (i <= 1); - else + else vset->tv[v] = scale_v * (float) (i > 1); } else { @@ -219,7 +219,7 @@ Editor::ApplyMaterial(Material* material, List<Poly>& polys, if (flip) vset->tu[v] = scale_u * (float) (i <= 1); - else + else vset->tu[v] = scale_u * (float) (i > 1); } } @@ -247,7 +247,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List<Poly>& polys, Poly* poly = iter.value(); for (int i = 0; i < poly->nverts; i++) { int v = poly->verts[i]; - + float u0 = project_u_cylindrical(loc[v], axis); float v0 = project_v_cylindrical(loc[v], axis); @@ -260,7 +260,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List<Poly>& polys, float base_u = 0.0f; float base_v = 0.0f; - + if (max_u != min_u) base_u = 1.0f / (max_u - min_u); if (max_v != min_v) base_v = 1.0f / (max_v - min_v); @@ -269,9 +269,9 @@ Editor::ApplyMaterialCylindrical(Material* material, List<Poly>& polys, // assign texture id and coordinates: while (++iter) { Poly* poly = iter.value(); - + poly->material = material; - + for (int i = 0; i < poly->nverts; i++) { int v = poly->verts[i]; float u0 = project_u_cylindrical(loc[v], axis); @@ -285,7 +285,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List<Poly>& polys, if (flip) vset->tv[v] = (1.0f - base_v * (v0 - min_v)) * scale_v; - else + else vset->tv[v] = (v0 - min_v) * scale_v * base_v; } else { @@ -296,7 +296,7 @@ Editor::ApplyMaterialCylindrical(Material* material, List<Poly>& polys, if (flip) vset->tu[v] = (1.0f - base_v * (v0 - min_v)) * scale_v; - else + else vset->tu[v] = (v0 - min_v) * scale_v * base_v; } } |