Included commented out version of new camera class

adapted RenderableVolume to use ModulePath
This commit is contained in:
Alexander Bock
2014-05-05 00:04:00 +02:00
parent 56f22d79c3
commit 283a55f4de
4 changed files with 150 additions and 4 deletions

View File

@@ -36,6 +36,52 @@
namespace openspace {
//class Camera {
//public:
// Camera();
//
// void setPosition(psc pos);
// const psc& position() const;
//
// void setFocus(psc focus);
// const psc& focus() const;
//
// void setUpVector(psc upVector);
// const psc& upVector() const;
//
// void setScaling(float scaling);
// float scaling() const;
//
// const glm::mat4& viewMatrix() const;
//
// void setProjectionMatrix(glm::mat4 projectionMatrix);
// const glm::mat4& projectionMatrix() const;
//
// void setMaxFox(float fov);
// float maxFov() const;
//
//
// // derived values
// psc lookVector() const;
//
//private:
// void invalidateViewMatrix();
// void updateViewMatrix() const; // has to be constant to be called from getter methods
//
// psc _position;
// psc _focus;
// psc _upVector;
//
// glm::mat4 _projectionMatrix;
// mutable glm::mat4 _viewMatrix;
// float _scaling;
//
// float _maxFov;
//
// mutable bool _viewMatrixIsDirty;
//};
class Camera {
public:
Camera();

View File

@@ -139,7 +139,7 @@ void RenderablePlanet::render(const Camera *camera, const psc &thisPosition) {
// scale the planet to appropriate size since the planet is a unit sphere
glm::mat4 transform = glm::mat4(1);
// transform = glm::rotate(transform, 4.1f*static_cast<float>(sgct::Engine::instance()->getTime()), glm::vec3(0.0f, 1.0f, 0.0f));
transform = glm::rotate(transform, 4.1f*static_cast<float>(sgct::Engine::instance()->getTime()), glm::vec3(0.0f, 1.0f, 0.0f));
// setup the data to the shader
_programObject->setUniform("ViewProjection", camera->viewProjectionMatrix());

View File

@@ -30,6 +30,7 @@
#include <openspace/engine/openspaceengine.h>
#include <openspace/util/kameleonwrapper.h>
#include <openspace/util/constants.h>
#include <sgct.h>
@@ -41,7 +42,7 @@
#include <type_traits>
namespace {
std::string _loggerCat = "RenderableVolume";
const std::string _loggerCat = "RenderableVolume";
bool hasExtension (std::string const &filepath, std::string const &extension)
{
@@ -77,8 +78,8 @@ RenderableVolume::RenderableVolume(const ghoul::Dictionary& dictionary)
{
// get path if available
_relativePath = "";
if(dictionary.hasKey("Path")) {
dictionary.getValue("Path", _relativePath);
if(dictionary.hasKey(constants::scenegraph::keyPathModule)) {
dictionary.getValue(constants::scenegraph::keyPathModule, _relativePath);
_relativePath += "/";
}
}

View File

@@ -28,10 +28,12 @@
// sgct includes
#include "sgct.h"
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtx/vector_angle.hpp>
namespace openspace {
Camera::Camera()
: _scaling(1.f, 0.f)
, _viewRotation(glm::quat(glm::vec3(0.f, 0.f, 0.f)))
@@ -145,4 +147,101 @@ const glm::vec3 Camera::lookUpVector() const
return _lookUp;
}
//
//Camera::Camera()
// : _position(0.f, 0.f, 1.f, 0.f)
// , _focus(0.f, 0.f, 0.f, 0.f)
// , _upVector(0.f, 1.f, 0.f, 0.f)
// , _projectionMatrix(glm::mat4(1.f))
// , _viewMatrix(glm::mat4(1.f))
// , _scaling(0.f)
// , _maxFov(0.f)
// , _viewMatrixIsDirty(false)
//{
//
//}
//
//void Camera::setPosition(psc pos)
//{
// _position = std::move(pos);
//}
//
//const psc& Camera::position() const
//{
// return _position;
//}
//
//void Camera::setFocus(psc focus)
//{
// _focus = std::move(focus);
//}
//
//const psc& Camera::focus() const
//{
// return _focus;
//}
//
//void Camera::setUpVector(psc upVector)
//{
// _upVector = std::move(upVector);
//}
//
//const psc& Camera::upVector() const
//{
// return _upVector;
//}
//
//void Camera::setScaling(float scaling)
//{
// _scaling = scaling;
//}
//
//float Camera::scaling() const
//{
// return _scaling;
//}
//
//const glm::mat4& Camera::viewMatrix() const
//{
//
// return _viewMatrix;
//}
//
//void Camera::setProjectionMatrix(glm::mat4 projectionMatrix)
//{
// _projectionMatrix = std::move(projectionMatrix);
//}
//
//const glm::mat4& Camera::projectionMatrix() const
//{
// return _projectionMatrix;
//}
//
//void Camera::setMaxFox(float fov)
//{
// _maxFov = fov;
//}
//
//float Camera::maxFov() const
//{
// return _maxFov;
//}
//
//psc Camera::lookVector() const
//{
// return _focus - _position;
//}
//
//void Camera::invalidateViewMatrix() {
// _viewMatrixIsDirty = true;
//}
//
//void Camera::updateViewMatrix() const {
// if (_viewMatrixIsDirty) {
// _viewMatrix = glm::lookAt(_position.getVec3f(), _focus.getVec3f(), _upVector.getVec3f());
// _viewMatrixIsDirty = false;
// }
//}
} // namespace openspace