Loading 3d-viewer/3d_canvas.cpp +30 −10 Original line number Diff line number Diff line Loading @@ -225,17 +225,35 @@ float spin_quat[4]; if ( event.m_wheelRotation ) { if( event.ShiftDown() ) { if ( event.GetWheelRotation() < 0 ) { /* up */ SetView3D(WXK_UP); } else { /* down */ SetView3D(WXK_DOWN); } } else if( event.ControlDown() ) { if ( event.GetWheelRotation() > 0 ) { /* right */ SetView3D(WXK_RIGHT); } else { /* left */ SetView3D(WXK_LEFT); } } else { if ( event.GetWheelRotation() > 0 ) { g_Parm_3D_Visu.m_Zoom /= 1.4; if ( g_Parm_3D_Visu.m_Zoom <= 0.01) g_Parm_3D_Visu.m_Zoom = 0.01; } else g_Parm_3D_Visu.m_Zoom *= 1.4; DisplayStatus(); Refresh(FALSE); } } if (event.Dragging()) { Loading Loading @@ -582,6 +600,8 @@ bool fmt_is_jpeg = FALSE; ); if ( FullFileName.IsEmpty() ) return; } wxYield(); // Requested to allow tne window redraw after closing the dialog box wxSize image_size = GetClientSize(); wxClientDC dc(this); wxBitmap bitmap(image_size.x, image_size.y ); Loading 3d-viewer/3d_read_mesh.cpp +17 −14 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ int LineNum = 0; return -1; } // Switch the locale to standard C (needed to print floating point numbers like 1.3) setlocale(LC_NUMERIC, "C"); while ( GetLine(file, line, &LineNum, 512) ) { text = strtok(line, " \t\n\r"); Loading @@ -68,6 +70,7 @@ int LineNum = 0; } fclose (file); setlocale(LC_NUMERIC, ""); // revert to the current locale return 0; } Loading Loading @@ -130,44 +133,44 @@ S3D_Material * material = NULL; if ( stricmp (text, "diffuseColor") == 0 ) { text = strtok(NULL," \t\n\r"); material->m_DiffuseColor.x = atof(from_point(text)); material->m_DiffuseColor.x = atof(text); text = strtok(NULL," \t\n\r"); material->m_DiffuseColor.y = atof(from_point(text)); material->m_DiffuseColor.y = atof(text); text = strtok(NULL," \t\n\r"); material->m_DiffuseColor.z = atof(from_point(text)); material->m_DiffuseColor.z = atof(text); } else if ( stricmp (text, "emissiveColor") == 0 ) { text = strtok(NULL," \t\n\r"); material->m_EmissiveColor.x = atof(from_point(text)); material->m_EmissiveColor.x = atof(text); text = strtok(NULL," \t\n\r"); material->m_EmissiveColor.y = atof(from_point(text)); material->m_EmissiveColor.y = atof(text); text = strtok(NULL," \t\n\r"); material->m_EmissiveColor.z = atof(from_point(text)); material->m_EmissiveColor.z = atof(text); } else if ( strnicmp (text, "specularColor", 13 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_SpecularColor.x = atof(from_point(text)); material->m_SpecularColor.x = atof(text); text = strtok(NULL," \t\n\r"); material->m_SpecularColor.y = atof(from_point(text)); material->m_SpecularColor.y = atof(text); text = strtok(NULL," \t\n\r"); material->m_SpecularColor.z = atof(from_point(text)); material->m_SpecularColor.z = atof(text); } else if ( strnicmp (text, "ambientIntensity", 16 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_AmbientIntensity = atof(from_point(text)); material->m_AmbientIntensity = atof(text); } else if ( strnicmp (text, "transparency", 12 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_Transparency = atof(from_point(text)); material->m_Transparency = atof(text); } else if ( strnicmp (text, "shininess", 9 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_Shininess = atof(from_point(text)); material->m_Shininess = atof(text); } } } Loading Loading @@ -323,7 +326,7 @@ char string_num[512]; case ',': jj = 0; if ( ! StartData || !HasData) break; data_list[ii] = atof(from_point(string_num)); data_list[ii] = atof(string_num); string_num[jj] = 0; ii++; if ( ii >= nn ) Loading Loading @@ -463,7 +466,7 @@ int * index = NULL; while ( text ) { if ( *text == ']') break; jj = atoi(from_point(text)); jj = atoi(text); if ( jj < 0 ) { S3D_Vertex * curr_coord = coords; Loading 3d-viewer/makefile.gtk +2 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ CC = gcc # Compiler flags. CPPFLAGS = -Wall -O2 -DPCBNEW -I../pcbnew -I ../include -I../common\ `wx-config --cxxflags` `wx-config --cxxflags` -fno-strict-aliasing include ../libs.linux Loading @@ -23,6 +23,7 @@ $(TARGET).a: $(OBJECTS3D) makefile.gtk makefile.include ar -rv $@ $(OBJECTS3D) ranlib $@ install:$(TARGET).a clean: rm -f *.o Loading 3d-viewer/makefile.include +2 −8 Original line number Diff line number Diff line EXTRALIBS = EXTRACPPFLAGS= -I./ -I../include -I../common -I../pcbnew CPPFLAGS += $(EXTRACPPFLAGS) OBJECTS3D = 3d_frame.o 3d_read_mesh.o 3d_canvas.o trackball.o 3d_aux.o\ 3d_draw.o 3d_toolbar.o 3d_class.o OBJECTS= ../common/trigo.o AUXLIBS= -mthreads -o $(TARGET)$(DLLSUFF)\ $(WXLIB_BASE) $(LIBS3D)\ -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm\ -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 3d_class.o: 3d_class.cpp 3d_struct.h 3d_viewer.h 3d_read_mesh.o: 3d_read_mesh.cpp 3d_struct.h 3d_viewer.h Loading 3d-viewer/makefile.macosx +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ CC = gcc CPPFLAGS = -Wall -O2 -DPCBNEW -I../pcbnew -I ../include -I../common\ `wx-config --cxxflags` CPPFLAGS += -arch i386 -arch ppc include ../libs.macosx Loading Loading
3d-viewer/3d_canvas.cpp +30 −10 Original line number Diff line number Diff line Loading @@ -225,17 +225,35 @@ float spin_quat[4]; if ( event.m_wheelRotation ) { if( event.ShiftDown() ) { if ( event.GetWheelRotation() < 0 ) { /* up */ SetView3D(WXK_UP); } else { /* down */ SetView3D(WXK_DOWN); } } else if( event.ControlDown() ) { if ( event.GetWheelRotation() > 0 ) { /* right */ SetView3D(WXK_RIGHT); } else { /* left */ SetView3D(WXK_LEFT); } } else { if ( event.GetWheelRotation() > 0 ) { g_Parm_3D_Visu.m_Zoom /= 1.4; if ( g_Parm_3D_Visu.m_Zoom <= 0.01) g_Parm_3D_Visu.m_Zoom = 0.01; } else g_Parm_3D_Visu.m_Zoom *= 1.4; DisplayStatus(); Refresh(FALSE); } } if (event.Dragging()) { Loading Loading @@ -582,6 +600,8 @@ bool fmt_is_jpeg = FALSE; ); if ( FullFileName.IsEmpty() ) return; } wxYield(); // Requested to allow tne window redraw after closing the dialog box wxSize image_size = GetClientSize(); wxClientDC dc(this); wxBitmap bitmap(image_size.x, image_size.y ); Loading
3d-viewer/3d_read_mesh.cpp +17 −14 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ int LineNum = 0; return -1; } // Switch the locale to standard C (needed to print floating point numbers like 1.3) setlocale(LC_NUMERIC, "C"); while ( GetLine(file, line, &LineNum, 512) ) { text = strtok(line, " \t\n\r"); Loading @@ -68,6 +70,7 @@ int LineNum = 0; } fclose (file); setlocale(LC_NUMERIC, ""); // revert to the current locale return 0; } Loading Loading @@ -130,44 +133,44 @@ S3D_Material * material = NULL; if ( stricmp (text, "diffuseColor") == 0 ) { text = strtok(NULL," \t\n\r"); material->m_DiffuseColor.x = atof(from_point(text)); material->m_DiffuseColor.x = atof(text); text = strtok(NULL," \t\n\r"); material->m_DiffuseColor.y = atof(from_point(text)); material->m_DiffuseColor.y = atof(text); text = strtok(NULL," \t\n\r"); material->m_DiffuseColor.z = atof(from_point(text)); material->m_DiffuseColor.z = atof(text); } else if ( stricmp (text, "emissiveColor") == 0 ) { text = strtok(NULL," \t\n\r"); material->m_EmissiveColor.x = atof(from_point(text)); material->m_EmissiveColor.x = atof(text); text = strtok(NULL," \t\n\r"); material->m_EmissiveColor.y = atof(from_point(text)); material->m_EmissiveColor.y = atof(text); text = strtok(NULL," \t\n\r"); material->m_EmissiveColor.z = atof(from_point(text)); material->m_EmissiveColor.z = atof(text); } else if ( strnicmp (text, "specularColor", 13 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_SpecularColor.x = atof(from_point(text)); material->m_SpecularColor.x = atof(text); text = strtok(NULL," \t\n\r"); material->m_SpecularColor.y = atof(from_point(text)); material->m_SpecularColor.y = atof(text); text = strtok(NULL," \t\n\r"); material->m_SpecularColor.z = atof(from_point(text)); material->m_SpecularColor.z = atof(text); } else if ( strnicmp (text, "ambientIntensity", 16 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_AmbientIntensity = atof(from_point(text)); material->m_AmbientIntensity = atof(text); } else if ( strnicmp (text, "transparency", 12 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_Transparency = atof(from_point(text)); material->m_Transparency = atof(text); } else if ( strnicmp (text, "shininess", 9 ) == 0 ) { text = strtok(NULL," \t\n\r"); material->m_Shininess = atof(from_point(text)); material->m_Shininess = atof(text); } } } Loading Loading @@ -323,7 +326,7 @@ char string_num[512]; case ',': jj = 0; if ( ! StartData || !HasData) break; data_list[ii] = atof(from_point(string_num)); data_list[ii] = atof(string_num); string_num[jj] = 0; ii++; if ( ii >= nn ) Loading Loading @@ -463,7 +466,7 @@ int * index = NULL; while ( text ) { if ( *text == ']') break; jj = atoi(from_point(text)); jj = atoi(text); if ( jj < 0 ) { S3D_Vertex * curr_coord = coords; Loading
3d-viewer/makefile.gtk +2 −1 Original line number Diff line number Diff line Loading @@ -4,7 +4,7 @@ CC = gcc # Compiler flags. CPPFLAGS = -Wall -O2 -DPCBNEW -I../pcbnew -I ../include -I../common\ `wx-config --cxxflags` `wx-config --cxxflags` -fno-strict-aliasing include ../libs.linux Loading @@ -23,6 +23,7 @@ $(TARGET).a: $(OBJECTS3D) makefile.gtk makefile.include ar -rv $@ $(OBJECTS3D) ranlib $@ install:$(TARGET).a clean: rm -f *.o Loading
3d-viewer/makefile.include +2 −8 Original line number Diff line number Diff line EXTRALIBS = EXTRACPPFLAGS= -I./ -I../include -I../common -I../pcbnew CPPFLAGS += $(EXTRACPPFLAGS) OBJECTS3D = 3d_frame.o 3d_read_mesh.o 3d_canvas.o trackball.o 3d_aux.o\ 3d_draw.o 3d_toolbar.o 3d_class.o OBJECTS= ../common/trigo.o AUXLIBS= -mthreads -o $(TARGET)$(DLLSUFF)\ $(WXLIB_BASE) $(LIBS3D)\ -lrpcrt4 -loleaut32 -lole32 -luuid -lwinspool -lwinmm\ -lshell32 -lcomctl32 -lcomdlg32 -lctl3d32 -ladvapi32 -lwsock32 -lgdi32 3d_class.o: 3d_class.cpp 3d_struct.h 3d_viewer.h 3d_read_mesh.o: 3d_read_mesh.cpp 3d_struct.h 3d_viewer.h Loading
3d-viewer/makefile.macosx +1 −0 Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ CC = gcc CPPFLAGS = -Wall -O2 -DPCBNEW -I../pcbnew -I ../include -I../common\ `wx-config --cxxflags` CPPFLAGS += -arch i386 -arch ppc include ../libs.macosx Loading