mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-27 07:18:57 -06:00
Add GuiISWAComponent
This commit is contained in:
@@ -25,15 +25,16 @@
|
||||
#define __ISWAMANAGER_H__
|
||||
|
||||
#include <ghoul/designpattern/singleton.h>
|
||||
|
||||
#include <memory>
|
||||
#include <map>
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <ghoul/glm.h>
|
||||
#include <ccmc/Kameleon.h>
|
||||
#include <openspace/engine/downloadmanager.h>
|
||||
#include <modules/kameleon/include/kameleonwrapper.h>
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/properties/selectionproperty.h>
|
||||
#include <openspace/scripting/scriptengine.h>
|
||||
|
||||
// #include <modules/iswa/rendering/iswacygnet.h>
|
||||
// #include <modules/iswa/rendering/iswagroup.h>
|
||||
|
||||
@@ -97,6 +98,8 @@ private:
|
||||
std::map<int, std::string> _geom;
|
||||
|
||||
std::map<int, std::shared_ptr<ISWAGroup>> _groups;
|
||||
|
||||
std::shared_ptr<ccmc::Kameleon> _kameleon;
|
||||
};
|
||||
|
||||
} //namespace openspace
|
||||
|
||||
41
modules/onscreengui/include/guiiswacomponent.h
Normal file
41
modules/onscreengui/include/guiiswacomponent.h
Normal file
@@ -0,0 +1,41 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __GUIISWACOMPONENT_H__
|
||||
#define __GUIISWACOMPONENT_H__
|
||||
|
||||
#include <modules/onscreengui/include/guicomponent.h>
|
||||
|
||||
namespace openspace {
|
||||
namespace gui {
|
||||
|
||||
class GuiISWAComponent : public GuiComponent {
|
||||
public:
|
||||
void render();
|
||||
};
|
||||
|
||||
} // namespace gui
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __GUIISWACOMPONENT_H__
|
||||
@@ -36,8 +36,7 @@
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/rendering/screenspacerenderable.h>
|
||||
#include <modules/base/rendering/screenspaceimage.h>
|
||||
#include <modules/iswa/util/iswamanager.h>
|
||||
|
||||
// #include <modules/iswa/util/iswamanager.h>
|
||||
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
@@ -297,10 +296,10 @@ void GUI::endFrame() {
|
||||
|
||||
if (_property.isEnabled())
|
||||
_property.render();
|
||||
if (_iSWAproperty.isEnabled())
|
||||
_iSWAproperty.render();
|
||||
if (_screenSpaceProperty.isEnabled())
|
||||
_screenSpaceProperty.render();
|
||||
if (_iSWAproperty.isEnabled())
|
||||
_iSWAproperty.render();
|
||||
if (_performance.isEnabled())
|
||||
_performance.render();
|
||||
if (_help.isEnabled())
|
||||
@@ -434,15 +433,13 @@ void GUI::renderMainWindow() {
|
||||
}
|
||||
|
||||
#ifdef OPENSPACE_MODULE_ISWA_ENABLED
|
||||
if(ISWAManager::isInitialized()){
|
||||
static const int addCygnetBufferSize = 256;
|
||||
static char addCygnetBuffer[addCygnetBufferSize];
|
||||
ImGui::InputText("addCynget", addCygnetBuffer, addCygnetBufferSize);
|
||||
|
||||
if(ImGui::SmallButton("Add Cygnet")){
|
||||
if(ImGui::SmallButton("Add Cygnet"))
|
||||
OsEng.scriptEngine().queueScript("openspace.iswa.addCygnet('"+std::string(addCygnetBuffer)+"');");
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
ImGui::End();
|
||||
|
||||
43
modules/onscreengui/src/guiiswacomponent.cpp
Normal file
43
modules/onscreengui/src/guiiswacomponent.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 <modules/onscreengui/include/guiiswacomponent.h>
|
||||
|
||||
#include "imgui.h"
|
||||
|
||||
namespace {
|
||||
const ImVec2 size = ImVec2(350, 500);
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
namespace gui {
|
||||
|
||||
void GuiHelpComponent::render() {
|
||||
ImGui::Begin("ISWA", &_isEnabled, size, 0.5f);
|
||||
ImGui::ShowUserGuide();
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
} // gui
|
||||
} // openspace
|
||||
@@ -514,22 +514,22 @@ void GuiPropertyComponent::handleProperty(const ghoul::Dictionary& dictionary) {
|
||||
void GuiPropertyComponent::render() {
|
||||
ImGui::Begin("Properties", &_isEnabled, size, 0.5f);
|
||||
|
||||
if (ImGui::CollapsingHeader("OnScreen GUI")) {
|
||||
glm::vec2& pos = OsEng.renderEngine()._onScreenInformation._position;
|
||||
Vec2Property::ValueType value = pos;
|
||||
ImGui::SliderFloat2("Position", &value.x, -1.f, 1.f);
|
||||
pos = value;
|
||||
// if (ImGui::CollapsingHeader("OnScreen GUI")) {
|
||||
// glm::vec2& pos = OsEng.renderEngine()._onScreenInformation._position;
|
||||
// Vec2Property::ValueType value = pos;
|
||||
// ImGui::SliderFloat2("Position", &value.x, -1.f, 1.f);
|
||||
// pos = value;
|
||||
|
||||
unsigned int& size = OsEng.renderEngine()._onScreenInformation._size;
|
||||
int sizeValue = static_cast<int>(size);
|
||||
ImGui::SliderInt("Size", &sizeValue, 0, 36);
|
||||
size = static_cast<unsigned int>(sizeValue);
|
||||
// unsigned int& size = OsEng.renderEngine()._onScreenInformation._size;
|
||||
// int sizeValue = static_cast<int>(size);
|
||||
// ImGui::SliderInt("Size", &sizeValue, 0, 36);
|
||||
// size = static_cast<unsigned int>(sizeValue);
|
||||
|
||||
int& node = OsEng.renderEngine()._onScreenInformation._node;
|
||||
int iValue = node;
|
||||
ImGui::SliderInt("Node#", &iValue, 0, 30);
|
||||
node = iValue;
|
||||
}
|
||||
// int& node = OsEng.renderEngine()._onScreenInformation._node;
|
||||
// int iValue = node;
|
||||
// ImGui::SliderInt("Node#", &iValue, 0, 30);
|
||||
// node = iValue;
|
||||
// }
|
||||
|
||||
ImGui::Spacing();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user