├── CMakeLists.txt ├── examples ├── CMakeLists.txt ├── demo_computed │ ├── CMakeLists.txt │ └── computedmain.cpp ├── demo_textured │ ├── CMakeLists.txt │ └── texturedmain.cpp └── skybox │ ├── CMakeLists.txt │ ├── abstracthimmelscene.cpp │ ├── abstracthimmelscene.h │ ├── gui │ ├── collapsibledockwidget.cpp │ ├── collapsibledockwidget.h │ ├── datetimewidget.cpp │ ├── datetimewidget.h │ ├── datetimewidget.ui │ ├── docktitlebarwidget.cpp │ ├── docktitlebarwidget.h │ ├── docktitlebarwidget.ui │ ├── glsleditor.cpp │ ├── glsleditor.h │ ├── glsleditor.ui │ ├── glslhighlighter.cpp │ ├── glslhighlighter.h │ ├── glsltextedit.cpp │ ├── glsltextedit.h │ ├── linenumberarea.cpp │ ├── linenumberarea.h │ ├── logoutputlabel.cpp │ ├── logoutputlabel.h │ ├── logoutputwidget.cpp │ ├── logoutputwidget.h │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── mainwindow.ui │ ├── plaintextwithlinenumberareasupport.h │ ├── propertywidget.cpp │ ├── propertywidget.h │ ├── qosgeventhandler.cpp │ ├── qosgeventhandler.h │ ├── qosgviewer.cpp │ ├── qosgviewer.h │ ├── qosgwidget.cpp │ └── qosgwidget.h │ ├── mainlogdispatcher.cpp │ ├── mainlogdispatcher.h │ ├── qtpropertybrowser │ ├── CMakeLists.txt │ ├── QtAbstractEditorFactoryBase │ ├── QtAbstractPropertyBrowser │ ├── QtAbstractPropertyManager │ ├── QtBoolPropertyManager │ ├── QtBrowserItem │ ├── QtButtonPropertyBrowser │ ├── QtCharEditorFactory │ ├── QtCharPropertyManager │ ├── QtCheckBoxFactory │ ├── QtColorEditorFactory │ ├── QtColorPropertyManager │ ├── QtCursorEditorFactory │ ├── QtCursorPropertyManager │ ├── QtDateEditFactory │ ├── QtDatePropertyManager │ ├── QtDateTimeEditFactory │ ├── QtDateTimePropertyManager │ ├── QtDoublePropertyManager │ ├── QtDoubleSpinBoxFactory │ ├── QtEnumEditorFactory │ ├── QtEnumPropertyManager │ ├── QtFlagPropertyManager │ ├── QtFontEditorFactory │ ├── QtFontPropertyManager │ ├── QtGroupBoxPropertyBrowser │ ├── QtGroupPropertyManager │ ├── QtIntPropertyManager │ ├── QtKeySequenceEditorFactory │ ├── QtKeySequencePropertyManager │ ├── QtLineEditFactory │ ├── QtLocalePropertyManager │ ├── QtPointFPropertyManager │ ├── QtPointPropertyManager │ ├── QtProperty │ ├── QtRectFPropertyManager │ ├── QtRectPropertyManager │ ├── QtScrollBarFactory │ ├── QtSizeFPropertyManager │ ├── QtSizePolicyPropertyManager │ ├── QtSizePropertyManager │ ├── QtSliderFactory │ ├── QtSpinBoxFactory │ ├── QtStringPropertyManager │ ├── QtTimeEditFactory │ ├── QtTimePropertyManager │ ├── QtTreePropertyBrowser │ ├── QtVariantEditorFactory │ ├── QtVariantProperty │ ├── QtVariantPropertyManager │ ├── qtbuttonpropertybrowser.cpp │ ├── qtbuttonpropertybrowser.h │ ├── qteditorfactory.cpp │ ├── qteditorfactory.h │ ├── qtgroupboxpropertybrowser.cpp │ ├── qtgroupboxpropertybrowser.h │ ├── qtpropertybrowser.cpp │ ├── qtpropertybrowser.h │ ├── qtpropertybrowser.pri │ ├── qtpropertybrowser.qrc │ ├── qtpropertybrowserutils.cpp │ ├── qtpropertybrowserutils_p.h │ ├── qtpropertymanager.cpp │ ├── qtpropertymanager.h │ ├── qttreepropertybrowser.cpp │ ├── qttreepropertybrowser.h │ ├── qtvariantproperty.cpp │ └── qtvariantproperty.h │ ├── scenes │ ├── scene_cubemappedhimmel.cpp │ ├── scene_cubemappedhimmel.h │ ├── scene_paraboloidmappedhimmel.cpp │ ├── scene_paraboloidmappedhimmel.h │ ├── scene_polarmappedhimmel.cpp │ ├── scene_polarmappedhimmel.h │ ├── scene_proceduralhimmel.cpp │ ├── scene_proceduralhimmel.h │ ├── scene_spheremappedhimmel.cpp │ └── scene_spheremappedhimmel.h │ ├── skyboxmain.cpp │ └── utils │ ├── abstractfactory.hpp │ ├── abstractpropertysupport.cpp │ ├── abstractpropertysupport.h │ ├── glslsyntax.hpp │ ├── glsltypes.h │ ├── import.cpp │ ├── import.h │ ├── log.cpp │ ├── log.h │ ├── qt2osg.cpp │ ├── qt2osg.h │ ├── shadermodifier.cpp │ ├── shadermodifier.h │ └── tr.h ├── include └── osgHimmel │ ├── abstractastronomy.h │ ├── abstracthimmel.h │ ├── abstractmappedhimmel.h │ ├── astronomy.h │ ├── astronomy2.h │ ├── atime.h │ ├── atmospheregeode.h │ ├── atmosphereprecompute.h │ ├── brightstars.h │ ├── cloudlayerhighgeode.h │ ├── coords.h │ ├── cubemappedhimmel.h │ ├── declspec.h │ ├── dubecloudlayergeode.h │ ├── earth.h │ ├── earth2.h │ ├── gaussianmapgenerator.h │ ├── highcloudlayergeode.h │ ├── himmel.h │ ├── himmelenvmap.h │ ├── himmeloverlay.h │ ├── himmelquad.h │ ├── horizonband.h │ ├── interpolate.h │ ├── julianday.h │ ├── mathmacros.h │ ├── moon.h │ ├── moon2.h │ ├── moongeode.h │ ├── moonglaregeode.h │ ├── noise.h │ ├── osgposter.h │ ├── paraboloidmappedhimmel.h │ ├── perlinmapgenerator.h │ ├── polarmappedhimmel.h │ ├── pragmanote.h │ ├── randommapgenerator.h │ ├── siderealtime.h │ ├── spheremappedhimmel.h │ ├── starmapgeode.h │ ├── stars.h │ ├── starsgeode.h │ ├── strutils.h │ ├── sun.h │ ├── sun2.h │ ├── timef.h │ ├── twounitschanger.h │ └── typedefs.h ├── src ├── CMakeLists.txt ├── abstractastronomy.cpp ├── abstracthimmel.cpp ├── abstractmappedhimmel.cpp ├── astronomy.cpp ├── astronomy2.cpp ├── atime.cpp ├── atmospheregeode.cpp ├── atmosphereprecompute.cpp ├── brightstars.cpp ├── cloudlayerhighgeode.cpp ├── coords.cpp ├── cubemappedhimmel.cpp ├── dubecloudlayergeode.cpp ├── earth.cpp ├── earth2.cpp ├── gaussianmapgenerator.cpp ├── highcloudlayergeode.cpp ├── himmel.cpp ├── himmelenvmap.cpp ├── himmeloverlay.cpp ├── himmelquad.cpp ├── horizonband.cpp ├── julianday.cpp ├── moon.cpp ├── moon2.cpp ├── moongeode.cpp ├── moonglaregeode.cpp ├── noise.cpp ├── osgposter.cpp ├── paraboloidmappedhimmel.cpp ├── perlinmapgenerator.cpp ├── polarmappedhimmel.cpp ├── randommapgenerator.cpp ├── shaderfragment │ ├── blend_difference.cpp │ ├── blend_difference.h │ ├── blend_lineardodge.cpp │ ├── blend_lineardodge.h │ ├── blend_multiply.cpp │ ├── blend_multiply.h │ ├── blend_normal.cpp │ ├── blend_normal.h │ ├── blend_screen.cpp │ ├── blend_screen.h │ ├── bruneton_common.cpp │ ├── bruneton_common.h │ ├── bruneton_inscatter.cpp │ ├── bruneton_inscatter.h │ ├── bruneton_irradiance.cpp │ ├── bruneton_irradiance.h │ ├── bruneton_transmittance.cpp │ ├── bruneton_transmittance.h │ ├── cloudlayer.cpp │ ├── cloudlayer.h │ ├── common.cpp │ ├── common.h │ ├── compose.h │ ├── dither.cpp │ ├── dither.h │ ├── fakesun.cpp │ ├── fakesun.h │ ├── hband.cpp │ ├── hband.h │ ├── noise.cpp │ ├── noise.h │ ├── pseudo_rand.cpp │ ├── pseudo_rand.h │ ├── scattering.cpp │ └── scattering.h ├── siderealtime.cpp ├── spheremappedhimmel.cpp ├── starmapgeode.cpp ├── stars.cpp ├── starsgeode.cpp ├── strutils.cpp ├── sun.cpp ├── sun2.cpp ├── timef.cpp └── twounitschanger.cpp └── tests ├── CMakeLists.txt ├── test.cpp ├── test.h ├── test_astronomy.cpp ├── test_astronomy.h ├── test_astronomy2.cpp ├── test_astronomy2.h ├── test_math.cpp ├── test_math.h ├── test_time.cpp ├── test_time.h ├── test_twounitschanger.cpp ├── test_twounitschanger.h └── tests.cpp /CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/CMakeLists.txt -------------------------------------------------------------------------------- /examples/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/CMakeLists.txt -------------------------------------------------------------------------------- /examples/demo_computed/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/demo_computed/CMakeLists.txt -------------------------------------------------------------------------------- /examples/demo_computed/computedmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/demo_computed/computedmain.cpp -------------------------------------------------------------------------------- /examples/demo_textured/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/demo_textured/CMakeLists.txt -------------------------------------------------------------------------------- /examples/demo_textured/texturedmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/demo_textured/texturedmain.cpp -------------------------------------------------------------------------------- /examples/skybox/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/CMakeLists.txt -------------------------------------------------------------------------------- /examples/skybox/abstracthimmelscene.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/abstracthimmelscene.cpp -------------------------------------------------------------------------------- /examples/skybox/abstracthimmelscene.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/abstracthimmelscene.h -------------------------------------------------------------------------------- /examples/skybox/gui/collapsibledockwidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/collapsibledockwidget.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/collapsibledockwidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/collapsibledockwidget.h -------------------------------------------------------------------------------- /examples/skybox/gui/datetimewidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/datetimewidget.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/datetimewidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/datetimewidget.h -------------------------------------------------------------------------------- /examples/skybox/gui/datetimewidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DateTimeWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 353 10 | 437 11 | 12 | 13 | 14 | DateTime and Location 15 | 16 | 17 | 18 | 19 | 20 | false 21 | 22 | 23 | 24 | 9 25 | 26 | 27 | 28 | 999°99'99'' A; 29 | 30 | 31 | 000°00'00'' E 32 | 33 | 34 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 35 | 36 | 37 | 38 | 39 | 40 | 41 | 2 42 | 43 | 44 | -13.000000000000000 45 | 46 | 47 | 13.000000000000000 48 | 49 | 50 | 51 | 52 | 53 | 54 | 1440 55 | 56 | 57 | 15 58 | 59 | 60 | true 61 | 62 | 63 | Qt::Horizontal 64 | 65 | 66 | QSlider::TicksAbove 67 | 68 | 69 | 60 70 | 71 | 72 | 73 | 74 | 75 | 76 | false 77 | 78 | 79 | 80 | 7 81 | 82 | 83 | 84 | ignore Daylight Saving Time 85 | 86 | 87 | 88 | 89 | 90 | 91 | &Cycle 92 | 93 | 94 | true 95 | 96 | 97 | 98 | 99 | 100 | 101 | false 102 | 103 | 104 | 105 | 9 106 | 107 | 108 | 109 | 99°99'99'' A; 110 | 111 | 112 | 00°00'00'' N 113 | 114 | 115 | Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 116 | 117 | 118 | 119 | 120 | 121 | 122 | Qt::Horizontal 123 | 124 | 125 | 126 | 127 | 128 | 129 | false 130 | 131 | 132 | &Preset: 133 | 134 | 135 | presetComboBox 136 | 137 | 138 | 139 | 140 | 141 | 142 | false 143 | 144 | 145 | L&ongitude: 146 | 147 | 148 | longitudeDoubleSpinBox 149 | 150 | 151 | 152 | 153 | 154 | 155 | &Offset to GMT: 156 | 157 | 158 | utcOffsetDoubleSpinBox 159 | 160 | 161 | 162 | 163 | 164 | 165 | Local Date&Time: 166 | 167 | 168 | dateTimeEdit 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | Qt::Horizontal 178 | 179 | 180 | 181 | 104 182 | 20 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | &Apply 191 | 192 | 193 | false 194 | 195 | 196 | true 197 | 198 | 199 | true 200 | 201 | 202 | 203 | 204 | 205 | 206 | Auto Apply 207 | 208 | 209 | true 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 0 220 | 0 221 | 222 | 223 | 224 | true 225 | 226 | 227 | s per Cycle 228 | 229 | 230 | 86400.000000000000000 231 | 232 | 233 | 234 | 235 | 236 | 237 | Qt::Vertical 238 | 239 | 240 | 241 | 20 242 | 40 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | false 251 | 252 | 253 | ° 254 | 255 | 256 | 4 257 | 258 | 259 | -180.000000000000000 260 | 261 | 262 | 180.000000000000000 263 | 264 | 265 | 266 | 267 | 268 | 269 | false 270 | 271 | 272 | L&atitude: 273 | 274 | 275 | latitudeDoubleSpinBox 276 | 277 | 278 | 279 | 280 | 281 | 282 | false 283 | 284 | 285 | ° 286 | 287 | 288 | 4 289 | 290 | 291 | -90.000000000000000 292 | 293 | 294 | 90.000000000000000 295 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 0 303 | 0 304 | 305 | 306 | 307 | 308 | 9 309 | 310 | 311 | 312 | dd.MM.yyyy HH:mm:ss 313 | 314 | 315 | true 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 0 324 | 0 325 | 326 | 327 | 328 | &Now 329 | 330 | 331 | 332 | 333 | 334 | 335 | false 336 | 337 | 338 | 339 | 340 | 341 | 342 | false 343 | 344 | 345 | &Altitude 346 | 347 | 348 | altitudeDoubleSpinBox 349 | 350 | 351 | 352 | 353 | 354 | 355 | false 356 | 357 | 358 | km 359 | 360 | 361 | 3 362 | 363 | 364 | 0.000000000000000 365 | 366 | 367 | 100.000000000000000 368 | 369 | 370 | 0.001000000000000 371 | 372 | 373 | 0.200000000000000 374 | 375 | 376 | 377 | 378 | 379 | 380 | latitudeDoubleSpinBox 381 | latitudeLineEdit 382 | longitudeDoubleSpinBox 383 | longitudeLineEdit 384 | presetComboBox 385 | autoApplyPushButton 386 | applyPushButton 387 | 388 | 389 | 390 | 391 | autoApplyPushButton 392 | toggled(bool) 393 | applyPushButton 394 | setDisabled(bool) 395 | 396 | 397 | 208 398 | 191 399 | 400 | 401 | 289 402 | 191 403 | 404 | 405 | 406 | 407 | 408 | -------------------------------------------------------------------------------- /examples/skybox/gui/docktitlebarwidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/docktitlebarwidget.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/docktitlebarwidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/docktitlebarwidget.h -------------------------------------------------------------------------------- /examples/skybox/gui/docktitlebarwidget.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | DockTitleBarWidget 4 | 5 | 6 | 7 | 0 8 | 0 9 | 355 10 | 22 11 | 12 | 13 | 14 | true 15 | 16 | 17 | QToolButton 18 | { 19 | margin-top: 1px; 20 | } 21 | 22 | 23 | 24 | 0 25 | 26 | 27 | 1 28 | 29 | 30 | 0 31 | 32 | 33 | 2 34 | 35 | 36 | 37 | 38 | true 39 | 40 | 41 | QFrame::Panel 42 | 43 | 44 | QFrame::Plain 45 | 46 | 47 | 48 | 1 49 | 50 | 51 | 4 52 | 53 | 54 | 1 55 | 56 | 57 | 0 58 | 59 | 60 | 0 61 | 62 | 63 | 64 | 65 | 66 | 16 67 | 16 68 | 69 | 70 | 71 | 72 | 16 73 | 16 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 2 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 15 96 | 15 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | true 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 15 115 | 15 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | true 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 15 134 | 15 135 | 136 | 137 | 138 | 139 | 140 | 141 | true 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | -------------------------------------------------------------------------------- /examples/skybox/gui/glsleditor.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/glsleditor.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/glsleditor.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/glsleditor.h -------------------------------------------------------------------------------- /examples/skybox/gui/glsleditor.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | GlslEditor 4 | 5 | 6 | 7 | 0 8 | 0 9 | 366 10 | 267 11 | 12 | 13 | 14 | GLSL-Editor 15 | 16 | 17 | 18 | 19 | 20 | 21 | 0 22 | 0 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | &Restore 31 | 32 | 33 | 34 | 35 | 36 | 37 | &Apply 38 | 39 | 40 | F5 41 | 42 | 43 | true 44 | 45 | 46 | 47 | 48 | 49 | 50 | QPlainTextEdit::NoWrap 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | GlslTextEdit 59 | QPlainTextEdit 60 |
gui/glsltextedit.h
61 |
62 |
63 | 64 | shaderComboBox 65 | glslTextEdit 66 | restorePushButton 67 | applyPushButton 68 | 69 | 70 | 71 |
72 | -------------------------------------------------------------------------------- /examples/skybox/gui/glslhighlighter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/glslhighlighter.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/glslhighlighter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/glslhighlighter.h -------------------------------------------------------------------------------- /examples/skybox/gui/glsltextedit.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/glsltextedit.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/glsltextedit.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/glsltextedit.h -------------------------------------------------------------------------------- /examples/skybox/gui/linenumberarea.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/linenumberarea.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/linenumberarea.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/linenumberarea.h -------------------------------------------------------------------------------- /examples/skybox/gui/logoutputlabel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/logoutputlabel.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/logoutputlabel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/logoutputlabel.h -------------------------------------------------------------------------------- /examples/skybox/gui/logoutputwidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/logoutputwidget.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/logoutputwidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/logoutputwidget.h -------------------------------------------------------------------------------- /examples/skybox/gui/mainwindow.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/mainwindow.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/mainwindow.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/mainwindow.h -------------------------------------------------------------------------------- /examples/skybox/gui/mainwindow.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | MainWindow 4 | 5 | 6 | 7 | 0 8 | 0 9 | 901 10 | 697 11 | 12 | 13 | 14 | 15 | true 16 | 17 | 18 | true 19 | 20 | 21 | 22 | 0 23 | 24 | 25 | 1 26 | 27 | 28 | 29 | 30 | 31 | 32 | 0 33 | 0 34 | 901 35 | 21 36 | 37 | 38 | 39 | true 40 | 41 | 42 | 43 | &Canvas 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | &Help 61 | 62 | 63 | 64 | 65 | 66 | &Debug 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | &Import... 81 | 82 | 83 | Ctrl+O 84 | 85 | 86 | 87 | 88 | true 89 | 90 | 91 | &Paint 92 | 93 | 94 | B 95 | 96 | 97 | 98 | 99 | true 100 | 101 | 102 | P&an 103 | 104 | 105 | H 106 | 107 | 108 | 109 | 110 | true 111 | 112 | 113 | Zoom &In 114 | 115 | 116 | Z 117 | 118 | 119 | 120 | 121 | true 122 | 123 | 124 | Zoom &Out 125 | 126 | 127 | Shift+Z 128 | 129 | 130 | 131 | 132 | &Actual Pixels 133 | 134 | 135 | Ctrl+0 136 | 137 | 138 | 139 | 140 | &About... 141 | 142 | 143 | 144 | 145 | &Preferences... 146 | 147 | 148 | 149 | 150 | &Quit 151 | 152 | 153 | Ctrl+Q 154 | 155 | 156 | 157 | 158 | af 159 | 160 | 161 | 162 | 163 | &Load Layout... 164 | 165 | 166 | 167 | 168 | &Save Current Layout 169 | 170 | 171 | 172 | 173 | Save Current Layout &As... 174 | 175 | 176 | 177 | 178 | false 179 | 180 | 181 | &Close 182 | 183 | 184 | Ctrl+W 185 | 186 | 187 | 188 | 189 | &Export... 190 | 191 | 192 | Ctrl+S 193 | 194 | 195 | 196 | 197 | &Save 198 | 199 | 200 | Ctrl+S 201 | 202 | 203 | 204 | 205 | true 206 | 207 | 208 | false 209 | 210 | 211 | &Erase 212 | 213 | 214 | E 215 | 216 | 217 | 218 | 219 | true 220 | 221 | 222 | Show &Original 223 | 224 | 225 | O 226 | 227 | 228 | 229 | 230 | true 231 | 232 | 233 | true 234 | 235 | 236 | Show &Result || Debug 237 | 238 | 239 | R 240 | 241 | 242 | 243 | 244 | true 245 | 246 | 247 | Show &Input Mask 248 | 249 | 250 | I 251 | 252 | 253 | 254 | 255 | true 256 | 257 | 258 | false 259 | 260 | 261 | Show &Supportive Layer 262 | 263 | 264 | 265 | 266 | df 267 | 268 | 269 | 270 | 271 | &Create new Brush... 272 | 273 | 274 | 275 | 276 | asd 277 | 278 | 279 | 280 | 281 | true 282 | 283 | 284 | &CubeMapped Himmel 285 | 286 | 287 | Ctrl+Shift+C 288 | 289 | 290 | 291 | 292 | true 293 | 294 | 295 | &PolarMapped Himmel 296 | 297 | 298 | Ctrl+Shift+P 299 | 300 | 301 | 302 | 303 | true 304 | 305 | 306 | &Procedural Himmel 307 | 308 | 309 | Ctrl+Alt+P 310 | 311 | 312 | 313 | 314 | &Insert 3D-Objects from File ... 315 | 316 | 317 | Ctrl+R 318 | 319 | 320 | 321 | 322 | Clea&r Scene 323 | 324 | 325 | Ctrl+W 326 | 327 | 328 | 329 | 330 | true 331 | 332 | 333 | Para&boloidMapped Himmel 334 | 335 | 336 | Ctrl+Shift+B 337 | 338 | 339 | 340 | 341 | &Sphere-Mapped Himmel 342 | 343 | 344 | Ctrl+Shift+S 345 | 346 | 347 | 348 | 349 | true 350 | 351 | 352 | false 353 | 354 | 355 | Camera Lock on &Moon 356 | 357 | 358 | Shift+M 359 | 360 | 361 | 362 | 363 | true 364 | 365 | 366 | false 367 | 368 | 369 | false 370 | 371 | 372 | Camera Lock on &Sun 373 | 374 | 375 | Shift+S 376 | 377 | 378 | 379 | 380 | true 381 | 382 | 383 | false 384 | 385 | 386 | Show Text Overlay 387 | 388 | 389 | 390 | 391 | Procedural Himmel with Clouds 392 | 393 | 394 | 395 | 396 | 397 | 398 | QOsgViewer 399 | QWidget 400 |
gui/qosgviewer.h
401 | 1 402 |
403 |
404 | 405 | 406 |
407 | -------------------------------------------------------------------------------- /examples/skybox/gui/plaintextwithlinenumberareasupport.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/plaintextwithlinenumberareasupport.h -------------------------------------------------------------------------------- /examples/skybox/gui/propertywidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/propertywidget.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/propertywidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/propertywidget.h -------------------------------------------------------------------------------- /examples/skybox/gui/qosgeventhandler.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/qosgeventhandler.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/qosgeventhandler.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/qosgeventhandler.h -------------------------------------------------------------------------------- /examples/skybox/gui/qosgviewer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/qosgviewer.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/qosgviewer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/qosgviewer.h -------------------------------------------------------------------------------- /examples/skybox/gui/qosgwidget.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/qosgwidget.cpp -------------------------------------------------------------------------------- /examples/skybox/gui/qosgwidget.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/gui/qosgwidget.h -------------------------------------------------------------------------------- /examples/skybox/mainlogdispatcher.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/mainlogdispatcher.cpp -------------------------------------------------------------------------------- /examples/skybox/mainlogdispatcher.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/mainlogdispatcher.h -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/qtpropertybrowser/CMakeLists.txt -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtAbstractEditorFactoryBase: -------------------------------------------------------------------------------- 1 | #include "qtpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtAbstractPropertyBrowser: -------------------------------------------------------------------------------- 1 | #include "qtpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtAbstractPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtBoolPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtBrowserItem: -------------------------------------------------------------------------------- 1 | #include "qtpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtButtonPropertyBrowser: -------------------------------------------------------------------------------- 1 | #include "qtbuttonpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtCharEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtCharPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtCheckBoxFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtColorEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtColorPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtCursorEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtCursorPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtDateEditFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtDatePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtDateTimeEditFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtDateTimePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtDoublePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtDoubleSpinBoxFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtEnumEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtEnumPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtFlagPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtFontEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtFontPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtGroupBoxPropertyBrowser: -------------------------------------------------------------------------------- 1 | #include "qtgroupboxpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtGroupPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtIntPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtKeySequenceEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtKeySequencePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtLineEditFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtLocalePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtPointFPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtPointPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtProperty: -------------------------------------------------------------------------------- 1 | #include "qtpropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtRectFPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtRectPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtScrollBarFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtSizeFPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtSizePolicyPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtSizePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtSliderFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtSpinBoxFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtStringPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtTimeEditFactory: -------------------------------------------------------------------------------- 1 | #include "qteditorfactory.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtTimePropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtpropertymanager.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtTreePropertyBrowser: -------------------------------------------------------------------------------- 1 | #include "qttreepropertybrowser.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtVariantEditorFactory: -------------------------------------------------------------------------------- 1 | #include "qtvariantproperty.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtVariantProperty: -------------------------------------------------------------------------------- 1 | #include "qtvariantproperty.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/QtVariantPropertyManager: -------------------------------------------------------------------------------- 1 | #include "qtvariantproperty.h" 2 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtbuttonpropertybrowser.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | #ifndef QTBUTTONPROPERTYBROWSER_H 42 | #define QTBUTTONPROPERTYBROWSER_H 43 | 44 | #include "qtpropertybrowser.h" 45 | 46 | #if QT_VERSION >= 0x040400 47 | QT_BEGIN_NAMESPACE 48 | #endif 49 | 50 | class QtButtonPropertyBrowserPrivate; 51 | 52 | class QT_QTPROPERTYBROWSER_EXPORT QtButtonPropertyBrowser : public QtAbstractPropertyBrowser 53 | { 54 | Q_OBJECT 55 | public: 56 | 57 | QtButtonPropertyBrowser(QWidget *parent = 0); 58 | ~QtButtonPropertyBrowser(); 59 | 60 | void setExpanded(QtBrowserItem *item, bool expanded); 61 | bool isExpanded(QtBrowserItem *item) const; 62 | 63 | Q_SIGNALS: 64 | 65 | void collapsed(QtBrowserItem *item); 66 | void expanded(QtBrowserItem *item); 67 | 68 | protected: 69 | virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem); 70 | virtual void itemRemoved(QtBrowserItem *item); 71 | virtual void itemChanged(QtBrowserItem *item); 72 | 73 | private: 74 | 75 | QtButtonPropertyBrowserPrivate *d_ptr; 76 | Q_DECLARE_PRIVATE(QtButtonPropertyBrowser) 77 | Q_DISABLE_COPY(QtButtonPropertyBrowser) 78 | Q_PRIVATE_SLOT(d_func(), void slotUpdate()) 79 | Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed()) 80 | Q_PRIVATE_SLOT(d_func(), void slotToggled(bool)) 81 | 82 | }; 83 | 84 | #if QT_VERSION >= 0x040400 85 | QT_END_NAMESPACE 86 | #endif 87 | 88 | #endif 89 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtgroupboxpropertybrowser.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | #ifndef QTGROUPBOXPROPERTYBROWSER_H 42 | #define QTGROUPBOXPROPERTYBROWSER_H 43 | 44 | #include "qtpropertybrowser.h" 45 | 46 | #if QT_VERSION >= 0x040400 47 | QT_BEGIN_NAMESPACE 48 | #endif 49 | 50 | class QtGroupBoxPropertyBrowserPrivate; 51 | 52 | class QT_QTPROPERTYBROWSER_EXPORT QtGroupBoxPropertyBrowser : public QtAbstractPropertyBrowser 53 | { 54 | Q_OBJECT 55 | public: 56 | 57 | QtGroupBoxPropertyBrowser(QWidget *parent = 0); 58 | ~QtGroupBoxPropertyBrowser(); 59 | 60 | protected: 61 | virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem); 62 | virtual void itemRemoved(QtBrowserItem *item); 63 | virtual void itemChanged(QtBrowserItem *item); 64 | 65 | private: 66 | 67 | QtGroupBoxPropertyBrowserPrivate *d_ptr; 68 | Q_DECLARE_PRIVATE(QtGroupBoxPropertyBrowser) 69 | Q_DISABLE_COPY(QtGroupBoxPropertyBrowser) 70 | Q_PRIVATE_SLOT(d_func(), void slotUpdate()) 71 | Q_PRIVATE_SLOT(d_func(), void slotEditorDestroyed()) 72 | 73 | }; 74 | 75 | #if QT_VERSION >= 0x040400 76 | QT_END_NAMESPACE 77 | #endif 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtpropertybrowser.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | #ifndef QTPROPERTYBROWSER_H 42 | #define QTPROPERTYBROWSER_H 43 | 44 | #include 45 | #include 46 | #include 47 | 48 | #if QT_VERSION >= 0x040400 49 | QT_BEGIN_NAMESPACE 50 | #endif 51 | 52 | #if defined(Q_WS_WIN) 53 | # if !defined(QT_QTPROPERTYBROWSER_EXPORT) && !defined(QT_QTPROPERTYBROWSER_IMPORT) 54 | # define QT_QTPROPERTYBROWSER_EXPORT 55 | # elif defined(QT_QTPROPERTYBROWSER_IMPORT) 56 | # if defined(QT_QTPROPERTYBROWSER_EXPORT) 57 | # undef QT_QTPROPERTYBROWSER_EXPORT 58 | # endif 59 | # define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllimport) 60 | # elif defined(QT_QTPROPERTYBROWSER_EXPORT) 61 | # undef QT_QTPROPERTYBROWSER_EXPORT 62 | # define QT_QTPROPERTYBROWSER_EXPORT __declspec(dllexport) 63 | # endif 64 | #else 65 | # undef QT_QTPROPERTYBROWSER_EXPORT 66 | # define QT_QTPROPERTYBROWSER_EXPORT 67 | #endif 68 | 69 | typedef QLineEdit::EchoMode EchoMode; 70 | 71 | class QtAbstractPropertyManager; 72 | class QtPropertyPrivate; 73 | 74 | class QT_QTPROPERTYBROWSER_EXPORT QtProperty 75 | { 76 | public: 77 | virtual ~QtProperty(); 78 | 79 | QList subProperties() const; 80 | 81 | QtAbstractPropertyManager *propertyManager() const; 82 | 83 | QString toolTip() const; 84 | QString statusTip() const; 85 | QString whatsThis() const; 86 | QString propertyName() const; 87 | bool isEnabled() const; 88 | bool isModified() const; 89 | 90 | bool hasValue() const; 91 | QIcon valueIcon() const; 92 | QString valueText() const; 93 | QString displayText() const; 94 | 95 | void setToolTip(const QString &text); 96 | void setStatusTip(const QString &text); 97 | void setWhatsThis(const QString &text); 98 | void setPropertyName(const QString &text); 99 | void setEnabled(bool enable); 100 | void setModified(bool modified); 101 | 102 | void addSubProperty(QtProperty *property); 103 | void insertSubProperty(QtProperty *property, QtProperty *afterProperty); 104 | void removeSubProperty(QtProperty *property); 105 | protected: 106 | explicit QtProperty(QtAbstractPropertyManager *manager); 107 | void propertyChanged(); 108 | private: 109 | friend class QtAbstractPropertyManager; 110 | QtPropertyPrivate *d_ptr; 111 | }; 112 | 113 | class QtAbstractPropertyManagerPrivate; 114 | 115 | class QT_QTPROPERTYBROWSER_EXPORT QtAbstractPropertyManager : public QObject 116 | { 117 | Q_OBJECT 118 | public: 119 | 120 | explicit QtAbstractPropertyManager(QObject *parent = 0); 121 | ~QtAbstractPropertyManager(); 122 | 123 | QSet properties() const; 124 | void clear() const; 125 | 126 | QtProperty *addProperty(const QString &name = QString()); 127 | Q_SIGNALS: 128 | 129 | void propertyInserted(QtProperty *property, 130 | QtProperty *parent, QtProperty *after); 131 | void propertyChanged(QtProperty *property); 132 | void propertyRemoved(QtProperty *property, QtProperty *parent); 133 | void propertyDestroyed(QtProperty *property); 134 | protected: 135 | virtual bool hasValue(const QtProperty *property) const; 136 | virtual QIcon valueIcon(const QtProperty *property) const; 137 | virtual QString valueText(const QtProperty *property) const; 138 | virtual QString displayText(const QtProperty *property) const; 139 | virtual EchoMode echoMode(const QtProperty *) const; 140 | virtual void initializeProperty(QtProperty *property) = 0; 141 | virtual void uninitializeProperty(QtProperty *property); 142 | virtual QtProperty *createProperty(); 143 | private: 144 | friend class QtProperty; 145 | QtAbstractPropertyManagerPrivate *d_ptr; 146 | Q_DECLARE_PRIVATE(QtAbstractPropertyManager) 147 | Q_DISABLE_COPY(QtAbstractPropertyManager) 148 | }; 149 | 150 | class QT_QTPROPERTYBROWSER_EXPORT QtAbstractEditorFactoryBase : public QObject 151 | { 152 | Q_OBJECT 153 | public: 154 | virtual QWidget *createEditor(QtProperty *property, QWidget *parent) = 0; 155 | protected: 156 | explicit QtAbstractEditorFactoryBase(QObject *parent = 0) 157 | : QObject(parent) {} 158 | 159 | virtual void breakConnection(QtAbstractPropertyManager *manager) = 0; 160 | protected Q_SLOTS: 161 | virtual void managerDestroyed(QObject *manager) = 0; 162 | 163 | friend class QtAbstractPropertyBrowser; 164 | }; 165 | 166 | template 167 | class QtAbstractEditorFactory : public QtAbstractEditorFactoryBase 168 | { 169 | public: 170 | explicit QtAbstractEditorFactory(QObject *parent) : QtAbstractEditorFactoryBase(parent) {} 171 | QWidget *createEditor(QtProperty *property, QWidget *parent) 172 | { 173 | QSetIterator it(m_managers); 174 | while (it.hasNext()) { 175 | PropertyManager *manager = it.next(); 176 | if (manager == property->propertyManager()) { 177 | return createEditor(manager, property, parent); 178 | } 179 | } 180 | return 0; 181 | } 182 | void addPropertyManager(PropertyManager *manager) 183 | { 184 | if (m_managers.contains(manager)) 185 | return; 186 | m_managers.insert(manager); 187 | connectPropertyManager(manager); 188 | connect(manager, SIGNAL(destroyed(QObject *)), 189 | this, SLOT(managerDestroyed(QObject *))); 190 | } 191 | void removePropertyManager(PropertyManager *manager) 192 | { 193 | if (!m_managers.contains(manager)) 194 | return; 195 | disconnect(manager, SIGNAL(destroyed(QObject *)), 196 | this, SLOT(managerDestroyed(QObject *))); 197 | disconnectPropertyManager(manager); 198 | m_managers.remove(manager); 199 | } 200 | QSet propertyManagers() const 201 | { 202 | return m_managers; 203 | } 204 | PropertyManager *propertyManager(QtProperty *property) const 205 | { 206 | QtAbstractPropertyManager *manager = property->propertyManager(); 207 | QSetIterator itManager(m_managers); 208 | while (itManager.hasNext()) { 209 | PropertyManager *m = itManager.next(); 210 | if (m == manager) { 211 | return m; 212 | } 213 | } 214 | return 0; 215 | } 216 | protected: 217 | virtual void connectPropertyManager(PropertyManager *manager) = 0; 218 | virtual QWidget *createEditor(PropertyManager *manager, QtProperty *property, 219 | QWidget *parent) = 0; 220 | virtual void disconnectPropertyManager(PropertyManager *manager) = 0; 221 | void managerDestroyed(QObject *manager) 222 | { 223 | QSetIterator it(m_managers); 224 | while (it.hasNext()) { 225 | PropertyManager *m = it.next(); 226 | if (m == manager) { 227 | m_managers.remove(m); 228 | return; 229 | } 230 | } 231 | } 232 | private: 233 | void breakConnection(QtAbstractPropertyManager *manager) 234 | { 235 | QSetIterator it(m_managers); 236 | while (it.hasNext()) { 237 | PropertyManager *m = it.next(); 238 | if (m == manager) { 239 | removePropertyManager(m); 240 | return; 241 | } 242 | } 243 | } 244 | private: 245 | QSet m_managers; 246 | friend class QtAbstractPropertyEditor; 247 | }; 248 | 249 | class QtAbstractPropertyBrowser; 250 | class QtBrowserItemPrivate; 251 | 252 | class QT_QTPROPERTYBROWSER_EXPORT QtBrowserItem 253 | { 254 | public: 255 | QtProperty *property() const; 256 | QtBrowserItem *parent() const; 257 | QList children() const; 258 | QtAbstractPropertyBrowser *browser() const; 259 | private: 260 | explicit QtBrowserItem(QtAbstractPropertyBrowser *browser, QtProperty *property, QtBrowserItem *parent); 261 | ~QtBrowserItem(); 262 | QtBrowserItemPrivate *d_ptr; 263 | friend class QtAbstractPropertyBrowserPrivate; 264 | }; 265 | 266 | class QtAbstractPropertyBrowserPrivate; 267 | 268 | class QT_QTPROPERTYBROWSER_EXPORT QtAbstractPropertyBrowser : public QWidget 269 | { 270 | Q_OBJECT 271 | public: 272 | 273 | explicit QtAbstractPropertyBrowser(QWidget *parent = 0); 274 | ~QtAbstractPropertyBrowser(); 275 | 276 | QList properties() const; 277 | QList items(QtProperty *property) const; 278 | QtBrowserItem *topLevelItem(QtProperty *property) const; 279 | QList topLevelItems() const; 280 | void clear(); 281 | 282 | template 283 | void setFactoryForManager(PropertyManager *manager, 284 | QtAbstractEditorFactory *factory) { 285 | QtAbstractPropertyManager *abstractManager = manager; 286 | QtAbstractEditorFactoryBase *abstractFactory = factory; 287 | 288 | if (addFactory(abstractManager, abstractFactory)) 289 | factory->addPropertyManager(manager); 290 | } 291 | 292 | void unsetFactoryForManager(QtAbstractPropertyManager *manager); 293 | 294 | QtBrowserItem *currentItem() const; 295 | void setCurrentItem(QtBrowserItem *); 296 | 297 | Q_SIGNALS: 298 | void currentItemChanged(QtBrowserItem *); 299 | 300 | public Q_SLOTS: 301 | 302 | QtBrowserItem *addProperty(QtProperty *property); 303 | QtBrowserItem *insertProperty(QtProperty *property, QtProperty *afterProperty); 304 | void removeProperty(QtProperty *property); 305 | 306 | protected: 307 | 308 | virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem) = 0; 309 | virtual void itemRemoved(QtBrowserItem *item) = 0; 310 | // can be tooltip, statustip, whatsthis, name, icon, text. 311 | virtual void itemChanged(QtBrowserItem *item) = 0; 312 | 313 | virtual QWidget *createEditor(QtProperty *property, QWidget *parent); 314 | private: 315 | 316 | bool addFactory(QtAbstractPropertyManager *abstractManager, 317 | QtAbstractEditorFactoryBase *abstractFactory); 318 | 319 | QtAbstractPropertyBrowserPrivate *d_ptr; 320 | Q_DECLARE_PRIVATE(QtAbstractPropertyBrowser) 321 | Q_DISABLE_COPY(QtAbstractPropertyBrowser) 322 | Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, 323 | QtProperty *, QtProperty *)) 324 | Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, 325 | QtProperty *)) 326 | Q_PRIVATE_SLOT(d_func(), void slotPropertyDestroyed(QtProperty *)) 327 | Q_PRIVATE_SLOT(d_func(), void slotPropertyDataChanged(QtProperty *)) 328 | 329 | }; 330 | 331 | #if QT_VERSION >= 0x040400 332 | QT_END_NAMESPACE 333 | #endif 334 | 335 | #endif // QTPROPERTYBROWSER_H 336 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtpropertybrowser.pri: -------------------------------------------------------------------------------- 1 | include(../common.pri) 2 | INCLUDEPATH += $$PWD 3 | DEPENDPATH += $$PWD 4 | 5 | qtpropertybrowser-uselib:!qtpropertybrowser-buildlib { 6 | LIBS += -L$$QTPROPERTYBROWSER_LIBDIR -l$$QTPROPERTYBROWSER_LIBNAME 7 | } else { 8 | SOURCES += $$PWD/qtpropertybrowser.cpp \ 9 | $$PWD/qtpropertymanager.cpp \ 10 | $$PWD/qteditorfactory.cpp \ 11 | $$PWD/qtvariantproperty.cpp \ 12 | $$PWD/qttreepropertybrowser.cpp \ 13 | $$PWD/qtbuttonpropertybrowser.cpp \ 14 | $$PWD/qtgroupboxpropertybrowser.cpp \ 15 | $$PWD/qtpropertybrowserutils.cpp 16 | HEADERS += $$PWD/qtpropertybrowser.h \ 17 | $$PWD/qtpropertymanager.h \ 18 | $$PWD/qteditorfactory.h \ 19 | $$PWD/qtvariantproperty.h \ 20 | $$PWD/qttreepropertybrowser.h \ 21 | $$PWD/qtbuttonpropertybrowser.h \ 22 | $$PWD/qtgroupboxpropertybrowser.h \ 23 | $$PWD/qtpropertybrowserutils_p.h 24 | RESOURCES += $$PWD/qtpropertybrowser.qrc 25 | } 26 | 27 | win32 { 28 | contains(TEMPLATE, lib):contains(CONFIG, shared):DEFINES += QT_QTPROPERTYBROWSER_EXPORT 29 | else:qtpropertybrowser-uselib:DEFINES += QT_QTPROPERTYBROWSER_IMPORT 30 | } 31 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtpropertybrowser.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtpropertybrowserutils_p.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | // 42 | // W A R N I N G 43 | // ------------- 44 | // 45 | // This file is not part of the Qt API. It exists for the convenience 46 | // of Qt Designer. This header 47 | // file may change from version to version without notice, or even be removed. 48 | // 49 | // We mean it. 50 | // 51 | 52 | #ifndef QTPROPERTYBROWSERUTILS_H 53 | #define QTPROPERTYBROWSERUTILS_H 54 | 55 | #include 56 | #include 57 | #include 58 | #include 59 | 60 | #if QT_VERSION >= 0x040400 61 | QT_BEGIN_NAMESPACE 62 | #endif 63 | 64 | class QMouseEvent; 65 | class QCheckBox; 66 | class QLineEdit; 67 | 68 | class QtCursorDatabase 69 | { 70 | public: 71 | QtCursorDatabase(); 72 | 73 | QStringList cursorShapeNames() const; 74 | QMap cursorShapeIcons() const; 75 | QString cursorToShapeName(const QCursor &cursor) const; 76 | QIcon cursorToShapeIcon(const QCursor &cursor) const; 77 | int cursorToValue(const QCursor &cursor) const; 78 | #ifndef QT_NO_CURSOR 79 | QCursor valueToCursor(int value) const; 80 | #endif 81 | private: 82 | void appendCursor(Qt::CursorShape shape, const QString &name, const QIcon &icon); 83 | QStringList m_cursorNames; 84 | QMap m_cursorIcons; 85 | QMap m_valueToCursorShape; 86 | QMap m_cursorShapeToValue; 87 | }; 88 | 89 | class QtPropertyBrowserUtils 90 | { 91 | public: 92 | static QPixmap brushValuePixmap(const QBrush &b); 93 | static QIcon brushValueIcon(const QBrush &b); 94 | static QString colorValueText(const QColor &c); 95 | static QPixmap fontValuePixmap(const QFont &f); 96 | static QIcon fontValueIcon(const QFont &f); 97 | static QString fontValueText(const QFont &f); 98 | }; 99 | 100 | class QtBoolEdit : public QWidget { 101 | Q_OBJECT 102 | public: 103 | QtBoolEdit(QWidget *parent = 0); 104 | 105 | bool textVisible() const { return m_textVisible; } 106 | void setTextVisible(bool textVisible); 107 | 108 | Qt::CheckState checkState() const; 109 | void setCheckState(Qt::CheckState state); 110 | 111 | bool isChecked() const; 112 | void setChecked(bool c); 113 | 114 | bool blockCheckBoxSignals(bool block); 115 | 116 | Q_SIGNALS: 117 | void toggled(bool); 118 | 119 | protected: 120 | void mousePressEvent(QMouseEvent * event); 121 | void paintEvent(QPaintEvent *); 122 | 123 | private: 124 | QCheckBox *m_checkBox; 125 | bool m_textVisible; 126 | }; 127 | 128 | class QtKeySequenceEdit : public QWidget 129 | { 130 | Q_OBJECT 131 | public: 132 | QtKeySequenceEdit(QWidget *parent = 0); 133 | 134 | QKeySequence keySequence() const; 135 | bool eventFilter(QObject *o, QEvent *e); 136 | public Q_SLOTS: 137 | void setKeySequence(const QKeySequence &sequence); 138 | Q_SIGNALS: 139 | void keySequenceChanged(const QKeySequence &sequence); 140 | protected: 141 | void focusInEvent(QFocusEvent *e); 142 | void focusOutEvent(QFocusEvent *e); 143 | void keyPressEvent(QKeyEvent *e); 144 | void keyReleaseEvent(QKeyEvent *e); 145 | void paintEvent(QPaintEvent *); 146 | bool event(QEvent *e); 147 | private slots: 148 | void slotClearShortcut(); 149 | private: 150 | void handleKeyEvent(QKeyEvent *e); 151 | int translateModifiers(Qt::KeyboardModifiers state, const QString &text) const; 152 | 153 | int m_num; 154 | QKeySequence m_keySequence; 155 | QLineEdit *m_lineEdit; 156 | }; 157 | 158 | #if QT_VERSION >= 0x040400 159 | QT_END_NAMESPACE 160 | #endif 161 | 162 | #endif 163 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qttreepropertybrowser.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | #ifndef QTTREEPROPERTYBROWSER_H 42 | #define QTTREEPROPERTYBROWSER_H 43 | 44 | #include "qtpropertybrowser.h" 45 | 46 | #if QT_VERSION >= 0x040400 47 | QT_BEGIN_NAMESPACE 48 | #endif 49 | 50 | class QTreeWidgetItem; 51 | class QtTreePropertyBrowserPrivate; 52 | 53 | class QT_QTPROPERTYBROWSER_EXPORT QtTreePropertyBrowser : public QtAbstractPropertyBrowser 54 | { 55 | Q_OBJECT 56 | Q_ENUMS(ResizeMode) 57 | Q_PROPERTY(int indentation READ indentation WRITE setIndentation) 58 | Q_PROPERTY(bool rootIsDecorated READ rootIsDecorated WRITE setRootIsDecorated) 59 | Q_PROPERTY(bool alternatingRowColors READ alternatingRowColors WRITE setAlternatingRowColors) 60 | Q_PROPERTY(bool headerVisible READ isHeaderVisible WRITE setHeaderVisible) 61 | Q_PROPERTY(ResizeMode resizeMode READ resizeMode WRITE setResizeMode) 62 | Q_PROPERTY(int splitterPosition READ splitterPosition WRITE setSplitterPosition) 63 | Q_PROPERTY(bool propertiesWithoutValueMarked READ propertiesWithoutValueMarked WRITE setPropertiesWithoutValueMarked) 64 | public: 65 | 66 | enum ResizeMode 67 | { 68 | Interactive, 69 | Stretch, 70 | Fixed, 71 | ResizeToContents 72 | }; 73 | 74 | QtTreePropertyBrowser(QWidget *parent = 0); 75 | ~QtTreePropertyBrowser(); 76 | 77 | int indentation() const; 78 | void setIndentation(int i); 79 | 80 | bool rootIsDecorated() const; 81 | void setRootIsDecorated(bool show); 82 | 83 | bool alternatingRowColors() const; 84 | void setAlternatingRowColors(bool enable); 85 | 86 | bool isHeaderVisible() const; 87 | void setHeaderVisible(bool visible); 88 | 89 | ResizeMode resizeMode() const; 90 | void setResizeMode(ResizeMode mode); 91 | 92 | int splitterPosition() const; 93 | void setSplitterPosition(int position); 94 | 95 | void setExpanded(QtBrowserItem *item, bool expanded); 96 | bool isExpanded(QtBrowserItem *item) const; 97 | 98 | bool isItemVisible(QtBrowserItem *item) const; 99 | void setItemVisible(QtBrowserItem *item, bool visible); 100 | 101 | void setBackgroundColor(QtBrowserItem *item, const QColor &color); 102 | QColor backgroundColor(QtBrowserItem *item) const; 103 | QColor calculatedBackgroundColor(QtBrowserItem *item) const; 104 | 105 | void setPropertiesWithoutValueMarked(bool mark); 106 | bool propertiesWithoutValueMarked() const; 107 | 108 | void editItem(QtBrowserItem *item); 109 | 110 | Q_SIGNALS: 111 | 112 | void collapsed(QtBrowserItem *item); 113 | void expanded(QtBrowserItem *item); 114 | 115 | protected: 116 | virtual void itemInserted(QtBrowserItem *item, QtBrowserItem *afterItem); 117 | virtual void itemRemoved(QtBrowserItem *item); 118 | virtual void itemChanged(QtBrowserItem *item); 119 | 120 | private: 121 | 122 | QtTreePropertyBrowserPrivate *d_ptr; 123 | Q_DECLARE_PRIVATE(QtTreePropertyBrowser) 124 | Q_DISABLE_COPY(QtTreePropertyBrowser) 125 | 126 | Q_PRIVATE_SLOT(d_func(), void slotCollapsed(const QModelIndex &)) 127 | Q_PRIVATE_SLOT(d_func(), void slotExpanded(const QModelIndex &)) 128 | Q_PRIVATE_SLOT(d_func(), void slotCurrentBrowserItemChanged(QtBrowserItem *)) 129 | Q_PRIVATE_SLOT(d_func(), void slotCurrentTreeItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)) 130 | 131 | }; 132 | 133 | #if QT_VERSION >= 0x040400 134 | QT_END_NAMESPACE 135 | #endif 136 | 137 | #endif 138 | -------------------------------------------------------------------------------- /examples/skybox/qtpropertybrowser/qtvariantproperty.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** 3 | ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). 4 | ** All rights reserved. 5 | ** 6 | ** Contact: Nokia Corporation (qt-info@nokia.com) 7 | ** 8 | ** This file is part of a Qt Solutions component. 9 | ** 10 | ** You may use this file under the terms of the BSD license as follows: 11 | ** 12 | ** "Redistribution and use in source and binary forms, with or without 13 | ** modification, are permitted provided that the following conditions are 14 | ** met: 15 | ** * Redistributions of source code must retain the above copyright 16 | ** notice, this list of conditions and the following disclaimer. 17 | ** * Redistributions in binary form must reproduce the above copyright 18 | ** notice, this list of conditions and the following disclaimer in 19 | ** the documentation and/or other materials provided with the 20 | ** distribution. 21 | ** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor 22 | ** the names of its contributors may be used to endorse or promote 23 | ** products derived from this software without specific prior written 24 | ** permission. 25 | ** 26 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 27 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 28 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 29 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 30 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 31 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 32 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 33 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 34 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 35 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 36 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." 37 | ** 38 | ****************************************************************************/ 39 | 40 | 41 | #ifndef QTVARIANTPROPERTY_H 42 | #define QTVARIANTPROPERTY_H 43 | 44 | #include "qtpropertybrowser.h" 45 | #include 46 | #include 47 | 48 | #if QT_VERSION >= 0x040400 49 | QT_BEGIN_NAMESPACE 50 | #endif 51 | 52 | typedef QMap QtIconMap; 53 | 54 | class QtVariantPropertyManager; 55 | class QtVariantPropertyPrivate; 56 | 57 | class QT_QTPROPERTYBROWSER_EXPORT QtVariantProperty : public QtProperty 58 | { 59 | public: 60 | ~QtVariantProperty(); 61 | QVariant value() const; 62 | QVariant attributeValue(const QString &attribute) const; 63 | int valueType() const; 64 | int propertyType() const; 65 | 66 | void setValue(const QVariant &value); 67 | void setAttribute(const QString &attribute, const QVariant &value); 68 | protected: 69 | QtVariantProperty(QtVariantPropertyManager *manager); 70 | private: 71 | friend class QtVariantPropertyManager; 72 | QtVariantPropertyPrivate *d_ptr; 73 | }; 74 | 75 | class QtVariantPropertyManagerPrivate; 76 | 77 | class QT_QTPROPERTYBROWSER_EXPORT QtVariantPropertyManager : public QtAbstractPropertyManager 78 | { 79 | Q_OBJECT 80 | public: 81 | QtVariantPropertyManager(QObject *parent = 0); 82 | ~QtVariantPropertyManager(); 83 | 84 | virtual QtVariantProperty *addProperty(int propertyType, const QString &name = QString()); 85 | 86 | int propertyType(const QtProperty *property) const; 87 | int valueType(const QtProperty *property) const; 88 | QtVariantProperty *variantProperty(const QtProperty *property) const; 89 | 90 | virtual bool isPropertyTypeSupported(int propertyType) const; 91 | virtual int valueType(int propertyType) const; 92 | virtual QStringList attributes(int propertyType) const; 93 | virtual int attributeType(int propertyType, const QString &attribute) const; 94 | 95 | virtual QVariant value(const QtProperty *property) const; 96 | virtual QVariant attributeValue(const QtProperty *property, const QString &attribute) const; 97 | 98 | static int enumTypeId(); 99 | static int flagTypeId(); 100 | static int groupTypeId(); 101 | static int iconMapTypeId(); 102 | public Q_SLOTS: 103 | virtual void setValue(QtProperty *property, const QVariant &val); 104 | virtual void setAttribute(QtProperty *property, 105 | const QString &attribute, const QVariant &value); 106 | Q_SIGNALS: 107 | void valueChanged(QtProperty *property, const QVariant &val); 108 | void attributeChanged(QtProperty *property, 109 | const QString &attribute, const QVariant &val); 110 | protected: 111 | virtual bool hasValue(const QtProperty *property) const; 112 | QString valueText(const QtProperty *property) const; 113 | QIcon valueIcon(const QtProperty *property) const; 114 | virtual void initializeProperty(QtProperty *property); 115 | virtual void uninitializeProperty(QtProperty *property); 116 | virtual QtProperty *createProperty(); 117 | private: 118 | QtVariantPropertyManagerPrivate *d_ptr; 119 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, int)) 120 | Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, int, int)) 121 | Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, int)) 122 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, double)) 123 | Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, double, double)) 124 | Q_PRIVATE_SLOT(d_func(), void slotSingleStepChanged(QtProperty *, double)) 125 | Q_PRIVATE_SLOT(d_func(), void slotDecimalsChanged(QtProperty *, int)) 126 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, bool)) 127 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QString &)) 128 | Q_PRIVATE_SLOT(d_func(), void slotRegExpChanged(QtProperty *, const QRegExp &)) 129 | Q_PRIVATE_SLOT(d_func(), void slotEchoModeChanged(QtProperty *, int)) 130 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDate &)) 131 | Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QDate &, const QDate &)) 132 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QTime &)) 133 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QDateTime &)) 134 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QKeySequence &)) 135 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QChar &)) 136 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QLocale &)) 137 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPoint &)) 138 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QPointF &)) 139 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSize &)) 140 | Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSize &, const QSize &)) 141 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizeF &)) 142 | Q_PRIVATE_SLOT(d_func(), void slotRangeChanged(QtProperty *, const QSizeF &, const QSizeF &)) 143 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRect &)) 144 | Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRect &)) 145 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QRectF &)) 146 | Q_PRIVATE_SLOT(d_func(), void slotConstraintChanged(QtProperty *, const QRectF &)) 147 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QColor &)) 148 | Q_PRIVATE_SLOT(d_func(), void slotEnumNamesChanged(QtProperty *, const QStringList &)) 149 | Q_PRIVATE_SLOT(d_func(), void slotEnumIconsChanged(QtProperty *, const QMap &)) 150 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QSizePolicy &)) 151 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QFont &)) 152 | Q_PRIVATE_SLOT(d_func(), void slotValueChanged(QtProperty *, const QCursor &)) 153 | Q_PRIVATE_SLOT(d_func(), void slotFlagNamesChanged(QtProperty *, const QStringList &)) 154 | 155 | Q_PRIVATE_SLOT(d_func(), void slotPropertyInserted(QtProperty *, QtProperty *, QtProperty *)) 156 | Q_PRIVATE_SLOT(d_func(), void slotPropertyRemoved(QtProperty *, QtProperty *)) 157 | Q_DECLARE_PRIVATE(QtVariantPropertyManager) 158 | Q_DISABLE_COPY(QtVariantPropertyManager) 159 | }; 160 | 161 | class QtVariantEditorFactoryPrivate; 162 | 163 | class QT_QTPROPERTYBROWSER_EXPORT QtVariantEditorFactory : public QtAbstractEditorFactory 164 | { 165 | Q_OBJECT 166 | public: 167 | QtVariantEditorFactory(QObject *parent = 0); 168 | ~QtVariantEditorFactory(); 169 | protected: 170 | void connectPropertyManager(QtVariantPropertyManager *manager); 171 | QWidget *createEditor(QtVariantPropertyManager *manager, QtProperty *property, 172 | QWidget *parent); 173 | void disconnectPropertyManager(QtVariantPropertyManager *manager); 174 | private: 175 | QtVariantEditorFactoryPrivate *d_ptr; 176 | Q_DECLARE_PRIVATE(QtVariantEditorFactory) 177 | Q_DISABLE_COPY(QtVariantEditorFactory) 178 | }; 179 | 180 | #if QT_VERSION >= 0x040400 181 | QT_END_NAMESPACE 182 | #endif 183 | 184 | Q_DECLARE_METATYPE(QIcon) 185 | Q_DECLARE_METATYPE(QtIconMap) 186 | #endif 187 | -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_cubemappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_cubemappedhimmel.cpp -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_cubemappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_cubemappedhimmel.h -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_paraboloidmappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_paraboloidmappedhimmel.cpp -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_paraboloidmappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_paraboloidmappedhimmel.h -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_polarmappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_polarmappedhimmel.cpp -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_polarmappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_polarmappedhimmel.h -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_proceduralhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_proceduralhimmel.cpp -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_proceduralhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_proceduralhimmel.h -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_spheremappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_spheremappedhimmel.cpp -------------------------------------------------------------------------------- /examples/skybox/scenes/scene_spheremappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/scenes/scene_spheremappedhimmel.h -------------------------------------------------------------------------------- /examples/skybox/skyboxmain.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/skyboxmain.cpp -------------------------------------------------------------------------------- /examples/skybox/utils/abstractfactory.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/abstractfactory.hpp -------------------------------------------------------------------------------- /examples/skybox/utils/abstractpropertysupport.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/abstractpropertysupport.cpp -------------------------------------------------------------------------------- /examples/skybox/utils/abstractpropertysupport.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/abstractpropertysupport.h -------------------------------------------------------------------------------- /examples/skybox/utils/glslsyntax.hpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/glslsyntax.hpp -------------------------------------------------------------------------------- /examples/skybox/utils/glsltypes.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/glsltypes.h -------------------------------------------------------------------------------- /examples/skybox/utils/import.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/import.cpp -------------------------------------------------------------------------------- /examples/skybox/utils/import.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/import.h -------------------------------------------------------------------------------- /examples/skybox/utils/log.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/log.cpp -------------------------------------------------------------------------------- /examples/skybox/utils/log.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/log.h -------------------------------------------------------------------------------- /examples/skybox/utils/qt2osg.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/qt2osg.cpp -------------------------------------------------------------------------------- /examples/skybox/utils/qt2osg.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/qt2osg.h -------------------------------------------------------------------------------- /examples/skybox/utils/shadermodifier.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/shadermodifier.cpp -------------------------------------------------------------------------------- /examples/skybox/utils/shadermodifier.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/shadermodifier.h -------------------------------------------------------------------------------- /examples/skybox/utils/tr.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/examples/skybox/utils/tr.h -------------------------------------------------------------------------------- /include/osgHimmel/abstractastronomy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/abstractastronomy.h -------------------------------------------------------------------------------- /include/osgHimmel/abstracthimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/abstracthimmel.h -------------------------------------------------------------------------------- /include/osgHimmel/abstractmappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/abstractmappedhimmel.h -------------------------------------------------------------------------------- /include/osgHimmel/astronomy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/astronomy.h -------------------------------------------------------------------------------- /include/osgHimmel/astronomy2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/astronomy2.h -------------------------------------------------------------------------------- /include/osgHimmel/atime.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/atime.h -------------------------------------------------------------------------------- /include/osgHimmel/atmospheregeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/atmospheregeode.h -------------------------------------------------------------------------------- /include/osgHimmel/atmosphereprecompute.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/atmosphereprecompute.h -------------------------------------------------------------------------------- /include/osgHimmel/brightstars.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __BRIGHTSTARS_H__ 32 | #define __BRIGHTSTARS_H__ 33 | 34 | #include "declspec.h" 35 | 36 | 37 | namespace osgHimmel 38 | { 39 | 40 | // NOTE: Enabling this, slows down compilation a lot! 41 | //#define BRIGHTSTARS_INCLUDE_CATALOGUE 42 | 43 | class OSGH_API BrightStars 44 | { 45 | public: 46 | // Structure based on the extended bright star catalogue. 47 | 48 | struct s_BrightStar 49 | { 50 | float Vmag; // visual magnitude (mag) 51 | float RA; // right ascension (decimal hours) 52 | float DE; // declination (decimal degrees) 53 | float pmRA; // proper annual motion in right ascension (decimal hours) 54 | float pmDE; // proper annual motion in declination (decimal degrees) 55 | float sRGB_R; // approximated color, red value ]0;1[ 56 | float sRGB_G; // approximated color, green value ]0;1[ 57 | float sRGB_B; // approximated color, blue value ]0;1[ 58 | }; 59 | 60 | #ifdef BRIGHTSTARS_INCLUDE_CATALOGUE 61 | BrightStars(); 62 | #endif // BRIGHTSTARS_INCLUDE_CATALOGUE 63 | 64 | BrightStars(const char *fileName); 65 | ~BrightStars(); 66 | 67 | const s_BrightStar *stars() const; 68 | const unsigned int numStars() const; 69 | 70 | unsigned int fromFile(const char *fileName); 71 | unsigned int toFile(const char *fileName) const; 72 | 73 | protected: 74 | 75 | s_BrightStar *m_stars; 76 | unsigned int m_numStars; 77 | }; 78 | 79 | } // namespace osgHimmel 80 | 81 | #endif // __BRIGHTSTARS_H__ -------------------------------------------------------------------------------- /include/osgHimmel/cloudlayerhighgeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/cloudlayerhighgeode.h -------------------------------------------------------------------------------- /include/osgHimmel/coords.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __COORDS_H__ 32 | #define __COORDS_H__ 33 | 34 | #include "julianday.h" 35 | #include "pragmanote.h" 36 | 37 | #include 38 | 39 | namespace osgHimmel 40 | { 41 | 42 | // Explained in "Astronomical Algorithms" and http://en.wikipedia.org/wiki/Celestial_coordinate_system 43 | 44 | template 45 | struct s_EquatorialCoords; 46 | 47 | template 48 | struct s_EclipticalCoords; 49 | 50 | template 51 | struct s_HorizontalCoords; 52 | 53 | template 54 | struct s_GalacticCoords; 55 | 56 | 57 | // http://en.wikipedia.org/wiki/Equatorial_coordinate_system 58 | 59 | template 60 | struct s_EquatorialCoords 61 | { 62 | s_EquatorialCoords(); 63 | 64 | const s_EclipticalCoords toEcliptical(const T obliquity) const; 65 | 66 | const s_HorizontalCoords toHorizontal( 67 | const t_julianDay siderealTime /* θ_0 */ 68 | , const T observersLatitude /* Φ */ 69 | , const T observersLongitude /* L */) const; 70 | 71 | const osg::Vec3f toEuclidean() const; 72 | 73 | // Not required for now... 74 | //#pragma NOTE("const s_GalacticCoords toGalactic() const; not yet implemented") 75 | 76 | // Measures the angle (longitudinal) of an object east of the apparent 77 | // location of the center of the Sun at the moment of the vernal equinox. 78 | T right_ascension; // α 79 | 80 | // Measures the angle (latitudinal) of an object above or below the 81 | // celestial equator. Positive, if north of the celestial equator. 82 | T declination; // δ 83 | 84 | // Radial distance of this point to origin. 85 | T r; 86 | }; 87 | 88 | typedef s_EquatorialCoords t_equd; 89 | typedef s_EquatorialCoords t_equf; 90 | 91 | 92 | // http://en.wikipedia.org/wiki/Ecliptic_coordinate_system 93 | 94 | template 95 | struct s_EclipticalCoords 96 | { 97 | s_EclipticalCoords(); 98 | 99 | const s_EquatorialCoords toEquatorial(const T obliquity) const; 100 | 101 | 102 | // Ecliptical longitude. Measured from the vernal equinox along the ecliptic. 103 | T longitude; // l 104 | 105 | // Ecliptical latitude. Positive if north of the ecliptic. 106 | T latitude; // β 107 | }; 108 | 109 | typedef s_EclipticalCoords t_ecld; 110 | typedef s_EclipticalCoords t_eclf; 111 | 112 | 113 | 114 | // http://en.wikipedia.org/wiki/Horizontal_coordinate_system 115 | 116 | template 117 | struct s_HorizontalCoords 118 | { 119 | s_HorizontalCoords(); 120 | 121 | const s_EquatorialCoords toEquatorial( 122 | const t_julianDay siderealTime /* θ_0 */ 123 | , const T observersLatitude /* Φ */ 124 | , const T observersLongitude /* L */) const; 125 | 126 | const osg::Vec3f toEuclidean() const; 127 | 128 | // Measured westwards from the south. (longitudinal) 129 | T azimuth; // h 130 | 131 | // Positive above, negative below horizon. (latitudinal) 132 | T altitude; // A 133 | }; 134 | 135 | typedef s_HorizontalCoords t_hord; 136 | typedef s_HorizontalCoords t_horf; 137 | 138 | 139 | // Not required for now... 140 | 141 | //// http://en.wikipedia.org/wiki/Galactic_coordinate_system 142 | // 143 | //typedef struct s_GalacticCoords 144 | //{ 145 | // s_GalacticCoords(); 146 | // 147 | //#pragma NOTE("const s_EquatorialCoords toEquatorial() const; not yet implemented") 148 | // 149 | // t_longf longitude; // l 150 | // t_longf latitude; // b 151 | // 152 | //} t_galCoords; 153 | 154 | 155 | 156 | #include "mathmacros.h" 157 | 158 | #include 159 | 160 | template 161 | s_EquatorialCoords::s_EquatorialCoords() 162 | : right_ascension(0.0) 163 | , declination(0.0) 164 | , r(1.0) 165 | { 166 | } 167 | 168 | 169 | template 170 | s_EclipticalCoords::s_EclipticalCoords() 171 | : longitude(0.0) 172 | , latitude(0.0) 173 | { 174 | } 175 | 176 | 177 | template 178 | s_HorizontalCoords::s_HorizontalCoords() 179 | : azimuth(0.0) 180 | , altitude(0.0) 181 | { 182 | } 183 | 184 | 185 | //s_GalacticCoords::s_GalacticCoords() 186 | //: longitude(0.0) 187 | //, latitude(0.0) 188 | //{ 189 | //} 190 | 191 | 192 | 193 | // To remove 180° ambiquity, atan2 is applied ("Astronomical Algorithms") 194 | 195 | template 196 | const s_EclipticalCoords s_EquatorialCoords::toEcliptical(const T obliquity) const 197 | { 198 | s_EclipticalCoords ecl; 199 | 200 | const T cose(cos(_rad(obliquity))); 201 | const T sine(sin(_rad(obliquity))); 202 | const T sina(sin(_rad(right_ascension))); 203 | 204 | ecl.latitude = _deg(atan2( 205 | sina * cose + tan(_rad(declination)) * sine, cos(_rad(right_ascension)))); 206 | 207 | ecl.longitude = _deg(asin( 208 | sin(_rad(declination)) * cose - cos(_rad(declination)) * sine * sina)); 209 | 210 | return ecl; 211 | } 212 | 213 | 214 | // (AA.12.5) and (AA.12.6) 215 | 216 | template 217 | const s_HorizontalCoords s_EquatorialCoords::toHorizontal( 218 | const t_julianDay siderealTime /* θ_0 */ 219 | , const T observersLatitude /* Φ */ 220 | , const T observersLongitude /* L */) const 221 | { 222 | s_HorizontalCoords hor; 223 | 224 | // local hour angle: H = θ - α (AA.p88) 225 | const T H = _rad(siderealTime + observersLongitude - right_ascension); 226 | 227 | const T cosh(cos(H)); 228 | const T sinr(sin(_rad(observersLatitude))); 229 | const T cosr(cos(_rad(observersLatitude))); 230 | 231 | hor.altitude = _deg(asin( 232 | sinr * sin(_rad(declination)) + cosr * cos(_rad(declination)) * cosh)); 233 | 234 | hor.azimuth = _deg(atan2(static_cast( 235 | sin(H)), static_cast(cosh * sinr - tan(_rad(declination)) * cosr))); 236 | 237 | return hor; 238 | } 239 | 240 | 241 | template 242 | const osg::Vec3f s_EquatorialCoords::toEuclidean() const 243 | { 244 | const T cosd(cos(_rad(declination))); 245 | 246 | const T x(r * sin(_rad(right_ascension)) * cosd); 247 | const T y(r * cos(_rad(right_ascension)) * cosd); 248 | const T z(r * sin(_rad(declination))); 249 | 250 | return osg::Vec3f(x, y, z); 251 | } 252 | 253 | 254 | template 255 | const s_EquatorialCoords s_EclipticalCoords::toEquatorial(const T obliquity) const 256 | { 257 | s_EquatorialCoords equ; 258 | 259 | const T cose(cos(_rad(obliquity))); 260 | const T sine(sin(_rad(obliquity))); 261 | 262 | const T sinl(sin(_rad(longitude))); 263 | 264 | equ.right_ascension = _deg(atan2( 265 | sinl * cose - tan(_rad(latitude)) * sine, cos(_rad(longitude)))); 266 | 267 | equ.declination = _deg(asin(sin(_rad(latitude)) * cose + cos(_rad(latitude)) * sine * sinl)); 268 | 269 | return equ; 270 | } 271 | 272 | 273 | template 274 | const s_EquatorialCoords s_HorizontalCoords::toEquatorial( 275 | const t_julianDay siderealTime /* θ_0 */ 276 | , const T observersLatitude /* Φ */ 277 | , const T observersLongitude /* L */) const 278 | { 279 | s_EquatorialCoords equ; 280 | 281 | const T cosa(cos(_rad(altitude))); 282 | 283 | const T sinr(sin(_rad(observersLatitude))); 284 | const T cosr(cos(_rad(observersLatitude))); 285 | 286 | const T H = _deg(atan2( 287 | sin(_rad(altitude)), cosa * sinr + tan(_rad(azimuth)) * cosr)); 288 | 289 | equ.right_ascension = _hours(siderealTime) - observersLongitude - H; 290 | 291 | equ.declination = _deg(asin( 292 | sinr * sin(_rad(azimuth)) - cosr * cos(_rad(azimuth)) * cosa)); 293 | 294 | return equ; 295 | } 296 | 297 | 298 | template 299 | const osg::Vec3f s_HorizontalCoords::toEuclidean() const 300 | { 301 | const T cosa(cos(_rad(altitude))); 302 | 303 | const T x(sin(_rad(azimuth)) * cosa); 304 | const T y(cos(_rad(azimuth)) * cosa); 305 | const T z(sin(_rad(altitude))); 306 | 307 | return osg::Vec3f(x, y, z); 308 | } 309 | 310 | } // namespace osgHimmel 311 | 312 | #endif // __COORDS_H__ -------------------------------------------------------------------------------- /include/osgHimmel/cubemappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/cubemappedhimmel.h -------------------------------------------------------------------------------- /include/osgHimmel/declspec.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/declspec.h -------------------------------------------------------------------------------- /include/osgHimmel/dubecloudlayergeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/dubecloudlayergeode.h -------------------------------------------------------------------------------- /include/osgHimmel/earth.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __EARTH_H__ 32 | #define __EARTH_H__ 33 | 34 | #include "declspec.h" 35 | #include "julianday.h" 36 | #include "typedefs.h" 37 | 38 | 39 | namespace osgHimmel 40 | { 41 | 42 | class OSGH_API Earth 43 | { 44 | public: 45 | 46 | static const t_longf orbitEccentricity(const t_julianDay t); 47 | 48 | static const t_longf apparentAngularSunDiameter(const t_julianDay t); 49 | static const t_longf apparentAngularMoonDiameter(const t_julianDay t); 50 | 51 | static const t_longf longitudeNutation(const t_julianDay t); 52 | static const t_longf obliquityNutation(const t_julianDay t); 53 | 54 | static const t_longf meanObliquity(const t_julianDay t); 55 | static const t_longf trueObliquity(const t_julianDay t); 56 | 57 | static const t_longf atmosphericRefraction(const t_longf altitude); 58 | 59 | static const t_longf viewDistanceWithinAtmosphere( 60 | const t_longf y /* height component of the view direction on ground into the sky */ 61 | , const bool refractionCorrected = false); 62 | 63 | static const t_longf meanRadius(); 64 | static const t_longf atmosphereThickness(); // if its density were uniform... 65 | static const t_longf atmosphereThicknessNonUniform(); 66 | 67 | static const t_longf apparentMagnitudeLimit(); 68 | }; 69 | 70 | } // namespace osgHimmel 71 | 72 | #endif // __EARTH_H__ -------------------------------------------------------------------------------- /include/osgHimmel/earth2.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __EARTH2_H__ 32 | #define __EARTH2_H__ 33 | 34 | #include "declspec.h" 35 | #include "typedefs.h" 36 | #include "julianday.h" 37 | 38 | 39 | namespace osgHimmel 40 | { 41 | 42 | class OSGH_API Earth2 // Lower Accuracy 43 | { 44 | public: 45 | 46 | static const float orbitEccentricity(); 47 | 48 | static const float apparentAngularSunDiameter(const t_julianDay t); 49 | static const float apparentAngularMoonDiameter(const t_julianDay t); 50 | 51 | static const float longitudeNutation(const t_julianDay t); 52 | static const float obliquityNutation(const t_julianDay t); 53 | 54 | static const float meanObliquity(const t_julianDay t); 55 | static const float trueObliquity(const t_julianDay t); 56 | 57 | static const float viewDistanceWithinAtmosphere(const float y); 58 | static const float atmosphericRefraction(const float altitude); 59 | static const float meanRadius(); 60 | 61 | static const float atmosphereThickness(); 62 | static const float atmosphereThicknessNonUniform(); 63 | 64 | static const float apparentMagnitudeLimit(); 65 | }; 66 | 67 | } // namespace osgHimmel 68 | 69 | #endif // __EARTH2_H__ -------------------------------------------------------------------------------- /include/osgHimmel/gaussianmapgenerator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/gaussianmapgenerator.h -------------------------------------------------------------------------------- /include/osgHimmel/highcloudlayergeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/highcloudlayergeode.h -------------------------------------------------------------------------------- /include/osgHimmel/himmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/himmel.h -------------------------------------------------------------------------------- /include/osgHimmel/himmelenvmap.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/himmelenvmap.h -------------------------------------------------------------------------------- /include/osgHimmel/himmeloverlay.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/himmeloverlay.h -------------------------------------------------------------------------------- /include/osgHimmel/himmelquad.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/himmelquad.h -------------------------------------------------------------------------------- /include/osgHimmel/horizonband.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/horizonband.h -------------------------------------------------------------------------------- /include/osgHimmel/interpolate.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/interpolate.h -------------------------------------------------------------------------------- /include/osgHimmel/julianday.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/julianday.h -------------------------------------------------------------------------------- /include/osgHimmel/mathmacros.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/mathmacros.h -------------------------------------------------------------------------------- /include/osgHimmel/moon.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __MOON_H__ 32 | #define __MOON_H__ 33 | 34 | #include "declspec.h" 35 | #include "typedefs.h" 36 | #include "julianday.h" 37 | #include "coords.h" 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | class OSGH_API Moon 44 | { 45 | public: 46 | static const t_longf meanLongitude(const t_julianDay t); 47 | static const t_longf meanElongation(const t_julianDay t); 48 | static const t_longf meanAnomaly(const t_julianDay t); 49 | static const t_longf meanLatitude(const t_julianDay t); 50 | 51 | static const t_longf meanOrbitLongitude(const t_julianDay t); 52 | 53 | static const t_ecld position(const t_julianDay t); 54 | static const t_equd apparentPosition(const t_julianDay t); 55 | 56 | static const t_hord horizontalPosition( 57 | const t_aTime &aTime 58 | , const t_longf latitude 59 | , const t_longf longitude); 60 | 61 | static const t_longf distance(const t_julianDay t); 62 | 63 | static void opticalLibrations( 64 | const t_julianDay t 65 | , t_longf &l /* librations in longitude */ 66 | , t_longf &b /* librations in latitude */); 67 | 68 | static const t_longf parallacticAngle( 69 | const t_aTime &aTime 70 | , const t_longf latitude 71 | , const t_longf longitude); 72 | 73 | static const t_longf positionAngleOfAxis(const t_julianDay t); 74 | 75 | static const t_longf meanRadius(); 76 | }; 77 | 78 | } // namespace osgHimmel 79 | 80 | #endif // __MOON_H__ -------------------------------------------------------------------------------- /include/osgHimmel/moon2.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __MOON2_H__ 32 | #define __MOON2_H__ 33 | 34 | #include "declspec.h" 35 | #include "typedefs.h" 36 | #include "julianday.h" 37 | #include "coords.h" 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | class OSGH_API Moon2 // Lower Accuracy 44 | { 45 | public: 46 | 47 | static const float meanLongitude(const t_julianDay t); 48 | static const float meanElongation(const t_julianDay t); 49 | static const float meanAnomaly(const t_julianDay t); 50 | static const float meanLatitude(const t_julianDay t); 51 | 52 | static const float meanOrbitLongitude(const t_julianDay t); 53 | 54 | static const t_eclf position(const t_julianDay t); 55 | static const t_equf apparentPosition(const t_julianDay t); 56 | 57 | static const t_horf horizontalPosition( 58 | const t_aTime &aTime 59 | , const float latitude 60 | , const float longitude); 61 | 62 | static const float distance(const t_julianDay t); 63 | 64 | static void opticalLibrations( 65 | const t_julianDay t 66 | , float &l /* librations in longitude */ 67 | , float &b /* librations in latitude */); 68 | 69 | static const float parallacticAngle( 70 | const t_aTime &aTime 71 | , const float latitude 72 | , const float longitude); 73 | 74 | static const float positionAngleOfAxis(const t_julianDay t); 75 | 76 | static const float meanRadius(); 77 | }; 78 | 79 | } // namespace osgHimmel 80 | 81 | #endif // __MOON2_H__ -------------------------------------------------------------------------------- /include/osgHimmel/moongeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/moongeode.h -------------------------------------------------------------------------------- /include/osgHimmel/moonglaregeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/moonglaregeode.h -------------------------------------------------------------------------------- /include/osgHimmel/noise.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/noise.h -------------------------------------------------------------------------------- /include/osgHimmel/osgposter.h: -------------------------------------------------------------------------------- 1 | 2 | //http://thread.gmane.org/gmane.comp.graphics.openscenegraph.cvs/6026 3 | 4 | /* OpenSceneGraph example, osgposter. 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining a copy 7 | * of this software and associated documentation files (the "Software"), to deal 8 | * in the Software without restriction, including without limitation the rights 9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | * copies of the Software, and to permit persons to whom the Software is 11 | * furnished to do so, subject to the following conditions: 12 | * 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | * THE SOFTWARE. 20 | */ 21 | 22 | #pragma once 23 | #ifndef __PRINTPOSTERHANDLER_H__ 24 | #define __PRINTPOSTERHANDLER_H__ 25 | 26 | #include "declspec.h" 27 | 28 | #include 29 | 30 | 31 | namespace osg 32 | { 33 | class Image; 34 | } 35 | 36 | namespace osgHimmel 37 | { 38 | 39 | class OSGH_API PrintPosterHandler : public osgGA::GUIEventHandler 40 | { 41 | public: 42 | typedef std::pair t_position; 43 | typedef std::map > t_tiles; 44 | 45 | public: 46 | 47 | PrintPosterHandler(); 48 | virtual ~PrintPosterHandler(); 49 | 50 | void print(); 51 | void print( 52 | const unsigned int width 53 | , const unsigned int height); 54 | 55 | void write() const; 56 | void write(const std::string &filePath) const; 57 | 58 | const osg::Image *get() const; 59 | 60 | // config 61 | 62 | // default path to save the posters 63 | void setDefaultPath(const std::string &path); 64 | 65 | // set default poster resolution in pixel 66 | void setSize( 67 | const unsigned int width 68 | , const unsigned int height); 69 | 70 | protected: 71 | 72 | const bool isReady() const; 73 | 74 | void make(osgViewer::View* view); 75 | void finish(); 76 | void aggregateAndFreeTiles(); 77 | 78 | 79 | static const std::string genFileName(); 80 | 81 | public: 82 | 83 | void setOutputTiles(const bool b); 84 | const bool getOutputTiles() const; 85 | 86 | void setTileSize( 87 | const int w 88 | , const int h); 89 | const osg::Vec2f& getTileSize() const; 90 | 91 | 92 | void setCameraRoot(osg::Group* root); 93 | const osg::Group* getCameraRoot() const; 94 | 95 | 96 | 97 | virtual bool handle( 98 | const osgGA::GUIEventAdapter& ea 99 | , osgGA::GUIActionAdapter& aa); 100 | 101 | protected: 102 | 103 | osg::Camera* getAvailableCamera(); 104 | 105 | void bindCameraToImage( 106 | osg::Camera* camera 107 | , const int row 108 | , const int col); 109 | 110 | 111 | protected: 112 | 113 | osg::ref_ptr m_poster; 114 | t_tiles m_tiles; 115 | 116 | std::string m_path; 117 | 118 | unsigned int m_width; 119 | unsigned int m_height; 120 | 121 | bool m_make; 122 | bool m_making; 123 | 124 | 125 | bool m_isFinished; 126 | 127 | bool m_outputTiles; 128 | 129 | osg::Vec2f m_tileSize; 130 | 131 | int m_tileRows; 132 | int m_tileColumns; 133 | 134 | int m_currentRow; 135 | int m_currentColumn; 136 | 137 | unsigned int m_cameraIndex; 138 | 139 | osg::Matrixd m_currentViewMatrix; 140 | osg::Matrixd m_currentProjectionMatrix; 141 | 142 | osg::ref_ptr m_cameraRoot; 143 | 144 | }; 145 | 146 | } // namespace osgHimmel 147 | 148 | #endif // __PRINTPOSTERHANDLER_H__ -------------------------------------------------------------------------------- /include/osgHimmel/paraboloidmappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/paraboloidmappedhimmel.h -------------------------------------------------------------------------------- /include/osgHimmel/perlinmapgenerator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/perlinmapgenerator.h -------------------------------------------------------------------------------- /include/osgHimmel/polarmappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/polarmappedhimmel.h -------------------------------------------------------------------------------- /include/osgHimmel/pragmanote.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/pragmanote.h -------------------------------------------------------------------------------- /include/osgHimmel/randommapgenerator.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/randommapgenerator.h -------------------------------------------------------------------------------- /include/osgHimmel/siderealtime.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/siderealtime.h -------------------------------------------------------------------------------- /include/osgHimmel/spheremappedhimmel.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/spheremappedhimmel.h -------------------------------------------------------------------------------- /include/osgHimmel/starmapgeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/starmapgeode.h -------------------------------------------------------------------------------- /include/osgHimmel/stars.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __STARS_H__ 32 | #define __STARS_H__ 33 | 34 | #include "declspec.h" 35 | #include "typedefs.h" 36 | #include "julianday.h" 37 | #include "coords.h" 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | class OSGH_API Stars 44 | { 45 | public: 46 | 47 | static const t_longf tempratureFromBV(const t_longf BtoV); 48 | 49 | static const osg::Vec2f planckianLocusInCieXYZ(const t_longf t /* temperature in K */); 50 | 51 | static const osg::Vec3f xyzTristimulus(const t_longf t /* temperature in K */); 52 | static const osg::Vec3f xyzTristimulus(const osg::Vec2f planckianLocus); 53 | 54 | static const osg::Vec3f sRgbColor(const t_longf t /* temperature in K */); 55 | static const osg::Vec3f sRgbColor(const osg::Vec2f planckianLocus); 56 | static const osg::Vec3f sRgbColor(const osg::Vec3f xyzTrisimulus); 57 | 58 | 59 | static const t_equd apparentPosition( 60 | const t_julianDay t 61 | , const t_longf a2000 /* right_ascension (RA) in decimal degrees, equinox J2000 */ 62 | , const t_longf d2000 /* declination (DE) in decimal degrees, equinox J2000 */ 63 | , const t_longf mpa2000 /* annual proper motion in RA J2000 */ 64 | , const t_longf mpd2000 /* annual proper motion in DE J2000 */); 65 | 66 | static const t_hord horizontalPosition( 67 | const t_aTime &aTime 68 | , const t_longf latitude 69 | , const t_longf longitude 70 | , const t_longf a2000 /* right_ascension (RA) in decimal degrees, equinox J2000 */ 71 | , const t_longf d2000 /* declination (DE) in decimal degrees, equinox J2000 */ 72 | , const t_longf mpa2000 /* annual proper motion in RA J2000 */ 73 | , const t_longf mpd2000 /* annual proper motion in DE J2000 */); 74 | }; 75 | 76 | } // namespace osgHimmel 77 | 78 | #endif // __STARS_H__ -------------------------------------------------------------------------------- /include/osgHimmel/starsgeode.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/starsgeode.h -------------------------------------------------------------------------------- /include/osgHimmel/strutils.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/strutils.h -------------------------------------------------------------------------------- /include/osgHimmel/sun.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __SUN_H__ 32 | #define __SUN_H__ 33 | 34 | #include "declspec.h" 35 | #include "typedefs.h" 36 | #include "julianday.h" 37 | #include "coords.h" 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | class OSGH_API Sun 44 | { 45 | public: 46 | 47 | static const t_longf meanAnomaly(const t_julianDay t); 48 | static const t_longf meanLongitude(const t_julianDay t); 49 | 50 | static const t_longf center(const t_julianDay t); 51 | 52 | static const t_longf trueAnomaly(const t_julianDay t); 53 | static const t_longf trueLongitude(const t_julianDay t); 54 | 55 | static const t_equd apparentPosition(const t_julianDay t); 56 | static const t_hord horizontalPosition( 57 | const t_aTime &aTime 58 | , const t_longf latitude 59 | , const t_longf longitude); 60 | 61 | static const t_longf distance(const t_julianDay t); 62 | 63 | static const t_longf meanRadius(); 64 | }; 65 | 66 | } // namespace osgHimmel 67 | 68 | #endif // __SUN_H__ -------------------------------------------------------------------------------- /include/osgHimmel/sun2.h: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #pragma once 31 | #ifndef __SUN2_H__ 32 | #define __SUN2_H__ 33 | 34 | #include "declspec.h" 35 | #include "typedefs.h" 36 | #include "julianday.h" 37 | #include "coords.h" 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | class OSGH_API Sun2 // Lower Accuracy 44 | { 45 | public: 46 | 47 | static const float meanAnomaly(const t_julianDay t); 48 | static const float meanLongitude(const t_julianDay t); 49 | 50 | static const float center(const t_julianDay t); 51 | 52 | static const float c(const t_julianDay t); 53 | static const float trueLongitude(const t_julianDay t); 54 | 55 | static const t_equf apparentPosition(const t_julianDay t); 56 | static const t_horf horizontalPosition( 57 | const t_aTime &aTime 58 | , const float latitude 59 | , const float longitude); 60 | 61 | static const float distance(const t_julianDay t); 62 | 63 | static const t_longf meanRadius(); 64 | }; 65 | 66 | } // namespace osgHimmel 67 | 68 | #endif // __SUN2_H__ -------------------------------------------------------------------------------- /include/osgHimmel/timef.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/timef.h -------------------------------------------------------------------------------- /include/osgHimmel/twounitschanger.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/twounitschanger.h -------------------------------------------------------------------------------- /include/osgHimmel/typedefs.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/include/osgHimmel/typedefs.h -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/CMakeLists.txt -------------------------------------------------------------------------------- /src/abstractastronomy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/abstractastronomy.cpp -------------------------------------------------------------------------------- /src/abstracthimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/abstracthimmel.cpp -------------------------------------------------------------------------------- /src/abstractmappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/abstractmappedhimmel.cpp -------------------------------------------------------------------------------- /src/astronomy.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/astronomy.cpp -------------------------------------------------------------------------------- /src/astronomy2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/astronomy2.cpp -------------------------------------------------------------------------------- /src/atime.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/atime.cpp -------------------------------------------------------------------------------- /src/atmospheregeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/atmospheregeode.cpp -------------------------------------------------------------------------------- /src/atmosphereprecompute.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/atmosphereprecompute.cpp -------------------------------------------------------------------------------- /src/brightstars.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/brightstars.cpp -------------------------------------------------------------------------------- /src/cloudlayerhighgeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/cloudlayerhighgeode.cpp -------------------------------------------------------------------------------- /src/coords.cpp: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "coords.h" 31 | #include "mathmacros.h" 32 | 33 | #include -------------------------------------------------------------------------------- /src/cubemappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/cubemappedhimmel.cpp -------------------------------------------------------------------------------- /src/dubecloudlayergeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/dubecloudlayergeode.cpp -------------------------------------------------------------------------------- /src/earth2.cpp: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "earth2.h" 31 | 32 | #include "earth.h" 33 | #include "sun2.h" 34 | #include "moon2.h" 35 | #include "mathmacros.h" 36 | 37 | #include 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | const float Earth2::orbitEccentricity() 44 | { 45 | // http://nssdc.gsfc.nasa.gov/planetary/factsheet/earthfact.html 46 | const float E = 0.01671022; 47 | 48 | return _revd(E); 49 | } 50 | 51 | 52 | const float Earth2::apparentAngularSunDiameter(const t_julianDay t) 53 | { 54 | return _adiameter(Sun2::distance(t), Sun2::meanRadius()); 55 | } 56 | 57 | 58 | const float Earth2::apparentAngularMoonDiameter(const t_julianDay t) 59 | { 60 | return _adiameter(Moon2::distance(t), Moon2::meanRadius()); 61 | } 62 | 63 | 64 | const float Earth2::longitudeNutation(const t_julianDay t) 65 | { 66 | const float sM = _rad(Sun2::meanAnomaly(t)); 67 | const float mM = _rad(Moon2::meanAnomaly(t)); 68 | const float O = _rad(Moon2::meanOrbitLongitude(t)); 69 | 70 | // (AA.21 p132) 71 | 72 | const float r = 73 | - _decimal(0, 0, 17.20) * sin(O) 74 | - _decimal(0, 0, 1.32) * sin(2.0 * sM) 75 | - _decimal(0, 0, 0.23) * sin(2.0 * mM) 76 | + _decimal(0, 0, 0.21) * sin(2.0 * O ); 77 | 78 | return r; 79 | } 80 | 81 | 82 | const float Earth2::obliquityNutation(const t_julianDay t) 83 | { 84 | const float O = _rad(Moon2::meanOrbitLongitude(t)); 85 | const float Ls = _rad(Sun2::meanAnomaly(t)); 86 | const float Lm = _rad(Moon2::meanAnomaly(t)); 87 | 88 | // (AA.21 p132) 89 | const float e = 90 | + _decimal(0, 0, 9.20) * cos(O) 91 | + _decimal(0, 0, 0.57) * cos(2.0 * Ls) 92 | + _decimal(0, 0, 0.10) * cos(2.0 * Lm) 93 | - _decimal(0, 0, 0.09) * cos(2.0 * O ); 94 | 95 | return e; 96 | } 97 | 98 | 99 | const float Earth2::trueObliquity(const t_julianDay t) 100 | { 101 | return meanObliquity(t) + obliquityNutation(t); // e 102 | } 103 | 104 | 105 | const float Earth2::meanObliquity(const t_julianDay t) 106 | { 107 | const t_julianDay T(jCenturiesSinceSE(t)); 108 | 109 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 110 | const float e0 = _deg(0.409093 - 0.000227 * T); 111 | 112 | // (AA.21.2) 113 | //const float e0 = _decimal(23, 26, 21.448) 114 | // + T * (- _decimal(0, 0, 46.8150) 115 | // + T * (- _decimal(0, 0, 0.00059) 116 | // + T * (+ _decimal(0, 0, 0.001813)))); 117 | 118 | return e0; 119 | } 120 | 121 | 122 | // This is not refraction corrected. 123 | 124 | const float Earth2::viewDistanceWithinAtmosphere( 125 | const float y) 126 | { 127 | const float t = atmosphereThickness(); 128 | //const float r = meanRadius(); 129 | 130 | // This works only for mean radius of earth. 131 | return t * 1116.0 / ((y + 0.004) * 1.1116); 132 | } 133 | 134 | 135 | const float Earth2::atmosphericRefraction(const float altitude) 136 | { 137 | return Earth::atmosphericRefraction(altitude); 138 | } 139 | 140 | 141 | const float Earth2::meanRadius() 142 | { 143 | return Earth::meanRadius(); 144 | } 145 | 146 | 147 | const float Earth2::atmosphereThickness() 148 | { 149 | return Earth::atmosphereThickness(); 150 | } 151 | 152 | 153 | const float Earth2::atmosphereThicknessNonUniform() 154 | { 155 | return Earth::atmosphereThicknessNonUniform(); 156 | } 157 | 158 | 159 | const float Earth2::apparentMagnitudeLimit() 160 | { 161 | return Earth::apparentMagnitudeLimit(); 162 | } 163 | 164 | } // namespace osgHimmel -------------------------------------------------------------------------------- /src/gaussianmapgenerator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/gaussianmapgenerator.cpp -------------------------------------------------------------------------------- /src/highcloudlayergeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/highcloudlayergeode.cpp -------------------------------------------------------------------------------- /src/himmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/himmel.cpp -------------------------------------------------------------------------------- /src/himmelenvmap.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/himmelenvmap.cpp -------------------------------------------------------------------------------- /src/himmeloverlay.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/himmeloverlay.cpp -------------------------------------------------------------------------------- /src/himmelquad.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/himmelquad.cpp -------------------------------------------------------------------------------- /src/horizonband.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/horizonband.cpp -------------------------------------------------------------------------------- /src/julianday.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/julianday.cpp -------------------------------------------------------------------------------- /src/moon2.cpp: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "moon2.h" 31 | 32 | #include "moon.h" 33 | #include "sun2.h" 34 | #include "earth2.h" 35 | #include "siderealtime.h" 36 | #include "mathmacros.h" 37 | 38 | #include 39 | 40 | 41 | namespace osgHimmel 42 | { 43 | 44 | // LOW ACCURACY 45 | 46 | const float Moon2::meanLongitude(const t_julianDay t) 47 | { 48 | const t_julianDay T(jCenturiesSinceSE(t)); 49 | 50 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 51 | const float L0 = _deg(3.8104 + 8399.7091 * T); 52 | 53 | // (AA.21 p132) 54 | //const float L0 = 218.3165 55 | // + T * (+ 481267.8813); 56 | 57 | // (http://www.jgiesen.de/moonmotion/index.html) 58 | //const float L0 = 218.31617f 59 | // + T * (+ 481267.88088 60 | // + T * (- 0.00112778)); 61 | 62 | return _revd(L0); 63 | } 64 | 65 | 66 | const float Moon2::meanElongation(const t_julianDay t) 67 | { 68 | const t_julianDay T(jCenturiesSinceSE(t)); 69 | 70 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 71 | const float D = _deg(5.1985 + 7771.3772 * T); 72 | 73 | return _revd(D); 74 | } 75 | 76 | 77 | const float Moon2::meanAnomaly(const t_julianDay t) 78 | { 79 | const t_julianDay T(jCenturiesSinceSE(t)); 80 | 81 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 82 | const float M = _deg(2.3554 + 8328.6911 * T); 83 | 84 | // (AA.21...) 85 | //const float M = 134.96298 86 | // + T * (+ 477198.867398 87 | // + T * (+ 0.0086972 88 | // + T * (+ 1.0 / 56250.0))); 89 | 90 | // (http://www.jgiesen.de/moonmotion/index.html) 91 | //const float M = 134.96292 92 | // + T * (+ 477198.86753 93 | // + T * (+ 0.00923611)); 94 | 95 | return _revd(M); 96 | } 97 | 98 | 99 | const float Moon2::meanLatitude(const t_julianDay t) 100 | { 101 | const t_julianDay T(jCenturiesSinceSE(t)); 102 | 103 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 104 | const float F = _deg(1.6280 + 8433.4663 * T); 105 | 106 | return _revd(F); 107 | } 108 | 109 | 110 | const float Moon2::meanOrbitLongitude(const t_julianDay t) 111 | { 112 | const t_julianDay T(jCenturiesSinceSE(t)); 113 | 114 | // (AA p152) 115 | const float O = 125.04 116 | + T * (- 1934.136); 117 | 118 | return _revd(O); 119 | } 120 | 121 | 122 | const t_eclf Moon2::position(const t_julianDay t) 123 | { 124 | const float sM = _rad(Sun2::meanAnomaly(t)); 125 | 126 | const float mL = _rad(meanLongitude(t)); 127 | const float mM = _rad(meanAnomaly(t)); 128 | const float mD = _rad(meanElongation(t)); 129 | const float mF = _rad(meanLatitude(t)); 130 | 131 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 132 | 133 | float Sl = mL; 134 | 135 | Sl += 0.1098 * sin( + 1 * mM ); 136 | Sl += 0.0222 * sin( 2 * mD - 1 * mM ); 137 | Sl += 0.0115 * sin( 2 * mD ); 138 | Sl += 0.0037 * sin( + 2 * mM ); 139 | Sl -= 0.0032 * sin( + 1 * sM ); 140 | Sl -= 0.0020 * sin( + 2 * mF); 141 | Sl += 0.0010 * sin( 2 * mD - 2 * mM ); 142 | Sl += 0.0010 * sin( 2 * mD - 1 * sM - 1 * mM ); 143 | Sl += 0.0009 * sin( 2 * mD + 1 * mM ); 144 | Sl += 0.0008 * sin( 2 * mD - 1 * sM ); 145 | Sl -= 0.0007 * sin( + 1 * sM - 1 * mM ); 146 | Sl -= 0.0006 * sin( 1 * mD ); 147 | Sl -= 0.0005 * sin( + 1 * sM + 1 * mM ); 148 | 149 | float Sb = 0.0; 150 | 151 | Sb += 0.0895 * sin( + 1 * mF); 152 | Sb += 0.0049 * sin( + 1 * mM + 1 * mF); 153 | Sb += 0.0048 * sin( + 1 * mM - 1 * mF); 154 | Sb += 0.0030 * sin( 2 * mD - 1 * mF); 155 | Sb += 0.0010 * sin( 2 * mD - 1 * mM + 1 * mF); 156 | Sb += 0.0008 * sin( 2 * mD - 1 * mM - 1 * mF); 157 | Sb += 0.0006 * sin( 2 * mD + 1 * mF); 158 | 159 | t_eclf ecl; 160 | 161 | ecl.longitude = _deg(Sl); 162 | ecl.latitude = _deg(Sb); 163 | 164 | return ecl; 165 | } 166 | 167 | 168 | const t_equf Moon2::apparentPosition(const t_julianDay t) 169 | { 170 | t_eclf ecl = position(t); 171 | 172 | return ecl.toEquatorial(Earth2::trueObliquity(t)); 173 | } 174 | 175 | 176 | const t_horf Moon2::horizontalPosition( 177 | const t_aTime &aTime 178 | , const float latitude 179 | , const float longitude) 180 | { 181 | t_julianDay t(jd(aTime)); 182 | t_julianDay s(siderealTime(aTime)); 183 | 184 | t_equf equ = apparentPosition(t); 185 | 186 | return equ.toHorizontal(s, latitude, longitude); 187 | } 188 | 189 | 190 | // NOTE: This gives the distance from the center of the moon to the 191 | // center of the earth. 192 | 193 | const float Moon2::distance(const t_julianDay t) 194 | { 195 | const float sM = _rad(Sun2::meanAnomaly(t)); 196 | 197 | const float mM = _rad(meanAnomaly(t)); 198 | const float mD = _rad(meanElongation(t)); 199 | 200 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 201 | 202 | float Sr = 0.016593; 203 | 204 | Sr += 0.000904 * cos( + 1 * mM); 205 | Sr += 0.000166 * cos( 2 * mD - 1 * mM); 206 | Sr += 0.000137 * cos( 2 * mD ); 207 | Sr += 0.000049 * cos( + 2 * mM); 208 | Sr += 0.000015 * cos( 2 * mD + 1 * mM); 209 | Sr += 0.000009 * cos( 2 * mD - 1 * sM ); 210 | 211 | return Earth2::meanRadius() / Sr; 212 | } 213 | 214 | 215 | void Moon2::opticalLibrations( 216 | const t_julianDay t 217 | , float &l /* librations in longitude */ 218 | , float &b /* librations in latitude */) 219 | { 220 | // (AA.51.1) 221 | 222 | const float Dr = _rad(Earth2::longitudeNutation(t)); 223 | 224 | const float F = _rad(meanLatitude(t)); 225 | const float O = _rad(meanOrbitLongitude(t)); 226 | 227 | const t_eclf ecl = position(t); 228 | const float lo = _rad(ecl.longitude); 229 | const float la = _rad(ecl.latitude); 230 | 231 | static const float I = _rad(1.54242f); 232 | 233 | const float cos_la = cos(la); 234 | const float sin_la = sin(la); 235 | const float cos_I = cos(I); 236 | const float sin_I = sin(I); 237 | 238 | const float W = _rev(lo - Dr - O); 239 | const float sin_W = sin(W); 240 | 241 | const float A = _rev(atan2(sin_W * cos_la * cos_I - sin_la * sin_I, cos(W) * cos_la)); 242 | 243 | l = _deg(A - F); 244 | b = _deg(asin(-sin_W * cos_la * sin_I - sin_la * cos_I)); 245 | } 246 | 247 | 248 | const float Moon2::parallacticAngle( 249 | const t_aTime &aTime 250 | , const float latitude 251 | , const float longitude) 252 | { 253 | // (AA.13.1) 254 | 255 | const t_julianDay t(jd(aTime)); 256 | 257 | const float la = _rad(latitude); 258 | const float lo = _rad(longitude); 259 | 260 | const t_equf pos = apparentPosition(t); 261 | const float ra = _rad(pos.right_ascension); 262 | const float de = _rad(pos.declination); 263 | 264 | const float s = _rad(siderealTime(aTime)); 265 | 266 | // (AA.p88) - local hour angle 267 | 268 | const float H = s + lo - ra; 269 | 270 | const float cos_la = cos(la); 271 | const float P = atan2(sin(H) * cos_la, sin(la) * cos(de) - sin(de) * cos_la * cos(H)); 272 | 273 | return _deg(P); 274 | } 275 | 276 | 277 | const float Moon2::positionAngleOfAxis(const t_julianDay t) 278 | { 279 | // (AA.p344) 280 | 281 | const t_equf pos = apparentPosition(t); 282 | 283 | const float a = _rad(pos.right_ascension); 284 | const float e = _rad(Earth2::meanObliquity(t)); 285 | 286 | const float Dr = _rad(Earth2::longitudeNutation(t)); 287 | const float O = _rad(meanOrbitLongitude(t)); 288 | 289 | const float V = O + Dr; 290 | 291 | static const float I = _rad(1.54242); 292 | const float sin_I = sin(I); 293 | 294 | const float X = sin_I * sin(V); 295 | const float Y = sin_I * cos(V) * cos(e) - cos(I) * sin(e); 296 | 297 | // optical libration in latitude 298 | 299 | const t_eclf ecl = position(t); 300 | 301 | const float lo = _rad(ecl.longitude); 302 | const float la = _rad(ecl.latitude); 303 | 304 | const float W = _rev(lo - Dr - O); 305 | const float b = asin(-sin(W) * cos(la) * sin_I - sin(la) * cos(I)); 306 | 307 | // final angle 308 | 309 | const float w = _rev(atan2(X, Y)); 310 | const float P = asin(sqrt(X * X + Y * Y) * cos(a - w) / cos(b)); 311 | 312 | return _deg(P); 313 | } 314 | 315 | 316 | const float Moon2::meanRadius() 317 | { 318 | return Moon::meanRadius(); 319 | } 320 | 321 | } // namespace osgHimmel -------------------------------------------------------------------------------- /src/moongeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/moongeode.cpp -------------------------------------------------------------------------------- /src/moonglaregeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/moonglaregeode.cpp -------------------------------------------------------------------------------- /src/noise.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/noise.cpp -------------------------------------------------------------------------------- /src/osgposter.cpp: -------------------------------------------------------------------------------- 1 | 2 | /* OpenSceneGraph example, osgposter. 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining a copy 5 | * of this software and associated documentation files (the "Software"), to deal 6 | * in the Software without restriction, including without limitation the rights 7 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | * copies of the Software, and to permit persons to whom the Software is 9 | * furnished to do so, subject to the following conditions: 10 | * 11 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 12 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 13 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 14 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 15 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 16 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 17 | * THE SOFTWARE. 18 | */ 19 | 20 | #include "osgposter.h" 21 | 22 | #include 23 | #include 24 | #include 25 | 26 | //#include 27 | #include 28 | 29 | #include 30 | 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | namespace osgHimmel 37 | { 38 | 39 | 40 | PrintPosterHandler::PrintPosterHandler() 41 | : 42 | m_poster(NULL) 43 | , m_path("") 44 | , m_make(false) 45 | , m_making(false) 46 | 47 | , m_isFinished(false) 48 | , m_outputTiles(false) 49 | , m_currentRow(0) 50 | , m_currentColumn(0) 51 | , m_cameraIndex(0) 52 | , m_cameraRoot(0) 53 | { 54 | } 55 | 56 | PrintPosterHandler::~PrintPosterHandler() 57 | { 58 | } 59 | 60 | 61 | void PrintPosterHandler::setDefaultPath(const std::string &path) 62 | { 63 | m_path = path; 64 | } 65 | 66 | 67 | bool PrintPosterHandler::handle( 68 | const osgGA::GUIEventAdapter& ea 69 | , osgGA::GUIActionAdapter& aa) 70 | { 71 | osgViewer::View* view = dynamic_cast(&aa); 72 | 73 | if(!view) 74 | return false; 75 | 76 | switch(ea.getEventType()) 77 | { 78 | case osgGA::GUIEventAdapter::FRAME: 79 | { 80 | // Wait until all paged LOD are processed 81 | if(view->getDatabasePager() && view->getDatabasePager()->getRequestsInProgress()) 82 | break; 83 | 84 | if(m_isFinished) 85 | { 86 | const osg::FrameStamp* fs = view->getFrameStamp(); 87 | if((fs->getFrameNumber() % 2) == 0) 88 | { 89 | aggregateAndFreeTiles(); // Record images and unref them to free memory 90 | std::cout << "finished" << std::endl; 91 | 92 | write(); 93 | m_isFinished = false; 94 | } 95 | } 96 | 97 | if(m_make) 98 | make(view); 99 | 100 | if(m_making) 101 | { 102 | 103 | // Every "copy-to-image" process seems to be finished in 2 frames. 104 | // So record them and dispatch cameras to next tiles. 105 | 106 | const osg::FrameStamp* fs = view->getFrameStamp(); 107 | 108 | if((fs->getFrameNumber() % 2) == 0) 109 | { 110 | // Record images and unref them to free memory 111 | aggregateAndFreeTiles(); 112 | 113 | osg::Camera* camera = 0; 114 | 115 | while((camera = getAvailableCamera()) != NULL) 116 | { 117 | std::cout << "Binding sub-camera " << m_currentRow << "_" << m_currentColumn 118 | << " to image..." << std::endl; 119 | 120 | bindCameraToImage(camera, m_currentRow, m_currentColumn); 121 | 122 | if (m_currentColumn < m_tileColumns - 1) 123 | m_currentColumn++; 124 | else 125 | { 126 | if(m_currentRow < m_tileRows - 1) 127 | { 128 | m_currentRow++; 129 | m_currentColumn = 0; 130 | } 131 | else 132 | { 133 | m_making = false; 134 | m_isFinished = true; 135 | 136 | std::cout << "Sub-cameras dispatching finished." << std::endl; 137 | break; 138 | } 139 | } 140 | } 141 | m_cameraIndex = m_cameraRoot->getNumChildren(); 142 | } 143 | } 144 | break; 145 | } 146 | 147 | case osgGA::GUIEventAdapter::KEYDOWN: 148 | { 149 | if ( ea.getKey()=='p' || ea.getKey()=='P' ) 150 | { 151 | print(); 152 | return true; 153 | } 154 | break; 155 | } 156 | 157 | default: 158 | break; 159 | } 160 | 161 | return false; 162 | } 163 | 164 | 165 | osg::Camera* PrintPosterHandler::getAvailableCamera() 166 | { 167 | // Find an available camera for rendering current tile image. 168 | if(!m_cameraIndex || !m_cameraRoot.valid()) 169 | return NULL; 170 | 171 | return dynamic_cast(m_cameraRoot->getChild(--m_cameraIndex)); 172 | } 173 | 174 | 175 | void PrintPosterHandler::bindCameraToImage( 176 | osg::Camera* camera 177 | , const int row 178 | , const int col) 179 | { 180 | std::stringstream stream; 181 | stream << "image_" << row << "_" << col; 182 | 183 | osg::ref_ptr image = new osg::Image; 184 | 185 | image->setName(stream.str()); 186 | image->allocateImage(static_cast(m_tileSize.x()), static_cast(m_tileSize.y()) 187 | , 1, GL_RGBA, GL_UNSIGNED_BYTE); 188 | 189 | m_tiles[t_position(row, col)] = image.get(); 190 | 191 | // calculate projection matrix offset of each tile 192 | osg::Matrixf offsetMatrix = osg::Matrixf::scale(m_tileColumns, m_tileRows, 1.0) 193 | * osg::Matrixf::translate(m_tileColumns - 1 - 2 * col, m_tileRows - 1 - 2 * row, 0.0); 194 | 195 | camera->setViewMatrix(m_currentViewMatrix); 196 | camera->setProjectionMatrix(m_currentProjectionMatrix * offsetMatrix); 197 | 198 | // Reattach cameras and new allocated images 199 | camera->setRenderingCache(NULL); // FIXME: Uses for reattaching camera with image, maybe inefficient? 200 | camera->detach(osg::Camera::COLOR_BUFFER); 201 | camera->attach(osg::Camera::COLOR_BUFFER, image.get(), 0, 0); 202 | } 203 | 204 | 205 | void PrintPosterHandler::aggregateAndFreeTiles() 206 | { 207 | t_tiles::iterator i(m_tiles.begin()); 208 | const t_tiles::const_iterator iEnd(m_tiles.end()); 209 | 210 | for(; i != iEnd; ++i) 211 | { 212 | osg::Image* image = i->second.get(); 213 | 214 | if(m_poster.valid()) 215 | { 216 | // FIXME: A stupid way to combine tile images to final result. Any better ideas? 217 | 218 | const unsigned int row = i->first.first; 219 | const unsigned int col = i->first.second; 220 | 221 | for(int s = 0; s < image->s(); ++s) 222 | { 223 | for(int t = 0; t < image->t(); ++t) 224 | { 225 | unsigned char* src = image->data(s, t); 226 | unsigned char* target = m_poster->data( 227 | s + col * static_cast(m_tileSize.x()), 228 | t + row * static_cast(m_tileSize.y())); 229 | 230 | for(int u = 0; u < 4; ++u) 231 | *(target + u) = *(src++); 232 | } 233 | } 234 | } 235 | } 236 | m_tiles.clear(); 237 | } 238 | 239 | 240 | const bool PrintPosterHandler::isReady() const 241 | { 242 | return !m_make && !m_making && m_cameraRoot.valid(); 243 | } 244 | 245 | 246 | void PrintPosterHandler::print() 247 | { 248 | if(!isReady()) 249 | return; 250 | 251 | m_make = true; 252 | } 253 | 254 | 255 | void PrintPosterHandler::print( 256 | const unsigned int width 257 | , const unsigned int height) 258 | { 259 | if(!isReady()) 260 | return; 261 | 262 | setSize(height, width); 263 | return print(); 264 | } 265 | 266 | 267 | void PrintPosterHandler::setSize( 268 | const unsigned int width 269 | , const unsigned int height) 270 | { 271 | m_width = width > 0 ? width : 1; 272 | m_height = height > 0 ? height : 1; 273 | } 274 | 275 | 276 | void PrintPosterHandler::make(osgViewer::View* view) 277 | { 278 | assert(m_make); 279 | assert(!m_making); 280 | 281 | m_poster = new osg::Image; 282 | m_poster->allocateImage(m_width, m_height, 1, GL_RGBA, GL_UNSIGNED_BYTE); 283 | 284 | 285 | m_tileRows = m_height / m_tileSize.y(); 286 | m_tileColumns = m_width / m_tileSize.x(); 287 | 288 | m_currentRow = m_currentColumn = 0; 289 | m_cameraIndex = m_cameraRoot->getNumChildren(); 290 | 291 | m_currentViewMatrix = view->getCamera()->getViewMatrix(); 292 | m_currentProjectionMatrix = view->getCamera()->getProjectionMatrix(); 293 | 294 | m_tiles.clear(); 295 | 296 | 297 | m_make = false; 298 | m_making = true; 299 | } 300 | 301 | 302 | const osg::Image *PrintPosterHandler::get() const 303 | { 304 | return m_poster.get(); 305 | } 306 | 307 | 308 | void PrintPosterHandler::write() const 309 | { 310 | return write(m_path); 311 | } 312 | 313 | 314 | void PrintPosterHandler::write(const std::string &filePath) const 315 | { 316 | const std::string fileName = (filePath.empty() ? "" : filePath + "/") + genFileName(); 317 | osgDB::writeImageFile(*m_poster, fileName); 318 | } 319 | 320 | 321 | const std::string PrintPosterHandler::genFileName() 322 | { 323 | std::time_t rawtime = std::time(NULL); 324 | struct tm* timeinfo = localtime(&rawtime); 325 | 326 | char p[16]; 327 | std::strftime(p, 16,"%Y%m%d%H%M%S", timeinfo); 328 | std::puts(p); 329 | 330 | std::string fileName = "_poster_" + std::string(p) + ".bmp"; 331 | 332 | return fileName; 333 | } 334 | 335 | 336 | void PrintPosterHandler::setOutputTiles(const bool b) 337 | { 338 | m_outputTiles = b; 339 | } 340 | 341 | const bool PrintPosterHandler::getOutputTiles() const 342 | { 343 | return m_outputTiles; 344 | } 345 | 346 | 347 | void PrintPosterHandler::setTileSize( 348 | const int w 349 | , const int h) 350 | { 351 | m_tileSize.set(w, h); 352 | } 353 | 354 | const osg::Vec2f& PrintPosterHandler::getTileSize() const 355 | { 356 | return m_tileSize; 357 | } 358 | 359 | 360 | void PrintPosterHandler::setCameraRoot( osg::Group* root ) 361 | { 362 | m_cameraRoot = root; 363 | } 364 | 365 | const osg::Group* PrintPosterHandler::getCameraRoot() const 366 | { 367 | return m_cameraRoot.get(); 368 | } 369 | 370 | } // namespace osgHimmel -------------------------------------------------------------------------------- /src/paraboloidmappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/paraboloidmappedhimmel.cpp -------------------------------------------------------------------------------- /src/perlinmapgenerator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/perlinmapgenerator.cpp -------------------------------------------------------------------------------- /src/polarmappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/polarmappedhimmel.cpp -------------------------------------------------------------------------------- /src/randommapgenerator.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/randommapgenerator.cpp -------------------------------------------------------------------------------- /src/shaderfragment/blend_difference.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_difference.cpp -------------------------------------------------------------------------------- /src/shaderfragment/blend_difference.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_difference.h -------------------------------------------------------------------------------- /src/shaderfragment/blend_lineardodge.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_lineardodge.cpp -------------------------------------------------------------------------------- /src/shaderfragment/blend_lineardodge.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_lineardodge.h -------------------------------------------------------------------------------- /src/shaderfragment/blend_multiply.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_multiply.cpp -------------------------------------------------------------------------------- /src/shaderfragment/blend_multiply.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_multiply.h -------------------------------------------------------------------------------- /src/shaderfragment/blend_normal.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_normal.cpp -------------------------------------------------------------------------------- /src/shaderfragment/blend_normal.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_normal.h -------------------------------------------------------------------------------- /src/shaderfragment/blend_screen.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_screen.cpp -------------------------------------------------------------------------------- /src/shaderfragment/blend_screen.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/blend_screen.h -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_common.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_common.cpp -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_common.h -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_inscatter.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_inscatter.cpp -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_inscatter.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_inscatter.h -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_irradiance.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_irradiance.cpp -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_irradiance.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_irradiance.h -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_transmittance.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_transmittance.cpp -------------------------------------------------------------------------------- /src/shaderfragment/bruneton_transmittance.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/bruneton_transmittance.h -------------------------------------------------------------------------------- /src/shaderfragment/cloudlayer.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/cloudlayer.cpp -------------------------------------------------------------------------------- /src/shaderfragment/cloudlayer.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/cloudlayer.h -------------------------------------------------------------------------------- /src/shaderfragment/common.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/common.cpp -------------------------------------------------------------------------------- /src/shaderfragment/common.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/common.h -------------------------------------------------------------------------------- /src/shaderfragment/compose.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/compose.h -------------------------------------------------------------------------------- /src/shaderfragment/dither.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/dither.cpp -------------------------------------------------------------------------------- /src/shaderfragment/dither.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/dither.h -------------------------------------------------------------------------------- /src/shaderfragment/fakesun.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/fakesun.cpp -------------------------------------------------------------------------------- /src/shaderfragment/fakesun.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/fakesun.h -------------------------------------------------------------------------------- /src/shaderfragment/hband.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/hband.cpp -------------------------------------------------------------------------------- /src/shaderfragment/hband.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/hband.h -------------------------------------------------------------------------------- /src/shaderfragment/noise.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/noise.cpp -------------------------------------------------------------------------------- /src/shaderfragment/noise.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/noise.h -------------------------------------------------------------------------------- /src/shaderfragment/pseudo_rand.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/pseudo_rand.cpp -------------------------------------------------------------------------------- /src/shaderfragment/pseudo_rand.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/pseudo_rand.h -------------------------------------------------------------------------------- /src/shaderfragment/scattering.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/scattering.cpp -------------------------------------------------------------------------------- /src/shaderfragment/scattering.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/shaderfragment/scattering.h -------------------------------------------------------------------------------- /src/siderealtime.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/siderealtime.cpp -------------------------------------------------------------------------------- /src/spheremappedhimmel.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/spheremappedhimmel.cpp -------------------------------------------------------------------------------- /src/starmapgeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/starmapgeode.cpp -------------------------------------------------------------------------------- /src/stars.cpp: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "stars.h" 31 | 32 | #include "mathmacros.h" 33 | #include "siderealtime.h" 34 | 35 | 36 | namespace osgHimmel 37 | { 38 | 39 | const t_longf Stars::tempratureFromBV(const t_longf BtoV) 40 | { 41 | // NOTE: This is just an estimation! 42 | 43 | // (Night Rendering - Jensen, Premovze, Shirley, Thompson, Ferwerda - 2001) 44 | return 7000.0 / (BtoV + 0.56); 45 | 46 | // (The Colors of the Stars - Olson - 1998) 47 | //return 1000.0 + 5000.0 / (BtoV + 0.5); 48 | } 49 | 50 | 51 | // Planckian locus in CIE XYZ Approximation 52 | 53 | const osg::Vec2f Stars::planckianLocusInCieXYZ(const t_longf t) 54 | { 55 | // (http://en.wikipedia.org/wiki/Planckian_locus) 56 | 57 | float x(0.f), y(0.f); 58 | 59 | const float o = 1.0 / t; 60 | 61 | if( 1667 <= t && t <= 4000) 62 | x = +0.17991 + o * (+877.6956 + o * (- 234358.0 + o * - 266123900.0)); 63 | else if( 4000 < t && t <= 25000) 64 | x = +0.24039 + o * (+222.6347 + o * (+2107037.9 + o * -3025846900.0)); 65 | 66 | 67 | if( 1667 <= t && t <= 2222) 68 | y = -0.20219683 + t * (+2.18555832 + t * (-1.3481102 + t * -1.1063814)); 69 | else if( 2222 < t && t <= 4000) 70 | y = -0.16748867 + t * (+2.09137015 + t * (-1.3741859 + t * -0.9549476)); 71 | else if( 4000 < t && t <= 25000) 72 | y = -0.37001483 + t * (+3.75112997 + t * (-5.8733867 + t * +3.0817580)); 73 | 74 | return osg::Vec2f(x, y); 75 | } 76 | 77 | 78 | const osg::Vec3f Stars::xyzTristimulus(const t_longf t) 79 | { 80 | return xyzTristimulus(planckianLocusInCieXYZ(t)); 81 | } 82 | 83 | const osg::Vec3f Stars::xyzTristimulus(const osg::Vec2f planckianLocus) 84 | { 85 | // (http://en.wikipedia.org/wiki/CIE_1931_color_space) 86 | // and (The Colors of the Stars - Olson - 1998) 87 | 88 | const float Y = 1.0; 89 | 90 | const float X = Y / planckianLocus.y() * planckianLocus.x(); 91 | const float Z = Y / planckianLocus.y() * (1.0 - planckianLocus.x() - planckianLocus.y()); 92 | 93 | return osg::Vec3f(X, Y, Z); 94 | } 95 | 96 | 97 | const osg::Vec3f Stars::sRgbColor(const t_longf t) 98 | { 99 | return sRgbColor(xyzTristimulus(t)); 100 | } 101 | 102 | const osg::Vec3f Stars::sRgbColor(const osg::Vec2f planckianLocus) 103 | { 104 | return sRgbColor(xyzTristimulus(planckianLocus)); 105 | } 106 | 107 | const osg::Vec3f Stars::sRgbColor(const osg::Vec3f xyzTristimulus) 108 | { 109 | // (The Colors of the Stars - Olson - 1998) - sRGB matrix - feel free to use other matrices here... 110 | 111 | const float r = 3.24 * xyzTristimulus.x() -1.537 * xyzTristimulus.y() -0.499 * xyzTristimulus.z(); 112 | const float g = -0.969 * xyzTristimulus.x() +1.876 * xyzTristimulus.y() +0.042 * xyzTristimulus.z(); 113 | const float b = 0.056 * xyzTristimulus.x() -0.204 * xyzTristimulus.y() +1.057 * xyzTristimulus.z(); 114 | 115 | return osg::Vec3f(r, g, b); 116 | } 117 | 118 | 119 | const t_equd Stars::apparentPosition( 120 | const t_julianDay /*t*/ 121 | , const t_longf /*a2000*/ 122 | , const t_longf /*d2000*/ 123 | , const t_longf /*mpa2000*/ 124 | , const t_longf /*mpd2000*/) 125 | { 126 | //const t_julianDay T(jCenturiesSinceSE(t)); 127 | 128 | // (AA.20.1) 129 | 130 | //const t_longf m = (_decimal(0, 0, 3.07496)) + (_decimal(0, 0, 0.00186)) * T * 100.0; 131 | //const t_longf n = _arcsecs(_decimal(0, 0, 1.33621)) - _arcsecs(_decimal(0, 0, 0.00057)) * T * 100.0; 132 | 133 | //const t_longf Da = m + n * sin(_rad(mpa2000)) * tan(_rad(mpd2000)); 134 | //const t_longf Db = n * cos(_rad(mpa2000)); 135 | 136 | // TODO 137 | 138 | return t_equd(); 139 | } 140 | 141 | 142 | const t_hord Stars::horizontalPosition( 143 | const t_aTime &aTime 144 | , const t_longf latitude 145 | , const t_longf longitude 146 | , const t_longf a2000 147 | , const t_longf d2000 148 | , const t_longf mpa2000 149 | , const t_longf mpd2000) 150 | { 151 | t_julianDay t(jd(aTime)); 152 | t_julianDay s(siderealTime(aTime)); 153 | 154 | t_equd equ = apparentPosition(t, a2000, d2000, mpa2000, mpd2000); 155 | 156 | return equ.toHorizontal(s, latitude, longitude); 157 | } 158 | 159 | } // namespace osgHimmel -------------------------------------------------------------------------------- /src/starsgeode.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/starsgeode.cpp -------------------------------------------------------------------------------- /src/strutils.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/strutils.cpp -------------------------------------------------------------------------------- /src/sun.cpp: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "sun.h" 31 | 32 | #include "earth.h" 33 | #include "moon.h" 34 | #include "siderealtime.h" 35 | #include "mathmacros.h" 36 | 37 | #include 38 | 39 | 40 | namespace osgHimmel 41 | { 42 | 43 | // Mean anomaly (AA.45.3). 44 | 45 | const t_longf Sun::meanAnomaly(const t_julianDay t) 46 | { 47 | const t_julianDay T(jCenturiesSinceSE(t)); 48 | 49 | // seems most accurate... :o 50 | const t_longf M = 357.5291092 51 | + T * (+ 35999.0502909 52 | + T * (- 0.0001536 53 | + T * (+ 1.0 / 24490000.0))); 54 | 55 | // AA uses different coefficients all over the book... 56 | // ...taken the (probably) most accurate above 57 | 58 | // (AA.21 ...) 59 | //const t_longf M = 357.52772 60 | // + T * (+ 35999.050340 61 | // + T * (- 0.0001603 62 | // + T * (- 1.0 / 300000.0))); 63 | 64 | // (AA.24.3) 65 | //const t_longf M = 357.52910 66 | // + T * (+ 35999.05030 67 | // + T * (- 0.0001559 68 | // + T * (- 0.00000048))); 69 | 70 | return _revd(M); 71 | } 72 | 73 | 74 | const t_longf Sun::meanLongitude(const t_julianDay t) 75 | { 76 | const t_julianDay T(jCenturiesSinceSE(t)); 77 | 78 | const t_longf L0 = 280.46645 79 | + T * (+ 36000.76983 80 | + T * (+ 0.0003032)); 81 | 82 | return _revd(L0); 83 | } 84 | 85 | 86 | // (AA p152) 87 | 88 | const t_longf Sun::center(const t_julianDay t) 89 | { 90 | const t_julianDay T(jCenturiesSinceSE(t)); 91 | 92 | const t_longf M = _rad(meanAnomaly(t)); 93 | 94 | const t_longf C = 95 | + (1.914600 - T * (0.004817 - T * 0.000014)) * sin(M) 96 | + (0.019993 - T * 0.000101) * sin(2.0 * M) 97 | + 0.000290 * sin(3.0 * M); 98 | 99 | return C; 100 | } 101 | 102 | 103 | const t_longf Sun::trueAnomaly(const t_julianDay t) 104 | { 105 | return meanAnomaly(t) + center(t); // v = M + C 106 | } 107 | 108 | 109 | // True geometric longitude referred to the mean equinox of the date. 110 | 111 | const t_longf Sun::trueLongitude(const t_julianDay t) 112 | { 113 | return meanLongitude(t) + center(t); // Θ 114 | } 115 | 116 | 117 | const t_equd Sun::apparentPosition(const t_julianDay t) 118 | { 119 | t_equd equ; 120 | 121 | const t_longf O = _rad(Moon::meanOrbitLongitude(t)); 122 | const t_longf e = _rad(Earth::trueObliquity(t) + 0.00256 * cos(O)); 123 | const t_longf l = _rad(trueLongitude(t) - 0.00569 - 0.00478 * sin(O)); 124 | 125 | const t_longf sinl = sin(l); 126 | 127 | equ.right_ascension = _revd(_deg(atan2(cos(e) * sinl, cos(l)))); 128 | equ.declination = _deg(asin(sin(e) * sinl)); 129 | 130 | return equ; 131 | } 132 | 133 | 134 | const t_hord Sun::horizontalPosition( 135 | const t_aTime &aTime 136 | , const t_longf latitude 137 | , const t_longf longitude) 138 | { 139 | t_julianDay t(jd(aTime)); 140 | t_julianDay s(siderealTime(aTime)); 141 | 142 | t_equd equ = Sun::apparentPosition(t); 143 | 144 | return equ.toHorizontal(s, latitude, longitude); 145 | } 146 | 147 | 148 | // NOTE: This gives the distance from the center of the sun to the 149 | // center of the earth. 150 | 151 | const t_longf Sun::distance(const t_julianDay t) 152 | { 153 | // (AA.24.5) 154 | const t_longf e = Earth::orbitEccentricity(t); 155 | 156 | const t_longf R = 1.000001018 * (1.0 - e * e) / 157 | (1.0 + e * cos(_rad(trueAnomaly(t)))); // in AU 158 | 159 | return _kms(R); 160 | } 161 | 162 | 163 | const t_longf Sun::meanRadius() 164 | { 165 | // http://nssdc.gsfc.nasa.gov/planetary/factsheet/sunfact.html 166 | 167 | return 0.696e+6; // in kilometers 168 | } 169 | 170 | } // namespace osgHimmel -------------------------------------------------------------------------------- /src/sun2.cpp: -------------------------------------------------------------------------------- 1 |  2 | // Copyright (c) 2011-2012, Daniel Müller 3 | // Computer Graphics Systems Group at the Hasso-Plattner-Institute, Germany 4 | // All rights reserved. 5 | // 6 | // Redistribution and use in source and binary forms, with or without 7 | // modification, are permitted provided that the following conditions are met: 8 | // * Redistributions of source code must retain the above copyright notice, 9 | // this list of conditions and the following disclaimer. 10 | // * Redistributions in binary form must reproduce the above copyright 11 | // notice, this list of conditions and the following disclaimer in the 12 | // documentation and/or other materials provided with the distribution. 13 | // * Neither the name of the Computer Graphics Systems Group at the 14 | // Hasso-Plattner-Institute (HPI), Germany nor the names of its 15 | // contributors may be used to endorse or promote products derived from 16 | // this software without specific prior written permission. 17 | // 18 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 19 | // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 20 | // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 21 | // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE 22 | // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 23 | // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 24 | // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 25 | // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 26 | // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 27 | // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 28 | // POSSIBILITY OF SUCH DAMAGE. 29 | 30 | #include "sun2.h" 31 | 32 | #include "sun.h" 33 | #include "earth2.h" 34 | #include "moon2.h" 35 | #include "siderealtime.h" 36 | #include "mathmacros.h" 37 | 38 | #include 39 | 40 | 41 | namespace osgHimmel 42 | { 43 | 44 | const float Sun2::meanAnomaly(const t_julianDay t) 45 | { 46 | const t_julianDay T(jCenturiesSinceSE(t)); 47 | 48 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 49 | const float M = _deg(6.24 + 628.302 * T); 50 | 51 | // suggestion (seems insuficient) from 52 | // http://wlym.com/~animations/ceres/calculatingposition/eccentric.html 53 | //const float M = 357.528 + 0.9856003 * t; 54 | 55 | return _revd(M); 56 | } 57 | 58 | 59 | const float Sun2::meanLongitude(const t_julianDay t) 60 | { 61 | const t_julianDay T(jCenturiesSinceSE(t)); 62 | 63 | const float L0 = 280.4665 64 | + T * (+ 36000.7698); 65 | 66 | return _revd(L0); 67 | } 68 | 69 | 70 | const t_equf Sun2::apparentPosition(const t_julianDay t) 71 | { 72 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 73 | 74 | const t_julianDay T(jCenturiesSinceSE(t)); 75 | const float M = _rad(meanAnomaly(t)); 76 | 77 | t_eclf ecl; 78 | 79 | ecl.longitude = _deg(4.895048 + 628.331951 * T 80 | + (0.033417 - 0.000084 * T) * sin(M) + 0.000351 * sin(2 * M)); 81 | ecl.latitude = 0; 82 | 83 | t_equf equ; 84 | equ = ecl.toEquatorial(Earth2::trueObliquity(t)); 85 | 86 | return equ; 87 | } 88 | 89 | 90 | const t_horf Sun2::horizontalPosition( 91 | const t_aTime &aTime 92 | , const float latitude 93 | , const float longitude) 94 | { 95 | t_julianDay t(jd(aTime)); 96 | t_julianDay s(siderealTime(aTime)); 97 | 98 | t_equf equ = apparentPosition(t); 99 | 100 | return equ.toHorizontal(s, latitude, longitude); 101 | } 102 | 103 | 104 | // NOTE: This gives the distance from the center of the sun to the 105 | // center of the earth. 106 | 107 | const float Sun2::distance(const t_julianDay t) 108 | { 109 | // ("A Physically-Based Night Sky Model" - 2001 - Wann Jensen et al.) 110 | const t_julianDay T(jCenturiesSinceSE(t)); 111 | 112 | const float M = 6.24 + 628.302 * T; 113 | 114 | const float R = 1.000140 - (0.016708 - 0.000042 * T) * cos(M) 115 | - 0.000141 * cos(2 * M); // in AU 116 | 117 | return _kms(R); 118 | } 119 | 120 | 121 | const t_longf Sun2::meanRadius() 122 | { 123 | return Sun::meanRadius(); 124 | } 125 | 126 | } // namespace osgHimmel -------------------------------------------------------------------------------- /src/timef.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/timef.cpp -------------------------------------------------------------------------------- /src/twounitschanger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/src/twounitschanger.cpp -------------------------------------------------------------------------------- /tests/CMakeLists.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/CMakeLists.txt -------------------------------------------------------------------------------- /tests/test.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test.cpp -------------------------------------------------------------------------------- /tests/test.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test.h -------------------------------------------------------------------------------- /tests/test_astronomy.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_astronomy.h -------------------------------------------------------------------------------- /tests/test_astronomy2.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_astronomy2.cpp -------------------------------------------------------------------------------- /tests/test_astronomy2.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_astronomy2.h -------------------------------------------------------------------------------- /tests/test_math.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_math.cpp -------------------------------------------------------------------------------- /tests/test_math.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_math.h -------------------------------------------------------------------------------- /tests/test_time.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_time.cpp -------------------------------------------------------------------------------- /tests/test_time.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_time.h -------------------------------------------------------------------------------- /tests/test_twounitschanger.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_twounitschanger.cpp -------------------------------------------------------------------------------- /tests/test_twounitschanger.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/test_twounitschanger.h -------------------------------------------------------------------------------- /tests/tests.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/cgcostume/osghimmel/3dc2950c12181c9efa0450c6eee9d9fe91fee139/tests/tests.cpp --------------------------------------------------------------------------------