Skip to content

Commit 5da08d4

Browse files
committed
VS2015 fixes for Tesselator.cpp. Fix issues:
C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(176): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(177): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(178): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(188): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(189): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(190): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(140): warning C4101: 'Umax': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(139): warning C4101: 'Umin': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(142): warning C4101: 'Vmax': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(141): warning C4101: 'Vmin': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(144): warning C4101: 'dUmax': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(145): warning C4101: 'dVmax': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(266): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(267): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(268): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(278): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(279): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(280): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(312): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(313): warning C4244: '=': conversion from 'Standard_Real' to 'float', possible loss of data [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(360): error C2039: 'max': is not a member of 'std' [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include\sstream(12): note: see declaration of 'std' C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(360): error C3861: 'max': identifier not found [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(874): warning C4101: 'aUmaxLeft': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(875): warning C4101: 'aUmaxBottom': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(875): warning C4101: 'aVmaxBottom': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(874): warning C4101: 'aVmaxLeft': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(873): warning C4101: 'aUmaxBack': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj] C:\projects\pythonocc-core\src\Visualization\Tesselator.cpp(873): warning C4101: 'aVmaxBack': unreferenced local variable [C:\projects\pythonocc-core\cmake-build\_Visualization.vcxproj]
1 parent f57951e commit 5da08d4

1 file changed

Lines changed: 16 additions & 26 deletions

File tree

src/Visualization/Tesselator.cpp

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
//---------------------------------------------------------------------------
1919
#include "Tesselator.h"
2020
#include <sstream>
21+
#include <algorithm>
2122
//---------------------------------------------------------------------------
2223
#include <TopExp_Explorer.hxx>
2324
#include <Bnd_Box.hxx>
@@ -136,14 +137,6 @@ void Tesselator::SetDeviation(Standard_Real aDeviation)
136137
//---------------------------------------------------------------------------
137138
void Tesselator::Tesselate()
138139
{
139-
Standard_Real Umin;
140-
Standard_Real Umax;
141-
Standard_Real Vmin;
142-
Standard_Real Vmax;
143-
144-
Standard_Real dUmax;
145-
Standard_Real dVmax;
146-
147140
TopExp_Explorer ExpFace;
148141
StdPrs_ToolShadedShape SST;
149142

@@ -173,9 +166,9 @@ void Tesselator::Tesselate()
173166
this_face->number_of_coords = Nodes.Length();
174167
for (int i = Nodes.Lower(); i <= Nodes.Upper(); i++) {
175168
p = Nodes(i).Transformed(aLocation.Transformation());
176-
this_face->vertex_coord[((i-1) * 3)+ 0] = p.X();
177-
this_face->vertex_coord[((i-1) * 3)+ 1] = p.Y();
178-
this_face->vertex_coord[((i-1) * 3)+ 2] = p.Z();
169+
this_face->vertex_coord[((i-1) * 3)+ 0] = static_cast<float>(p.X());
170+
this_face->vertex_coord[((i-1) * 3)+ 1] = static_cast<float>(p.Y());
171+
this_face->vertex_coord[((i-1) * 3)+ 2] = static_cast<float>(p.Z());
179172
}
180173

181174
//write normal buffer
@@ -185,9 +178,9 @@ void Tesselator::Tesselate()
185178
this_face->number_of_normals = myNormal.Length();
186179
for (int i = myNormal.Lower(); i <= myNormal.Upper(); i++) {
187180
d = myNormal(i).Transformed(aLocation.Transformation());
188-
this_face->normal_coord[((i-1) * 3)+ 0] = d.X();
189-
this_face->normal_coord[((i-1) * 3)+ 1] = d.Y();
190-
this_face->normal_coord[((i-1) * 3)+ 2] = d.Z();
181+
this_face->normal_coord[((i-1) * 3)+ 0] = static_cast<float>(d.X());
182+
this_face->normal_coord[((i-1) * 3)+ 1] = static_cast<float>(d.Y());
183+
this_face->normal_coord[((i-1) * 3)+ 2] = static_cast<float>(d.Z());
191184
}
192185

193186
// set uvcoords buffers to NULL
@@ -263,9 +256,9 @@ void Tesselator::TesselateWithUVCoords()
263256
this_face->number_of_coords = Nodes.Length();
264257
for (int i = Nodes.Lower(); i <= Nodes.Upper(); i++) {
265258
p = Nodes(i).Transformed(aLocation.Transformation());
266-
this_face->vertex_coord[((i-1) * 3)+ 0] = p.X();
267-
this_face->vertex_coord[((i-1) * 3)+ 1] = p.Y();
268-
this_face->vertex_coord[((i-1) * 3)+ 2] = p.Z();
259+
this_face->vertex_coord[((i-1) * 3)+ 0] = static_cast<float>(p.X());
260+
this_face->vertex_coord[((i-1) * 3)+ 1] = static_cast<float>(p.Y());
261+
this_face->vertex_coord[((i-1) * 3)+ 2] = static_cast<float>(p.Z());
269262
}
270263

271264
//write normal buffer
@@ -275,9 +268,9 @@ void Tesselator::TesselateWithUVCoords()
275268
this_face->number_of_normals = myNormal.Length();
276269
for (int i = myNormal.Lower(); i <= myNormal.Upper(); i++) {
277270
d = myNormal(i).Transformed(aLocation.Transformation());
278-
this_face->normal_coord[((i-1) * 3)+ 0] = d.X();
279-
this_face->normal_coord[((i-1) * 3)+ 1] = d.Y();
280-
this_face->normal_coord[((i-1) * 3)+ 2] = d.Z();
271+
this_face->normal_coord[((i-1) * 3)+ 0] = static_cast<float>(d.X());
272+
this_face->normal_coord[((i-1) * 3)+ 1] = static_cast<float>(d.Y());
273+
this_face->normal_coord[((i-1) * 3)+ 2] = static_cast<float>(d.Z());
281274
}
282275

283276
//write uvcoord buffer
@@ -309,9 +302,9 @@ void Tesselator::TesselateWithUVCoords()
309302
d_coord.SetY((-myVOrigin+(myVRepeat*(d_coord.Y()-Vmin))/dVmax)/myScaleV);
310303
}
311304
d_coord.Rotate(gp::Origin2d(), myRotationAngle);
312-
this_face->tex_coord[((i-1) * 3)+ id1] = d_coord.X();
313-
this_face->tex_coord[((i-1) * 3)+ id2] = d_coord.Y();
314-
this_face->tex_coord[((i-1) * 3)+ idNull] = 0;
305+
this_face->tex_coord[((i-1) * 3)+ id1] = static_cast<float>(d_coord.X());
306+
this_face->tex_coord[((i-1) * 3)+ id2] = static_cast<float>(d_coord.Y());
307+
this_face->tex_coord[((i-1) * 3)+ idNull] = 0.;
315308
}
316309

317310
//write triangle buffer
@@ -877,9 +870,6 @@ void Tesselator::PrepareBoxTextureCoordinates(const TopoDS_Shape& aShape)
877870
//declare local variables
878871
Bnd_Box aBox;
879872
Standard_Real aXmin,aYmin ,aZmin ,aXmax ,aYmax ,aZmax;
880-
Standard_Real aUmaxBack, aVmaxBack;
881-
Standard_Real aUmaxLeft, aVmaxLeft;
882-
Standard_Real aUmaxBottom, aVmaxBottom;
883873

884874
//calculate the bounding box
885875
BRepBndLib::Add(aShape, aBox);

0 commit comments

Comments
 (0)