mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-21 18:38:20 -05:00
Merge branch 'feature/osirisrex' of github.com:OpenSpace/OpenSpace into feature/osirisrex
This commit is contained in:
@@ -1,23 +1,9 @@
|
||||
return {
|
||||
-- Earth barycenter module
|
||||
{
|
||||
Name = "EarthBarycenter",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Static = true,
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
Body = "EARTH BARYCENTER",
|
||||
Reference = "ECLIPJ2000",
|
||||
Observer = "SUN",
|
||||
Kernels = {
|
||||
"${OPENSPACE_DATA}/spice/de430_1850-2150.bsp"
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
-- RenderableGlobe module
|
||||
{
|
||||
Name = "DebugGlobe",
|
||||
Parent = "EarthBarycenter",
|
||||
Parent = "Root",
|
||||
Renderable = {
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_EARTH",
|
||||
@@ -67,11 +53,7 @@ return {
|
||||
Enabled = true,
|
||||
},
|
||||
--[[
|
||||
{
|
||||
Name = "Mars Viking Clr",
|
||||
FilePath = "textures/Mars_Viking_ClrMosaic_global_925m_longlat_full.vrt",
|
||||
Enabled = true,
|
||||
},
|
||||
|
||||
{
|
||||
Name = "On Mercury Color",
|
||||
FilePath = "map_service_configs/mercury/OnMercuryColor.xml",
|
||||
@@ -86,7 +68,7 @@ return {
|
||||
{
|
||||
Name = "CTX Mosaic",
|
||||
FilePath = "map_service_configs/mars/CTX_Mosaic.xml",
|
||||
Enabled = false,
|
||||
Enabled = true,
|
||||
},
|
||||
|
||||
--[[
|
||||
@@ -129,7 +111,6 @@ return {
|
||||
},
|
||||
},
|
||||
HeightMaps = {
|
||||
|
||||
{
|
||||
Name = "Mola Elevation",
|
||||
FilePath = "map_service_configs/mars/Mola_Elevation.xml",
|
||||
@@ -173,30 +154,4 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/Planets/DebugGlobe"
|
||||
},
|
||||
-- EarthTrail module
|
||||
{
|
||||
Name = "EarthTrail",
|
||||
Parent = "SolarSystemBarycenter",
|
||||
Renderable = {
|
||||
Type = "RenderableTrail",
|
||||
Body = "EARTH",
|
||||
Frame = "GALACTIC",
|
||||
Observer = "SUN",
|
||||
RGB = { 0.5, 0.8, 1.0},
|
||||
TropicalOrbitPeriod = 365.242,
|
||||
EarthOrbitRatio = 1,
|
||||
DayLength = 24
|
||||
},
|
||||
GuiName = "/Solar/EarthTrail"
|
||||
}
|
||||
--[[,
|
||||
{
|
||||
Name = "DebugPlane",
|
||||
Parent = "DebugGlobe",
|
||||
Renderable = {
|
||||
Type = "RenderableDebugPlane",
|
||||
Texture = 34,
|
||||
Size = { 1, 7 }
|
||||
}
|
||||
}]]
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
function preInitialization()
|
||||
--[[
|
||||
The scripts in this function are executed after the scene is loaded but before the
|
||||
scene elements have been initialized, thus they should be used to set the time at
|
||||
which the scene should start and other settings that might determine initialization
|
||||
critical objects.
|
||||
]]--
|
||||
|
||||
--openspace.time.setTime(openspace.time.currentWallTime())
|
||||
openspace.spice.loadKernel("${SPICE}/naif0011.tls")
|
||||
openspace.spice.loadKernel("${SPICE}/pck00010.tpc")
|
||||
|
||||
openspace.time.setTime("2015 NOV 24 00:00:00")
|
||||
|
||||
|
||||
dofile(openspace.absPath('${SCRIPTS}/bind_keys.lua'))
|
||||
end
|
||||
|
||||
function postInitialization()
|
||||
openspace.printInfo("Setting default values")
|
||||
|
||||
openspace.setInteractionMode('GlobeBrowsing')
|
||||
|
||||
openspace.time.setDeltaTime(0)
|
||||
openspace.restoreCameraStateFromFile("debugstart.view")
|
||||
openspace.resetCameraDirection()
|
||||
openspace.gui.show()
|
||||
|
||||
openspace.printInfo("Done setting default values")
|
||||
end
|
||||
|
||||
|
||||
return {
|
||||
ScenePath = ".",
|
||||
CommonFolder = "common",
|
||||
Camera = {
|
||||
Focus = "DebugGlobe",
|
||||
Position = {3428016.852415, 616607.056698, 60430.587719},
|
||||
Rotation = {0.178551, -0.280661, 0.916566, 0.221935},
|
||||
},
|
||||
|
||||
Modules = {
|
||||
"debugglobe"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,6 @@ return {
|
||||
{
|
||||
Name = "MARS_Viking_MDIM21",
|
||||
FilePath = "map_service_configs/MARS_Viking_MDIM21.xml",
|
||||
Enabled = true,
|
||||
},
|
||||
{
|
||||
Name = "Mars Viking Clr",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
return {
|
||||
FileRequest = {
|
||||
{ Identifier = "67p_textures", Destination = "textures", Version = 2 }
|
||||
{ Identifier = "67p_textures", Destination = "textures", Version = 2 },
|
||||
{ Identifier = "rosettaimages", Destination = "rosettaimages", Version = 1}
|
||||
},
|
||||
TorrentFiles = {
|
||||
{ File = "67P_rotated_5_130.obj.torrent", Destination = "obj" },
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: 9e4431d254...6174b77164
+1
-1
Submodule ext/sgct updated: 0a2d0241f4...70cde82e33
@@ -50,4 +50,4 @@ protected:
|
||||
} // namespace interaction
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __CONTROLLER_H__
|
||||
#endif // __CONTROLLER_H__
|
||||
|
||||
@@ -52,4 +52,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -21,4 +21,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -26,4 +26,4 @@ protected:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -162,4 +162,4 @@ namespace openspace{
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MESSAGESTRUCTURES_H__
|
||||
#endif // __MESSAGESTRUCTURES_H__
|
||||
|
||||
@@ -75,4 +75,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __NETWORKENGINE_H__
|
||||
#endif // __NETWORKENGINE_H__
|
||||
|
||||
@@ -205,4 +205,4 @@ namespace openspace{
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OSPARALLELCONNECTION_H__
|
||||
#endif // __OSPARALLELCONNECTION_H__
|
||||
|
||||
@@ -39,4 +39,4 @@ const std::string OPENSPACE_VERSION_STRING = "prerelease-9 (IPS)";
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __OPENSPACE_H__
|
||||
#endif // __OPENSPACE_H__
|
||||
|
||||
@@ -125,4 +125,4 @@ private:
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __STRINGPROPERTY_H__
|
||||
#endif // __STRINGPROPERTY_H__
|
||||
|
||||
@@ -79,4 +79,4 @@ bool PropertyDelegate<TemplateProperty<std::vector<int>>>::toString(std::string&
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __SELECTIONPROPERTY_H__
|
||||
#endif // __SELECTIONPROPERTY_H__
|
||||
|
||||
@@ -35,4 +35,4 @@ REGISTER_TEMPLATEPROPERTY_HEADER(StringProperty, std::string);
|
||||
} // namespace properties
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __STRINGPROPERTY_H__
|
||||
#endif // __STRINGPROPERTY_H__
|
||||
|
||||
@@ -48,4 +48,4 @@ std::vector<properties::Property*> allProperties();
|
||||
|
||||
} // namespace
|
||||
|
||||
#endif // __QUERY_H__
|
||||
#endif // __QUERY_H__
|
||||
|
||||
@@ -218,4 +218,4 @@ namespace openspace {
|
||||
};
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __CAMERA_H__
|
||||
#endif // __CAMERA_H__
|
||||
|
||||
@@ -116,4 +116,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // SYNCBUFFER_H
|
||||
#endif // SYNCBUFFER_H
|
||||
|
||||
@@ -84,4 +84,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLEMODEL_H__
|
||||
#endif // __RENDERABLEMODEL_H__
|
||||
|
||||
@@ -218,4 +218,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLEPLANET_H__
|
||||
#endif // __RENDERABLEPLANET_H__
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/filesystem/filesystem>
|
||||
|
||||
|
||||
@@ -73,10 +73,10 @@ Fragment getFragment() {
|
||||
// The plane is oriented on the xz plane
|
||||
// WARNING: This might not be the case for Uranus
|
||||
if (gl_FrontFacing) {
|
||||
normal = vec3(0.0, 1.0, 0.0);
|
||||
normal = vec3(-1.0, 0.0, 0.0);
|
||||
}
|
||||
else {
|
||||
normal = vec3(0.0, -1.0, 0.0);
|
||||
normal = vec3(1.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
// Reduce the color of the fragment by the user factor
|
||||
|
||||
@@ -32,9 +32,7 @@ in vec4 vs_position;
|
||||
#include "fragment.glsl"
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
|
||||
|
||||
|
||||
Fragment getFragment(){
|
||||
Fragment getFragment() {
|
||||
Fragment frag;
|
||||
|
||||
// power scale coordinates for depth. w value is set to 1.0.
|
||||
@@ -44,6 +42,7 @@ Fragment getFragment(){
|
||||
if(frag.color.a == 0.0f){
|
||||
discard;
|
||||
}
|
||||
|
||||
frag.depth = denormalizeFloat(depth);
|
||||
|
||||
return frag;
|
||||
|
||||
@@ -36,6 +36,6 @@ out vec4 vs_position;
|
||||
|
||||
void main(){
|
||||
vs_st = in_st;
|
||||
vs_position = ViewProjectionMatrix*ModelTransform*in_position;
|
||||
vs_position = ViewProjectionMatrix * ModelTransform * in_position;
|
||||
gl_Position = vec4(vs_position);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,6 +71,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentjobmanager.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentqueue.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/statscollector.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/threadpool.h
|
||||
|
||||
|
||||
)
|
||||
@@ -122,6 +123,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/lrucache.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/concurrentjobmanager.inl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/statscollector.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/other/threadpool.cpp
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@
|
||||
|
||||
#include <modules/globebrowsing/chunk/chunknode.h>
|
||||
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
|
||||
namespace ghoul {
|
||||
|
||||
@@ -96,4 +96,4 @@ namespace openspace {
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __AABB_H__
|
||||
#endif // __AABB_H__
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace openspace {
|
||||
, _saveOrThrowCamera(properties::BoolProperty("saveOrThrowCamera", "saveOrThrowCamera"))
|
||||
, _resetTileProviders(properties::BoolProperty("resetTileProviders", "resetTileProviders"))
|
||||
, _cameraMinHeight(properties::FloatProperty("cameraMinHeight", "cameraMinHeight", 100.0f, 0.0f, 1000.0f))
|
||||
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 5.0f, 1.0f, 50.0f))
|
||||
, lodScaleFactor(properties::FloatProperty("lodScaleFactor", "lodScaleFactor", 10.0f, 1.0f, 50.0f))
|
||||
, debugSelection(ReferencedBoolSelection("Debug", "Debug"))
|
||||
, atmosphereEnabled(properties::BoolProperty(" Atmosphere", " Atmosphere", false))
|
||||
{
|
||||
|
||||
@@ -71,4 +71,4 @@ protected:
|
||||
const int _ySegments;
|
||||
};
|
||||
} // namespace openspace
|
||||
#endif // __GRIDGEOMETRY_H__
|
||||
#endif // __GRIDGEOMETRY_H__
|
||||
|
||||
@@ -175,4 +175,4 @@ void TriangleSoup::drawUsingActiveProgram() {
|
||||
glBindVertexArray(0);
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -100,4 +100,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __TRIANGLESOUP_H__
|
||||
#endif // __TRIANGLESOUP_H__
|
||||
|
||||
@@ -32,7 +32,8 @@
|
||||
#include <queue>
|
||||
|
||||
#include <modules/globebrowsing/other/concurrentqueue.h>
|
||||
#include <ghoul/misc/threadpool.h>
|
||||
#include <modules/globebrowsing/other/threadpool.h>
|
||||
//#include <ghoul/misc/threadpool.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
|
||||
@@ -64,7 +65,7 @@ namespace openspace {
|
||||
template<typename P>
|
||||
class ConcurrentJobManager{
|
||||
public:
|
||||
ConcurrentJobManager(std::shared_ptr<ghoul::ThreadPool> pool) : threadPool(pool)
|
||||
ConcurrentJobManager(std::shared_ptr<ThreadPool> pool) : threadPool(pool)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -75,14 +76,19 @@ namespace openspace {
|
||||
|
||||
|
||||
void enqueueJob(std::shared_ptr<Job<P>> job) {
|
||||
threadPool->queue([this, job]() {
|
||||
//threadPool->queue([this, job]() {
|
||||
// job->execute();
|
||||
// _finishedJobs.push(job);
|
||||
//});
|
||||
threadPool->enqueue([this, job]() {
|
||||
job->execute();
|
||||
_finishedJobs.push(job);
|
||||
});
|
||||
}
|
||||
|
||||
void clearEnqueuedJobs() {
|
||||
threadPool->clearRemainingTasks();
|
||||
//threadPool->clearRemainingTasks();
|
||||
threadPool->clearTasks();
|
||||
}
|
||||
|
||||
std::shared_ptr<Job<P>> popFinishedJob() {
|
||||
@@ -95,14 +101,15 @@ namespace openspace {
|
||||
}
|
||||
|
||||
void reset() {
|
||||
threadPool->clearRemainingTasks();
|
||||
//threadPool->clearRemainingTasks();
|
||||
threadPool->clearTasks();
|
||||
}
|
||||
|
||||
|
||||
private:
|
||||
|
||||
ConcurrentQueue<std::shared_ptr<Job<P>>> _finishedJobs;
|
||||
std::shared_ptr<ghoul::ThreadPool> threadPool;
|
||||
std::shared_ptr<ThreadPool> threadPool;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,123 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <thread>
|
||||
#include <queue>
|
||||
|
||||
#include <modules/globebrowsing/other/concurrentqueue.h>
|
||||
#include <modules/globebrowsing/other/threadpool.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Worker::Worker(ThreadPool& pool)
|
||||
: pool(pool)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Worker::operator()() {
|
||||
std::function<void()> task;
|
||||
while (true) {
|
||||
|
||||
// acquire lock
|
||||
{
|
||||
std::unique_lock<std::mutex> lock(pool.queue_mutex);
|
||||
|
||||
// look for a work item
|
||||
while (!pool.stop && pool.tasks.empty()) {
|
||||
// if there are none wait for notification
|
||||
pool.condition.wait(lock);
|
||||
}
|
||||
|
||||
if (pool.stop) { // exit if the pool is stopped
|
||||
return;
|
||||
}
|
||||
|
||||
// get the task from the queue
|
||||
task = pool.tasks.front();
|
||||
pool.tasks.pop_front();
|
||||
|
||||
}// release lock
|
||||
|
||||
// execute the task
|
||||
task();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ThreadPool::ThreadPool(size_t numThreads)
|
||||
: stop(false)
|
||||
{
|
||||
for (size_t i = 0; i < numThreads; ++i) {
|
||||
workers.push_back(std::thread(Worker(*this)));
|
||||
}
|
||||
}
|
||||
|
||||
// the destructor joins all threads
|
||||
ThreadPool::~ThreadPool() {
|
||||
// stop all threads
|
||||
stop = true;
|
||||
condition.notify_all();
|
||||
|
||||
// join them
|
||||
for (size_t i = 0; i < workers.size(); ++i) {
|
||||
workers[i].join();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// add new work item to the pool
|
||||
void ThreadPool::enqueue(std::function<void()> f) {
|
||||
{ // acquire lock
|
||||
std::unique_lock<std::mutex> lock(queue_mutex);
|
||||
|
||||
// add the task
|
||||
tasks.push_back(f);
|
||||
} // release lock
|
||||
|
||||
// wake up one thread
|
||||
condition.notify_one();
|
||||
}
|
||||
|
||||
void ThreadPool::clearTasks() {
|
||||
{ // acquire lock
|
||||
std::unique_lock<std::mutex> lock(queue_mutex);
|
||||
tasks.clear();
|
||||
} // release lock
|
||||
}
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
@@ -0,0 +1,81 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014-2016 *
|
||||
* *
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy of this *
|
||||
* software and associated documentation files (the "Software"), to deal in the Software *
|
||||
* without restriction, including without limitation the rights to use, copy, modify, *
|
||||
* merge, publish, distribute, sublicense, and/or sell copies of the Software, and to *
|
||||
* permit persons to whom the Software is furnished to do so, subject to the following *
|
||||
* conditions: *
|
||||
* *
|
||||
* The above copyright notice and this permission notice shall be included in all copies *
|
||||
* or substantial portions of the Software. *
|
||||
* *
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, *
|
||||
* INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A *
|
||||
* PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT *
|
||||
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF *
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __THREAD_POOL_H__
|
||||
#define __THREAD_POOL_H__
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <memory>
|
||||
#include <ostream>
|
||||
#include <thread>
|
||||
#include <queue>
|
||||
|
||||
#include <modules/globebrowsing/other/concurrentqueue.h>
|
||||
|
||||
#include <ghoul/misc/assert.h>
|
||||
|
||||
|
||||
|
||||
// Implementatin based on http://progsch.net/wordpress/?p=81
|
||||
|
||||
namespace openspace {
|
||||
|
||||
|
||||
class ThreadPool;
|
||||
|
||||
class Worker {
|
||||
public:
|
||||
Worker(ThreadPool& pool);
|
||||
void operator()();
|
||||
private:
|
||||
ThreadPool& pool;
|
||||
};
|
||||
|
||||
class ThreadPool {
|
||||
public:
|
||||
ThreadPool(size_t numThreads);
|
||||
~ThreadPool();
|
||||
|
||||
void enqueue(std::function<void()> f);
|
||||
void clearTasks();
|
||||
|
||||
private:
|
||||
friend class Worker;
|
||||
|
||||
std::vector<std::thread> workers;
|
||||
|
||||
std::deque<std::function<void()>> tasks;
|
||||
|
||||
std::mutex queue_mutex;
|
||||
std::condition_variable condition;
|
||||
|
||||
bool stop;
|
||||
};
|
||||
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
|
||||
|
||||
#endif // __THREAD_POOL_H__
|
||||
@@ -117,9 +117,9 @@ namespace openspace {
|
||||
|
||||
AsyncTileDataProvider::AsyncTileDataProvider(
|
||||
std::shared_ptr<TileDataset> tileDataset,
|
||||
std::shared_ptr<ghoul::ThreadPool> pool)
|
||||
std::shared_ptr<ThreadPool> pool)
|
||||
: _tileDataset(tileDataset)
|
||||
, _threadPool(pool)
|
||||
, _concurrentJobManager(pool)
|
||||
{
|
||||
|
||||
}
|
||||
@@ -135,12 +135,11 @@ namespace openspace {
|
||||
|
||||
bool AsyncTileDataProvider::enqueueTileIO(const ChunkIndex& chunkIndex) {
|
||||
if (satisfiesEnqueueCriteria(chunkIndex)) {
|
||||
const static auto job = [](const ChunkIndex& chunkIndex, std::shared_ptr<TileDataset> tileDataset) {
|
||||
return tileDataset->readTileData(chunkIndex);
|
||||
};
|
||||
auto job = std::make_shared<TileLoadJob>(_tileDataset, chunkIndex);
|
||||
//auto job = std::make_shared<DiskCachedTileLoadJob>(_tileDataset, chunkIndex, tileDiskCache, "ReadAndWrite");
|
||||
_concurrentJobManager.enqueueJob(job);
|
||||
_enqueuedTileRequests[chunkIndex.hashKey()] = chunkIndex;
|
||||
|
||||
FutureResult futureResult = _threadPool->queue(job, chunkIndex, _tileDataset);
|
||||
_futureTileIOResults[chunkIndex.hashKey()] = std::move(futureResult);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
@@ -148,16 +147,8 @@ namespace openspace {
|
||||
|
||||
std::vector<std::shared_ptr<TileIOResult>> AsyncTileDataProvider::getTileIOResults() {
|
||||
std::vector<std::shared_ptr<TileIOResult>> readyResults;
|
||||
auto it = _futureTileIOResults.begin();
|
||||
while(it != _futureTileIOResults.end()) {
|
||||
std::future_status status = it->second.wait_for(std::chrono::seconds(0));
|
||||
if (status == std::future_status::ready) {
|
||||
readyResults.push_back(it->second.get());
|
||||
it = _futureTileIOResults.erase(it);
|
||||
}
|
||||
else {
|
||||
it++;
|
||||
}
|
||||
while (_concurrentJobManager.numFinishedJobs() > 0) {
|
||||
readyResults.push_back(_concurrentJobManager.popFinishedJob()->product());
|
||||
}
|
||||
return readyResults;
|
||||
}
|
||||
@@ -165,19 +156,28 @@ namespace openspace {
|
||||
|
||||
bool AsyncTileDataProvider::satisfiesEnqueueCriteria(const ChunkIndex& chunkIndex) const {
|
||||
// only allow tile to be enqueued if it's not already enqueued
|
||||
return _futureTileIOResults.find(chunkIndex.hashKey()) == _futureTileIOResults.end();
|
||||
//return _futureTileIOResults.find(chunkIndex.hashKey()) == _futureTileIOResults.end();
|
||||
return _enqueuedTileRequests.find(chunkIndex.hashKey()) == _enqueuedTileRequests.end();
|
||||
|
||||
}
|
||||
|
||||
void AsyncTileDataProvider::reset() {
|
||||
_futureTileIOResults.clear();
|
||||
_threadPool->stop(ghoul::ThreadPool::RunRemainingTasks::No);
|
||||
_threadPool->start();
|
||||
//_futureTileIOResults.clear();
|
||||
//_threadPool->stop(ghoul::ThreadPool::RunRemainingTasks::No);
|
||||
//_threadPool->start();
|
||||
_enqueuedTileRequests.clear();
|
||||
_concurrentJobManager.reset();
|
||||
while (_concurrentJobManager.numFinishedJobs() > 0) {
|
||||
_concurrentJobManager.popFinishedJob();
|
||||
}
|
||||
getTextureDataProvider()->reset();
|
||||
}
|
||||
|
||||
void AsyncTileDataProvider::clearRequestQueue() {
|
||||
_threadPool->clearRemainingTasks();
|
||||
_futureTileIOResults.clear();
|
||||
//_threadPool->clearRemainingTasks();
|
||||
//_futureTileIOResults.clear();
|
||||
_concurrentJobManager.clearEnqueuedJobs();
|
||||
_enqueuedTileRequests.clear();
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#include <modules/globebrowsing/geometry/geodetic2.h>
|
||||
|
||||
#include <modules/globebrowsing/other/concurrentjobmanager.h>
|
||||
#include <ghoul/misc/threadpool.h>
|
||||
#include <modules/globebrowsing/other/threadpool.h>
|
||||
//#include <ghoul/misc/threadpool.h>
|
||||
|
||||
#include <modules/globebrowsing/tile/tiledataset.h>
|
||||
|
||||
@@ -118,7 +119,7 @@ namespace openspace {
|
||||
public:
|
||||
|
||||
AsyncTileDataProvider(std::shared_ptr<TileDataset> textureDataProvider,
|
||||
std::shared_ptr<ghoul::ThreadPool> pool);
|
||||
std::shared_ptr<ThreadPool> pool);
|
||||
|
||||
~AsyncTileDataProvider();
|
||||
|
||||
@@ -136,12 +137,13 @@ namespace openspace {
|
||||
virtual bool satisfiesEnqueueCriteria(const ChunkIndex&) const;
|
||||
|
||||
private:
|
||||
using FutureResult = std::future<std::shared_ptr<TileIOResult>>;
|
||||
|
||||
|
||||
|
||||
std::shared_ptr<TileDataset> _tileDataset;
|
||||
std::shared_ptr<ghoul::ThreadPool> _threadPool;
|
||||
std::unordered_map<ChunkHashKey, FutureResult> _futureTileIOResults;
|
||||
ConcurrentJobManager<TileIOResult> _concurrentJobManager;
|
||||
std::unordered_map<ChunkHashKey, ChunkIndex> _enqueuedTileRequests;
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -63,9 +63,9 @@ namespace openspace {
|
||||
|
||||
}
|
||||
|
||||
TileDataLayout::TileDataLayout(GDALDataset* dataSet, GLuint _glType) {
|
||||
TileDataLayout::TileDataLayout(GDALDataset* dataSet, GLuint preferredGlType) {
|
||||
// Assume all raster bands have the same data type
|
||||
gdalType = _glType != 0 ? TileDataType::getGdalDataType(glType) : dataSet->GetRasterBand(1)->GetRasterDataType();
|
||||
gdalType = preferredGlType != 0 ? TileDataType::getGdalDataType(preferredGlType) : dataSet->GetRasterBand(1)->GetRasterDataType();
|
||||
glType = TileDataType::getOpenGLDataType(gdalType);
|
||||
numRasters = dataSet->GetRasterCount();
|
||||
bytesPerDatum = TileDataType::numberOfBytes(gdalType);
|
||||
@@ -640,6 +640,7 @@ namespace openspace {
|
||||
size_t largestIndex = (end.y - 1) * io.write.bytesPerLine + (end.x - 1) * _dataLayout.bytesPerPixel;
|
||||
ghoul_assert(largestIndex <= io.write.totalNumBytes, "Invalid write region");
|
||||
|
||||
|
||||
char * dataDest = dataDestination;
|
||||
|
||||
// OBS! GDAL reads pixels top to bottom, but we want our pixels bottom to top.
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace openspace {
|
||||
|
||||
struct TileDataLayout {
|
||||
TileDataLayout();
|
||||
TileDataLayout(GDALDataset* dataSet, GLuint glType);
|
||||
TileDataLayout(GDALDataset* dataSet, GLuint preferredGlType);
|
||||
|
||||
GDALDataType gdalType;
|
||||
GLuint glType;
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/globebrowsing/tile/tileproviderfactory.h>
|
||||
#include <modules/globebrowsing/other/threadpool.h>
|
||||
|
||||
#include <modules/globebrowsing/tile/tileprovider/singleimageprovider.h>
|
||||
#include <modules/globebrowsing/tile/tileprovider/cachingtileprovider.h>
|
||||
@@ -89,7 +90,7 @@ namespace openspace {
|
||||
config.minimumTilePixelSize = initData.minimumPixelSize;
|
||||
|
||||
auto tileDataset = std::make_shared<TileDataset>(desc, config);
|
||||
auto threadPool = std::make_shared<ghoul::ThreadPool>(1);
|
||||
auto threadPool = std::make_shared<ThreadPool>(1);
|
||||
auto tileReader = std::make_shared<AsyncTileDataProvider>(tileDataset, threadPool);
|
||||
auto tileCache = std::make_shared<TileCache>(initData.cacheSize);
|
||||
auto tileProvider = std::make_shared<CachingTileProvider>(tileReader, tileCache, initData.framesUntilRequestQueueFlush);
|
||||
|
||||
@@ -21,9 +21,11 @@
|
||||
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/iswa/rendering/textureplane.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "TexturePlane";
|
||||
|
||||
@@ -76,4 +76,5 @@ protected:
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
#endif //__DATAPROCESSOR_H__
|
||||
|
||||
#endif //__DATAPROCESSOR_H__
|
||||
|
||||
@@ -46,7 +46,7 @@ void main() {
|
||||
|
||||
vec4 tmp = in_position;
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
vs_position = tmp;
|
||||
vs_position = position;
|
||||
|
||||
vec4 raw_pos = psc_to_meter(in_position, _scaling);
|
||||
ProjTexCoord = ProjectorMatrix * ModelTransform * raw_pos;
|
||||
|
||||
@@ -75,4 +75,4 @@ private:
|
||||
};
|
||||
|
||||
}
|
||||
#endif //__HONGKANGPARSER_H__
|
||||
#endif //__HONGKANGPARSER_H__
|
||||
|
||||
@@ -73,4 +73,4 @@ std::vector<std::string> InstrumentDecoder::getTranslation(){
|
||||
return _spiceIDs;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -75,4 +75,4 @@ private:
|
||||
bool _badDecoding;
|
||||
};
|
||||
}
|
||||
#endif //__LABELPARSER_H__
|
||||
#endif //__LABELPARSER_H__
|
||||
|
||||
@@ -50,4 +50,4 @@ void ScannerDecoder::setStopCommand(std::string stopCommand){
|
||||
_abort = stopCommand;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -48,4 +48,4 @@ std::vector<std::string> TargetDecoder::getTranslation(){
|
||||
return _names;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
+5
-2
@@ -9,6 +9,9 @@ return {
|
||||
-- of all entities that will be visible during an instance of OpenSpace
|
||||
-- Scene = "${SCENE}/default-moon.scene",
|
||||
-- Scene = "${SCENE}/default.scene",
|
||||
|
||||
--Scene = "${SCENE}/globebrowsing.scene",
|
||||
-- Scene = "${SCENE}/globebrowsing-debug.scene",
|
||||
-- Scene = "${SCENE}/globebrowsing.scene",
|
||||
-- Scene = "${SCENE}/rosetta.scene",
|
||||
-- Scene = "${SCENE}/dawn.scene",
|
||||
@@ -35,8 +38,8 @@ return {
|
||||
Light = "${FONTS}/Roboto/Roboto-Regular.ttf"
|
||||
},
|
||||
Logging = {
|
||||
LogLevel = "Info",
|
||||
ImmediateFlush = false,
|
||||
LogLevel = "Debug",
|
||||
ImmediateFlush = true,
|
||||
Logs = {
|
||||
{ Type = "HTML", FileName = "${BASE_PATH}/log.html", Append = false }
|
||||
},
|
||||
|
||||
@@ -639,6 +639,7 @@ InteractionHandler::InteractionHandler()
|
||||
return;
|
||||
}
|
||||
setFocusNode(node);
|
||||
resetCameraDirection();
|
||||
});
|
||||
|
||||
_coordinateSystem.onChange([this]() {
|
||||
|
||||
@@ -64,4 +64,4 @@ bool Ephemeris::initialize() {
|
||||
|
||||
void Ephemeris::update(const UpdateData& data) {}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -55,4 +55,4 @@ void ProgressBar::print(int current) {
|
||||
_previous = iprogress;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -65,4 +65,4 @@ const std::vector<ScreenLog::LogEntry>& ScreenLog::entries() const {
|
||||
return _entries;
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
} // namespace openspace
|
||||
|
||||
@@ -68,7 +68,12 @@ function (set_compile_settings project)
|
||||
set_property(TARGET ${project} PROPERTY CXX_STANDARD_REQUIRED On)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(${project} PUBLIC "/MP" "/wd4201" "/wd4127")
|
||||
target_compile_options(${project} PUBLIC
|
||||
"/MP" # Multi-threading support
|
||||
"/ZI" # Edit and continue support
|
||||
"/wd4201" # Disable nameless struct warning
|
||||
"/wd4127" # Disable conditional expression is constant warning
|
||||
)
|
||||
if (OPENSPACE_WARNINGS_AS_ERRORS)
|
||||
target_compile_options(${project} PUBLIC "/WX")
|
||||
endif ()
|
||||
@@ -126,7 +131,7 @@ function (add_external_dependencies)
|
||||
libOpenSpace
|
||||
# sgct
|
||||
sgct_light glew glfw png16_static quat tinythreadpp tinyxml2static turbojpeg-static
|
||||
vrpn zlibstatic
|
||||
vrpn
|
||||
${GLFW_LIBRARIES}
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user