mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-04-23 20:50:59 -05:00
Restructured SceneGraphNode code
This commit is contained in:
@@ -31,7 +31,8 @@ namespace openspace {
|
||||
|
||||
class ConstantPositionInformation: public PositionInformation {
|
||||
public:
|
||||
ConstantPositionInformation(const ghoul::Dictionary& dictionary);
|
||||
ConstantPositionInformation(const ghoul::Dictionary& dictionary
|
||||
= ghoul::Dictionary());
|
||||
virtual ~ConstantPositionInformation();
|
||||
virtual bool initialize();
|
||||
virtual const psc& position() const;
|
||||
|
||||
@@ -25,36 +25,36 @@
|
||||
#ifndef SCENEGRAPH_H
|
||||
#define SCENEGRAPH_H
|
||||
|
||||
// open space includes
|
||||
#include <openspace/scenegraph/scenegraphnode.h>
|
||||
|
||||
// std includes
|
||||
#include <vector>
|
||||
#include <map>
|
||||
|
||||
#include <openspace/util/camera.h>
|
||||
|
||||
// ghoul includes
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class SceneGraphNode;
|
||||
|
||||
class SceneGraph {
|
||||
public:
|
||||
|
||||
// constructors & destructor
|
||||
SceneGraph();
|
||||
~SceneGraph();
|
||||
// constructors & destructor
|
||||
SceneGraph();
|
||||
~SceneGraph();
|
||||
|
||||
/**
|
||||
* Initalizes the SceneGraph by loading modules from the ${SCENEPATH} directory
|
||||
*/
|
||||
bool initialize();
|
||||
|
||||
bool initialize();
|
||||
|
||||
/*
|
||||
* Clean up everything
|
||||
*/
|
||||
bool deinitialize();
|
||||
|
||||
|
||||
/*
|
||||
* Load the scenegraph from the provided folder
|
||||
*/
|
||||
@@ -66,17 +66,17 @@ public:
|
||||
/*
|
||||
* Updates all SceneGraphNodes relative positions
|
||||
*/
|
||||
void update();
|
||||
|
||||
void update();
|
||||
|
||||
/*
|
||||
* Evaluates if the SceneGraphNodes are visible to the provided camera
|
||||
*/
|
||||
void evaluate(Camera *camera);
|
||||
|
||||
void evaluate(Camera* camera);
|
||||
|
||||
/*
|
||||
* Render visible SceneGraphNodes using the provided camera
|
||||
*/
|
||||
void render(Camera *camera);
|
||||
void render(Camera* camera);
|
||||
|
||||
/*
|
||||
* Prints the SceneGraph tree. For debugging purposes
|
||||
@@ -90,12 +90,11 @@ public:
|
||||
|
||||
private:
|
||||
std::string _focus, _position;
|
||||
|
||||
// actual scenegraph
|
||||
SceneGraphNode *_root;
|
||||
std::vector<SceneGraphNode*> _nodes;
|
||||
std::map<std::string, SceneGraphNode*> _allNodes;
|
||||
|
||||
// actual scenegraph
|
||||
SceneGraphNode* _root;
|
||||
std::vector<SceneGraphNode*> _nodes;
|
||||
std::map<std::string, SceneGraphNode*> _allNodes;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -29,12 +29,14 @@
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/scenegraph/positioninformation.h>
|
||||
|
||||
#include <openspace/scenegraph/scenegraph.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
// std includes
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
@@ -42,8 +44,10 @@ class SceneGraphNode {
|
||||
public:
|
||||
|
||||
// constructors & destructor
|
||||
SceneGraphNode(const ghoul::Dictionary& dictionary);
|
||||
SceneGraphNode();
|
||||
~SceneGraphNode();
|
||||
|
||||
static SceneGraphNode* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
@@ -77,7 +81,6 @@ public:
|
||||
const Renderable * getRenderable() const;
|
||||
|
||||
private:
|
||||
|
||||
// essential
|
||||
std::vector<SceneGraphNode*> _children;
|
||||
SceneGraphNode* _parent;
|
||||
@@ -98,6 +101,4 @@ private:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#include <openspace/scenegraph/scenegraphnode.inl>
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* OpenSpace *
|
||||
* *
|
||||
* Copyright (c) 2014 *
|
||||
* *
|
||||
* 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 SCENEGRAPHNODE_INL
|
||||
#define SCENEGRAPHNODE_INL
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user