mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-05-01 16:29:43 -05:00
Merge branch 'feature/screenspaceimage' of github.com:OpenSpace/OpenSpace-Development into feature/screenspaceimage
This commit is contained in:
@@ -6,6 +6,12 @@ ext/SGCT
|
||||
.DS_Store
|
||||
*.swp
|
||||
|
||||
# Windows system files:
|
||||
Thumbs.db
|
||||
|
||||
# Emacs backup files:
|
||||
*~
|
||||
|
||||
# generated glsl files
|
||||
*.gglsl
|
||||
*.GhoulGenerated.glsl
|
||||
|
||||
@@ -8,8 +8,8 @@ return {
|
||||
Type = "RenderableModelProjection",
|
||||
Body = "CHURYUMOV-GERASIMENKO",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/67P/obj/67P_rotated_5_130.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/67P/obj/67P_rotated_5_130.obj",
|
||||
Magnification = 0,
|
||||
},
|
||||
Textures = {
|
||||
|
||||
@@ -8,8 +8,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "DAWN",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/dawn/obj/mainbodydawn.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/dawn/obj/mainbodydawn.obj",
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
@@ -633,8 +633,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "DAWN",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/dawn/obj/solarpanelleft.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/dawn/obj/solarpanelleft.obj",
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
@@ -656,8 +656,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "DAWN",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/dawn/obj/solarpanelright.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/dawn/obj/solarpanelright.obj",
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
|
||||
@@ -9,8 +9,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "NEW HORIZONS",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/newhorizons/models/NewHorizonsCleanModel.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/newhorizons/models/NewHorizonsCleanModel.obj",
|
||||
Magnification = 4,
|
||||
},
|
||||
Textures = {
|
||||
@@ -103,8 +103,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "NEW HORIZONS",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/newhorizons/models/Labels.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/newhorizons/models/Labels.obj",
|
||||
Magnification = 4,
|
||||
},
|
||||
Textures = {
|
||||
@@ -175,4 +175,4 @@ return {
|
||||
},
|
||||
GuiName = "/Solar/NewHorizonsPathJupiter"
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "ROSETTA",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/rosetta/obj/Rosettafromstl.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/rosetta/obj/mainbodyros.obj",
|
||||
Magnification = 1,
|
||||
},
|
||||
Textures = {
|
||||
@@ -114,9 +114,9 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "ROSETTA",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
Type = "MultiModelGeometry",
|
||||
Magnification = 1,
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/rosetta/obj/solarpanelleft.obj",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/rosetta/obj/solarpanelleft.obj",
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
@@ -138,8 +138,8 @@ return {
|
||||
Type = "RenderableModel",
|
||||
Body = "ROSETTA",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/rosetta/obj/solarpanelright.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/rosetta/obj/solarpanelright.obj",
|
||||
Magnification = 1,
|
||||
},
|
||||
Textures = {
|
||||
@@ -215,4 +215,4 @@ return {
|
||||
},
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,8 @@ return {
|
||||
Frame = "IAU_VESTA",
|
||||
Body = "VESTA",
|
||||
Geometry = {
|
||||
Type = "WavefrontGeometry",
|
||||
ObjFile = "${OPENSPACE_DATA}/scene/vestaprojection_2/obj/VestaComet_5000.obj",
|
||||
Type = "MultiModelGeometry",
|
||||
GeometryFile = "${OPENSPACE_DATA}/scene/vestaprojection_2/obj/VestaComet_5000.obj",
|
||||
},
|
||||
Textures = {
|
||||
Type = "simple",
|
||||
|
||||
+1
-1
Submodule ext/ghoul updated: a9b5025618...ae36394e9c
@@ -312,7 +312,7 @@ bool NumericalProperty<T>::setStringValue(std::string value) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<NumericalProperty<T>>::template fromString<T>(value, success);
|
||||
if (success)
|
||||
TemplateProperty<T>::set(boost::any(thisValue));
|
||||
TemplateProperty<T>::set(ghoul::any(thisValue));
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include <openspace/properties/propertydelegate.h>
|
||||
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <boost/any.hpp>
|
||||
#include <functional>
|
||||
#include <string>
|
||||
|
||||
@@ -92,11 +91,11 @@ public:
|
||||
/**
|
||||
* This method returns the encapsulated value of the Property to the caller. The type
|
||||
* that is returned is determined by the type function and is up to the developer of
|
||||
* the derived class. The default implementation returns an empty boost::any object.
|
||||
* \return The value that is encapsulated by this Property, or an empty boost::any
|
||||
* the derived class. The default implementation returns an empty ghoul::any object.
|
||||
* \return The value that is encapsulated by this Property, or an empty ghoul::any
|
||||
* object if the method was not overritten.
|
||||
*/
|
||||
virtual boost::any get() const;
|
||||
virtual ghoul::any get() const;
|
||||
|
||||
/**
|
||||
* Sets the value encapsulated by this Property to the <code>value</code> passed to
|
||||
@@ -106,7 +105,7 @@ public:
|
||||
* implementation of this method ignores the input.
|
||||
* \param value The new value that should be stored in this Property
|
||||
*/
|
||||
virtual void set(boost::any value);
|
||||
virtual void set(ghoul::any value);
|
||||
|
||||
/**
|
||||
* This method returns the type that is requested by this Property for the set method.
|
||||
|
||||
@@ -83,22 +83,22 @@ public:
|
||||
virtual std::string className() const override;
|
||||
|
||||
/**
|
||||
* Returns the stored value packed into a <code>boost::any</code> object.
|
||||
* \return The stored value packed into a <code>boost::any</code> object
|
||||
* Returns the stored value packed into a ghoul::any object.
|
||||
* \return The stored value packed into a ghoul::any object
|
||||
*/
|
||||
virtual boost::any get() const override;
|
||||
virtual ghoul::any get() const override;
|
||||
|
||||
/**
|
||||
* Sets the value fro the provided <code>boost::any</code> object. If the types
|
||||
* between <code>T</code> and <code>value</code> disagree, an error is logged and the
|
||||
* stored value remains unchanged.
|
||||
* Sets the value fro the provided ghoul::any object. If the types between
|
||||
* <code>T</code> and <code>value</code> disagree, an error is logged and the stored
|
||||
* value remains unchanged.
|
||||
*/
|
||||
virtual void set(boost::any value) override;
|
||||
virtual void set(ghoul::any value) override;
|
||||
|
||||
/**
|
||||
* Returns the <code>std::type_info</code> describing the template parameter
|
||||
* <code>T</code>. It can be used to test against a <code>boost::any</code> value
|
||||
* before trying to assign it.
|
||||
* <code>T</code>. It can be used to test against a ghoul::any value before trying to
|
||||
* assign it.
|
||||
* \return The type info object describing the template parameter <code>T</code>
|
||||
*/
|
||||
virtual const std::type_info& type() const override;
|
||||
|
||||
@@ -212,20 +212,20 @@ std::ostream& operator<<(std::ostream& os, const TemplateProperty<T>& obj) {
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
boost::any TemplateProperty<T>::get() const {
|
||||
return boost::any(_value);
|
||||
ghoul::any TemplateProperty<T>::get() const {
|
||||
return ghoul::any(_value);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void TemplateProperty<T>::set(boost::any value) {
|
||||
void TemplateProperty<T>::set(ghoul::any value) {
|
||||
try {
|
||||
T v = boost::any_cast<T>(std::move(value));
|
||||
T v = ghoul::any_cast<T>(std::move(value));
|
||||
if (v != _value) {
|
||||
_value = std::move(v);
|
||||
notifyListener();
|
||||
}
|
||||
}
|
||||
catch (boost::bad_any_cast&) {
|
||||
catch (ghoul::bad_any_cast&) {
|
||||
LERRORC("TemplateProperty", "Illegal cast from '" << value.type().name()
|
||||
<< "' to '" << typeid(T).name() << "'");
|
||||
}
|
||||
@@ -247,7 +247,7 @@ bool TemplateProperty<T>::setLuaValue(lua_State* state) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromLuaValue<T>(state, success);
|
||||
if (success)
|
||||
set(boost::any(thisValue));
|
||||
set(ghoul::any(thisValue));
|
||||
return success;
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ bool TemplateProperty<T>::setStringValue(std::string value) {
|
||||
bool success = false;
|
||||
T thisValue = PropertyDelegate<TemplateProperty<T>>::template fromString<T>(value, success);
|
||||
if (success)
|
||||
set(boost::any(thisValue));
|
||||
set(ghoul::any(thisValue));
|
||||
return success;
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
* listeners regardless of the value
|
||||
* \param value The ignored value
|
||||
*/
|
||||
void set(boost::any value);
|
||||
void set(ghoul::any value);
|
||||
};
|
||||
|
||||
} // namespace properties
|
||||
|
||||
@@ -26,6 +26,7 @@ include(${OPENSPACE_CMAKE_EXT_DIR}/module_definition.cmake)
|
||||
|
||||
set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableconstellationbounds.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.h
|
||||
@@ -37,7 +38,6 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablestars.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/wavefrontgeometry.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimage.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/dynamicephemeris.h
|
||||
@@ -48,6 +48,7 @@ source_group("Header Files" FILES ${HEADER_FILES})
|
||||
|
||||
set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/modelgeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/multimodelgeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/planetgeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderableconstellationbounds.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablemodel.cpp
|
||||
@@ -59,7 +60,6 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderablestars.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/renderabletrail.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/simplespheregeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/wavefrontgeometry.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceframebuffer.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspaceimage.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/ephemeris/dynamicephemeris.cpp
|
||||
@@ -96,4 +96,4 @@ create_new_module(
|
||||
"Base"
|
||||
base_module
|
||||
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
|
||||
)
|
||||
)
|
||||
@@ -41,7 +41,7 @@
|
||||
#include <modules/base/rendering/renderableplane.h>
|
||||
#include <modules/base/rendering/simplespheregeometry.h>
|
||||
#include <modules/base/rendering/modelgeometry.h>
|
||||
#include <modules/base/rendering/wavefrontgeometry.h>
|
||||
#include <modules/base/rendering/multimodelgeometry.h>
|
||||
|
||||
#include <modules/base/ephemeris/staticephemeris.h>
|
||||
#include <modules/base/ephemeris/dynamicephemeris.h>
|
||||
@@ -84,7 +84,7 @@ void BaseModule::internalInitialize() {
|
||||
|
||||
auto fModelGeometry = FactoryManager::ref().factory<modelgeometry::ModelGeometry>();
|
||||
ghoul_assert(fModelGeometry, "Model geometry factory was not created");
|
||||
fModelGeometry->registerClass<modelgeometry::WavefrontGeometry>("WavefrontGeometry");
|
||||
fModelGeometry->registerClass<modelgeometry::MultiModelGeometry>("MultiModelGeometry");
|
||||
}
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -28,11 +28,10 @@
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
|
||||
#include <fstream>
|
||||
#include <modules/base/rendering/wavefrontgeometry.h>
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "ModelGeometry";
|
||||
const std::string keyObjFile = "ObjFile";
|
||||
const std::string keyGeomModelFile = "GeometryFile";
|
||||
const int8_t CurrentCacheVersion = 3;
|
||||
const std::string keyType = "Type";
|
||||
const std::string keyName = "Name";
|
||||
@@ -77,15 +76,15 @@ ModelGeometry::ModelGeometry(const ghoul::Dictionary& dictionary)
|
||||
if (dictionary.hasKeyAndValue<double>(keySize))
|
||||
_magnification = static_cast<float>(dictionary.value<double>(keySize));
|
||||
|
||||
success = dictionary.getValue(keyObjFile, _file);
|
||||
success = dictionary.getValue(keyGeomModelFile, _file);
|
||||
if (!success) {
|
||||
LERROR("WaveFrontGeometry of '" << name << "' did not provide a key '"
|
||||
<< keyObjFile << "'");
|
||||
LERROR("Geometric Model file of '" << name << "' did not provide a key '"
|
||||
<< keyGeomModelFile << "'");
|
||||
}
|
||||
_file = FileSys.absolutePath(_file);
|
||||
|
||||
if (!FileSys.fileExists(_file, ghoul::filesystem::FileSystem::RawPath::Yes))
|
||||
LERROR("Could not load OBJ file '" << _file << "': File not found");
|
||||
LERROR("Could not load the geometric model file '" << _file << "': File not found");
|
||||
|
||||
|
||||
addProperty(_magnification);
|
||||
@@ -145,93 +144,95 @@ void ModelGeometry::deinitialize() {
|
||||
}
|
||||
|
||||
bool ModelGeometry::loadObj(const std::string& filename) {
|
||||
std::string cachedFile = FileSys.cacheManager()->cachedFilename(
|
||||
filename,
|
||||
ghoul::filesystem::CacheManager::Persistent::Yes
|
||||
std::string cachedFile = FileSys.cacheManager()->cachedFilename(
|
||||
filename,
|
||||
ghoul::filesystem::CacheManager::Persistent::Yes
|
||||
);
|
||||
|
||||
bool hasCachedFile = FileSys.fileExists(cachedFile);
|
||||
if (hasCachedFile) {
|
||||
LINFO("Cached file '" << cachedFile << "' used for Model file '" << filename << "'");
|
||||
bool hasCachedFile = FileSys.fileExists(cachedFile);
|
||||
if (hasCachedFile) {
|
||||
LINFO("Cached file '" << cachedFile << "' used for Model file '" << filename << "'");
|
||||
|
||||
bool success = loadCachedFile(cachedFile);
|
||||
if (success)
|
||||
return true;
|
||||
else
|
||||
FileSys.cacheManager()->removeCacheFile(filename);
|
||||
// Intentional fall-through to the 'else' computation to generate the cache
|
||||
// file for the next run
|
||||
}
|
||||
else {
|
||||
LINFO("Cache for Model '" << filename << "' not found");
|
||||
}
|
||||
LINFO("Loading Model file '" << filename << "'");
|
||||
bool success = loadModel(filename);
|
||||
if (!success)
|
||||
//return false;
|
||||
bool success = loadCachedFile(cachedFile);
|
||||
if (success)
|
||||
return true;
|
||||
else
|
||||
FileSys.cacheManager()->removeCacheFile(filename);
|
||||
// Intentional fall-through to the 'else' computation to generate the cache
|
||||
// file for the next run
|
||||
}
|
||||
else {
|
||||
LINFO("Cached file '" << cachedFile << "' used for Model file '" << filename << "' not found");
|
||||
}
|
||||
|
||||
LINFO("Saving cache");
|
||||
success = saveCachedFile(cachedFile);
|
||||
LINFO("Loading Model file '" << filename << "'");
|
||||
bool success = loadModel(filename);
|
||||
|
||||
return success;
|
||||
if (!success)
|
||||
return false;
|
||||
|
||||
LINFO("Saving cache");
|
||||
success = saveCachedFile(cachedFile);
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
bool ModelGeometry::saveCachedFile(const std::string& filename) {
|
||||
std::ofstream fileStream(filename, std::ofstream::binary);
|
||||
if (fileStream.good()) {
|
||||
fileStream.write(reinterpret_cast<const char*>(&CurrentCacheVersion),
|
||||
sizeof(int8_t));
|
||||
std::ofstream fileStream(filename, std::ofstream::binary);
|
||||
if (fileStream.good()) {
|
||||
fileStream.write(reinterpret_cast<const char*>(&CurrentCacheVersion),
|
||||
sizeof(int8_t));
|
||||
|
||||
int64_t vSize = _vertices.size();
|
||||
fileStream.write(reinterpret_cast<const char*>(&vSize), sizeof(int64_t));
|
||||
int64_t iSize = _indices.size();
|
||||
fileStream.write(reinterpret_cast<const char*>(&iSize), sizeof(int64_t));
|
||||
int64_t vSize = _vertices.size();
|
||||
fileStream.write(reinterpret_cast<const char*>(&vSize), sizeof(int64_t));
|
||||
int64_t iSize = _indices.size();
|
||||
fileStream.write(reinterpret_cast<const char*>(&iSize), sizeof(int64_t));
|
||||
|
||||
fileStream.write(reinterpret_cast<const char*>(_vertices.data()), sizeof(Vertex) * vSize);
|
||||
fileStream.write(reinterpret_cast<const char*>(_indices.data()), sizeof(int) * iSize);
|
||||
fileStream.write(reinterpret_cast<const char*>(_vertices.data()), sizeof(Vertex) * vSize);
|
||||
fileStream.write(reinterpret_cast<const char*>(_indices.data()), sizeof(int) * iSize);
|
||||
|
||||
return fileStream.good();
|
||||
}
|
||||
else {
|
||||
LERROR("Error opening file '" << filename << "' for save cache file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return fileStream.good();
|
||||
}
|
||||
else {
|
||||
LERROR("Error opening file '" << filename << "' for save cache file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ModelGeometry::loadCachedFile(const std::string& filename) {
|
||||
std::ifstream fileStream(filename, std::ifstream::binary);
|
||||
if (fileStream.good()) {
|
||||
int8_t version = 0;
|
||||
fileStream.read(reinterpret_cast<char*>(&version), sizeof(int8_t));
|
||||
if (version != CurrentCacheVersion) {
|
||||
LINFO("The format of the cached file has changed, deleting old cache");
|
||||
fileStream.close();
|
||||
FileSys.deleteFile(filename);
|
||||
return false;
|
||||
}
|
||||
std::ifstream fileStream(filename, std::ifstream::binary);
|
||||
if (fileStream.good()) {
|
||||
int8_t version = 0;
|
||||
fileStream.read(reinterpret_cast<char*>(&version), sizeof(int8_t));
|
||||
if (version != CurrentCacheVersion) {
|
||||
LINFO("The format of the cached file has changed, deleting old cache");
|
||||
fileStream.close();
|
||||
FileSys.deleteFile(filename);
|
||||
return false;
|
||||
}
|
||||
|
||||
int64_t vSize, iSize;
|
||||
fileStream.read(reinterpret_cast<char*>(&vSize), sizeof(int64_t));
|
||||
fileStream.read(reinterpret_cast<char*>(&iSize), sizeof(int64_t));
|
||||
int64_t vSize, iSize;
|
||||
fileStream.read(reinterpret_cast<char*>(&vSize), sizeof(int64_t));
|
||||
fileStream.read(reinterpret_cast<char*>(&iSize), sizeof(int64_t));
|
||||
|
||||
if (vSize == 0 || iSize == 0) {
|
||||
LERROR("Error opening file '" << filename << "' for loading cache file");
|
||||
return false;
|
||||
}
|
||||
if (vSize == 0 || iSize == 0) {
|
||||
LERROR("Error opening file '" << filename << "' for loading cache file");
|
||||
return false;
|
||||
}
|
||||
|
||||
_vertices.resize(vSize);
|
||||
_indices.resize(iSize);
|
||||
_vertices.resize(vSize);
|
||||
_indices.resize(iSize);
|
||||
|
||||
fileStream.read(reinterpret_cast<char*>(_vertices.data()), sizeof(Vertex) * vSize);
|
||||
fileStream.read(reinterpret_cast<char*>(_indices.data()), sizeof(int) * iSize);
|
||||
fileStream.read(reinterpret_cast<char*>(_vertices.data()), sizeof(Vertex) * vSize);
|
||||
fileStream.read(reinterpret_cast<char*>(_indices.data()), sizeof(int) * iSize);
|
||||
|
||||
return fileStream.good();
|
||||
}
|
||||
else {
|
||||
LERROR("Error opening file '" << filename << "' for loading cache file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return fileStream.good();
|
||||
}
|
||||
else {
|
||||
LERROR("Error opening file '" << filename << "' for loading cache file");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool ModelGeometry::getVertices(std::vector<Vertex>* vertexList) {
|
||||
vertexList->clear();
|
||||
|
||||
@@ -0,0 +1,90 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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/base/rendering/multimodelgeometry.h>
|
||||
|
||||
#include "ghoul/logging/logmanager.h"
|
||||
#include "ghoul/io/model/modelreadermultiformat.h"
|
||||
#include "ghoul/opengl/vertexbufferobject.h"
|
||||
|
||||
namespace {
|
||||
const std::string _loggerCat = "MultiModelGeometry";
|
||||
}
|
||||
|
||||
namespace openspace {
|
||||
namespace modelgeometry {
|
||||
|
||||
MultiModelGeometry::MultiModelGeometry(const ghoul::Dictionary& dictionary)
|
||||
: ModelGeometry(dictionary)
|
||||
{
|
||||
loadObj(_file);
|
||||
}
|
||||
|
||||
bool MultiModelGeometry::initialize(Renderable* parent)
|
||||
{
|
||||
bool success = ModelGeometry::initialize(parent);
|
||||
return success;
|
||||
}
|
||||
|
||||
void MultiModelGeometry::deinitialize()
|
||||
{
|
||||
ModelGeometry::deinitialize();
|
||||
}
|
||||
|
||||
bool MultiModelGeometry::loadModel(const std::string& filename)
|
||||
{
|
||||
try {
|
||||
ghoul::io::ModelReaderMultiFormat modelReader;
|
||||
|
||||
std::vector<ghoul::io::ModelReaderBase::Vertex> vertices;
|
||||
std::vector<int> indices;
|
||||
|
||||
modelReader.loadModel(filename, vertices, indices);
|
||||
|
||||
_vertices.reserve(vertices.size());
|
||||
for (const auto & v : vertices)
|
||||
{
|
||||
Vertex vv;
|
||||
memcpy(vv.location, v.location, sizeof(GLfloat) * 3);
|
||||
memcpy(vv.tex, v.tex, sizeof(GLfloat) * 2);
|
||||
memcpy(vv.normal, v.normal, sizeof(GLfloat) * 3);
|
||||
_vertices.push_back(vv);
|
||||
}
|
||||
|
||||
_indices.resize(indices.size());
|
||||
std::copy(indices.begin(), indices.end(), _indices.begin());
|
||||
}
|
||||
catch (ghoul::io::ModelReaderBase::ModelReaderException & e)
|
||||
{
|
||||
// Log error reading geometry file.
|
||||
LERROR(e.message);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
} // namespace modelgeometry
|
||||
} // namespace openspace
|
||||
@@ -0,0 +1,51 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 __MULTIMODELGEOMETRY_H__
|
||||
#define __MULTIMODELGEOMETRY_H__
|
||||
|
||||
#include <modules/base/rendering/modelgeometry.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class RenderableModel;
|
||||
class RenderableModelProjection;
|
||||
|
||||
namespace modelgeometry {
|
||||
|
||||
class MultiModelGeometry : public ModelGeometry {
|
||||
public:
|
||||
MultiModelGeometry(const ghoul::Dictionary& dictionary);
|
||||
|
||||
bool initialize(Renderable* parent) override;
|
||||
void deinitialize() override;
|
||||
|
||||
private:
|
||||
bool loadModel(const std::string& filename);
|
||||
};
|
||||
|
||||
} // namespace modelgeometry
|
||||
} // namespace openspace
|
||||
|
||||
#endif // __MULTIMODELOBJECT_H__
|
||||
@@ -0,0 +1 @@
|
||||
set(DEFAULT_MODULE ON)
|
||||
@@ -369,16 +369,16 @@ void RenderablePlanetProjection::imageProjectGPU(){
|
||||
_fboProgramObject->setUniform("boresight" , _boresight);
|
||||
|
||||
if (_geometry->hasProperty("radius")){
|
||||
boost::any r = _geometry->property("radius")->get();
|
||||
if (glm::vec4* radius = boost::any_cast<glm::vec4>(&r)){
|
||||
ghoul::any r = _geometry->property("radius")->get();
|
||||
if (glm::vec4* radius = ghoul::any_cast<glm::vec4>(&r)){
|
||||
_fboProgramObject->setUniform("radius", radius);
|
||||
}
|
||||
}else{
|
||||
LERROR("Geometry object needs to provide radius");
|
||||
}
|
||||
if (_geometry->hasProperty("segments")){
|
||||
boost::any s = _geometry->property("segments")->get();
|
||||
if (int* segments = boost::any_cast<int>(&s)){
|
||||
ghoul::any s = _geometry->property("segments")->get();
|
||||
if (int* segments = ghoul::any_cast<int>(&s)){
|
||||
_fboProgramObject->setAttribute("segments", segments[0]);
|
||||
}
|
||||
}else{
|
||||
|
||||
+6
-3
@@ -7,7 +7,11 @@ return {
|
||||
|
||||
-- Sets the scene that is to be loaded by OpenSpace. A scene file is a description
|
||||
-- of all entities that will be visible during an instance of OpenSpace
|
||||
Scene = "${SCENE}/default.scene",
|
||||
Scene = "${SCENE}/default_nh.scene",
|
||||
-- Scene = "${SCENE}/default.scene",
|
||||
-- Scene = "${SCENE}/default-modified.scene",
|
||||
-- Scene = "${SCENE}/rosetta.scene",
|
||||
-- Scene = "${SCENE}/dawn.scene",
|
||||
|
||||
Paths = {
|
||||
SGCT = "${BASE_PATH}/config/sgct",
|
||||
@@ -54,7 +58,6 @@ return {
|
||||
File = "${BASE_PATH}/Properties.txt"
|
||||
},
|
||||
DownloadRequestURL = "http://openspace.itn.liu.se/request.cgi",
|
||||
--RenderingMethod = "Framebuffer"
|
||||
RenderingMethod = "ABuffer" -- alternative: "Framebuffer"
|
||||
--RenderingMethod = "ABuffer" -- alternative: "Framebuffer"
|
||||
|
||||
}
|
||||
@@ -27,9 +27,7 @@
|
||||
#define _ERRNO WSAGetLastError()
|
||||
#endif
|
||||
#else //Use BSD sockets
|
||||
#ifdef _XCODE
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
@@ -82,15 +82,15 @@ std::string Property::fullyQualifiedIdentifier() const {
|
||||
return identifier;
|
||||
}
|
||||
|
||||
boost::any Property::get() const {
|
||||
return boost::any();
|
||||
ghoul::any Property::get() const {
|
||||
return ghoul::any();
|
||||
}
|
||||
|
||||
bool Property::getLuaValue(lua_State* state) const {
|
||||
return false;
|
||||
}
|
||||
|
||||
void Property::set(boost::any value) {}
|
||||
void Property::set(ghoul::any value) {}
|
||||
|
||||
bool Property::setLuaValue(lua_State* state) {
|
||||
return false;
|
||||
|
||||
@@ -40,7 +40,7 @@ bool TriggerProperty::setLuaValue(lua_State* state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void TriggerProperty::set(boost::any value) {
|
||||
void TriggerProperty::set(ghoul::any value) {
|
||||
notifyListener();
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -34,8 +34,6 @@
|
||||
#include <openspace/scripting/script_helper.h>
|
||||
#include <openspace/util/time.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <ghoul/filesystem/filesystem.h>
|
||||
#include <ghoul/io/texture/texturereader.h>
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
@@ -47,6 +45,7 @@
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <chrono>
|
||||
|
||||
@@ -38,8 +38,6 @@
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/util/factorymanager.h>
|
||||
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
#include <cctype>
|
||||
#include <chrono>
|
||||
|
||||
|
||||
@@ -165,8 +165,8 @@ PowerScaledSphere::PowerScaledSphere(properties::Vec4Property &radius, int segme
|
||||
powerscale = powerScaledRadii[3];
|
||||
}
|
||||
else {
|
||||
boost::any r = radius.get();
|
||||
glm::vec4 modRadius = boost::any_cast<glm::vec4>(r);
|
||||
ghoul::any r = radius.get();
|
||||
glm::vec4 modRadius = ghoul::any_cast<glm::vec4>(r);
|
||||
a = modRadius[0];
|
||||
b = modRadius[1];
|
||||
c = modRadius[2];
|
||||
|
||||
@@ -30,11 +30,14 @@
|
||||
#include <ghoul/misc/dictionary.h>
|
||||
#include <ghoul/lua/ghoul_lua.h>
|
||||
|
||||
// test files
|
||||
#include <test_common.inl>
|
||||
//#include <test_spicemanager.inl>
|
||||
#include <test_scenegraphloader.inl>
|
||||
//#include <test_luaconversions.inl>
|
||||
//#include <test_powerscalecoordinates.inl>
|
||||
#include <test_screenspaceimage.inl>
|
||||
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/engine/wrapper/windowwrapper.h>
|
||||
#include <openspace/engine/configurationmanager.h>
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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 "gtest/gtest.h"
|
||||
#include <modules/base/rendering/screenspaceimage.h>
|
||||
|
||||
/*
|
||||
* Constructor() -> setUp() -> test -> tearDown() -> Deconstructor()
|
||||
*/
|
||||
|
||||
namespace openspace {
|
||||
|
||||
class ScreenSpaceRenderableTest : public testing::Test{
|
||||
protected:
|
||||
|
||||
ScreenSpaceRenderableTest() :
|
||||
_ssr(texturePath)
|
||||
{
|
||||
_sharedSsr = std::make_shared<ScreenSpaceImage>("${OPENSPACE_DATA}/test3.jpg");
|
||||
}
|
||||
|
||||
~ScreenSpaceRenderableTest(){}
|
||||
|
||||
|
||||
void reset() {}
|
||||
|
||||
// These variables are shared by all tests
|
||||
std::string texturePath = "${OPENSPACE_DATA}/test2.jpg";
|
||||
ScreenSpaceImage _ssr;
|
||||
std::shared_ptr<ScreenSpaceRenderable> _sharedSsr;
|
||||
};
|
||||
|
||||
|
||||
TEST_F(ScreenSpaceRenderableTest, initialize){
|
||||
|
||||
bool isReady = _ssr.isReady();
|
||||
ASSERT_TRUE(!isReady) << "ScreenSpaceImage is ready before initialize";
|
||||
}
|
||||
|
||||
}//namespace openspace
|
||||
Reference in New Issue
Block a user