Changeset 4973 for geovis/trunk
- Timestamp:
- Jan 31, 2015 11:27:43 PM (9 years ago)
- Location:
- geovis/trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
geovis/trunk/Renderer.cpp
r4957 r4973 736 736 skyOpts.atmosphericLighting() = true; 737 737 skyOpts.exposure() = 3.0; 738 osgEarth::Util::SkyNode *sky= osgEarth::Util::SkyNode::create(skyOpts, mapNode);739 sky->addChild(mapNode);740 sky->attach(_viewer.get(), 0);741 _sceneRoot = sky;738 _skyNode = osgEarth::Util::SkyNode::create(skyOpts, mapNode); 739 _skyNode->addChild(mapNode); 740 _skyNode->attach(_viewer.get(), 0); 741 _sceneRoot = _skyNode; 742 742 #else 743 743 _sceneRoot = new osg::Group(); … … 745 745 746 746 TRACE("Creating SkyNode"); 747 osgEarth::Util::SkyNode *sky= new osgEarth::Util::SkyNode(map);748 _sceneRoot->addChild( sky);749 sky->setAmbientBrightness(0.2f);750 sky->setDateTime(now);751 sky->attach(_viewer.get(), 0);747 _skyNode = new osgEarth::Util::SkyNode(map); 748 _sceneRoot->addChild(_skyNode.get()); 749 _skyNode->setAmbientBrightness(0.2f); 750 _skyNode->setDateTime(now); 751 _skyNode->attach(_viewer.get(), 0); 752 752 #endif 753 753 } else { … … 811 811 } 812 812 _verticalScale->setScale(scale); 813 _needsRedraw = true; 814 } 815 } 816 817 void Renderer::setEphemerisTime(int year, int month, int day, double hours) 818 { 819 if (_skyNode.valid()) { 820 osgEarth::DateTime time(year, month, day, hours); 821 _skyNode->setDateTime(time); 813 822 _needsRedraw = true; 814 823 } -
geovis/trunk/Renderer.h
r4957 r4973 22 22 #include <osgUtil/IncrementalCompileOperation> 23 23 24 #include <osgEarth/Version> 24 25 #include <osgEarth/StringUtils> 25 26 #include <osgEarth/Map> … … 33 34 #include <osgEarthAnnotation/AnnotationNode> 34 35 #include <osgEarthAnnotation/FeatureNode> 36 #if OSGEARTH_MIN_VERSION_REQUIRED(2, 5, 1) 37 #include <osgEarthUtil/Sky> 38 #else 39 #include <osgEarthUtil/SkyNode> 40 #endif 35 41 #include <osgEarthUtil/EarthManipulator> 36 42 #include <osgEarthUtil/MouseCoordsTool> … … 195 201 void setTerrainWireframe(bool state); 196 202 203 void setEphemerisTime(int year, int month, int day, double hours); 204 197 205 // Image raster layers 198 206 … … 517 525 osg::ref_ptr<osgEarth::MapNode> _mapNode; 518 526 osg::ref_ptr<osgEarth::Map> _map; 527 osg::ref_ptr<osgEarth::Util::SkyNode> _skyNode; 519 528 osg::ref_ptr<osgViewer::Viewer> _viewer; 520 529 osg::ref_ptr<ScreenCaptureCallback> _captureCallback; -
geovis/trunk/RendererCmd.cpp
r4957 r4973 1727 1727 } 1728 1728 1729 static int 1730 MapTimeOp(ClientData clientData, Tcl_Interp *interp, int objc, 1731 Tcl_Obj *const *objv) 1732 { 1733 osgEarth::DateTime now; 1734 int year, month, day; 1735 double hours; 1736 year = now.year(); 1737 month = now.month(); 1738 day = now.day(); 1739 hours = now.hours(); 1740 if (objc > 2) { 1741 if (Tcl_GetDoubleFromObj(interp, objv[2], &hours) != TCL_OK) { 1742 return TCL_ERROR; 1743 } 1744 } 1745 if (objc > 3) { 1746 if (Tcl_GetIntFromObj(interp, objv[3], &day) != TCL_OK) { 1747 return TCL_ERROR; 1748 } 1749 } 1750 if (objc > 4) { 1751 if (Tcl_GetIntFromObj(interp, objv[4], &month) != TCL_OK) { 1752 return TCL_ERROR; 1753 } 1754 } 1755 if (objc > 5) { 1756 if (Tcl_GetIntFromObj(interp, objv[5], &year) != TCL_OK) { 1757 return TCL_ERROR; 1758 } 1759 } 1760 1761 g_renderer->setEphemerisTime(year, month, day, hours); 1762 return TCL_OK; 1763 } 1764 1729 1765 static CmdSpec mapOps[] = { 1730 1766 {"box", 1, MapBoxOp, 3, 0, "op ?params..."}, … … 1739 1775 {"setpos", 1, MapSetPositionOp, 2, 4, "x y"}, 1740 1776 {"terrain", 1, MapTerrainOp, 3, 0, "op ?params...?"}, 1777 {"time", 1, MapTimeOp, 2, 6, "?hours? ?day? ?month? ?year?"}, 1741 1778 }; 1742 1779 static int nMapOps = NumCmdSpecs(mapOps); -
geovis/trunk/geovis_protocol.txt
r4957 r4973 206 206 Set scale factor for terrain height 207 207 map terrain wireframe <bool> 208 map time <?hours?> <?day?> <?month?> <?year?> 209 Set ephemeris time for sky. When args are omitted, set to current time. 210 Time is interpreted as server's local time. 208 211 209 212 ================================================================================
Note: See TracChangeset
for help on using the changeset viewer.