solve merge conflict and linux fix

This commit is contained in:
Michael Nilsson
2016-06-27 17:37:58 -04:00
26 changed files with 104 additions and 97 deletions

View File

@@ -34,7 +34,10 @@
#include <openspace/util/keys.h>
#include <list>
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
#include <modules/globebrowsing/globes/renderableglobe.h>
#endif
#include <mutex>
@@ -273,6 +276,7 @@ protected:
glm::dquat _globalCameraRotation;
};
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
class GlobeBrowsingInteractionMode : public OrbitalInteractionMode
{
public:
@@ -288,6 +292,7 @@ private:
void updateCameraStateFromMouseStates();
RenderableGlobe* _globe;
};
#endif
class InteractionHandler : public properties::PropertyOwner
@@ -302,7 +307,9 @@ public:
// Interaction mode setters
void setInteractionModeToOrbital();
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
void setInteractionModeToGlobeBrowsing();
#endif
void resetKeyBindings();
@@ -345,7 +352,10 @@ private:
std::shared_ptr<InteractionMode> _currentInteractionMode;
std::shared_ptr<OrbitalInteractionMode> _orbitalInteractionMode;
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
std::shared_ptr<GlobeBrowsingInteractionMode> _globebrowsingInteractionMode;
#endif
// Properties
properties::StringProperty _origin;

View File

@@ -1,4 +1,3 @@
set (DEFAULT_MODULE ON)
set (OPENSPACE_DEPENDENCIES
volume
)

View File

@@ -73,7 +73,7 @@ namespace openspace {
_owner = newOwner;
}
Chunk::State Chunk::update(const RenderData& data) {
Chunk::Status Chunk::update(const RenderData& data) {
Camera* savedCamera = _owner->getSavedCamera();
const Camera& camRef = savedCamera != nullptr ? *savedCamera : data.camera;
RenderData myRenderData = { camRef, data.position, data.doPerformanceMeasurement };
@@ -82,14 +82,14 @@ namespace openspace {
_isVisible = true;
if (_owner->testIfCullable(*this, myRenderData)) {
_isVisible = false;
return State::WANT_MERGE;
return Status::WANT_MERGE;
}
int desiredLevel = _owner->getDesiredLevel(*this, myRenderData);
if (desiredLevel < _index.level) return State::WANT_MERGE;
else if (_index.level < desiredLevel) return State::WANT_SPLIT;
else return State::DO_NOTHING;
if (desiredLevel < _index.level) return Status::WANT_MERGE;
else if (_index.level < desiredLevel) return Status::WANT_SPLIT;
else return Status::DO_NOTHING;
}
Chunk::BoundingHeights Chunk::getBoundingHeights() const {
@@ -104,7 +104,7 @@ namespace openspace {
auto heightMapProviders = tileProvidermanager->getActivatedLayerCategory(LayeredTextures::HeightMaps);
if (heightMapProviders.size() > 0) {
TileAndTransform tileAndTransform = TileSelector::getHighestResolutionTile(heightMapProviders[0].get(), _index);
if (tileAndTransform.tile.status == Tile::State::OK) {
if (tileAndTransform.tile.status == Tile::Status::OK) {
std::shared_ptr<TilePreprocessData> preprocessData = tileAndTransform.tile.preprocessData;
if ((preprocessData != nullptr) && preprocessData->maxValues.size() > 0) {
boundingHeights.max = preprocessData->maxValues[0];

View File

@@ -50,7 +50,7 @@ namespace openspace {
bool available;
};
enum class State {
enum class Status {
DO_NOTHING,
WANT_MERGE,
WANT_SPLIT,
@@ -59,7 +59,7 @@ namespace openspace {
Chunk(ChunkedLodGlobe* owner, const ChunkIndex& chunkIndex, bool initVisible = true);
/// Updates chunk internally and returns a desired level
State update(const RenderData& data);
Status update(const RenderData& data);
void render(const RenderData& data) const;

View File

@@ -27,7 +27,7 @@
#include <glm/glm.hpp>
#include <vector>
#include <string>
namespace openspace {

View File

@@ -154,8 +154,8 @@ namespace openspace {
// simply check the first heigtmap
if (heightMapProviders.size() > 0) {
Tile::State heightTileStatus = heightMapProviders[0]->getTileStatus(chunk.index());
if (heightTileStatus == Tile::State::IOError || heightTileStatus == Tile::State::OutOfRange) {
Tile::Status heightTileStatus = heightMapProviders[0]->getTileStatus(chunk.index());
if (heightTileStatus == Tile::Status::IOError || heightTileStatus == Tile::Status::OutOfRange) {
return currLevel-1;
}

View File

@@ -73,11 +73,11 @@ bool ChunkNode::updateChunkTree(const RenderData& data) {
//LDEBUG("x: " << patch.x << " y: " << patch.y << " level: " << patch.level << " lat: " << center.lat << " lon: " << center.lon);
if (isLeaf()) {
Chunk::State status = _chunk.update(data);
if (status == Chunk::State::WANT_SPLIT) {
Chunk::Status status = _chunk.update(data);
if (status == Chunk::Status::WANT_SPLIT) {
split();
}
return status == Chunk::State::WANT_MERGE;
return status == Chunk::Status::WANT_MERGE;
}
else {
char requestedMergeMask = 0;
@@ -88,7 +88,7 @@ bool ChunkNode::updateChunkTree(const RenderData& data) {
}
bool allChildrenWantsMerge = requestedMergeMask == 0xf;
bool thisChunkWantsSplit = _chunk.update(data) == Chunk::State::WANT_SPLIT;
bool thisChunkWantsSplit = _chunk.update(data) == Chunk::Status::WANT_SPLIT;
if (allChildrenWantsMerge && !thisChunkWantsSplit) {
merge();

View File

@@ -226,7 +226,7 @@ namespace openspace {
// Get the texture that should be used for rendering
TileAndTransform tileAndTransform = TileSelector::getHighestResolutionTile(tileProvider, chunkIndex);
if (tileAndTransform.tile.status == Tile::State::Unavailable) {
if (tileAndTransform.tile.status == Tile::Status::Unavailable) {
// don't render if no tile was available
programObject->deactivate();
return nullptr;
@@ -243,7 +243,7 @@ namespace openspace {
// If blending is enabled, two more textures are needed
if (layeredTexturePreprocessingData.layeredTextureInfo[category].layerBlendingEnabled) {
TileAndTransform tileAndTransformParent1 = TileSelector::getHighestResolutionTile(tileProvider, chunkIndex, 1);
if (tileAndTransformParent1.tile.status == Tile::State::Unavailable) {
if (tileAndTransformParent1.tile.status == Tile::Status::Unavailable) {
tileAndTransformParent1 = tileAndTransform;
}
activateTileAndSetTileUniforms(
@@ -255,7 +255,7 @@ namespace openspace {
tileAndTransformParent1);
TileAndTransform tileAndTransformParent2 = TileSelector::getHighestResolutionTile(tileProvider, chunkIndex, 2);
if (tileAndTransformParent2.tile.status == Tile::State::Unavailable) {
if (tileAndTransformParent2.tile.status == Tile::Status::Unavailable) {
tileAndTransformParent2 = tileAndTransformParent1;
}
activateTileAndSetTileUniforms(

View File

@@ -66,7 +66,7 @@ namespace openspace {
if (o.contains(*this)) return AABBSpatialRelation::Contained;
return AABBSpatialRelation::Intersecting;
}
return AABBSpatialRelation::NoRelation;
return AABBSpatialRelation::None;
}
@@ -113,7 +113,7 @@ namespace openspace {
if (o.contains(*this)) return AABBSpatialRelation::Contained;
return AABBSpatialRelation::Intersecting;
}
return AABBSpatialRelation::NoRelation;
return AABBSpatialRelation::None;
}
@@ -163,7 +163,7 @@ namespace openspace {
if (o.contains(*this)) return AABBSpatialRelation::Contained;
return AABBSpatialRelation::Intersecting;
}
return AABBSpatialRelation::NoRelation;
return AABBSpatialRelation::None;
}

View File

@@ -37,7 +37,7 @@ namespace openspace {
using namespace glm;
enum class AABBSpatialRelation {
NoRelation,
None,
Intersecting,
Contained,
Containing

View File

@@ -1 +0,0 @@
set(DEFAULT_MODULE ON)

View File

@@ -116,7 +116,7 @@ namespace openspace {
return _currentTileProvider->depthTransform();
}
Tile::State TemporalTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
Tile::Status TemporalTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
if (_currentTileProvider == nullptr) {
LDEBUG("Warning: had to call prerender from getTileStatus()");
prerender();

View File

@@ -121,7 +121,7 @@ namespace openspace {
// These methods implements TileProvider
virtual Tile getTile(const ChunkIndex& chunkIndex);
virtual Tile::State getTileStatus(const ChunkIndex& chunkIndex);
virtual Tile::Status getTileStatus(const ChunkIndex& chunkIndex);
virtual TileDepthTransform depthTransform();
virtual void prerender();
virtual std::shared_ptr<AsyncTileDataProvider> getAsyncTileReader();

View File

@@ -47,7 +47,7 @@ namespace {
namespace openspace {
const Tile Tile::TileUnavailable = {nullptr, nullptr, Tile::State::Unavailable };
const Tile Tile::TileUnavailable = {nullptr, nullptr, Tile::Status::Unavailable };
@@ -83,7 +83,7 @@ namespace openspace {
auto tileDataset = _asyncTextureDataProvider->getTextureDataProvider();
if (chunkIndex.level > tileDataset->getMaximumLevel()) {
tile.status = Tile::State::OutOfRange;
tile.status = Tile::Status::OutOfRange;
return tile;
}
@@ -112,10 +112,10 @@ namespace openspace {
_framesSinceLastRequestFlush = 0;
}
Tile::State CachingTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
Tile::Status CachingTileProvider::getTileStatus(const ChunkIndex& chunkIndex) {
auto tileDataset = _asyncTextureDataProvider->getTextureDataProvider();
if (chunkIndex.level > tileDataset->getMaximumLevel()) {
return Tile::State::OutOfRange;
return Tile::Status::OutOfRange;
}
HashKey key = chunkIndex.hashKey();
@@ -124,7 +124,7 @@ namespace openspace {
return _tileCache->get(key).status;
}
return Tile::State::Unavailable;
return Tile::Status::Unavailable;
}
@@ -166,7 +166,7 @@ namespace openspace {
Tile tile = {
texture,
tileIOResult->preprocessData,
tileIOResult->error == CE_None ? Tile::State::OK : Tile::State::IOError
tileIOResult->error == CE_None ? Tile::Status::OK : Tile::Status::IOError
};
_tileCache->put(key, tile);

View File

@@ -56,7 +56,7 @@ namespace openspace {
std::shared_ptr<Texture> texture;
std::shared_ptr<TilePreprocessData> preprocessData;
enum class State { Unavailable, OutOfRange, IOError, OK } status;
enum class Status { Unavailable, OutOfRange, IOError, OK } status;
static const Tile TileUnavailable;
};
@@ -68,7 +68,7 @@ namespace openspace {
virtual ~TileProvider() { }
virtual Tile getTile(const ChunkIndex& chunkIndex) = 0;
virtual Tile::State getTileStatus(const ChunkIndex& index) = 0;
virtual Tile::Status getTileStatus(const ChunkIndex& index) = 0;
virtual TileDepthTransform depthTransform() = 0;
virtual void prerender() = 0;
virtual std::shared_ptr<AsyncTileDataProvider> getAsyncTileReader() = 0;
@@ -94,7 +94,7 @@ namespace openspace {
virtual ~CachingTileProvider();
virtual Tile getTile(const ChunkIndex& chunkIndex);
virtual Tile::State getTileStatus(const ChunkIndex& index);
virtual Tile::Status getTileStatus(const ChunkIndex& index);
virtual TileDepthTransform depthTransform();
virtual void prerender();
virtual std::shared_ptr<AsyncTileDataProvider> getAsyncTileReader();

View File

@@ -61,7 +61,7 @@ namespace openspace {
// has a loaded tile ready to use.
while (chunkIndex.level > 1) {
Tile tile = tileProvider->getTile(chunkIndex);
if (tile.status != Tile::State::OK) {
if (tile.status != Tile::Status::OK) {
ascendToParent(chunkIndex, uvTransform);
}
else return { tile, uvTransform };

View File

@@ -28,7 +28,7 @@
#include <modules/kameleon/include/kameleonwrapper.h>
namespace {
using json = nlohmann::json;
using json = nlohmann::json;
const std::string _loggerCat = "IswaCygnet";
}
@@ -39,9 +39,9 @@ LuaCygnetConverter::~LuaCygnetConverter(){};
std::string LuaCygnetConverter::toLuaTable(std::shared_ptr<MetadataFuture> metadata) const {
//get resource type as enum value
int resourceType;
IswaManager::ref().getResourceType(metadata->resourceType, resourceType);
//get resource type as enum value
int resourceType;
IswaManager::ref().getResourceType(metadata->resourceType, resourceType);
std::string luaTable;
if (IswaManager::ResourceType::Json == resourceType)
@@ -53,7 +53,7 @@ std::string LuaCygnetConverter::toLuaTable(std::shared_ptr<MetadataFuture> metad
}
std::string LuaCygnetConverter::toLuaTable(CdfInfo info, std::string cut) const {
return kameleonToLuaTable(info, cut); // KameleonPlane
return kameleonToLuaTable(info, cut); // KameleonPlane
}
std::string LuaCygnetConverter::toLuaTable(std::string name, std::string cdfPath, std::string seedPath) const {

View File

@@ -31,6 +31,7 @@
* used to add a cygnet to the scene.
*/
#include <memory> // for shared_pointer
#include <string>
namespace openspace {
class MetadataFuture;
@@ -41,17 +42,17 @@ public:
LuaCygnetConverter();
~LuaCygnetConverter();
std::string toLuaTable(std::shared_ptr<MetadataFuture> metadata) const;
std::string toLuaTable(CdfInfo info, std::string cut) const;
std::string toLuaTable(std::string name, std::string cdfPath, std::string seedPath) const;
std::string toLuaTable(std::shared_ptr<MetadataFuture> metadata) const;
std::string toLuaTable(CdfInfo info, std::string cut) const;
std::string toLuaTable(std::string name, std::string cdfPath, std::string seedPath) const;
private:
std::string planeToLuaTable(std::shared_ptr<MetadataFuture> data) const;
std::string sphereToLuaTable(std::shared_ptr<MetadataFuture> data) const;
std::string kameleonToLuaTable(CdfInfo info, std::string cut) const;
std::string fieldlineToLuaTable(std::string name, std::string cdfPath, std::string seedPath) const;
std::string planeToLuaTable(std::shared_ptr<MetadataFuture> data) const;
std::string sphereToLuaTable(std::shared_ptr<MetadataFuture> data) const;
std::string kameleonToLuaTable(CdfInfo info, std::string cut) const;
std::string fieldlineToLuaTable(std::string name, std::string cdfPath, std::string seedPath) const;
};
} //namespace openspace

View File

@@ -1 +0,0 @@
set (DEFAULT_MODULE ON)

View File

@@ -32,7 +32,7 @@
#include <ghoul/misc/sharedmemory.h>
#include <imgui.h>
#include <cppformat/format.h>
#include <fmt/format.h>
#include <algorithm>
#include <numeric>

View File

@@ -269,43 +269,43 @@ void InteractionHandler::orbit(const float &dx, const float &dy, const float &dz
float rollSpeed = 100.0f;
glm::mat4 transform;
transform = glm::rotate(glm::radians(dx * rotationSpeed), cameraUp) * transform;
transform = glm::rotate(glm::radians(dy * rotationSpeed), cameraRight) * transform;
transform = glm::rotate(glm::radians(dz * rollSpeed), _camera->viewDirection()) * transform;
glm::mat4 transform;
transform = glm::rotate(glm::radians(dx * rotationSpeed), cameraUp) * transform;
transform = glm::rotate(glm::radians(dy * rotationSpeed), cameraRight) * transform;
transform = glm::rotate(glm::radians(dz * rollSpeed), _camera->viewDirection()) * transform;
//// get camera position
//psc relative = _camera->position();
//// get camera position
//psc relative = _camera->position();
// get camera position (UNSYNCHRONIZED)
psc relative = _camera->unsynchedPosition();
// get camera position (UNSYNCHRONIZED)
psc relative = _camera->unsynchedPosition();
//get relative vector
psc relative_focus_coordinate = relative - focusPos;
//rotate relative vector
relative_focus_coordinate = glm::inverse(transform) * relative_focus_coordinate.vec4();
//get new new position of focus node
psc origin;
if (_focusNode) {
origin = _focusNode->worldPosition();
}
//get relative vector
psc relative_focus_coordinate = relative - focusPos;
//rotate relative vector
relative_focus_coordinate = glm::inverse(transform) * relative_focus_coordinate.vec4();
//get new new position of focus node
psc origin;
if (_focusNode) {
origin = _focusNode->worldPosition();
}
//new camera position
relative = origin + relative_focus_coordinate;
//new camera position
relative = origin + relative_focus_coordinate;
psc target = relative + relative_focus_coordinate * dist * zoomSpeed;
psc target = relative + relative_focus_coordinate * dist * zoomSpeed;
//don't fly into objects
if ((target - origin).length() < focusNodeBounds){
//target = relative;
}
//don't fly into objects
if ((target - origin).length() < focusNodeBounds){
//target = relative;
}
unlockControls();
unlockControls();
_camera->setFocusPosition(origin);
@@ -885,6 +885,7 @@ void OrbitalInteractionMode::update(double deltaTime) {
updateCameraStateFromMouseStates();
}
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
GlobeBrowsingInteractionMode::GlobeBrowsingInteractionMode(
std::shared_ptr<InputState> inputState,
double sensitivity,
@@ -893,9 +894,7 @@ GlobeBrowsingInteractionMode::GlobeBrowsingInteractionMode(
}
GlobeBrowsingInteractionMode::~GlobeBrowsingInteractionMode() {
}
GlobeBrowsingInteractionMode::~GlobeBrowsingInteractionMode() {}
void GlobeBrowsingInteractionMode::setFocusNode(SceneGraphNode* focusNode) {
_focusNode = focusNode;
@@ -911,7 +910,6 @@ void GlobeBrowsingInteractionMode::setFocusNode(SceneGraphNode* focusNode) {
}
void GlobeBrowsingInteractionMode::updateCameraStateFromMouseStates() {
if (_focusNode && _globe) {
// Declare variables to use in interaction calculations
@@ -989,6 +987,8 @@ void GlobeBrowsingInteractionMode::update(double deltaTime) {
updateCameraStateFromMouseStates();
}
#endif
// InteractionHandler
InteractionHandler::InteractionHandler()
: _origin("origin", "Origin", "")
@@ -1014,8 +1014,11 @@ InteractionHandler::InteractionHandler()
_inputState = std::shared_ptr<InputState>(new InputState());
_orbitalInteractionMode = std::shared_ptr<OrbitalInteractionMode>(
new OrbitalInteractionMode(_inputState, 0.002, 0.02));
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
_globebrowsingInteractionMode = std::shared_ptr<GlobeBrowsingInteractionMode>(
new GlobeBrowsingInteractionMode(_inputState, 0.002, 0.02));
#endif
// Set the interactionMode
_currentInteractionMode = _orbitalInteractionMode;
@@ -1050,9 +1053,11 @@ void InteractionHandler::setInteractionModeToOrbital() {
setInteractionMode(_orbitalInteractionMode);
}
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
void InteractionHandler::setInteractionModeToGlobeBrowsing() {
setInteractionMode(_globebrowsingInteractionMode);
}
#endif
void InteractionHandler::lockControls() {

View File

@@ -134,7 +134,11 @@ int setInteractionMode(lua_State* L) {
OsEng.interactionHandler().setInteractionModeToOrbital();
}
else if (interactionModeName == "GlobeBrowsingInteractionMode") {
#ifdef OPENSPACE_MODULE_GLOBEBROWSING_ENABLED
OsEng.interactionHandler().setInteractionModeToGlobeBrowsing();
#else
return luaL_error(L, "OpenSpace compiled without support for GlobeBrowsing");
#endif
}
else { // Default
return luaL_error(L, "Unknown interaction mode. default is 'OrbitalInteractionMode'");

View File

@@ -32,7 +32,7 @@
#include <glm/gtc/type_ptr.hpp>
#include <algorithm>
#include <cppformat/format.h>
#include <fmt/format.h>
namespace {
const std::string _loggerCat = "SpiceManager";

View File

@@ -24,7 +24,7 @@
#include <ghoul/misc/assert.h>
#include <cppformat/format.h>
#include <fmt/format.h>
#include <ctime>
namespace openspace {

View File

@@ -31,7 +31,6 @@
#include <ghoul/lua/ghoul_lua.h>
// test files
// <<<<<<< HEAD
//#include <test_common.inl>
//#include <test_spicemanager.inl>
//#include <test_scenegraphloader.inl>
@@ -39,7 +38,7 @@
//#include <test_lrucache.inl>
//#include <test_threadpool.inl>
//#include <test_aabb.inl>
#include <test_convexhull.inl>
//#include <test_convexhull.inl>
//#include <test_luaconversions.inl>
//#include <test_powerscalecoordinates.inl>
@@ -53,15 +52,6 @@
//#include <test_concurrentjobmanager.inl>
//#include <test_screenspaceimage.inl>
//#include <test_iswamanager.inl>
// =======
#include <test_common.inl>
#include <test_spicemanager.inl>
#include <test_scenegraphloader.inl>
#include <test_luaconversions.inl>
#include <test_powerscalecoordinates.inl>
#include <test_screenspaceimage.inl>
#include <test_iswamanager.inl>
// >>>>>>> develop
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>