Making most includes in openspaceengine into forward declarations

This commit is contained in:
Alexander Bock
2015-02-17 10:36:18 +01:00
parent 26e69b2b2c
commit 862bfd6947
18 changed files with 245 additions and 213 deletions

View File

@@ -25,19 +25,26 @@
#ifndef __OPENSPACEENGINE_H__
#define __OPENSPACEENGINE_H__
#include <openspace/interaction/interactionhandler.h>
#include <openspace/interaction/luaconsole.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/gui/gui.h>
#include <ghoul/cmdparser/commandlineparser.h>
#include <string>
#include <vector>
namespace ghoul {
namespace cmdparser {
class CommandlineParser;
}
}
namespace openspace {
class GUI;
class SyncBuffer;
class ConfigurationManager;
class LuaConsole;
class GUI;
class RenderEngine;
class SyncBuffer;
namespace interaction {
class InteractionHandler;
}
namespace scripting {
class ScriptEngine;
}
@@ -53,13 +60,14 @@ public:
static bool findConfiguration(std::string& filename);
ConfigurationManager& configurationManager();
interaction::InteractionHandler& interactionHandler();
RenderEngine& renderEngine();
scripting::ScriptEngine& scriptEngine();
LuaConsole& console();
// Guaranteed to return a valid pointer
ConfigurationManager* configurationManager();
interaction::InteractionHandler* interactionHandler();
RenderEngine* renderEngine();
scripting::ScriptEngine* scriptEngine();
LuaConsole* console();
GUI& gui();
GUI* gui();
// SGCT callbacks
bool initializeGL();
@@ -91,13 +99,13 @@ private:
static OpenSpaceEngine* _engine;
ConfigurationManager _configurationManager;
interaction::InteractionHandler _interactionHandler;
RenderEngine _renderEngine;
scripting::ScriptEngine _scriptEngine;
ghoul::cmdparser::CommandlineParser _commandlineParser;
LuaConsole _console;
GUI _gui;
ConfigurationManager* _configurationManager;
interaction::InteractionHandler* _interactionHandler;
RenderEngine* _renderEngine;
scripting::ScriptEngine* _scriptEngine;
ghoul::cmdparser::CommandlineParser* _commandlineParser;
LuaConsole* _console;
GUI* _gui;
double _dt;
SyncBuffer* _syncBuffer;

View File

@@ -25,15 +25,16 @@
#ifndef __RENDERABLE_H__
#define __RENDERABLE_H__
// openspace
#include <openspace/properties/propertyowner.h>
#include <openspace/properties/scalarproperty.h>
#include <openspace/util/powerscaledscalar.h>
#include <openspace/util/updatestructures.h>
#include <ghoul/opengl/programobject.h>
// Forward declare to minimize dependencies
namespace ghoul {
namespace opengl {
class ProgramObject;
class Texture;
}
class Dictionary;

View File

@@ -34,6 +34,7 @@ return {
File = "${BASE_PATH}/LuaScripting.txt"
},
SGCTConfig = "${SGCT}/single.xml",
--SGCTConfig = "${SGCT}/single_fisheye.xml",
--SGCTConfig = "${SGCT}/two_nodes.xml",
--SGCTConfig = "${SGCT}/single_sbs_stereo.xml",
Scene = "${OPENSPACE_DATA}/scene/default.scene",

View File

@@ -24,10 +24,16 @@
#include <openspace/engine/openspaceengine.h>
// sgct
#define SGCT_WINDOWS_INCLUDE
#include <sgct.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/logfactory.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/gui/gui.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/interaction/keyboardcontroller.h>
#include <openspace/interaction/luaconsole.h>
#include <openspace/interaction/mousecontroller.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scripting/scriptengine.h>
@@ -39,18 +45,15 @@
#include <openspace/util/spicemanager.h>
#include <openspace/util/syncbuffer.h>
#include <ghoul/cmdparser/commandlineparser.h>
#include <ghoul/cmdparser/singlecommand.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/filesystem/cachemanager.h>
#include <ghoul/logging/consolelog.h>
#include <ghoul/systemcapabilities/systemcapabilities.h>
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/lua_helper.h>
#include <ghoul/cmdparser/commandlineparser.h>
#include <ghoul/cmdparser/singlecommand.h>
// sgct
#define SGCT_WINDOWS_INCLUDE
#include <sgct.h>
#include <ghoul/systemcapabilities/systemcapabilities.h>
// std
#include <iostream>
@@ -81,7 +84,13 @@ namespace openspace {
OpenSpaceEngine* OpenSpaceEngine::_engine = nullptr;
OpenSpaceEngine::OpenSpaceEngine(std::string programName)
: _commandlineParser(programName, true)
: _configurationManager(new ConfigurationManager)
, _interactionHandler(new interaction::InteractionHandler)
, _renderEngine(new RenderEngine)
, _scriptEngine(new scripting::ScriptEngine)
, _commandlineParser(new ghoul::cmdparser::CommandlineParser(programName, true))
, _console(new LuaConsole)
, _gui(new GUI)
, _syncBuffer(nullptr)
{
SpiceManager::initialize();
@@ -91,8 +100,17 @@ OpenSpaceEngine::OpenSpaceEngine(std::string programName)
}
OpenSpaceEngine::~OpenSpaceEngine() {
_gui.deinitializeGL();
if(_syncBuffer)
_gui->deinitializeGL();
delete _configurationManager;
delete _interactionHandler;
delete _renderEngine;
delete _scriptEngine;
delete _commandlineParser;
delete _console;
delete _gui;
if(_syncBuffer)
delete _syncBuffer;
_syncBuffer = nullptr;
}
@@ -135,8 +153,8 @@ bool OpenSpaceEngine::create(int argc, char** argv,
// Parse commandline arguments
std::vector<std::string> remainingArguments;
_engine->_commandlineParser.setCommandLine(argc, argv, &sgctArguments);
const bool executeSuccess = _engine->_commandlineParser.execute();
_engine->_commandlineParser->setCommandLine(argc, argv, &sgctArguments);
const bool executeSuccess = _engine->_commandlineParser->execute();
if (!executeSuccess)
return false;
@@ -156,7 +174,7 @@ bool OpenSpaceEngine::create(int argc, char** argv,
// Loading configuration from disk
LDEBUG("Loading configuration from disk");
const bool configLoadSuccess = _engine->configurationManager().loadFromFile(
const bool configLoadSuccess = _engine->configurationManager()->loadFromFile(
configurationFilePath);
if (!configLoadSuccess) {
LFATAL("Loading of configuration file '" << configurationFilePath << "' failed");
@@ -179,7 +197,7 @@ bool OpenSpaceEngine::create(int argc, char** argv,
// Create the cachemanager
FileSys.createCacheManager(absPath("${" + constants::configurationmanager::keyCache + "}"));
_engine->_console.initialize();
_engine->_console->initialize();
// Register the provided shader directories
ghoul::opengl::ShaderObject::addIncludePath("${SHADERS}");
@@ -189,7 +207,7 @@ bool OpenSpaceEngine::create(int argc, char** argv,
// Determining SGCT configuration file
LDEBUG("Determining SGCT configuration file");
std::string sgctConfigurationPath = _sgctDefaultConfigFile;
_engine->configurationManager().getValue(
_engine->configurationManager()->getValue(
constants::configurationmanager::keyConfigSgct, sgctConfigurationPath);
if (!commandlineArgumentPlaceholders.sgctConfigurationName.empty()) {
@@ -208,7 +226,7 @@ bool OpenSpaceEngine::create(int argc, char** argv,
}
void OpenSpaceEngine::destroy() {
_engine->_console.deinitialize();
_engine->_console->deinitialize();
delete _engine;
ghoul::systemcapabilities::SystemCapabilities::deinitialize();
FactoryManager::deinitialize();
@@ -237,50 +255,50 @@ bool OpenSpaceEngine::initialize() {
// Register Lua script functions
LDEBUG("Registering Lua libraries");
_scriptEngine.addLibrary(RenderEngine::luaLibrary());
_scriptEngine.addLibrary(SceneGraph::luaLibrary());
_scriptEngine.addLibrary(Time::luaLibrary());
_scriptEngine.addLibrary(interaction::InteractionHandler::luaLibrary());
_scriptEngine.addLibrary(LuaConsole::luaLibrary());
_scriptEngine.addLibrary(GUI::luaLibrary());
_scriptEngine->addLibrary(RenderEngine::luaLibrary());
_scriptEngine->addLibrary(SceneGraph::luaLibrary());
_scriptEngine->addLibrary(Time::luaLibrary());
_scriptEngine->addLibrary(interaction::InteractionHandler::luaLibrary());
_scriptEngine->addLibrary(LuaConsole::luaLibrary());
_scriptEngine->addLibrary(GUI::luaLibrary());
// TODO: Maybe move all scenegraph and renderengine stuff to initializeGL
scriptEngine().initialize();
scriptEngine()->initialize();
// If a LuaDocumentationFile was specified, generate it now
using constants::configurationmanager::keyLuaDocumentationType;
using constants::configurationmanager::keyLuaDocumentationFile;
const bool hasType = configurationManager().hasKey(keyLuaDocumentationType);
const bool hasFile = configurationManager().hasKey(keyLuaDocumentationFile);
const bool hasType = configurationManager()->hasKey(keyLuaDocumentationType);
const bool hasFile = configurationManager()->hasKey(keyLuaDocumentationFile);
if (hasType && hasFile) {
std::string luaDocumentationType;
configurationManager().getValue(keyLuaDocumentationType, luaDocumentationType);
configurationManager()->getValue(keyLuaDocumentationType, luaDocumentationType);
std::string luaDocumentationFile;
configurationManager().getValue(keyLuaDocumentationFile, luaDocumentationFile);
configurationManager()->getValue(keyLuaDocumentationFile, luaDocumentationFile);
luaDocumentationFile = absPath(luaDocumentationFile);
_scriptEngine.writeDocumentation(luaDocumentationFile, luaDocumentationType);
_scriptEngine->writeDocumentation(luaDocumentationFile, luaDocumentationType);
}
// Load scenegraph
SceneGraph* sceneGraph = new SceneGraph;
_renderEngine.setSceneGraph(sceneGraph);
_renderEngine->setSceneGraph(sceneGraph);
// initialize the RenderEngine
_renderEngine.initialize();
_renderEngine->initialize();
sceneGraph->initialize();
std::string sceneDescriptionPath;
success = configurationManager().getValue(
success = configurationManager()->getValue(
constants::configurationmanager::keyConfigScene, sceneDescriptionPath);
if (success)
sceneGraph->scheduleLoadSceneFile(sceneDescriptionPath);
_interactionHandler.setKeyboardController(new interaction::KeyboardControllerFixed);
_interactionHandler->setKeyboardController(new interaction::KeyboardControllerFixed);
//_interactionHandler.setKeyboardController(new interaction::KeyboardControllerLua);
//_interactionHandler.setMouseController(new interaction::TrackballMouseController);
_interactionHandler.setMouseController(new interaction::OrbitalMouseController);
_interactionHandler->setMouseController(new interaction::OrbitalMouseController);
// Run start up scripts
runStartupScripts();
@@ -288,7 +306,7 @@ bool OpenSpaceEngine::initialize() {
// Load a light and a monospaced font
loadFonts();
_gui.initialize();
_gui->initialize();
return true;
}
@@ -314,14 +332,14 @@ bool OpenSpaceEngine::gatherCommandlineArguments() {
CommandlineCommand* configurationFileCommand = new SingleCommand<std::string>(
&commandlineArgumentPlaceholders.configurationName, "-config", "-c",
"Provides the path to the OpenSpace configuration file");
_commandlineParser.addCommand(configurationFileCommand);
_commandlineParser->addCommand(configurationFileCommand);
commandlineArgumentPlaceholders.sgctConfigurationName = "";
CommandlineCommand* sgctConfigFileCommand = new SingleCommand<std::string>(
&commandlineArgumentPlaceholders.sgctConfigurationName, "-sgct", "-s",
"Provides the path to the SGCT configuration file, overriding the value set in"
"the OpenSpace configuration file");
_commandlineParser.addCommand(sgctConfigFileCommand);
_commandlineParser->addCommand(sgctConfigFileCommand);
return true;
}
@@ -354,7 +372,7 @@ bool OpenSpaceEngine::loadSpiceKernels() {
// Load time kernel
using constants::configurationmanager::keySpiceTimeKernel;
std::string timeKernel;
bool success = configurationManager().getValue(keySpiceTimeKernel, timeKernel);
bool success = configurationManager()->getValue(keySpiceTimeKernel, timeKernel);
if (!success) {
LERROR("Configuration file does not contain a '" << keySpiceTimeKernel << "'");
return false;
@@ -369,7 +387,7 @@ bool OpenSpaceEngine::loadSpiceKernels() {
// Load SPICE leap second kernel
using constants::configurationmanager::keySpiceLeapsecondKernel;
std::string leapSecondKernel;
success = configurationManager().getValue(keySpiceLeapsecondKernel, leapSecondKernel);
success = configurationManager()->getValue(keySpiceLeapsecondKernel, leapSecondKernel);
if (!success) {
LERROR("Configuration file does not have a '" << keySpiceLeapsecondKernel << "'");
return false;
@@ -384,7 +402,7 @@ bool OpenSpaceEngine::loadSpiceKernels() {
void OpenSpaceEngine::runStartupScripts() {
ghoul::Dictionary scripts;
configurationManager().getValue(
configurationManager()->getValue(
constants::configurationmanager::keyStartupScript, scripts);
for (size_t i = 1; i <= scripts.size(); ++i) {
std::stringstream stream;
@@ -400,7 +418,7 @@ void OpenSpaceEngine::runStartupScripts() {
std::string scriptPath;
scripts.getValue(key, scriptPath);
std::string&& absoluteScriptPath = absPath(scriptPath);
_engine->scriptEngine().runScriptFile(absoluteScriptPath);
_engine->scriptEngine()->runScriptFile(absoluteScriptPath);
}
}
@@ -408,7 +426,7 @@ void OpenSpaceEngine::loadFonts() {
sgct_text::FontManager::FontPath local = sgct_text::FontManager::FontPath::FontPath_Local;
ghoul::Dictionary fonts;
configurationManager().getValue(constants::configurationmanager::keyFonts, fonts);
configurationManager()->getValue(constants::configurationmanager::keyFonts, fonts);
for (const std::string& key : fonts.keys()) {
std::string font;
@@ -428,15 +446,15 @@ void OpenSpaceEngine::configureLogging() {
using constants::configurationmanager::keyLogLevel;
using constants::configurationmanager::keyLogs;
if (configurationManager().hasKeyAndValue<std::string>(keyLogLevel)) {
if (configurationManager()->hasKeyAndValue<std::string>(keyLogLevel)) {
using constants::configurationmanager::keyLogLevel;
using constants::configurationmanager::keyLogImmediateFlush;
std::string logLevel;
configurationManager().getValue(keyLogLevel, logLevel);
configurationManager()->getValue(keyLogLevel, logLevel);
bool immediateFlush = false;
configurationManager().getValue(keyLogImmediateFlush, immediateFlush);
configurationManager()->getValue(keyLogImmediateFlush, immediateFlush);
LogManager::LogLevel level = LogManager::levelFromString(logLevel);
LogManager::deinitialize();
@@ -444,9 +462,9 @@ void OpenSpaceEngine::configureLogging() {
LogMgr.addLog(new ConsoleLog);
}
if (configurationManager().hasKeyAndValue<ghoul::Dictionary>(keyLogs)) {
if (configurationManager()->hasKeyAndValue<ghoul::Dictionary>(keyLogs)) {
ghoul::Dictionary logs;
configurationManager().getValue(keyLogs, logs);
configurationManager()->getValue(keyLogs, logs);
for (size_t i = 1; i <= logs.size(); ++i) {
ghoul::Dictionary logInfo;
@@ -460,33 +478,39 @@ void OpenSpaceEngine::configureLogging() {
}
}
ConfigurationManager& OpenSpaceEngine::configurationManager() {
ConfigurationManager* OpenSpaceEngine::configurationManager() {
ghoul_assert(_configurationManager != nullptr, "ConfigurationManager is nullptr");
return _configurationManager;
}
interaction::InteractionHandler& OpenSpaceEngine::interactionHandler() {
interaction::InteractionHandler* OpenSpaceEngine::interactionHandler() {
ghoul_assert(_interactionHandler != nullptr, "InteractionHandler is nullptr");
return _interactionHandler;
}
RenderEngine& OpenSpaceEngine::renderEngine() {
RenderEngine* OpenSpaceEngine::renderEngine() {
ghoul_assert(_renderEngine != nullptr, "RenderEngine is nullptr");
return _renderEngine;
}
ScriptEngine& OpenSpaceEngine::scriptEngine() {
ScriptEngine* OpenSpaceEngine::scriptEngine() {
ghoul_assert(_scriptEngine != nullptr, "ScriptEngine is nullptr");
return _scriptEngine;
}
LuaConsole& OpenSpaceEngine::console() {
LuaConsole* OpenSpaceEngine::console() {
ghoul_assert(_console != nullptr, "LuaConsole is nullptr");
return _console;
}
GUI& OpenSpaceEngine::gui() {
GUI* OpenSpaceEngine::gui() {
ghoul_assert(_gui != nullptr, "GUI is nullptr");
return _gui;
}
bool OpenSpaceEngine::initializeGL() {
bool success = _renderEngine.initializeGL();
_gui.initializeGL();
bool success = _renderEngine->initializeGL();
_gui->initializeGL();
return success;
}
@@ -495,19 +519,19 @@ void OpenSpaceEngine::preSynchronization() {
if (sgct::Engine::instance()->isMaster()) {
const double dt = sgct::Engine::instance()->getDt();
_interactionHandler.update(dt);
_interactionHandler->update(dt);
//_interactionHandler.lockControls();
Time::ref().advanceTime(dt);
_renderEngine.preSynchronization();
_renderEngine->preSynchronization();
}
}
void OpenSpaceEngine::postSynchronizationPreDraw() {
_renderEngine.postSynchronizationPreDraw();
_renderEngine->postSynchronizationPreDraw();
if (sgct::Engine::instance()->isMaster() && _gui.isEnabled()) {
if (sgct::Engine::instance()->isMaster() && _gui->isEnabled()) {
double posX, posY;
sgct::Engine::instance()->getMousePos(0, &posX, &posY);
@@ -519,22 +543,22 @@ void OpenSpaceEngine::postSynchronizationPreDraw() {
bool buttons[2] = { button0 != 0, button1 != 0 };
double dt = std::max(sgct::Engine::instance()->getDt(), 1.0/60.0);
_gui.startFrame(static_cast<float>(dt), glm::vec2(glm::ivec2(x,y)), glm::vec2(posX, posY), buttons);
_gui->startFrame(static_cast<float>(dt), glm::vec2(glm::ivec2(x,y)), glm::vec2(posX, posY), buttons);
}
}
void OpenSpaceEngine::render() {
_renderEngine.render();
_renderEngine->render();
if (sgct::Engine::instance()->isMaster()) {
// If currently writing a command, render it to screen
sgct::SGCTWindow* w = sgct::Engine::instance()->getActiveWindowPtr();
if (sgct::Engine::instance()->isMaster() && !w->isUsingFisheyeRendering() && _console.isVisible()) {
_console.render();
if (sgct::Engine::instance()->isMaster() && !w->isUsingFisheyeRendering() && _console->isVisible()) {
_console->render();
}
if (_gui.isEnabled())
_gui.endFrame();
if (_gui->isEnabled())
_gui->endFrame();
}
}
@@ -542,76 +566,76 @@ void OpenSpaceEngine::postDraw() {
if (sgct::Engine::instance()->isMaster())
//_interactionHandler.unlockControls();
_renderEngine.postDraw();
_renderEngine->postDraw();
}
void OpenSpaceEngine::keyboardCallback(int key, int action) {
if (sgct::Engine::instance()->isMaster()) {
if (_gui.isEnabled()) {
bool isConsumed = _gui.keyCallback(key, action);
if (_gui->isEnabled()) {
bool isConsumed = _gui->keyCallback(key, action);
if (isConsumed)
return;
}
if (key == _console.commandInputButton() && (action == SGCT_PRESS || action == SGCT_REPEAT))
_console.toggleVisibility();
if (key == _console->commandInputButton() && (action == SGCT_PRESS || action == SGCT_REPEAT))
_console->toggleVisibility();
if (!_console.isVisible()) {
_interactionHandler.keyboardCallback(key, action);
if (!_console->isVisible()) {
_interactionHandler->keyboardCallback(key, action);
}
else {
_console.keyboardCallback(key, action);
_console->keyboardCallback(key, action);
}
}
}
void OpenSpaceEngine::charCallback(unsigned int codepoint) {
if (sgct::Engine::instance()->isMaster()) {
if (_gui.isEnabled()) {
bool isConsumed = _gui.charCallback(codepoint);
if (_gui->isEnabled()) {
bool isConsumed = _gui->charCallback(codepoint);
if (isConsumed)
return;
}
if (_console.isVisible()) {
_console.charCallback(codepoint);
if (_console->isVisible()) {
_console->charCallback(codepoint);
}
}
}
void OpenSpaceEngine::mouseButtonCallback(int key, int action) {
if (sgct::Engine::instance()->isMaster()) {
if (_gui.isEnabled()) {
bool isConsumed = _gui.mouseButtonCallback(key, action);
if (_gui->isEnabled()) {
bool isConsumed = _gui->mouseButtonCallback(key, action);
if (isConsumed && action != SGCT_RELEASE)
return;
}
_interactionHandler.mouseButtonCallback(key, action);
_interactionHandler->mouseButtonCallback(key, action);
}
}
void OpenSpaceEngine::mousePositionCallback(int x, int y) {
if (sgct::Engine::instance()->isMaster()) {
_interactionHandler.mousePositionCallback(x, y);
_interactionHandler->mousePositionCallback(x, y);
}
}
void OpenSpaceEngine::mouseScrollWheelCallback(int pos) {
if (sgct::Engine::instance()->isMaster()) {
if (_gui.isEnabled()) {
bool isConsumed = _gui.mouseWheelCallback(pos);
if (_gui->isEnabled()) {
bool isConsumed = _gui->mouseWheelCallback(pos);
if (isConsumed)
return;
}
_interactionHandler.mouseScrollWheelCallback(pos);
_interactionHandler->mouseScrollWheelCallback(pos);
}
}
void OpenSpaceEngine::encode() {
if (_syncBuffer) {
_renderEngine.serialize(_syncBuffer);
_renderEngine->serialize(_syncBuffer);
_syncBuffer->write();
}
}
@@ -619,7 +643,7 @@ void OpenSpaceEngine::encode() {
void OpenSpaceEngine::decode() {
if (_syncBuffer) {
_syncBuffer->read();
_renderEngine.deserialize(_syncBuffer);
_renderEngine->deserialize(_syncBuffer);
}
}
@@ -636,7 +660,7 @@ void OpenSpaceEngine::externalControlCallback(const char* receivedChars,
{
std::string script = std::string(receivedChars + 1);
LINFO("Received Lua Script: '" << script << "'");
_scriptEngine.runScript(script);
_scriptEngine->runScript(script);
}
}
}

View File

@@ -24,8 +24,14 @@
#include <openspace/gui/gui.h>
// This needs to be included first due to Windows.h / winsock2.h complications
#define SGCT_WINDOWS_INCLUDE
#include <sgct.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/properties/property.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/ghoul_gl.h>
@@ -45,7 +51,6 @@
#include <ghoul/filesystem/cachemanager.h>
#include <imgui.h>
#include <sgct.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
@@ -572,7 +577,7 @@ void GUI::renderPerformanceWindow() {
};
ImGui::Begin("Performance", &_showPerformanceWindow);
if (OsEng.renderEngine().doesPerformanceMeasurements() &&
if (OsEng.renderEngine()->doesPerformanceMeasurements() &&
ghoul::SharedMemory::exists(RenderEngine::PerformanceMeasurementSharedData))
{
ImGui::SliderFloat2("Min values, max Value", _minMaxValues, 0.f, 10000.f);
@@ -618,7 +623,7 @@ int show(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.gui().setEnabled(true);
OsEng.gui()->setEnabled(true);
return 0;
}
@@ -632,7 +637,7 @@ int hide(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.gui().setEnabled(false);
OsEng.gui()->setEnabled(false);
return 0;
}
@@ -646,7 +651,7 @@ int toggle(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.gui().setEnabled(!OsEng.gui().isEnabled());
OsEng.gui()->setEnabled(!OsEng.gui()->isEnabled());
return 0;
}

View File

@@ -22,35 +22,15 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
//<<<<<<< HEAD
//// open space includes
#include <openspace/interaction/interactionhandler.h>
//
#include <openspace/engine/openspaceengine.h>
//#include <openspace/interaction/deviceidentifier.h>
//#include <openspace/interaction/externalcontrol/externalcontrol.h>
//#include <openspace/interaction/externalcontrol/randomexternalcontrol.h>
//#include <openspace/interaction/externalcontrol/joystickexternalcontrol.h>
#include <openspace/query/query.h>
//#include <openspace/scenegraph/scenegraphnode.h>
//#include <openspace/util/camera.h>
//#include <openspace/util/powerscaledcoordinate.h>
#include <openspace/util/time.h>
//
//// ghoul
#include <ghoul/logging/logmanager.h>
//
//// other
//#include <sgct.h>
//#include <glm/gtx/vector_angle.hpp>
//
//// std includes
//#include <cassert>
//#include <algorithm>
//
#include <openspace/interaction/interactionhandler.h>
#include <openspace/query/query.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/time.h>
#include <ghoul/logging/logmanager.h>
#include <ghoul/misc/highresclock.h>
namespace {
@@ -231,7 +211,7 @@ int setOrigin(lua_State* L) {
return 0;
}
OsEng.interactionHandler().setFocusNode(node);
OsEng.interactionHandler()->setFocusNode(node);
return 0;
}
@@ -264,7 +244,7 @@ int bindKey(lua_State* L) {
}
OsEng.interactionHandler().bindKey(iKey, command);
OsEng.interactionHandler()->bindKey(iKey, command);
return 0;
}
@@ -282,7 +262,7 @@ int clearKeys(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.interactionHandler().resetKeyBindings();
OsEng.interactionHandler()->resetKeyBindings();
return 0;
}
@@ -297,7 +277,7 @@ int dt(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
lua_pushnumber(L,OsEng.interactionHandler().deltaTime());
lua_pushnumber(L,OsEng.interactionHandler()->deltaTime());
return 1;
}
@@ -314,7 +294,7 @@ int distance(lua_State* L) {
double d1 = luaL_checknumber(L, -2);
double d2 = luaL_checknumber(L, -1);
PowerScaledScalar dist(static_cast<float>(d1), static_cast<float>(d2));
OsEng.interactionHandler().distanceDelta(dist);
OsEng.interactionHandler()->distanceDelta(dist);
return 0;
}
@@ -852,21 +832,21 @@ void InteractionHandler::keyboardCallback(int key, int action) {
rotateDelta(rot);
}
if (key == SGCT_KEY_KP_SUBTRACT) {
glm::vec2 s = OsEng.renderEngine().camera()->scaling();
glm::vec2 s = OsEng.renderEngine()->camera()->scaling();
s[1] -= 0.5f;
OsEng.renderEngine().camera()->setScaling(s);
OsEng.renderEngine()->camera()->setScaling(s);
}
if (key == SGCT_KEY_KP_ADD) {
glm::vec2 s = OsEng.renderEngine().camera()->scaling();
glm::vec2 s = OsEng.renderEngine()->camera()->scaling();
s[1] += 0.5f;
OsEng.renderEngine().camera()->setScaling(s);
OsEng.renderEngine()->camera()->setScaling(s);
}
// iterate over key bindings
_validKeyLua = true;
auto ret = _keyLua.equal_range(key);
for (auto it = ret.first; it != ret.second; ++it) {
OsEng.scriptEngine().runScript(it->second);
OsEng.scriptEngine()->runScript(it->second);
if (!_validKeyLua) {
break;
}

View File

@@ -24,7 +24,9 @@
#include <openspace/interaction/keyboardcontroller.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/time.h>
#include <ghoul/filesystem/filesystem.h>
@@ -114,14 +116,14 @@ void KeyboardControllerFixed::keyPressed(KeyAction action, Key key, KeyModifier
}
if (key == Key::KeypadSubtract) {
glm::vec2 s = OsEng.renderEngine().camera()->scaling();
glm::vec2 s = OsEng.renderEngine()->camera()->scaling();
s[1] -= 0.5;
OsEng.renderEngine().camera()->setScaling(s);
OsEng.renderEngine()->camera()->setScaling(s);
}
if (key == Key::KeypadAdd) {
glm::vec2 s = OsEng.renderEngine().camera()->scaling();
glm::vec2 s = OsEng.renderEngine()->camera()->scaling();
s[1] += 0.5;
OsEng.renderEngine().camera()->setScaling(s);
OsEng.renderEngine()->camera()->setScaling(s);
}
}
/*

View File

@@ -58,7 +58,7 @@ int show(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.console().setVisible(true);
OsEng.console()->setVisible(true);
return 0;
}
@@ -72,7 +72,7 @@ int hide(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.console().setVisible(false);
OsEng.console()->setVisible(false);
return 0;
}
@@ -86,7 +86,7 @@ int toggle(lua_State* L) {
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.console().toggleVisibility();
OsEng.console()->toggleVisibility();
return 0;
}
@@ -116,7 +116,7 @@ void LuaConsole::initialize() {
int64_t nCommands;
file.read(reinterpret_cast<char*>(&nCommands), sizeof(int64_t));
for (size_t i = 0; i < nCommands; ++i) {
for (int64_t i = 0; i < nCommands; ++i) {
int64_t length;
file.read(reinterpret_cast<char*>(&length), sizeof(int64_t));
char* tmp = new char[length + 1];
@@ -217,7 +217,7 @@ void LuaConsole::keyboardCallback(int key, int action) {
// ENTER == run lua script
else {
if (_commands.at(_activeCommand) != "") {
OsEng.scriptEngine().runScript(_commands.at(_activeCommand));
OsEng.scriptEngine()->runScript(_commands.at(_activeCommand));
if (!_commandsHistory.empty() &&
_commands.at(_activeCommand) != _commandsHistory.at(_commandsHistory.size() - 1))
_commandsHistory.push_back(_commands.at(_activeCommand));
@@ -243,7 +243,7 @@ void LuaConsole::keyboardCallback(int key, int action) {
// find the value before the one that was previously found
if (_autoCompleteInfo.lastAutoCompleteIndex != NoAutoComplete && modifierShift)
_autoCompleteInfo.lastAutoCompleteIndex -= 2;
std::vector<std::string> allCommands = OsEng.scriptEngine().allLuaFunctions();
std::vector<std::string> allCommands = OsEng.scriptEngine()->allLuaFunctions();
std::sort(allCommands.begin(), allCommands.end());
std::string currentCommand = _commands.at(_activeCommand);

View File

@@ -22,10 +22,9 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
// open space includes
#include <openspace/engine/openspaceengine.h>
// sgct includes
#include <ghoul/logging/logging>
#include <sgct.h>
sgct::Engine* _sgctEngine;

View File

@@ -25,6 +25,7 @@
#include <openspace/query/query.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/rendering/renderable.h>
#include <openspace/scenegraph/scenegraph.h>
#include <openspace/scenegraph/scenegraphnode.h>
@@ -37,7 +38,7 @@ namespace {
SceneGraph* sceneGraph()
{
return OsEng.renderEngine().sceneGraph();
return OsEng.renderEngine()->sceneGraph();
}
SceneGraphNode* sceneGraphNode(const std::string& name)

View File

@@ -29,7 +29,7 @@
#include <openspace/rendering/model/renderablemodel.h>
#include <openspace/util/constants.h>
#include <openspace/rendering/model/modelgeometry.h>
#include <openspace/engine/configurationmanager.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/textureunit.h>
@@ -99,7 +99,7 @@ bool RenderableModel::initialize(){
bool completeSuccess = true;
if (_programObject == nullptr)
completeSuccess
&= OsEng.ref().configurationManager().getValue("pscShader", _programObject);
&= OsEng.ref().configurationManager()->getValue("pscShader", _programObject);
loadTexture();

View File

@@ -24,18 +24,20 @@
// open space includes
#include <openspace/rendering/planets/renderableplanet.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/planets/planetgeometry.h>
#include <openspace/util/constants.h>
#include <openspace/util/time.h>
#include <openspace/util/spicemanager.h>
#include <openspace/rendering/planets/planetgeometry.h>
#include <openspace/engine/openspaceengine.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/assert.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/programobject.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/opengl/textureunit.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem.h>
#include <ghoul/misc/assert.h>
#include <sgct.h>
@@ -103,7 +105,7 @@ RenderablePlanet::~RenderablePlanet() {
bool RenderablePlanet::initialize() {
if (_programObject == nullptr)
OsEng.ref().configurationManager().getValue("pscShader", _programObject);
OsEng.ref().configurationManager()->getValue("pscShader", _programObject);
loadTexture();
_geometry->initialize(this);

View File

@@ -21,15 +21,18 @@
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <openspace/rendering/renderablefov.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/util/constants.h>
#include <openspace/util/spicemanager.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/texture.h>
#include <ghoul/filesystem/filesystem.h>
#include <openspace/util/spicemanager.h>
#include <iomanip>
#include <utility>
@@ -127,7 +130,7 @@ void RenderableFov::sendToGPU(){
bool RenderableFov::initialize(){
bool completeSuccess = true;
if (_programObject == nullptr)
completeSuccess &= OsEng.ref().configurationManager().getValue("EphemerisProgram", _programObject);
completeSuccess &= OsEng.ref().configurationManager()->getValue("EphemerisProgram", _programObject);
SpiceManager::ref().getETfromDate("2007 feb 26 20:00:00", _startTrail);

View File

@@ -21,17 +21,21 @@
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#include <openspace/rendering/renderablepath.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/util/constants.h>
#include <openspace/util/spicemanager.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/opengl/textureunit.h>
#include <ghoul/filesystem/filesystem.h>
#include <openspace/util/spicemanager.h>
#include <iomanip>
#include <utility>
namespace {
const std::string _loggerCat = "RenderablePath";
//constants
@@ -170,7 +174,7 @@ bool RenderablePath::initialize(){
bool completeSuccess = true;
if (_programObject == nullptr)
completeSuccess
&= OsEng.ref().configurationManager().getValue("EphemerisProgram", _programObject);
&= OsEng.ref().configurationManager()->getValue("EphemerisProgram", _programObject);
// Initialize and upload to graphics card
glGenVertexArrays(1, &_vaoID);

View File

@@ -22,18 +22,15 @@
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
//standard includes.
#include <iostream>
#include <iomanip>
#define _USE_MATH_DEFINES
#include <math.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderablesphericalgrid.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/util/constants.h>
#include <openspace/util/spicemanager.h>
#define _USE_MATH_DEFINES
#include <math.h>
namespace {
const std::string _loggerCat = "RenderableSphericalGrid";
@@ -155,7 +152,7 @@ bool RenderableSphericalGrid::deinitialize(){
bool RenderableSphericalGrid::initialize(){
bool completeSuccess = true;
if (_gridProgram == nullptr)
completeSuccess &= OsEng.ref().configurationManager().getValue("GridProgram", _gridProgram);
completeSuccess &= OsEng.ref().configurationManager()->getValue("GridProgram", _gridProgram);
// Initialize and upload to graphics card
glGenVertexArrays(1, &_vaoID);

View File

@@ -25,7 +25,9 @@
#include <openspace/rendering/renderablevolumegl.h>
#include <openspace/abuffer/abuffer.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/util/kameleonwrapper.h>
#include <openspace/util/constants.h>
@@ -178,13 +180,13 @@ bool RenderableVolumeGL::initialize() {
if(_filename != "") {
_volume = loadVolume(_filename, _hintsDictionary);
_volume->uploadTexture();
OsEng.renderEngine().abuffer()->addVolume(_volumeName, _volume);
OsEng.renderEngine()->abuffer()->addVolume(_volumeName, _volume);
}
if(_transferFunctionPath != "") {
_transferFunction = loadTransferFunction(_transferFunctionPath);
_transferFunction->uploadTexture();
OsEng.renderEngine().abuffer()->addTransferFunction(_transferFunctionName, _transferFunction);
OsEng.renderEngine()->abuffer()->addTransferFunction(_transferFunctionName, _transferFunction);
auto textureCallback = [this](const ghoul::filesystem::File& file) {
_updateTransferfunction = true;
@@ -193,9 +195,9 @@ bool RenderableVolumeGL::initialize() {
}
// add the sampler and get the ID
_id = OsEng.renderEngine().abuffer()->addSamplerfile(_samplerFilename);
_id = OsEng.renderEngine()->abuffer()->addSamplerfile(_samplerFilename);
OsEng.configurationManager().getValue("RaycastProgram", _boxProgram);
OsEng.configurationManager()->getValue("RaycastProgram", _boxProgram);
// ============================
// GEOMETRY (box)

View File

@@ -31,6 +31,7 @@
#include <openspace/abuffer/abufferfixed.h>
#include <openspace/abuffer/abufferdynamic.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/scenegraph/scenegraph.h>
#include <openspace/util/camera.h>
#include <openspace/util/constants.h>
@@ -87,7 +88,7 @@ int takeScreenshot(lua_State* L) {
int nArguments = lua_gettop(L);
if (nArguments != 0)
return luaL_error(L, "Expected %i arguments, got %i", 0, nArguments);
OsEng.renderEngine().takeScreenshot();
OsEng.renderEngine()->takeScreenshot();
return 0;
}
@@ -103,7 +104,7 @@ int visualizeABuffer(lua_State* L) {
const int type = lua_type(L, -1);
bool b = lua_toboolean(L, -1) != 0;
OsEng.renderEngine().toggleVisualizeABuffer(b);
OsEng.renderEngine()->toggleVisualizeABuffer(b);
return 0;
}
@@ -119,7 +120,7 @@ int showRenderInformation(lua_State* L) {
const int type = lua_type(L, -1);
bool b = lua_toboolean(L, -1) != 0;
OsEng.renderEngine().toggleInfoText(b);
OsEng.renderEngine()->toggleInfoText(b);
return 0;
}
@@ -134,7 +135,7 @@ int setPerformanceMeasurement(lua_State* L) {
return luaL_error(L, "Expected %i arguments, got %i", 1, nArguments);
bool b = lua_toboolean(L, -1) != 0;
OsEng.renderEngine().setPerformanceMeasurements(b);
OsEng.renderEngine()->setPerformanceMeasurements(b);
return 0;
}
@@ -183,7 +184,7 @@ bool RenderEngine::initialize()
_mainCamera = new Camera();
_mainCamera->setScaling(glm::vec2(1.0, -8.0));
_mainCamera->setPosition(psc(0.f, 0.f, 1.499823f, 11.f));
OsEng.interactionHandler().setCamera(_mainCamera);
OsEng.interactionHandler()->setCamera(_mainCamera);
#ifdef GHOUL_USE_DEVIL
ghoul::io::TextureReader::ref().addReader(new ghoul::io::impl::TextureReaderDevIL);
@@ -337,7 +338,7 @@ void RenderEngine::postSynchronizationPreDraw()
//Allow focus node to update camera (enables camera-following)
//FIX LATER: THIS CAUSES MASTER NODE TO BE ONE FRAME AHEAD OF SLAVES
if (const SceneGraphNode* node = OsEng.ref().interactionHandler().focusNode()){
if (const SceneGraphNode* node = OsEng.ref().interactionHandler()->focusNode()){
node->updateCamera(_mainCamera);
}
@@ -426,7 +427,7 @@ void RenderEngine::render()
const glm::vec2 scaling = _mainCamera->scaling();
const glm::vec3 viewdirection = _mainCamera->viewDirection();
const psc position = _mainCamera->position();
const psc origin = OsEng.interactionHandler().focusNode()->worldPosition();
const psc origin = OsEng.interactionHandler()->focusNode()->worldPosition();
const PowerScaledScalar pssl = (position - origin).length();
// GUI PRINT

View File

@@ -23,25 +23,27 @@
****************************************************************************************/
#include <openspace/scenegraph/scenegraph.h>
#include <openspace/scenegraph/scenegraphnode.h>
#include <openspace/abuffer/abuffer.h>
#include <openspace/engine/configurationmanager.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/gui/gui.h>
#include <openspace/interaction/interactionhandler.h>
#include <openspace/query/query.h>
#include <openspace/rendering/renderengine.h>
#include <openspace/scenegraph/scenegraphnode.h>
#include <openspace/scripting/scriptengine.h>
#include <openspace/util/constants.h>
#include <openspace/query/query.h>
#include <openspace/util/time.h>
#include <openspace/abuffer/abuffer.h>
#include <openspace/gui/gui.h>
#include "ghoul/logging/logmanager.h"
#include "ghoul/opengl/programobject.h"
#include "ghoul/io/texture/texturereader.h"
#include "ghoul/opengl/texture.h"
#include <ghoul/filesystem/filesystem.h>
#include "ghoul/io/texture/texturereader.h"
#include <ghoul/misc/dictionary.h>
#include "ghoul/logging/logmanager.h"
#include <ghoul/lua/ghoul_lua.h>
#include <ghoul/lua/lua_helper.h>
#include "ghoul/opengl/programobject.h"
#include "ghoul/opengl/texture.h"
#include <iostream>
#include <fstream>
@@ -125,7 +127,7 @@ int loadScene(lua_State* L) {
std::string sceneFile = luaL_checkstring(L, -1);
OsEng.renderEngine().sceneGraph()->scheduleLoadSceneFile(sceneFile);
OsEng.renderEngine()->sceneGraph()->scheduleLoadSceneFile(sceneFile);
return 0;
}
@@ -170,7 +172,7 @@ bool SceneGraph::initialize()
if( ! tmpProgram) return false;
tmpProgram->setProgramObjectCallback(cb);
_programs.push_back(tmpProgram);
OsEng.ref().configurationManager().setValue("pscShader", tmpProgram);
OsEng.ref().configurationManager()->setValue("pscShader", tmpProgram);
// RaycastProgram
tmpProgram = ProgramObject::Build("RaycastProgram",
@@ -179,7 +181,7 @@ bool SceneGraph::initialize()
if (!tmpProgram) return false;
tmpProgram->setProgramObjectCallback(cb);
_programs.push_back(tmpProgram);
OsEng.ref().configurationManager().setValue("RaycastProgram", tmpProgram);
OsEng.ref().configurationManager()->setValue("RaycastProgram", tmpProgram);
// Grid program
tmpProgram = ProgramObject::Build("Grid",
@@ -188,7 +190,7 @@ bool SceneGraph::initialize()
if (!tmpProgram) return false;
tmpProgram->setProgramObjectCallback(cb);
_programs.push_back(tmpProgram);
OsEng.ref().configurationManager().setValue("GridProgram", tmpProgram);
OsEng.ref().configurationManager()->setValue("GridProgram", tmpProgram);
// Done building shaders
double elapsed = std::chrono::duration_cast<second_>(clock_::now()-beginning).count();
@@ -213,13 +215,13 @@ bool SceneGraph::deinitialize()
void SceneGraph::update(const UpdateData& data)
{
if (!_sceneGraphToLoad.empty()) {
OsEng.renderEngine().sceneGraph()->clearSceneGraph();
OsEng.renderEngine()->sceneGraph()->clearSceneGraph();
bool success = loadSceneInternal(_sceneGraphToLoad);
_sceneGraphToLoad = "";
if (!success)
return;
#ifndef __APPLE__
OsEng.renderEngine().abuffer()->invalidateABuffer();
OsEng.renderEngine()->abuffer()->invalidateABuffer();
#endif
}
for (SceneGraphNode* node : _nodes)
@@ -360,7 +362,7 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
_root->calculateBoundingSphere();
// set the camera position
Camera* c = OsEng.ref().renderEngine().camera();
Camera* c = OsEng.ref().renderEngine()->camera();
auto focusIterator = _allNodes.find(_focus);
glm::vec2 cameraScaling(1);
@@ -400,7 +402,7 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
// c->setScaling(scaling);
// Set the focus node for the interactionhandler
OsEng.interactionHandler().setFocusNode(focusNode);
OsEng.interactionHandler()->setFocusNode(focusNode);
}
glm::vec4 position;
@@ -418,7 +420,7 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
}
// the camera position
const SceneGraphNode* fn = OsEng.interactionHandler().focusNode();
const SceneGraphNode* fn = OsEng.interactionHandler()->focusNode();
//psc relative = fn->worldPosition() - c->position();
psc relative = fn->worldPosition() - cameraPosition;
@@ -439,7 +441,7 @@ bool SceneGraph::loadSceneInternal(const std::string& sceneDescriptionFilePath)
for (SceneGraphNode* node : _nodes) {
std::vector<properties::Property*> properties = node->propertiesRecursive();
for (properties::Property* p : properties) {
OsEng.gui().registerProperty(p);
OsEng.gui()->registerProperty(p);
}
}