Changeset 3695 for trunk/packages
- Timestamp:
- Jun 16, 2013 9:47:15 PM (11 years ago)
- Location:
- trunk/packages/vizservers/vtkvis
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/vizservers/vtkvis/Arrow.cpp
r3683 r3695 40 40 41 41 vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); 42 normalFilter->SetFeatureAngle(90.); 42 43 normalFilter->SetInputConnection(_arrow->GetOutputPort()); 43 normalFilter->AutoOrientNormalsOff();44 44 45 45 _pdMapper->SetInputConnection(_arrow->GetOutputPort()); -
trunk/packages/vizservers/vtkvis/Cone.cpp
r3683 r3695 40 40 41 41 vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); 42 normalFilter->SetFeatureAngle(90.); 42 43 normalFilter->SetInputConnection(_cone->GetOutputPort()); 43 normalFilter->AutoOrientNormalsOff();44 44 45 45 _pdMapper->SetInputConnection(_cone->GetOutputPort()); -
trunk/packages/vizservers/vtkvis/Disk.cpp
r3683 r3695 41 41 vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); 42 42 normalFilter->SetInputConnection(_disk->GetOutputPort()); 43 normalFilter->AutoOrientNormalsOff();44 43 45 44 _pdMapper->SetInputConnection(normalFilter->GetOutputPort()); -
trunk/packages/vizservers/vtkvis/Glyphs.cpp
r3677 r3695 27 27 #include <vtkPolyDataMapper.h> 28 28 #include <vtkTransformPolyDataFilter.h> 29 #include <vtkPolyDataNormals.h> 29 30 30 31 #include "Glyphs.h" … … 104 105 // by the SourceTransform, so the lighting would be wrong 105 106 107 bool needsNormals = false; 108 double featureAngle = 90.; 109 106 110 switch (_glyphShape) { 107 111 case LINE: … … 113 117 arrow->SetTipResolution(8); 114 118 arrow->SetShaftResolution(8); 119 needsNormals = true; 115 120 } 116 121 break; … … 119 124 vtkSmartPointer<vtkConeSource> cone = vtkConeSource::SafeDownCast(_glyphSource); 120 125 cone->SetResolution(8); 126 needsNormals = true; 121 127 } 122 128 break; … … 138 144 _glyphSource = vtkSmartPointer<vtkPlatonicSolidSource>::New(); 139 145 vtkPlatonicSolidSource::SafeDownCast(_glyphSource)->SetSolidTypeToDodecahedron(); 146 needsNormals = true; 147 featureAngle = 30.; 140 148 break; 141 149 case ICOSAHEDRON: 142 150 _glyphSource = vtkSmartPointer<vtkPlatonicSolidSource>::New(); 143 151 vtkPlatonicSolidSource::SafeDownCast(_glyphSource)->SetSolidTypeToIcosahedron(); 152 needsNormals = true; 153 featureAngle = 30.; 144 154 break; 145 155 case OCTAHEDRON: 146 156 _glyphSource = vtkSmartPointer<vtkPlatonicSolidSource>::New(); 147 157 vtkPlatonicSolidSource::SafeDownCast(_glyphSource)->SetSolidTypeToOctahedron(); 158 needsNormals = true; 159 featureAngle = 30.; 148 160 break; 149 161 case POINT: … … 165 177 _glyphSource = vtkSmartPointer<vtkPlatonicSolidSource>::New(); 166 178 vtkPlatonicSolidSource::SafeDownCast(_glyphSource)->SetSolidTypeToTetrahedron(); 179 needsNormals = true; 180 featureAngle = 30.; 167 181 break; 168 182 default: … … 179 193 } 180 194 181 if (_glyphMapper != NULL) { 195 if (needsNormals && _glyphMapper != NULL) { 196 vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); 197 normalFilter->SetFeatureAngle(featureAngle); 198 normalFilter->SetInputConnection(_glyphSource->GetOutputPort()); 199 _glyphMapper->SetSourceConnection(normalFilter->GetOutputPort()); 200 } else if (_glyphMapper != NULL) { 182 201 _glyphMapper->SetSourceConnection(_glyphSource->GetOutputPort()); 183 202 } 184 185 //setQuality(0.8);186 203 } 187 204 … … 191 208 case ARROW: { 192 209 vtkSmartPointer<vtkArrowSource> arrow = vtkArrowSource::SafeDownCast(_glyphSource); 193 int res = (int)(quality * 25);194 if (res < 5) res = 5;210 int res = (int)(quality * 8.); 211 if (res < 3) res = 3; 195 212 arrow->SetTipResolution(res); 196 213 arrow->SetShaftResolution(res); … … 199 216 case CONE: { 200 217 vtkSmartPointer<vtkConeSource> cone = vtkConeSource::SafeDownCast(_glyphSource); 201 int res = (int)(quality * 25);202 if (res < 5) res = 5;218 int res = (int)(quality * 8.); 219 if (res < 3) res = 3; 203 220 cone->SetResolution(res); 221 } 222 break; 223 case CYLINDER: { 224 vtkSmartPointer<vtkCylinderSource> csource = 225 vtkCylinderSource::SafeDownCast(_glyphSource->GetInputAlgorithm(0, 0)); 226 if (csource == NULL) { 227 ERROR("Can't get cylinder glyph source"); 228 return; 229 } 230 int res = (int)(quality * 8.); 231 if (res < 3) res = 3; 232 csource->SetResolution(res); 204 233 } 205 234 break; 206 235 case SPHERE: { 207 236 vtkSmartPointer<vtkSphereSource> sphere = vtkSphereSource::SafeDownCast(_glyphSource); 208 int res = (int)(quality * 50); 209 if (res < 5) res = 5; 210 sphere->SetThetaResolution(res); 211 sphere->SetPhiResolution(res); 212 } 213 break; 214 case CYLINDER: { 215 assert(vtkTransformPolyDataFilter::SafeDownCast(_glyphSource) != NULL); 216 assert(vtkTransformPolyDataFilter::SafeDownCast(_glyphSource)->GetInputConnection(0, 0) != NULL); 217 vtkSmartPointer<vtkCylinderSource> csource = vtkCylinderSource::SafeDownCast(vtkTransformPolyDataFilter::SafeDownCast(_glyphSource)->GetInputConnection(0, 0)); 218 int res = (int)(quality * 25); 219 if (res < 5) res = 5; 220 csource->SetResolution(res); 237 int thetaRes = (int)(quality * 14.); 238 int phiRes = thetaRes; 239 if (thetaRes < 4) thetaRes = 4; 240 if (phiRes < 3) phiRes = 3; 241 242 sphere->SetThetaResolution(thetaRes); 243 sphere->SetPhiResolution(phiRes); 221 244 } 222 245 break; 223 246 default: 224 247 break; 248 } 249 if (_glyphMapper != NULL) { 250 _glyphMapper->Modified(); 251 _glyphMapper->Update(); 225 252 } 226 253 } -
trunk/packages/vizservers/vtkvis/Polygon.cpp
r3683 r3695 41 41 vtkSmartPointer<vtkPolyDataNormals> normalFilter = vtkSmartPointer<vtkPolyDataNormals>::New(); 42 42 normalFilter->SetInputConnection(_polygon->GetOutputPort()); 43 normalFilter->AutoOrientNormalsOff();44 43 45 44 _pdMapper->SetInputConnection(_polygon->GetOutputPort()); -
trunk/packages/vizservers/vtkvis/Renderer.h
r3693 r3695 679 679 void setGlyphsOrientMode(const DataSetId& id, bool state, const char *name); 680 680 681 void setGlyphsQuality(const DataSetId& id, double quality); 682 681 683 void setGlyphsColorMode(const DataSetId& id, 682 684 Glyphs::ColorMode mode, -
trunk/packages/vizservers/vtkvis/RendererCmd.cpp
r3693 r3695 5666 5666 5667 5667 static int 5668 GlyphsQualityOp(ClientData clientData, Tcl_Interp *interp, int objc, 5669 Tcl_Obj *const *objv) 5670 { 5671 double quality; 5672 if (Tcl_GetDoubleFromObj(interp, objv[2], &quality) != TCL_OK) { 5673 return TCL_ERROR; 5674 } 5675 if (objc == 4) { 5676 const char *name = Tcl_GetString(objv[3]); 5677 g_renderer->setGlyphsQuality(name, quality); 5678 } else { 5679 g_renderer->setGlyphsQuality("all", quality); 5680 } 5681 return TCL_OK; 5682 } 5683 5684 static int 5668 5685 GlyphsScaleOp(ClientData clientData, Tcl_Interp *interp, int objc, 5669 5686 Tcl_Obj *const *objv) … … 5825 5842 {"pos", 2, GlyphsPositionOp, 5, 6, "x y z ?dataSetName?"}, 5826 5843 {"ptsize", 2, GlyphsPointSizeOp, 3, 4, "size ?dataSetName?"}, 5844 {"quality", 1, GlyphsQualityOp, 3, 4, "val ?dataSetName?"}, 5827 5845 {"scale", 2, GlyphsScaleOp, 5, 6, "sx sy sz ?dataSetName?"}, 5828 5846 {"shape", 2, GlyphsShapeOp, 3, 4, "shapeVal ?dataSetName?"}, -
trunk/packages/vizservers/vtkvis/RendererGraphicsObjs.cpp
r3693 r3695 1618 1618 1619 1619 /** 1620 * \brief Set glyph shape resolution 1621 */ 1622 void Renderer::setGlyphsQuality(const DataSetId& id, double quality) 1623 { 1624 GlyphsHashmap::iterator itr; 1625 1626 bool doAll = false; 1627 1628 if (id.compare("all") == 0) { 1629 itr = _glyphs.begin(); 1630 if (itr == _glyphs.end()) 1631 return; 1632 doAll = true; 1633 } else { 1634 itr = _glyphs.find(id); 1635 } 1636 if (itr == _glyphs.end()) { 1637 ERROR("Glyphs not found: %s", id.c_str()); 1638 return; 1639 } 1640 1641 do { 1642 itr->second->setQuality(quality); 1643 } while (doAll && ++itr != _glyphs.end()); 1644 1645 sceneBoundsChanged(); 1646 _needsRedraw = true; 1647 } 1648 1649 /** 1620 1650 * \brief Set the shape of Glyphs for the given DataSet 1621 1651 */ … … 2298 2328 } 2299 2329 2300 2301 2330 /** 2302 2331 * \brief Set bond cylinder resolution … … 2328 2357 _needsRedraw = true; 2329 2358 } 2330 2331 2359 2332 2360 /**
Note: See TracChangeset
for help on using the changeset viewer.