mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-05 10:59:47 -05:00
Isolated rendering of simple sphere planet by duplicating the classes in to new ones in the new planetbrowsing module. From here the code can be reduced to fit our rendering model.
This commit is contained in:
@@ -25,9 +25,25 @@ return {
|
||||
Name = "Earth",
|
||||
Parent = "EarthBarycenter",
|
||||
Renderable = {
|
||||
Type = "Planet",
|
||||
Type = "RenderableTestPlanet",
|
||||
Frame = "IAU_EARTH",
|
||||
Body = "EARTH",
|
||||
Geometry = {
|
||||
Type = "SimpleSphereTest",
|
||||
Radius = { 6.371, 6 },
|
||||
Segments = 100
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
Color = "textures/earth_bluemarble.jpg",
|
||||
Night = "textures/earth_night.jpg",
|
||||
-- Depth = "textures/earth_depth.png"
|
||||
},
|
||||
Atmosphere = {
|
||||
Type = "Nishita", -- for example, values missing etc etc
|
||||
MieFactor = 1.0,
|
||||
MieColor = {1.0, 1.0, 1.0}
|
||||
}
|
||||
},
|
||||
Ephemeris = {
|
||||
Type = "Spice",
|
||||
|
||||
@@ -27,12 +27,18 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
|
||||
set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/geometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletestplanet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planettestgeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheretestgeometry.h
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/geometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletestplanet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planettestgeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheretestgeometry.cpp
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
|
||||
|
||||
@@ -24,7 +24,10 @@
|
||||
|
||||
#include <modules/planetbrowsing/planetbrowsingmodule.h>
|
||||
|
||||
#include <modules/planetbrowsing/rendering/Planet.h>
|
||||
#include <modules/planetbrowsing/rendering/planet.h>
|
||||
#include <modules/planetbrowsing/rendering/renderabletestplanet.h>
|
||||
#include <modules/planetbrowsing/rendering/planettestgeometry.h>
|
||||
#include <modules/planetbrowsing/rendering/simplespheretestgeometry.h>
|
||||
|
||||
#include <openspace/rendering/renderable.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
@@ -39,11 +42,36 @@ PlanetBrowsingModule::PlanetBrowsingModule()
|
||||
{}
|
||||
|
||||
void PlanetBrowsingModule::internalInitialize() {
|
||||
|
||||
/*
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "Renderable factory was not created");
|
||||
|
||||
fRenderable->registerClass<Planet>("Planet");
|
||||
fRenderable->registerClass<RenderableTestPlanet>("RenderableTestPlanet");
|
||||
//fRenderable->registerClass<planettestgeometry::PlanetTestGeometry>("PlanetTestGeometry");
|
||||
|
||||
auto fPlanetGeometry = FactoryManager::ref().factory<planettestgeometry::PlanetTestGeometry>();
|
||||
ghoul_assert(fPlanetGeometry, "Planet test geometry factory was not created");
|
||||
fPlanetGeometry->registerClass<planettestgeometry::SimpleSphereTestGeometry>("SimpleSphereTest");
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
FactoryManager::ref().addFactory(std::make_unique<ghoul::TemplateFactory<planettestgeometry::PlanetTestGeometry>>());
|
||||
|
||||
auto fRenderable = FactoryManager::ref().factory<Renderable>();
|
||||
ghoul_assert(fRenderable, "Renderable factory was not created");
|
||||
|
||||
fRenderable->registerClass<RenderableTestPlanet>("RenderableTestPlanet");
|
||||
|
||||
|
||||
auto fPlanetGeometry = FactoryManager::ref().factory<planettestgeometry::PlanetTestGeometry>();
|
||||
ghoul_assert(fPlanetGeometry, "Planet test geometry factory was not created");
|
||||
fPlanetGeometry->registerClass<planettestgeometry::SimpleSphereTestGeometry>("SimpleSphereTest");
|
||||
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -30,6 +30,7 @@ Geometry::~Geometry() {
|
||||
}
|
||||
|
||||
void Geometry::setPositionData(std::vector<glm::vec4> positions) {
|
||||
_vertexData.resize(positions.size());
|
||||
for (size_t i = 0; i < positions.size(); i++)
|
||||
{
|
||||
_vertexData[i].position[0] = static_cast<GLfloat>(positions[i].x);
|
||||
@@ -40,6 +41,7 @@ void Geometry::setPositionData(std::vector<glm::vec4> positions) {
|
||||
}
|
||||
|
||||
void Geometry::setTextureData(std::vector<glm::vec2> textures) {
|
||||
_vertexData.resize(textures.size());
|
||||
for (size_t i = 0; i < textures.size(); i++)
|
||||
{
|
||||
_vertexData[i].texture[0] = static_cast<GLfloat>(textures[i].s);
|
||||
@@ -48,6 +50,7 @@ void Geometry::setTextureData(std::vector<glm::vec2> textures) {
|
||||
}
|
||||
|
||||
void Geometry::setNormalData(std::vector<glm::vec3> normals) {
|
||||
_vertexData.resize(normals.size());
|
||||
for (size_t i = 0; i < normals.size(); i++)
|
||||
{
|
||||
_vertexData[i].normal[0] = static_cast<GLfloat>(normals[i].x);
|
||||
@@ -57,6 +60,7 @@ void Geometry::setNormalData(std::vector<glm::vec3> normals) {
|
||||
}
|
||||
|
||||
void Geometry::setElementData(std::vector<unsigned int> elements) {
|
||||
_elementData.resize(elements.size());
|
||||
for (size_t i = 0; i < elements.size(); i++)
|
||||
{
|
||||
_elementData[i] = static_cast<GLuint>(elements[i]);
|
||||
@@ -126,6 +130,7 @@ bool Geometry::initialize() {
|
||||
return true;
|
||||
}
|
||||
void Geometry::render() const {
|
||||
|
||||
glBindVertexArray(_vaoID);
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, _elementBufferID);
|
||||
glDrawElements(GL_TRIANGLES, _elementData.size(), GL_UNSIGNED_INT, 0);
|
||||
|
||||
@@ -25,17 +25,29 @@
|
||||
// open space includes
|
||||
#include <modules/planetbrowsing/rendering/Planet.h>
|
||||
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
|
||||
#include <modules/base/rendering/planetgeometry.h>
|
||||
|
||||
|
||||
#include <vector>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "Planet";
|
||||
const std::string keyGeometry = "Geometry";
|
||||
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
Planet::Planet(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary) {
|
||||
|
||||
Planet::Planet(const ghoul::Dictionary& dictionary) :
|
||||
Renderable(dictionary),
|
||||
_geometry(nullptr),
|
||||
_testProgramObject(nullptr)
|
||||
{
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
LDEBUG(name);
|
||||
@@ -43,6 +55,41 @@ Planet::Planet(const ghoul::Dictionary& dictionary)
|
||||
ghoul_assert(success,
|
||||
"Planet need the '" << SceneGraphNode::KeyName << "' be specified");
|
||||
|
||||
|
||||
ghoul::Dictionary geometryDictionary;
|
||||
success = dictionary.getValue(keyGeometry, geometryDictionary);
|
||||
if (success) {
|
||||
geometryDictionary.setValue(SceneGraphNode::KeyName, name);
|
||||
//geometryDictionary.setValue(constants::scenegraph::keyPathModule, path);
|
||||
_geometry = planetgeometry::PlanetGeometry::createFromDictionary(geometryDictionary);
|
||||
}
|
||||
|
||||
addPropertySubOwner(_geometry);
|
||||
|
||||
/*
|
||||
// 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.5, 1));
|
||||
trianglePositions.push_back(glm::vec4(1, 0, -0.5, 1));
|
||||
trianglePositions.push_back(glm::vec4(1, 1, -0.5, 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::Textures::No,
|
||||
Geometry::Normals::No));
|
||||
|
||||
_testGeometry->setPositionData(trianglePositions);
|
||||
_testGeometry->initialize();
|
||||
*/
|
||||
// Create a test shader program object
|
||||
|
||||
}
|
||||
|
||||
Planet::~Planet() {
|
||||
@@ -50,19 +97,53 @@ Planet::~Planet() {
|
||||
}
|
||||
|
||||
bool Planet::initialize() {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_testProgramObject == nullptr) {
|
||||
_testProgramObject = renderEngine.buildRenderProgram(
|
||||
"simpleTestProgram",
|
||||
"${MODULE_PLANETBROWSING}/shaders/simple_vs.glsl",
|
||||
"${MODULE_PLANETBROWSING}/shaders/simple_fs.glsl");
|
||||
if (!_testProgramObject) return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Planet::deinitialize() {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_testProgramObject) {
|
||||
renderEngine.removeRenderProgram(_testProgramObject);
|
||||
_testProgramObject = nullptr;
|
||||
}
|
||||
|
||||
if (_geometry) {
|
||||
_geometry->deinitialize();
|
||||
delete _geometry;
|
||||
}
|
||||
_geometry = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Planet::isReady() const {
|
||||
return true;
|
||||
bool ready = true;
|
||||
ready &= (_testProgramObject != nullptr);
|
||||
ready &= (_geometry != nullptr);
|
||||
|
||||
return ready;
|
||||
}
|
||||
|
||||
void Planet::render(const RenderData& data) {
|
||||
|
||||
// activate shader
|
||||
_testProgramObject->activate();
|
||||
|
||||
|
||||
//_testGeometry->render();
|
||||
_geometry->render();
|
||||
|
||||
|
||||
// disable shader
|
||||
_testProgramObject->deactivate();
|
||||
}
|
||||
|
||||
void Planet::update(const UpdateData& data) {
|
||||
|
||||
@@ -28,11 +28,16 @@
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
//#include <openspace/properties/stringproperty.h>
|
||||
//#include <openspace/util/updatestructures.h>
|
||||
#include <modules/planetbrowsing/rendering/geometry.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace planetgeometry {
|
||||
class PlanetGeometry;
|
||||
}
|
||||
|
||||
class Planet : public Renderable {
|
||||
public:
|
||||
Planet(const ghoul::Dictionary& dictionary);
|
||||
@@ -46,6 +51,10 @@ public:
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
// std::unique_ptr<Geometry> _testGeometry;
|
||||
planetgeometry::PlanetGeometry* _geometry;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _testProgramObject;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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/planetbrowsing/rendering/planettestgeometry.h>
|
||||
#include <modules/planetbrowsing/rendering/renderabletestplanet.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "PlanetTestGeometry";
|
||||
const std::string KeyType = "Type";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
namespace planettestgeometry {
|
||||
|
||||
PlanetTestGeometry* PlanetTestGeometry::createFromDictionary(const ghoul::Dictionary& dictionary) {
|
||||
std::string geometryType;
|
||||
const bool success = dictionary.getValue(KeyType, geometryType);
|
||||
if (!success) {
|
||||
LERROR("PlanetTestGeometry did not contain a correct value of the key '"
|
||||
<< KeyType << "'");
|
||||
return nullptr;
|
||||
}
|
||||
ghoul::TemplateFactory<PlanetTestGeometry>* factory
|
||||
= FactoryManager::ref().factory<PlanetTestGeometry>();
|
||||
|
||||
PlanetTestGeometry* result = factory->create(geometryType, dictionary);
|
||||
if (result == nullptr) {
|
||||
LERROR("Failed to create a PlanetTestGeometry object of type '" << geometryType
|
||||
<< "'");
|
||||
return nullptr;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
PlanetTestGeometry::PlanetTestGeometry()
|
||||
: _parent(nullptr)
|
||||
{
|
||||
setName("PlanetTestGeometry");
|
||||
}
|
||||
|
||||
PlanetTestGeometry::~PlanetTestGeometry()
|
||||
{
|
||||
}
|
||||
|
||||
bool PlanetTestGeometry::initialize(RenderableTestPlanet* parent)
|
||||
{
|
||||
_parent = parent;
|
||||
return true;
|
||||
}
|
||||
|
||||
void PlanetTestGeometry::deinitialize()
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace planettestgeometry
|
||||
} // namespace openspace
|
||||
@@ -0,0 +1,53 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __PLANETTESTGEOMETRY_H__
|
||||
#define __PLANETTESTGEOMETRY_H__
|
||||
|
||||
#include <openspace/properties/propertyowner.h>
|
||||
#include <modules/planetbrowsing/rendering/renderabletestplanet.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace planettestgeometry {
|
||||
|
||||
class PlanetTestGeometry : public properties::PropertyOwner {
|
||||
public:
|
||||
static PlanetTestGeometry* createFromDictionary(const ghoul::Dictionary& dictionary);
|
||||
|
||||
PlanetTestGeometry();
|
||||
virtual ~PlanetTestGeometry();
|
||||
virtual bool initialize(RenderableTestPlanet* parent);
|
||||
virtual void deinitialize();
|
||||
virtual void render() = 0;
|
||||
|
||||
protected:
|
||||
RenderableTestPlanet* _parent;
|
||||
};
|
||||
|
||||
} // namespace planettestgeometry
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __PLANETTESTGEOMETRY_H__
|
||||
@@ -0,0 +1,279 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
// open space includes
|
||||
#include <modules/planetbrowsing/rendering/renderabletestplanet.h>
|
||||
#include <modules/planetbrowsing/rendering/planettestgeometry.h>
|
||||
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <modules/base/rendering/planetgeometry.h>
|
||||
#include <openspace/util/time.h>
|
||||
#include <openspace/util/spicemanager.h>
|
||||
#include <openspace/scene/scenegraphnode.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>
|
||||
|
||||
#define _USE_MATH_DEFINES
|
||||
#include <math.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "RenderableTestPlanet";
|
||||
|
||||
const std::string keyFrame = "Frame";
|
||||
const std::string keyGeometry = "Geometry";
|
||||
const std::string keyShading = "PerformShading";
|
||||
|
||||
const std::string keyBody = "Body";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
RenderableTestPlanet::RenderableTestPlanet(const ghoul::Dictionary& dictionary)
|
||||
: Renderable(dictionary)
|
||||
, _colorTexturePath("colorTexture", "Color Texture")
|
||||
, _programObject(nullptr)
|
||||
, _texture(nullptr)
|
||||
, _nightTexture(nullptr)
|
||||
, _geometry(nullptr)
|
||||
, _performShading("performShading", "Perform Shading", true)
|
||||
, _rotation("rotation", "Rotation", 0, 0, 360)
|
||||
, _alpha(1.f)
|
||||
, _nightTexturePath("")
|
||||
, _hasNightTexture(false)
|
||||
{
|
||||
std::string name;
|
||||
bool success = dictionary.getValue(SceneGraphNode::KeyName, name);
|
||||
ghoul_assert(success,
|
||||
"RenderablePlanet need the '" << SceneGraphNode::KeyName<<"' be specified");
|
||||
|
||||
//std::string path;
|
||||
//success = dictionary.getValue(constants::scenegraph::keyPathModule, path);
|
||||
//ghoul_assert(success,
|
||||
// "RenderablePlanet need the '"<<constants::scenegraph::keyPathModule<<"' be specified");
|
||||
|
||||
ghoul::Dictionary geometryDictionary;
|
||||
success = dictionary.getValue(keyGeometry, geometryDictionary);
|
||||
if (success) {
|
||||
geometryDictionary.setValue(SceneGraphNode::KeyName, name);
|
||||
//geometryDictionary.setValue(constants::scenegraph::keyPathModule, path);
|
||||
_geometry = planettestgeometry::PlanetTestGeometry::createFromDictionary(geometryDictionary);
|
||||
}
|
||||
|
||||
dictionary.getValue(keyFrame, _frame);
|
||||
dictionary.getValue(keyBody, _target);
|
||||
if (_target != "")
|
||||
setBody(_target);
|
||||
|
||||
// TODO: textures need to be replaced by a good system similar to the geometry as soon
|
||||
// as the requirements are fixed (ab)
|
||||
std::string texturePath = "";
|
||||
success = dictionary.getValue("Textures.Color", texturePath);
|
||||
if (success)
|
||||
_colorTexturePath = absPath(texturePath);
|
||||
|
||||
std::string nightTexturePath = "";
|
||||
dictionary.getValue("Textures.Night", nightTexturePath);
|
||||
|
||||
if (nightTexturePath != ""){
|
||||
_hasNightTexture = true;
|
||||
_nightTexturePath = absPath(nightTexturePath);
|
||||
}
|
||||
|
||||
addPropertySubOwner(_geometry);
|
||||
|
||||
addProperty(_colorTexturePath);
|
||||
_colorTexturePath.onChange(std::bind(&RenderableTestPlanet::loadTexture, this));
|
||||
|
||||
if (dictionary.hasKeyAndValue<bool>(keyShading)) {
|
||||
bool shading;
|
||||
dictionary.getValue(keyShading, shading);
|
||||
_performShading = shading;
|
||||
}
|
||||
|
||||
addProperty(_performShading);
|
||||
// Mainly for debugging purposes @AA
|
||||
addProperty(_rotation);
|
||||
}
|
||||
|
||||
RenderableTestPlanet::~RenderableTestPlanet() {
|
||||
}
|
||||
|
||||
bool RenderableTestPlanet::initialize() {
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_programObject == nullptr && _hasNightTexture) {
|
||||
// Night texture program
|
||||
_programObject = renderEngine.buildRenderProgram(
|
||||
"nightTextureProgram",
|
||||
"${SHADERS}/nighttexture_vs.glsl",
|
||||
"${SHADERS}/nighttexture_fs.glsl");
|
||||
if (!_programObject) return false;
|
||||
}
|
||||
else if (_programObject == nullptr) {
|
||||
// pscstandard
|
||||
_programObject = renderEngine.buildRenderProgram(
|
||||
"pscstandard",
|
||||
"${SHADERS}/pscstandard_vs.glsl",
|
||||
"${SHADERS}/pscstandard_fs.glsl");
|
||||
if (!_programObject) return false;
|
||||
|
||||
}
|
||||
using IgnoreError = ghoul::opengl::ProgramObject::IgnoreError;
|
||||
_programObject->setIgnoreSubroutineUniformLocationError(IgnoreError::Yes);
|
||||
|
||||
loadTexture();
|
||||
_geometry->initialize(this);
|
||||
|
||||
return isReady();
|
||||
}
|
||||
|
||||
bool RenderableTestPlanet::deinitialize() {
|
||||
if(_geometry) {
|
||||
_geometry->deinitialize();
|
||||
delete _geometry;
|
||||
}
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_programObject) {
|
||||
renderEngine.removeRenderProgram(_programObject);
|
||||
_programObject = nullptr;
|
||||
}
|
||||
|
||||
_geometry = nullptr;
|
||||
_texture = nullptr;
|
||||
_nightTexture = nullptr;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool RenderableTestPlanet::isReady() const {
|
||||
bool ready = true;
|
||||
ready &= (_programObject != nullptr);
|
||||
ready &= (_texture != nullptr);
|
||||
ready &= (_geometry != nullptr);
|
||||
return ready;
|
||||
}
|
||||
|
||||
void RenderableTestPlanet::render(const RenderData& data)
|
||||
{
|
||||
// activate shader
|
||||
_programObject->activate();
|
||||
|
||||
// scale the planet to appropriate size since the planet is a unit sphere
|
||||
glm::mat4 transform = glm::mat4(1);
|
||||
|
||||
//earth needs to be rotated for that to work.
|
||||
glm::mat4 rot = glm::rotate(transform, static_cast<float>(M_PI_2), glm::vec3(1, 0, 0));
|
||||
glm::mat4 roty = glm::rotate(transform, static_cast<float>(M_PI_2), glm::vec3(0, -1, 0));
|
||||
glm::mat4 rotProp = glm::rotate(transform, glm::radians(static_cast<float>(_rotation)), glm::vec3(0, 1, 0));
|
||||
|
||||
for (int i = 0; i < 3; i++){
|
||||
for (int j = 0; j < 3; j++){
|
||||
transform[i][j] = static_cast<float>(_stateMatrix[i][j]);
|
||||
}
|
||||
}
|
||||
transform = transform * rot * roty * rotProp;
|
||||
|
||||
//glm::mat4 modelview = data.camera.viewMatrix()*data.camera.modelMatrix();
|
||||
//glm::vec3 camSpaceEye = (-(modelview*data.position.vec4())).xyz;
|
||||
|
||||
|
||||
double lt;
|
||||
glm::dvec3 p =
|
||||
SpiceManager::ref().targetPosition("SUN", _target, "GALACTIC", {}, _time, lt);
|
||||
psc sun_pos = PowerScaledCoordinate::CreatePowerScaledCoordinate(p.x, p.y, p.z);
|
||||
|
||||
// setup the data to the shader
|
||||
// _programObject->setUniform("camdir", camSpaceEye);
|
||||
_programObject->setUniform("transparency", _alpha);
|
||||
_programObject->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_programObject->setUniform("ModelTransform", transform);
|
||||
setPscUniforms(_programObject.get(), &data.camera, data.position);
|
||||
|
||||
_programObject->setUniform("_performShading", _performShading);
|
||||
|
||||
// Bind texture
|
||||
ghoul::opengl::TextureUnit dayUnit;
|
||||
dayUnit.activate();
|
||||
_texture->bind();
|
||||
_programObject->setUniform("texture1", dayUnit);
|
||||
|
||||
// Bind possible night texture
|
||||
if (_hasNightTexture) {
|
||||
ghoul::opengl::TextureUnit nightUnit;
|
||||
nightUnit.activate();
|
||||
_nightTexture->bind();
|
||||
_programObject->setUniform("nightTex", nightUnit);
|
||||
}
|
||||
|
||||
glEnable(GL_CULL_FACE);
|
||||
glCullFace(GL_BACK);
|
||||
|
||||
// render
|
||||
_geometry->render();
|
||||
|
||||
// disable shader
|
||||
_programObject->deactivate();
|
||||
}
|
||||
|
||||
void RenderableTestPlanet::update(const UpdateData& data){
|
||||
// set spice-orientation in accordance to timestamp
|
||||
_stateMatrix = SpiceManager::ref().positionTransformMatrix(_frame, "GALACTIC", data.time);
|
||||
_time = data.time;
|
||||
}
|
||||
|
||||
void RenderableTestPlanet::loadTexture() {
|
||||
_texture = nullptr;
|
||||
if (_colorTexturePath.value() != "") {
|
||||
_texture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_colorTexturePath)));
|
||||
if (_texture) {
|
||||
LDEBUG("Loaded texture from '" << _colorTexturePath << "'");
|
||||
_texture->uploadTexture();
|
||||
|
||||
// Textures of planets looks much smoother with AnisotropicMipMap rather than linear
|
||||
// TODO: AnisotropicMipMap crashes on ATI cards ---abock
|
||||
//_texture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
|
||||
_texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
}
|
||||
}
|
||||
if (_hasNightTexture) {
|
||||
_nightTexture = nullptr;
|
||||
if (_nightTexturePath != "") {
|
||||
_nightTexture = std::move(ghoul::io::TextureReader::ref().loadTexture(absPath(_nightTexturePath)));
|
||||
if (_nightTexture) {
|
||||
LDEBUG("Loaded texture from '" << _nightTexturePath << "'");
|
||||
_nightTexture->uploadTexture();
|
||||
_nightTexture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
//_nightTexture->setFilter(ghoul::opengl::Texture::FilterMode::AnisotropicMipMap);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
@@ -0,0 +1,83 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __RENDERABLETESTPLANET_H__
|
||||
#define __RENDERABLETESTPLANET_H__
|
||||
|
||||
// open space includes
|
||||
#include <openspace/rendering/renderable.h>
|
||||
|
||||
#include <openspace/properties/stringproperty.h>
|
||||
#include <openspace/util/updatestructures.h>
|
||||
|
||||
// ghoul includes
|
||||
namespace ghoul {
|
||||
namespace opengl {
|
||||
class ProgramObject;
|
||||
class Texture;
|
||||
}
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace planettestgeometry {
|
||||
class PlanetTestGeometry;
|
||||
}
|
||||
|
||||
class RenderableTestPlanet : public Renderable {
|
||||
public:
|
||||
RenderableTestPlanet(const ghoul::Dictionary& dictionary);
|
||||
~RenderableTestPlanet();
|
||||
|
||||
bool initialize() override;
|
||||
bool deinitialize() override;
|
||||
bool isReady() const override;
|
||||
|
||||
void render(const RenderData& data) override;
|
||||
void update(const UpdateData& data) override;
|
||||
|
||||
protected:
|
||||
void loadTexture();
|
||||
|
||||
private:
|
||||
properties::StringProperty _colorTexturePath;
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _programObject;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _nightTexture;
|
||||
planettestgeometry::PlanetTestGeometry* _geometry;
|
||||
properties::BoolProperty _performShading;
|
||||
properties::IntProperty _rotation;
|
||||
float _alpha;
|
||||
|
||||
glm::dmat3 _stateMatrix;
|
||||
std::string _nightTexturePath;
|
||||
std::string _frame;
|
||||
std::string _target;
|
||||
bool _hasNightTexture;
|
||||
double _time;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __RENDERABLETESTPLANET_H__
|
||||
@@ -0,0 +1,127 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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/planetbrowsing/rendering/simplespheretestgeometry.h>
|
||||
#include <openspace/util/powerscaledsphere.h>
|
||||
#include <openspace/scene/scenegraphnode.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "SimpleSphereTestGeometry";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
|
||||
namespace constants {
|
||||
namespace simplespheretestgeometry {
|
||||
const std::string keyRadius = "Radius";
|
||||
const std::string keySegments = "Segments";
|
||||
} // namespace simplespheretestgeometry
|
||||
}
|
||||
|
||||
namespace planettestgeometry {
|
||||
|
||||
SimpleSphereTestGeometry::SimpleSphereTestGeometry(const ghoul::Dictionary& dictionary)
|
||||
: PlanetTestGeometry()
|
||||
, _realRadius("radius", "Radius", glm::vec4(1.f, 1.f, 1.f, 0.f), glm::vec4(-10.f, -10.f, -10.f, -20.f),
|
||||
glm::vec4(10.f, 10.f, 10.f, 20.f))
|
||||
, _segments("segments", "Segments", 20, 1, 50)
|
||||
, _sphere(nullptr)
|
||||
{
|
||||
using constants::simplespheretestgeometry::keyRadius;
|
||||
using constants::simplespheretestgeometry::keySegments;
|
||||
|
||||
// The name is passed down from the SceneGraphNode
|
||||
bool success = dictionary.getValue(SceneGraphNode::KeyName, _name);
|
||||
assert(success);
|
||||
|
||||
glm::vec4 radius;
|
||||
success = dictionary.getValue(keyRadius, _modRadius);
|
||||
if (!success) {
|
||||
LERROR("SimpleSphereTestGeometry of '" << _name << "' did not provide a key '"
|
||||
<< keyRadius << "'");
|
||||
}
|
||||
else {
|
||||
radius[0] = _modRadius[0];
|
||||
radius[1] = _modRadius[0];
|
||||
radius[2] = _modRadius[0];
|
||||
radius[3] = _modRadius[1];
|
||||
_realRadius = radius; // In case the kernels does not supply a real
|
||||
}
|
||||
|
||||
double segments;
|
||||
success = dictionary.getValue(keySegments, segments);
|
||||
if (!success) {
|
||||
LERROR("SimpleSphereTestGeometry of '" << _name << "' did not provide a key '"
|
||||
<< keySegments << "'");
|
||||
}
|
||||
else
|
||||
_segments = static_cast<int>(segments);
|
||||
|
||||
// The shader need the radii values but they are not changeable runtime
|
||||
// TODO: Possibly add a scaling property @AA
|
||||
addProperty(_realRadius);
|
||||
// Changing the radius/scaling should affect the shader but not the geometry? @AA
|
||||
//_radius.onChange(std::bind(&SimpleSphereTestGeometry::createSphere, this));
|
||||
addProperty(_segments);
|
||||
_segments.onChange(std::bind(&SimpleSphereTestGeometry::createSphere, this));
|
||||
}
|
||||
|
||||
SimpleSphereTestGeometry::~SimpleSphereTestGeometry()
|
||||
{
|
||||
}
|
||||
|
||||
bool SimpleSphereTestGeometry::initialize(RenderableTestPlanet* parent)
|
||||
{
|
||||
bool success = PlanetTestGeometry::initialize(parent);
|
||||
createSphere();
|
||||
return success;
|
||||
}
|
||||
|
||||
void SimpleSphereTestGeometry::deinitialize()
|
||||
{
|
||||
if (_sphere)
|
||||
delete _sphere;
|
||||
_sphere = nullptr;
|
||||
}
|
||||
|
||||
void SimpleSphereTestGeometry::render()
|
||||
{
|
||||
_sphere->render();
|
||||
}
|
||||
|
||||
void SimpleSphereTestGeometry::createSphere() {
|
||||
//create the power scaled scalar
|
||||
|
||||
PowerScaledScalar planetSize(_modRadius);
|
||||
_parent->setBoundingSphere(planetSize);
|
||||
|
||||
if (_sphere)
|
||||
delete _sphere;
|
||||
//_sphere = new PowerScaledSphere(planetSize, _segments);
|
||||
_sphere = new PowerScaledSphere(_realRadius, _segments, _name);
|
||||
_sphere->initialize();
|
||||
}
|
||||
|
||||
} // namespace planetgeometry
|
||||
} // namespace openspace
|
||||
@@ -0,0 +1,64 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __SIMPLESPHERETESTGEOMETRY_H__
|
||||
#define __SIMPLESPHERETESTGEOMETRY_H__
|
||||
|
||||
#include <modules/planetbrowsing/rendering/planettestgeometry.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <openspace/properties/scalarproperty.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class RenderablePlanet;
|
||||
class PowerScaledSphere;
|
||||
|
||||
namespace planettestgeometry {
|
||||
|
||||
class SimpleSphereTestGeometry : public PlanetTestGeometry {
|
||||
public:
|
||||
SimpleSphereTestGeometry(const ghoul::Dictionary& dictionary);
|
||||
~SimpleSphereTestGeometry();
|
||||
|
||||
|
||||
bool initialize(RenderableTestPlanet* parent) override;
|
||||
void deinitialize() override;
|
||||
void render() override;
|
||||
PowerScaledSphere* _planet;
|
||||
|
||||
private:
|
||||
void createSphere();
|
||||
|
||||
glm::vec2 _modRadius;
|
||||
properties::Vec4Property _realRadius;
|
||||
properties::IntProperty _segments;
|
||||
std::string _name;
|
||||
|
||||
PowerScaledSphere* _sphere;
|
||||
};
|
||||
|
||||
} // namespace planetgeometry
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __SIMPLESPHERETESTGEOMETRY_H__
|
||||
@@ -0,0 +1,41 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
|
||||
in vec4 vs_position;
|
||||
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
#include "fragment.glsl"
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
|
||||
Fragment frag;
|
||||
|
||||
frag.color = vec4(1,1,1,1);
|
||||
frag.depth = 0;
|
||||
|
||||
return frag;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
|
||||
out vec4 vs_position;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main()
|
||||
{
|
||||
// set variables
|
||||
vs_position = in_position;
|
||||
|
||||
gl_Position = in_position;
|
||||
}
|
||||
Reference in New Issue
Block a user