mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-02-19 19:39:30 -06:00
Rename planetbrowsing to globebrowsing
This commit is contained in:
@@ -25,7 +25,7 @@ return {
|
||||
Name = "Earth",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "Planet",
|
||||
Type = "RenderableGlobe",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Textures = {
|
||||
|
||||
@@ -25,20 +25,20 @@
|
||||
include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
|
||||
|
||||
set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableglobe.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/distanceswitch.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/geometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gridgeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetmesh.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/globemesh.h
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableglobe.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/distanceswitch.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/geometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/gridgeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetmesh.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/globemesh.cpp
|
||||
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
@@ -49,7 +49,7 @@ set(SHADER_FILES
|
||||
source_group("Shader Files" FILES ${SHADER_FILES})
|
||||
|
||||
create_new_module(
|
||||
"PlanetBrowsing"
|
||||
planetbrowsing_module
|
||||
"GlobeBrowsing"
|
||||
globebrowsing_module
|
||||
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
|
||||
)
|
||||
@@ -22,11 +22,11 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/planetbrowsing/planetbrowsingmodule.h>
|
||||
#include <modules/globebrowsing/globebrowsingmodule.h>
|
||||
|
||||
#include <modules/planetbrowsing/rendering/planet.h>
|
||||
#include <modules/planetbrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/planetbrowsing/rendering/planetmesh.h>
|
||||
#include <modules/globebrowsing/rendering/renderableglobe.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
@@ -36,11 +36,11 @@
|
||||
|
||||
namespace openspace {
|
||||
|
||||
PlanetBrowsingModule::PlanetBrowsingModule()
|
||||
: OpenSpaceModule("PlanetBrowsing")
|
||||
GlobeBrowsingModule::GlobeBrowsingModule()
|
||||
: OpenSpaceModule("GlobeBrowsing")
|
||||
{}
|
||||
|
||||
void PlanetBrowsingModule::internalInitialize() {
|
||||
void GlobeBrowsingModule::internalInitialize() {
|
||||
/*
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "Renderable factory was not created");
|
||||
@@ -62,8 +62,8 @@ void PlanetBrowsingModule::internalInitialize() {
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "Renderable factory was not created");
|
||||
|
||||
fRenderable->registerClass<Planet>("Planet");
|
||||
fRenderable->registerClass<PlanetMesh>("PlanetMesh");
|
||||
fRenderable->registerClass<RenderableGlobe>("RenderableGlobe");
|
||||
fRenderable->registerClass<GlobeMesh>("GlobeMesh");
|
||||
fRenderable->registerClass<DistanceSwitch>("DistanceSwitch");
|
||||
}
|
||||
|
||||
@@ -22,16 +22,16 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __PLANETBROWSING_H__
|
||||
#define __PLANETBROWSING_H__
|
||||
#ifndef __GLOBEBROWSING_H__
|
||||
#define __GLOBEBROWSING_H__
|
||||
|
||||
#include <openspace/util/openspacemodule.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class PlanetBrowsingModule : public OpenSpaceModule {
|
||||
class GlobeBrowsingModule : public OpenSpaceModule {
|
||||
public:
|
||||
PlanetBrowsingModule();
|
||||
GlobeBrowsingModule();
|
||||
|
||||
protected:
|
||||
void internalInitialize() override;
|
||||
@@ -39,4 +39,4 @@ protected:
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __PLANETBROWSING_H__
|
||||
#endif // __GLOBEBROWSING_H__
|
||||
@@ -23,7 +23,7 @@
|
||||
****************************************************************************************/
|
||||
|
||||
// open space includes
|
||||
#include <modules/planetbrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "DistanceSwitch";
|
||||
@@ -43,7 +43,6 @@ namespace openspace {
|
||||
*/
|
||||
class DistanceSwitch : public Renderable {
|
||||
public:
|
||||
|
||||
DistanceSwitch();
|
||||
virtual ~DistanceSwitch();
|
||||
|
||||
@@ -1,4 +1,28 @@
|
||||
#include <modules/planetbrowsing/rendering/geometry.h>
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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/globebrowsing/rendering/geometry.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "Geometry";
|
||||
@@ -83,7 +83,6 @@ protected:
|
||||
// Vertex data
|
||||
std::vector<Vertex> _vertexData;
|
||||
std::vector<GLuint> _elementData;
|
||||
|
||||
private:
|
||||
// GL handles
|
||||
GLuint _vaoID;
|
||||
@@ -22,7 +22,7 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/planetbrowsing/rendering/planetmesh.h>
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -37,7 +37,7 @@
|
||||
#include <math.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "PlanetMesh";
|
||||
const std::string _loggerCat = "GlobeMesh";
|
||||
|
||||
const std::string keyFrame = "Frame";
|
||||
const std::string keyGeometry = "Geometry";
|
||||
@@ -47,8 +47,7 @@ namespace {
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
PlanetMesh::PlanetMesh(const ghoul::Dictionary& dictionary)
|
||||
GlobeMesh::GlobeMesh(const ghoul::Dictionary& dictionary)
|
||||
: DistanceSwitch()
|
||||
, _programObject(nullptr)
|
||||
, _grid(10, 10, Geometry::Positions::Yes, Geometry::TextureCoordinates::No, Geometry::Normals::No)
|
||||
@@ -57,7 +56,7 @@ namespace openspace {
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
ghoul_assert(success,
|
||||
"PlanetMesh need the '" << SceneGraphNode::KeyName << "' be specified");
|
||||
"GlobeMesh need the '" << SceneGraphNode::KeyName << "' be specified");
|
||||
setName(name);
|
||||
|
||||
dictionary.getValue(keyFrame, _frame);
|
||||
@@ -69,43 +68,20 @@ namespace openspace {
|
||||
addProperty(_rotation);
|
||||
|
||||
_grid.initialize();
|
||||
|
||||
/*
|
||||
// Create a simple triangle for testing the geometry
|
||||
std::vector<unsigned int> triangleElements;
|
||||
std::vector<glm::vec4> trianglePositions;
|
||||
|
||||
trianglePositions.push_back(glm::vec4(0, 0, 0, 1));
|
||||
trianglePositions.push_back(glm::vec4(10000000, 0, 0, 1));
|
||||
trianglePositions.push_back(glm::vec4(10000000, 10000000, 0, 1));
|
||||
|
||||
triangleElements.push_back(0);
|
||||
triangleElements.push_back(1);
|
||||
triangleElements.push_back(2);
|
||||
|
||||
_testGeometry = std::unique_ptr<Geometry>(new Geometry(
|
||||
triangleElements,
|
||||
Geometry::Positions::Yes,
|
||||
Geometry::TextureCoordinates::No,
|
||||
Geometry::Normals::No));
|
||||
|
||||
_testGeometry->setVertexPositions(trianglePositions);
|
||||
_testGeometry->initialize();
|
||||
*/
|
||||
}
|
||||
|
||||
PlanetMesh::~PlanetMesh() {
|
||||
GlobeMesh::~GlobeMesh() {
|
||||
}
|
||||
|
||||
bool PlanetMesh::initialize() {
|
||||
bool GlobeMesh::initialize() {
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_programObject == nullptr) {
|
||||
// Night texture program
|
||||
_programObject = renderEngine.buildRenderProgram(
|
||||
"simpleTextureProgram",
|
||||
"${MODULE_PLANETBROWSING}/shaders/simple_vs.glsl",
|
||||
"${MODULE_PLANETBROWSING}/shaders/simple_fs.glsl");
|
||||
"${MODULE_GLOBEBROWSING}/shaders/simple_vs.glsl",
|
||||
"${MODULE_GLOBEBROWSING}/shaders/simple_fs.glsl");
|
||||
if (!_programObject) return false;
|
||||
}
|
||||
|
||||
@@ -115,7 +91,7 @@ namespace openspace {
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool PlanetMesh::deinitialize() {
|
||||
bool GlobeMesh::deinitialize() {
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_programObject) {
|
||||
@@ -126,13 +102,13 @@ namespace openspace {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PlanetMesh::isReady() const {
|
||||
bool GlobeMesh::isReady() const {
|
||||
bool ready = true;
|
||||
ready &= (_programObject != nullptr);
|
||||
return ready;
|
||||
}
|
||||
|
||||
void PlanetMesh::render(const RenderData& data)
|
||||
void GlobeMesh::render(const RenderData& data)
|
||||
{
|
||||
// activate shader
|
||||
_programObject->activate();
|
||||
@@ -162,14 +138,13 @@ namespace openspace {
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
// render
|
||||
// _testGeometry->drawUsingActiveProgram();
|
||||
_grid.drawUsingActiveProgram();
|
||||
|
||||
// disable shader
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
void PlanetMesh::update(const UpdateData& data) {
|
||||
void GlobeMesh::update(const UpdateData& data) {
|
||||
// set spice-orientation in accordance to timestamp
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
|
||||
_time = data.time;
|
||||
@@ -22,8 +22,8 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#ifndef __PLANETMESH_H__
|
||||
#define __PLANETMESH_H__
|
||||
#ifndef __GLOBEMESH_H__
|
||||
#define __GLOBEMESH_H__
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
@@ -31,11 +31,9 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <modules/planetbrowsing/rendering/geometry.h>
|
||||
#include <modules/planetbrowsing/rendering/gridgeometry.h>
|
||||
#include <modules/planetbrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/planetbrowsing/rendering/planetmesh.h>
|
||||
|
||||
#include <modules/globebrowsing/rendering/geometry.h>
|
||||
#include <modules/globebrowsing/rendering/gridgeometry.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
@@ -45,10 +43,10 @@ namespace ghoul {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class PlanetMesh : public DistanceSwitch {
|
||||
class GlobeMesh : public DistanceSwitch {
|
||||
public:
|
||||
PlanetMesh(const ghoul::Dictionary& dictionary);
|
||||
~PlanetMesh();
|
||||
GlobeMesh(const ghoul::Dictionary& dictionary);
|
||||
~GlobeMesh();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
@@ -74,4 +72,4 @@ namespace openspace {
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __PLANETMESH_H__
|
||||
#endif // __GLOBEMESH_H__
|
||||
@@ -1,4 +1,4 @@
|
||||
#include <modules/planetbrowsing/rendering/gridgeometry.h>
|
||||
#include <modules/globebrowsing/rendering/gridgeometry.h>
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <ghoul/opengl/ghoul_gl.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include <modules/planetbrowsing/rendering/geometry.h>
|
||||
#include <modules/globebrowsing/rendering/geometry.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
@@ -22,9 +22,9 @@
|
||||
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
||||
****************************************************************************************/
|
||||
|
||||
#include <modules/planetbrowsing/rendering/planet.h>
|
||||
#include <modules/globebrowsing/rendering/renderableglobe.h>
|
||||
|
||||
#include <modules/planetbrowsing/rendering/planetmesh.h>
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
|
||||
// open space includes
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
@@ -39,7 +39,7 @@
|
||||
#include <math.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "Planet";
|
||||
const std::string _loggerCat = "RenderableGlobe";
|
||||
|
||||
const std::string keyFrame = "Frame";
|
||||
const std::string keyGeometry = "Geometry";
|
||||
@@ -50,14 +50,14 @@ namespace {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Planet::Planet(const ghoul::Dictionary& dictionary)
|
||||
RenderableGlobe::RenderableGlobe(const ghoul::Dictionary& dictionary)
|
||||
: DistanceSwitch()
|
||||
, _rotation("rotation", "Rotation", 0, 0, 360)
|
||||
{
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
ghoul_assert(success,
|
||||
"Planet need the '" << SceneGraphNode::KeyName << "' be specified");
|
||||
"RenderableGlobe need the '" << SceneGraphNode::KeyName << "' be specified");
|
||||
setName(name);
|
||||
dictionary.getValue(keyFrame, _frame);
|
||||
dictionary.getValue(keyBody, _target);
|
||||
@@ -68,13 +68,13 @@ namespace openspace {
|
||||
// Mainly for debugging purposes @AA
|
||||
addProperty(_rotation);
|
||||
|
||||
addSwitchValue(std::shared_ptr<PlanetMesh>(new PlanetMesh(dictionary)), 1000000000);
|
||||
addSwitchValue(std::shared_ptr<GlobeMesh>(new GlobeMesh(dictionary)), 1000000000);
|
||||
}
|
||||
|
||||
Planet::~Planet() {
|
||||
RenderableGlobe::~RenderableGlobe() {
|
||||
}
|
||||
|
||||
void Planet::update(const UpdateData& data) {
|
||||
void RenderableGlobe::update(const UpdateData& data) {
|
||||
// set spice-orientation in accordance to timestamp
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
|
||||
_time = data.time;
|
||||
@@ -31,9 +31,9 @@
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
#include <modules/planetbrowsing/rendering/geometry.h>
|
||||
#include <modules/planetbrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/planetbrowsing/rendering/planetmesh.h>
|
||||
#include <modules/globebrowsing/rendering/geometry.h>
|
||||
#include <modules/globebrowsing/rendering/distanceswitch.h>
|
||||
#include <modules/globebrowsing/rendering/globemesh.h>
|
||||
|
||||
|
||||
namespace ghoul {
|
||||
@@ -45,10 +45,10 @@ namespace opengl {
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class Planet : public DistanceSwitch {
|
||||
class RenderableGlobe : public DistanceSwitch {
|
||||
public:
|
||||
Planet(const ghoul::Dictionary& dictionary);
|
||||
~Planet();
|
||||
RenderableGlobe(const ghoul::Dictionary& dictionary);
|
||||
~RenderableGlobe();
|
||||
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
Reference in New Issue
Block a user