Solve merge conflict and add properties for friction and interaction parameters.

This commit is contained in:
kbladin
2016-06-30 14:07:51 -04:00
238 changed files with 3637 additions and 4131 deletions

View File

@@ -89,8 +89,8 @@ set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_ge.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/star_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screnspace_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screnspace_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/screenspace_vs.glsl
)
source_group("Shader Files" FILES ${SHADER_FILES})

View File

@@ -196,7 +196,7 @@ void RenderablePlane::render(const RenderData& data) {
SceneGraphNode* textureNode = OsEng.renderEngine().scene()->sceneGraphNode(_nodeName)->parent();
if (textureNode != nullptr){
RenderablePlanetProjection* t = static_cast<RenderablePlanetProjection*>(textureNode->renderable());
_texture = std::unique_ptr<ghoul::opengl::Texture>(t->baseTexture());
_texture = std::unique_ptr<ghoul::opengl::Texture>(&(t->baseTexture()));
float h = _texture->height();
float w = _texture->width();
float scale = h / w;

View File

@@ -21,15 +21,16 @@
* 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/screenspaceframebuffer.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/rendering/renderengine.h>
#include <modules/onscreengui/include/gui.h>
#include <openspace/util/camera.h>
#include <openspace/rendering/renderer.h>
#include <openspace/rendering/abufferrenderer.h>
#include <openspace/rendering/framebufferrenderer.h>
#include <openspace/engine/wrapper/windowwrapper.h>
namespace openspace {
ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictionary)
@@ -39,11 +40,9 @@ ScreenSpaceFramebuffer::ScreenSpaceFramebuffer(const ghoul::Dictionary& dictiona
{
_id = id();
setName("ScreenSpaceFramebuffer" + std::to_string(_id));
registerProperties();
glm::vec2 resolution = OsEng.windowWrapper().currentWindowResolution();
addProperty(_size);
OsEng.gui()._screenSpaceProperty.registerProperty(&_size);
_size.set(glm::vec4(0, 0, resolution.x,resolution.y));
_scale.setValue(1.0f);
@@ -62,8 +61,6 @@ bool ScreenSpaceFramebuffer::initialize(){
}
bool ScreenSpaceFramebuffer::deinitialize(){
unregisterProperties();
glDeleteVertexArrays(1, &_quad);
_quad = 0;

View File

@@ -1,74 +1,76 @@
/*****************************************************************************************
* *
* 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. *
****************************************************************************************/
* *
* 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/screenspaceimage.h>
#include <openspace/engine/openspaceengine.h>
#include <openspace/engine/wrapper/windowwrapper.h>
#include <openspace/rendering/renderengine.h>
#include <ghoul/io/texture/texturereader.h>
#include <ghoul/filesystem/filesystem>
namespace {
const std::string _loggerCat = "ScreenSpaceImage";
const std::string KeyName = "Name";
const std::string KeyTexturePath = "TexturePath";
const std::string KeyUrl = "URL";
}
namespace openspace {
ScreenSpaceImage::ScreenSpaceImage(const ghoul::Dictionary& dictionary)
:ScreenSpaceRenderable(dictionary)
,_texturePath("texturePath", "Texture path", "")
,_downloadImage(false)
: ScreenSpaceRenderable(dictionary)
, _texturePath("texturePath", "Texture path", "")
, _downloadImage(false)
{
std::string name;
if(dictionary.getValue("Name", name)){
if (dictionary.getValue(KeyName, name)) {
setName(name);
}else{
_id = id();
setName("ScreenSpaceImage" + std::to_string(_id));
} else {
static int id = 0;
setName("ScreenSpaceImage " + std::to_string(id));
++id;
}
addProperty(_texturePath);
registerProperties();
std::string texturePath;
bool texturesucces = (dictionary.getValue("TexturePath", texturePath));
if(texturesucces){
_texturePath.set(texturePath);
OsEng.gui()._screenSpaceProperty.registerProperty(&_texturePath);
if (dictionary.getValue(KeyTexturePath, texturePath)) {
_texturePath = texturePath;
_texturePath.onChange([this](){ loadTexture(); });
}
bool urlsucces = dictionary.getValue("URL", _url);
if(urlsucces){
_downloadImage =true;
if (dictionary.getValue(KeyUrl, _url)) {
_downloadImage = true;
}
//screenspaceCygnet does not have url or texturePath
// if(!texturesucces && !urlsucces){
// LERROR("Must specify TexturePath or URL");
// }
}
ScreenSpaceImage::~ScreenSpaceImage(){}
ScreenSpaceImage::~ScreenSpaceImage() {}
bool ScreenSpaceImage::initialize(){
bool ScreenSpaceImage::initialize() {
_originalViewportSize = OsEng.windowWrapper().currentWindowResolution();
createPlane();
@@ -78,8 +80,7 @@ bool ScreenSpaceImage::initialize(){
return isReady();
}
bool ScreenSpaceImage::deinitialize(){
unregisterProperties();
bool ScreenSpaceImage::deinitialize() {
glDeleteVertexArrays(1, &_quad);
_quad = 0;
@@ -90,47 +91,32 @@ bool ScreenSpaceImage::deinitialize(){
_texturePath = "";
_texture = nullptr;
RenderEngine& renderEngine = OsEng.renderEngine();
if (_shader) {
renderEngine.removeRenderProgram(_shader);
OsEng.renderEngine().removeRenderProgram(_shader);
_shader = nullptr;
}
return true;
}
void ScreenSpaceImage::render(){
if(!isReady()) return;
if(!_enabled) return;
glm::mat4 rotation = rotationMatrix();
glm::mat4 translation = translationMatrix();
glm::mat4 scale = scaleMatrix();
glm::mat4 modelTransform = rotation*translation*scale;
draw(modelTransform);
void ScreenSpaceImage::render() {
draw(rotationMatrix() * translationMatrix() * scaleMatrix());
}
void ScreenSpaceImage::update(){
if(_downloadImage && _futureImage.valid() && DownloadManager::futureReady(_futureImage)){
void ScreenSpaceImage::update() {
bool futureReady = DownloadManager::futureReady(_futureImage);
if (_downloadImage && _futureImage.valid() && futureReady) {
loadTexture();
}
}
bool ScreenSpaceImage::isReady() const{
bool ready = true;
if (!_shader)
ready &= false;
if(!_texture)
ready &= false;
return ready;
bool ScreenSpaceImage::isReady() const {
return _shader && _texture;
}
void ScreenSpaceImage::loadTexture() {
std::unique_ptr<ghoul::opengl::Texture> texture = nullptr;
if(!_downloadImage)
if (!_downloadImage)
texture = std::move(loadFromDisk());
else
texture = std::move(loadFromMemory());
@@ -146,56 +132,54 @@ void ScreenSpaceImage::loadTexture() {
}
}
void ScreenSpaceImage::updateTexture(){
if(!_downloadImage){
void ScreenSpaceImage::updateTexture() {
if (!_downloadImage) {
loadTexture();
} else {
if(_futureImage.valid())
if (_futureImage.valid())
return;
std::future<DownloadManager::MemoryFile> future = downloadImageToMemory(_url);
if(future.valid()){
if (future.valid()) {
_futureImage = std::move(future);
}
}
}
std::unique_ptr<ghoul::opengl::Texture> ScreenSpaceImage::loadFromDisk(){
std::unique_ptr<ghoul::opengl::Texture> ScreenSpaceImage::loadFromDisk() {
if (_texturePath.value() != "")
return (ghoul::io::TextureReader::ref().loadTexture(absPath(_texturePath.value())));
return nullptr;
}
std::unique_ptr<ghoul::opengl::Texture> ScreenSpaceImage::loadFromMemory(){
if(_futureImage.valid() && DownloadManager::futureReady(_futureImage) ){
std::unique_ptr<ghoul::opengl::Texture> ScreenSpaceImage::loadFromMemory() {
if (_futureImage.valid() && DownloadManager::futureReady(_futureImage)) {
DownloadManager::MemoryFile imageFile = _futureImage.get();
if(imageFile.corrupted)
if (imageFile.corrupted)
return nullptr;
return (ghoul::io::TextureReader::ref().loadTexture(
(void*) imageFile.buffer,
reinterpret_cast<void*>(imageFile.buffer),
imageFile.size,
imageFile.format));
imageFile.format)
);
}
}
std::future<DownloadManager::MemoryFile> ScreenSpaceImage::downloadImageToMemory(std::string url){
return std::move( DlManager.fetchFile(
url,
[url](const DownloadManager::MemoryFile& file){
LDEBUG("Download to memory finished for screen space image");
},
[url](const std::string& err){
LDEBUG("Download to memory failer for screen space image: " +err);
}
) );
std::future<DownloadManager::MemoryFile> ScreenSpaceImage::downloadImageToMemory(
std::string url)
{
return std::move(OsEng.downloadManager().fetchFile(
url,
[url](const DownloadManager::MemoryFile& file) {
LDEBUG("Download to memory finished for screen space image");
},
[url](const std::string& err) {
LDEBUG("Download to memory failer for screen space image: " +err);
}
));
}
int ScreenSpaceImage::id(){
static int id = 0;
return id++;
}
}
} // namespace openspace

View File

@@ -21,55 +21,46 @@
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE *
* OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
****************************************************************************************/
#ifndef __SCREENSPACEIMAGE_H__
#define __SCREENSPACEIMAGE_H__
#include <openspace/rendering/screenspacerenderable.h>
#include <ghoul/opengl/texture.h>
#include <openspace/engine/downloadmanager.h>
#include <openspace/engine/downloadmanager.h>
#include <openspace/properties/stringproperty.h>
#include <ghoul/opengl/texture.h>
namespace openspace {
/**
* @brief Creates a textured plane rendered in screenspace
* @details The plane gets the same ratio as the texture. Implements
* the interface that ScreenSpaceImage speciefies.
*
* @param texturePath Path to the image that should be used as texture
*/
class ScreenSpaceImage : public ScreenSpaceRenderable {
class ScreenSpaceImage : public ScreenSpaceRenderable {
public:
ScreenSpaceImage(std::string texturePath);
ScreenSpaceImage(const ghoul::Dictionary& dictionary);
~ScreenSpaceImage();
bool initialize() override;
bool deinitialize() override;
void render() override;
virtual void update() override;
void update() override;
bool isReady() const override;
protected:
void loadTexture();
void updateTexture();
std::string _url;
bool _downloadImage;
std::future<DownloadManager::MemoryFile> _futureImage;
void loadTexture();
void updateTexture();
private:
static int id();
std::future<DownloadManager::MemoryFile> downloadImageToMemory(std::string url);
std::unique_ptr<ghoul::opengl::Texture> loadFromDisk();
std::unique_ptr<ghoul::opengl::Texture> loadFromMemory();
properties::StringProperty _texturePath;
//std::string _memorybuffer;
int _id;
};
} //namespace openspace
#endif //__SCREENSPACEIMAGE_H__
#endif //__SCREENSPACEIMAGE_H__

View File

@@ -39,7 +39,7 @@ Fragment getFragment(){
// power scale coordinates for depth. w value is set to 1.0.
float depth = (1.0 + log(abs(OcclusionDepth) + 1/pow(k, 1.0))/log(k)) / 27.0;
frag.color = texture(texture1, vec2(vs_st.s, 1-vs_st.t));
frag.color = texture(texture1, vec2(vs_st.s, vs_st.t));
frag.color.a = (frag.color.a != 0.0f) ? Alpha : frag.color.a;
if(frag.color.a == 0.0f){
discard;

View File

@@ -1,4 +1,3 @@
set (DEFAULT_MODULE ON)
set (OPENSPACE_DEPENDENCIES
volume
)

View File

@@ -25,6 +25,8 @@
#ifndef __GALAXYRAYCASTER_H__
#define __GALAXYRAYCASTER_H__
#include <memory>
#include <ghoul/glm.h>
#include <string>
#include <vector>

View File

@@ -138,13 +138,28 @@ create_new_module(
${HEADER_FILES} ${SOURCE_FILES} ${SHADER_FILES}
)
target_include_directories(
openspace-module-globebrowsing
SYSTEM PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include
)
if (WIN32)
target_include_directories(
openspace-module-globebrowsing
SYSTEM PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/include
)
target_link_libraries(
openspace-module-globebrowsing
${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib
)
target_link_libraries(
openspace-module-globebrowsing
${CMAKE_CURRENT_SOURCE_DIR}/ext/gdal/lib/gdal_i.lib
)
else (WIN32)
find_package(GDAL REQUIRED)
target_include_directories(
openspace-module-globebrowsing
SYSTEM PUBLIC
${GDAL_INCLUDE}
)
target_link_libraries(
openspace-module-globebrowsing
${GDAL_LIBRARY}
)
endif ()

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_atomic_ops.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Name: cpl_atomic_ops.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_aws.h 33758 2016-03-21 09:06:22Z rouault $
*
* Name: cpl_aws.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_conv.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: CPL - Common Portability Library
* Purpose: Convenience functions declarations.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_csv.h 33844 2016-04-01 08:42:13Z rouault $
*
* Project: Common Portability Library
* Purpose: Functions for reading and scanning CSV (comma separated,

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_error.h 33842 2016-04-01 08:37:32Z rouault $
*
* Name: cpl_error.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_hash_set.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Name: cpl_hash_set.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_http.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: Common Portability Library
* Purpose: Function wrapper for libcurl HTTP access.

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_list.h 33671 2016-03-07 18:39:06Z goatbar $
*
* Name: cpl_list.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_minixml.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: CPL - Common Portability Library
* Purpose: Declarations for MiniXML Handler.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_minizip_zip.h 31826 2015-11-29 15:39:57Z goatbar $
*
* Project: CPL - Common Portability Library
* Author: Frank Warmerdam, warmerdam@pobox.com

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_multiproc.h 33817 2016-03-30 17:35:37Z rouault $
*
* Project: CPL - Common Portability Library
* Purpose: CPL Multi-Threading, and process handling portability functions.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_odbc.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: OGR ODBC Driver
* Purpose: Declarations for ODBC Access Cover API.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_port.h 33907 2016-04-07 00:37:06Z goatbar $
*
* Project: CPL - Common Portability Library
* Author: Frank Warmerdam, warmerdam@pobox.com

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_quad_tree.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: CPL - Common Portability Library
* Purpose: Implementation of quadtree building and searching functions.

View File

@@ -1,4 +1,4 @@
/* $Id$ */
/* $Id: cpl_sha256.h 31777 2015-11-26 14:14:41Z rouault $ */
/* The MIT License

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_spawn.h 31287 2015-11-01 18:29:27Z goatbar $
*
* Project: CPL - Common Portability Library
* Purpose: Implement CPLSystem().

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_string.h 33788 2016-03-26 00:45:58Z goatbar $
*
* Name: cpl_string.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_time.h 33783 2016-03-24 13:45:22Z goatbar $
*
* Name: cpl_time.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_virtualmem.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Name: cpl_virtualmem.h
* Project: CPL - Common Portability Library

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_vsi.h 33758 2016-03-21 09:06:22Z rouault $
*
* Project: CPL - Common Portability Library
* Author: Frank Warmerdam, warmerdam@pobox.com

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_vsi_error.h 33758 2016-03-21 09:06:22Z rouault $
*
* Project: VSI Virtual File System
* Purpose: Implement an error system for reporting file system errors.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_vsi_virtual.h 33759 2016-03-21 09:33:06Z rouault $
*
* Project: VSI Virtual File System
* Purpose: Declarations for classes related to the virtual filesystem.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cpl_vsil_curl_priv.h 31749 2015-11-25 02:32:55Z goatbar $
*
* Project: CPL - Common Portability Library
* Purpose: Private API for VSICurl

View File

@@ -1,5 +1,5 @@
/**********************************************************************
* $Id$
* $Id: cpl_worker_thread_pool.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: CPL - Common Portability Library
* Purpose: CPL worker thread pool

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: cplkeywordparser.h 33666 2016-03-07 05:21:07Z goatbar $
*
* Project: Common Portability Library
* Purpose: Implementation of CPLKeywordParser - a class for parsing

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal.h 33852 2016-04-01 23:27:53Z goatbar $
*
* Project: GDAL Core
* Purpose: GDAL Core C/Public declarations.
@@ -1102,9 +1102,9 @@ CPLVirtualMem CPL_DLL* GDALGetVirtualMemAuto( GDALRasterBandH hBand,
typedef enum
{
/*! TileAndTransform Interleaved by Pixel: tile (0,0) with internal band interleaved by pixel organization, tile (1, 0), ... */
/*! Tile Interleaved by Pixel: tile (0,0) with internal band interleaved by pixel organization, tile (1, 0), ... */
GTO_TIP,
/*! Band Interleaved by TileAndTransform : tile (0,0) of first band, tile (0,0) of second band, ... tile (1,0) of first band, tile (1,0) of second band, ... */
/*! Band Interleaved by Tile : tile (0,0) of first band, tile (0,0) of second band, ... tile (1,0) of first band, tile (1,0) of second band, ... */
GTO_BIT,
/*! Band SeQuential : all the tiles of first band, all the tiles of following band... */
GTO_BSQ

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_alg.h 33715 2016-03-13 08:52:06Z goatbar $
*
* Project: GDAL Image Processing Algorithms
* Purpose: Prototypes, and definitions for various GDAL based algorithms.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_alg_priv.h 33757 2016-03-20 20:22:33Z goatbar $
*
* Project: GDAL Image Processing Algorithms
* Purpose: Prototypes and definitions for various GDAL based algorithms:

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_csv.h 33844 2016-04-01 08:42:13Z rouault $
*
* Project: Common Portability Library
* Purpose: Functions for reading and scanning CSV (comma separated,

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_frmts.h 33351 2016-02-03 15:52:38Z goatbar $
*
* Project: GDAL
* Purpose: Prototypes for all format specific driver initialization.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_mdreader.h 33694 2016-03-10 17:54:30Z goatbar $
*
* Project: GDAL Core
* Purpose: Read metadata (mainly the remote sensing imagery) from files of

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_pam.h 33694 2016-03-10 17:54:30Z goatbar $
*
* Project: GDAL Core
* Purpose: Declaration for Peristable Auxiliary Metadata classes.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_priv.h 33808 2016-03-29 21:15:28Z goatbar $
*
* Name: gdal_priv.h
* Project: GDAL Core

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_proxy.h 33694 2016-03-10 17:54:30Z goatbar $
*
* Project: GDAL Core
* Purpose: GDAL Core C++/Private declarations

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_rat.h 33773 2016-03-23 18:39:47Z goatbar $
*
* Project: GDAL Core
* Purpose: GDALRasterAttributeTable class declarations.

View File

@@ -22,8 +22,8 @@
#endif
#ifndef GDAL_RELEASE_DATE
# define GDAL_RELEASE_DATE 20160401
# define GDAL_RELEASE_DATE 20160425
#endif
#ifndef GDAL_RELEASE_NAME
# define GDAL_RELEASE_NAME "2.1.0beta1"
# define GDAL_RELEASE_NAME "2.1.0"
#endif

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdal_vrt.h 33720 2016-03-15 00:39:53Z goatbar $
*
* Project: Virtual GDAL Datasets
* Purpose: C/Public declarations of virtual GDAL dataset objects.
@@ -37,9 +37,9 @@
*/
#include "gdal.h"
#include "cpl_port.h"
#include "cpl_error.h"
#include "cpl_minixml.h"
#include "cpl_port.h"
#define VRT_NODATA_UNSET -1234.56
@@ -54,22 +54,22 @@ typedef CPLErr
/* -------------------------------------------------------------------- */
/* Define handle types related to various VRT dataset classes. */
/* -------------------------------------------------------------------- */
typedef void *VRTAveragedSourceH;
typedef void *VRTAverageFilteredSourceH;
typedef void *VRTComplexSourceH;
typedef void *VRTDatasetH;
typedef void *VRTDerivedRasterBandH;
typedef void *VRTDriverH;
typedef void *VRTFilteredSourceH;
typedef void *VRTFuncSourceH;
typedef void *VRTKernelFilteredSourceH;
typedef void *VRTRasterBandH;
typedef void *VRTRawRasterBandH;
typedef void *VRTSimpleSourceH;
typedef void *VRTSourceH;
typedef void *VRTSourcedRasterBandH;
typedef void *VRTSimpleSourceH;
typedef void *VRTAveragedSourceH;
typedef void *VRTComplexSourceH;
typedef void *VRTFilteredSourceH;
typedef void *VRTKernelFilteredSourceH;
typedef void *VRTAverageFilteredSourceH;
typedef void *VRTFuncSourceH;
typedef void *VRTDatasetH;
typedef void *VRTWarpedDatasetH;
typedef void *VRTRasterBandH;
typedef void *VRTSourcedRasterBandH;
typedef void *VRTWarpedRasterBandH;
typedef void *VRTDerivedRasterBandH;
typedef void *VRTRawRasterBandH;
/* ==================================================================== */
/* VRTDataset class. */

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalexif.h 33175 2016-01-27 00:37:49Z goatbar $
*
* Project: JPEG JFIF Driver
* Purpose: Implement GDAL JPEG Support based on IJG libjpeg.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalgeorefpamdataset.h 33794 2016-03-26 13:19:07Z goatbar $
*
* Project: GDAL
* Purpose: GDALPamDataset with internal storage for georeferencing, with

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalgrid.h 29541 2015-07-20 14:03:42Z rouault $
*
* Project: GDAL Gridding API.
* Purpose: Prototypes, and definitions for of GDAL scattered data gridder.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalgrid_priv.h 33715 2016-03-13 08:52:06Z goatbar $
*
* Project: GDAL Gridding API.
* Purpose: Prototypes, and definitions for of GDAL scattered data gridder.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdaljp2abstractdataset.h 33794 2016-03-26 13:19:07Z goatbar $
*
* Project: GDAL
* Purpose: GDALGeorefPamDataset with helper to read georeferencing and other

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdaljp2metadata.h 33694 2016-03-10 17:54:30Z goatbar $
*
* Project: GDAL
* Purpose: JP2 Box Reader (and GMLJP2 Interpreter)

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdaljp2metadatagenerator.h 33694 2016-03-10 17:54:30Z goatbar $
*
* Project: GDAL
* Purpose: GDALJP2Metadata: metadata generator

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalpansharpen.h 33715 2016-03-13 08:52:06Z goatbar $
*
* Project: GDAL Pansharpening module
* Purpose: Prototypes, and definitions for pansharpening related work.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalsse_priv.h 32173 2015-12-14 00:04:53Z goatbar $
*
* Project: GDAL
* Purpose: SSE2 helper

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalwarper.h 33717 2016-03-14 06:29:14Z goatbar $
*
* Project: GDAL High Performance Warper
* Purpose: Prototypes, and definitions for warping related work.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: gdalwarpkernel_opencl.h 33715 2016-03-13 08:52:06Z goatbar $
*
* Project: OpenCL Image Reprojector
* Purpose: Implementation of the GDALWarpKernel reprojector in OpenCL.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: memdataset.h 33838 2016-03-31 20:42:32Z goatbar $
*
* Project: Memory Array Translator
* Purpose: Declaration of MEMDataset, and MEMRasterBand.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_api.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: C API for OGR Geometry, Feature, Layers, DataSource and drivers.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_attrind.h 32177 2015-12-14 07:25:30Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Classes related to generic implementation of attribute indexing.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_core.h 33680 2016-03-08 09:59:03Z rouault $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Define some core portability services for cross-platform OGR code.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_expat.h 27044 2014-03-16 23:41:27Z rouault $
*
* Project: OGR
* Purpose: Convenience function for parsing with Expat library

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_feature.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Class for representing a whole feature, and layer schemas.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_featurestyle.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Define of Feature Representation

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_geocoding.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Client of geocoding service.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_geometry.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Classes for manipulating simple features that is not specific

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_geos.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Definitions related to support for use of GEOS in OGR.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_p.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Some private helper functions and stuff for OGR implementation.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_spatialref.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Classes for manipulating spatial reference systems in a

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogr_srs_api.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: C API and constant declarations for OGR Spatial References.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ograpispy.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: OGR C API "Spy"

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogrgeomediageometry.h 31777 2015-11-26 14:14:41Z rouault $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Implements decoder of geomedia geometry blobs

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogrpgeogeometry.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Implements decoder of shapebin geometry for PGeo

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: ogrsf_frmts.h 33631 2016-03-04 06:28:09Z goatbar $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: Classes related to format registration, and file opening.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: osr_cs_wkt.h 31777 2015-11-26 14:14:41Z rouault $
*
* Project: OpenGIS Simple Features Reference Implementation
* Purpose: CS WKT parser

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: rawdataset.h 33673 2016-03-07 20:40:54Z goatbar $
*
* Project: Raw Translator
* Purpose: Implementation of RawDataset class. Intended to be subclassed

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: thinplatespline.h 33715 2016-03-13 08:52:06Z goatbar $
*
* Project: GDAL Warp API
* Purpose: Declarations for 2D Thin Plate Spline transformer.

View File

@@ -1,5 +1,5 @@
/******************************************************************************
* $Id$
* $Id: vrtdataset.h 33794 2016-03-26 13:19:07Z goatbar $
*
* Project: Virtual GDAL Datasets
* Purpose: Declaration of virtual gdal dataset classes.
@@ -66,7 +66,7 @@ public:
if( poBand == NULL )
/* do nothing */;
else if( poBand->GetDataset()->GetShared() )
GDALClose( /* (GDALDatasetH) */ poBand->GetDataset() );
GDALClose( (GDALDatasetH) poBand->GetDataset() );
else
poBand->GetDataset()->Dereference();
}
@@ -90,20 +90,17 @@ public:
virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess ) = 0;
virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess ) = 0;
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
double* adfMinMax ) = 0;
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax ) = 0;
virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
int bApproxOK,
double *pdfMin, double *pdfMax,
double *pdfMean, double *pdfStdDev,
GDALProgressFunc pfnProgress,
void *pProgressData ) = 0;
GDALProgressFunc pfnProgress, void *pProgressData ) = 0;
virtual CPLErr GetHistogram( int nXSize, int nYSize,
double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc pfnProgress,
void *pProgressData ) = 0;
GDALProgressFunc pfnProgress, void *pProgressData ) = 0;
virtual CPLErr XMLInit( CPLXMLNode *psTree, const char * ) = 0;
virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath ) = 0;
@@ -134,7 +131,7 @@ class CPL_DLL VRTDataset : public GDALDataset
int m_bGeoTransformSet;
double m_adfGeoTransform[6];
int m_nGCPCount;
int m_nGCPCount;
GDAL_GCP *m_pasGCPList;
char *m_pszGCPProjection;
@@ -210,8 +207,7 @@ class CPL_DLL VRTDataset : public GDALDataset
static int Identify( GDALOpenInfo * );
static GDALDataset *Open( GDALOpenInfo * );
static GDALDataset *OpenXML( const char *, const char * = NULL,
GDALAccess eAccess = GA_ReadOnly );
static GDALDataset *OpenXML( const char *, const char * = NULL, GDALAccess eAccess = GA_ReadOnly );
static GDALDataset *Create( const char * pszName,
int nXSize, int nYSize, int nBands,
GDALDataType eType, char ** papszOptions );
@@ -290,8 +286,7 @@ class VRTPansharpenedDataset : public VRTDataset
GDALPansharpenOperation* m_poPansharpener;
VRTPansharpenedDataset* m_poMainDataset;
std::vector<VRTPansharpenedDataset*> m_apoOverviewDatasets;
// Map from absolute to relative.
std::map<CPLString,CPLString> m_oMapToRelativeFilenames;
std::map<CPLString,CPLString> m_oMapToRelativeFilenames; // map from absolute to relative
int m_bLoadingOtherBands;
@@ -312,15 +307,15 @@ class VRTPansharpenedDataset : public VRTDataset
public:
VRTPansharpenedDataset( int nXSize, int nYSize );
virtual ~VRTPansharpenedDataset();
~VRTPansharpenedDataset();
virtual CPLErr XMLInit( CPLXMLNode *, const char * );
virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
CPLErr XMLInit( CPLXMLNode *psTree, const char *pszVRTPath,
GDALRasterBandH hPanchroBandIn,
int nInputSpectralBandsIn,
GDALRasterBandH* pahInputSpectralBandsIn );
GDALRasterBandH hPanchroBandIn,
int nInputSpectralBandsIn,
GDALRasterBandH* pahInputSpectralBandsIn );
virtual CPLErr AddBand( GDALDataType eType,
char **papszOptions=NULL );
@@ -354,8 +349,7 @@ class CPL_DLL VRTRasterBand : public GDALRasterBand
int m_bIsMaskBand;
int m_bNoDataValueSet;
// If set to true, will not report the existence of nodata.
int m_bHideNoDataValue;
int m_bHideNoDataValue; // If set to true, will not report the existence of nodata
double m_dfNoDataValue;
GDALColorTable *m_poColorTable;
@@ -413,9 +407,9 @@ class CPL_DLL VRTRasterBand : public GDALRasterBand
virtual GDALRasterBand *GetOverview(int);
virtual CPLErr GetHistogram( double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc, void *pProgressData );
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc, void *pProgressData );
virtual CPLErr GetDefaultHistogram( double *pdfMin, double *pdfMax,
int *pnBuckets, GUIntBig ** ppanHistogram,
@@ -462,7 +456,9 @@ class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
CPLString m_osLastLocationInfo;
char **m_papszSourceList;
bool CanUseSourcesMinMaxImplementations();
void Initialize( int nXSize, int nYSize );
int CanUseSourcesMinMaxImplementations();
public:
int nSources;
@@ -501,13 +497,11 @@ class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
virtual CPLErr ComputeStatistics( int bApproxOK,
double *pdfMin, double *pdfMax,
double *pdfMean, double *pdfStdDev,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLErr GetHistogram( double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
CPLErr AddSource( VRTSource * );
CPLErr AddSimpleSource( GDALRasterBand *poSrcBand,
@@ -529,22 +523,20 @@ class CPL_DLL VRTSourcedRasterBand : public VRTRasterBand
CPLErr AddMaskBandSource( GDALRasterBand *poSrcBand,
double dfSrcXOff=-1, double dfSrcYOff=-1,
double dfSrcXSize=-1,
double dfSrcYSize=-1,
double dfSrcXSize=-1, double dfSrcYSize=-1,
double dfDstXOff=-1, double dfDstYOff=-1,
double dfDstXSize=-1,
double dfDstYSize=-1 );
double dfDstXSize=-1, double dfDstYSize=-1 );
CPLErr AddFuncSource( VRTImageReadFunc pfnReadFunc, void *hCBData,
double dfNoDataValue = VRT_NODATA_UNSET );
void ConfigureSource(VRTSimpleSource *poSimpleSource,
GDALRasterBand *poSrcBand,
int bAddAsMaskBand,
double dfSrcXOff, double dfSrcYOff,
double dfSrcXSize, double dfSrcYSize,
double dfDstXOff, double dfDstYOff,
double dfDstXSize, double dfDstYSize );
GDALRasterBand *poSrcBand,
int bAddAsMaskBand,
double dfSrcXOff, double dfSrcYOff,
double dfSrcXSize, double dfSrcYSize,
double dfDstXOff, double dfDstYOff,
double dfDstXSize, double dfDstYSize);
virtual CPLErr IReadBlock( int, int, void * );
@@ -564,7 +556,7 @@ class CPL_DLL VRTWarpedRasterBand : public VRTRasterBand
{
public:
VRTWarpedRasterBand( GDALDataset *poDS, int nBand,
GDALDataType eType = GDT_Unknown );
GDALDataType eType = GDT_Unknown );
virtual ~VRTWarpedRasterBand();
virtual CPLErr XMLInit( CPLXMLNode *, const char * );
@@ -585,9 +577,8 @@ class VRTPansharpenedRasterBand : public VRTRasterBand
int m_nIndexAsPansharpenedBand;
public:
VRTPansharpenedRasterBand(
GDALDataset *poDS, int nBand,
GDALDataType eDataType = GDT_Unknown );
VRTPansharpenedRasterBand( GDALDataset *poDS, int nBand,
GDALDataType eDataType = GDT_Unknown );
virtual ~VRTPansharpenedRasterBand();
virtual CPLErr XMLInit( CPLXMLNode *, const char * );
@@ -607,10 +598,8 @@ class VRTPansharpenedRasterBand : public VRTRasterBand
virtual int IsPansharpenRasterBand() { return TRUE; }
void SetIndexAsPansharpenedBand( int nIdx )
{ m_nIndexAsPansharpenedBand = nIdx; }
int GetIndexAsPansharpenedBand() const
{ return m_nIndexAsPansharpenedBand; }
void SetIndexAsPansharpenedBand(int nIdx) { m_nIndexAsPansharpenedBand = nIdx; }
int GetIndexAsPansharpenedBand() const { return m_nIndexAsPansharpenedBand; }
};
/************************************************************************/
@@ -619,13 +608,14 @@ class VRTPansharpenedRasterBand : public VRTRasterBand
class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
{
public:
char *pszFuncName;
GDALDataType eSourceTransferType;
VRTDerivedRasterBand( GDALDataset *poDS, int nBand );
VRTDerivedRasterBand( GDALDataset *poDS, int nBand,
GDALDataType eType, int nXSize, int nYSize );
VRTDerivedRasterBand(GDALDataset *poDS, int nBand);
VRTDerivedRasterBand(GDALDataset *poDS, int nBand,
GDALDataType eType, int nXSize, int nYSize);
virtual ~VRTDerivedRasterBand();
virtual CPLErr IRasterIO( GDALRWFlag, int, int, int, int,
@@ -633,12 +623,12 @@ class CPL_DLL VRTDerivedRasterBand : public VRTSourcedRasterBand
GSpacing nPixelSpace, GSpacing nLineSpace,
GDALRasterIOExtraArg* psExtraArg );
static CPLErr AddPixelFunction( const char *pszFuncName,
GDALDerivedPixelFunc pfnPixelFunc );
static GDALDerivedPixelFunc GetPixelFunction( const char *pszFuncName );
static CPLErr AddPixelFunction
(const char *pszFuncName, GDALDerivedPixelFunc pfnPixelFunc);
static GDALDerivedPixelFunc GetPixelFunction(const char *pszFuncName);
void SetPixelFunctionName( const char *pszFuncName );
void SetSourceTransferType( GDALDataType eDataType );
void SetPixelFunctionName(const char *pszFuncName);
void SetSourceTransferType(GDALDataType eDataType);
virtual CPLErr XMLInit( CPLXMLNode *, const char * );
virtual CPLXMLNode * SerializeToXML( const char *pszVRTPath );
@@ -683,8 +673,8 @@ class CPL_DLL VRTRawRasterBand : public VRTRasterBand
void ClearRawLink();
virtual void GetFileList( char*** ppapszFileList, int *pnSize,
int *pnMaxSize, CPLHashSet* hSetFiles );
virtual void GetFileList(char*** ppapszFileList, int *pnSize,
int *pnMaxSize, CPLHashSet* hSetFiles);
};
/************************************************************************/
@@ -693,9 +683,11 @@ class CPL_DLL VRTRawRasterBand : public VRTRasterBand
class VRTDriver : public GDALDriver
{
void *m_pDeserializerData;
public:
VRTDriver();
virtual ~VRTDriver();
~VRTDriver();
char **papszSourceParsers;
@@ -718,8 +710,8 @@ class CPL_DLL VRTSimpleSource : public VRTSource
protected:
GDALRasterBand *m_poRasterBand;
// When poRasterBand is a mask band, poMaskBandMainBand is the band
// from which the mask band is taken.
/* when poRasterBand is a mask band, poMaskBandMainBand is the band */
/* from which the mask band is taken */
GDALRasterBand *m_poMaskBandMainBand;
double m_dfSrcXOff;
@@ -745,8 +737,8 @@ protected:
public:
VRTSimpleSource();
VRTSimpleSource( const VRTSimpleSource* poSrcSource,
double dfXDstRatio, double dfYDstRatio );
VRTSimpleSource(const VRTSimpleSource* poSrcSource,
double dfXDstRatio, double dfYDstRatio);
virtual ~VRTSimpleSource();
virtual CPLErr XMLInit( CPLXMLNode *psTree, const char * );
@@ -774,34 +766,31 @@ public:
virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
double* adfMinMax );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
int bApproxOK,
double *pdfMin, double *pdfMax,
double *pdfMean, double *pdfStdDev,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLErr GetHistogram( int nXSize, int nYSize,
double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
void DstToSrc( double dfX, double dfY,
double &dfXOut, double &dfYOut );
void SrcToDst( double dfX, double dfY,
double &dfXOut, double &dfYOut );
virtual void GetFileList( char*** ppapszFileList, int *pnSize,
int *pnMaxSize, CPLHashSet* hSetFiles );
virtual void GetFileList(char*** ppapszFileList, int *pnSize,
int *pnMaxSize, CPLHashSet* hSetFiles);
virtual int IsSimpleSource() { return TRUE; }
virtual const char* GetType() { return "SimpleSource"; }
GDALRasterBand* GetBand();
int IsSameExceptBandNumber( VRTSimpleSource* poOtherSource );
int IsSameExceptBandNumber(VRTSimpleSource* poOtherSource);
CPLErr DatasetRasterIO(
int nXOff, int nYOff, int nXSize, int nYSize,
void * pData, int nBufXSize, int nBufYSize,
@@ -809,11 +798,11 @@ public:
int nBandCount, int *panBandMap,
GSpacing nPixelSpace, GSpacing nLineSpace,
GSpacing nBandSpace,
GDALRasterIOExtraArg* psExtraArg );
GDALRasterIOExtraArg* psExtraArg);
void UnsetPreservedRelativeFilenames();
void SetMaxValue( int nVal ) { m_nMaxValue = nVal; }
void SetMaxValue(int nVal) { m_nMaxValue = nVal; }
};
/************************************************************************/
@@ -832,20 +821,17 @@ public:
virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
double* adfMinMax );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
int bApproxOK,
double *pdfMin, double *pdfMax,
double *pdfMean, double *pdfStdDev,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLErr GetHistogram( int nXSize, int nYSize,
double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
virtual const char* GetType() { return "AveragedSource"; }
@@ -866,10 +852,10 @@ class CPL_DLL VRTComplexSource : public VRTSimpleSource
{
protected:
VRTComplexSourceScaling m_eScalingType;
double m_dfScaleOff; // For linear scaling.
double m_dfScaleRatio; // For linear scaling.
double m_dfScaleOff; /* for linear scaling */
double m_dfScaleRatio; /* for linear scaling */
// For non-linear scaling with a power function.
/* For non-linear scaling with a power function. */
int m_bSrcMinMaxDefined;
double m_dfSrcMin;
double m_dfSrcMax;
@@ -900,20 +886,17 @@ public:
virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
double* adfMinMax );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
int bApproxOK,
double *pdfMin, double *pdfMax,
double *pdfMean, double *pdfStdDev,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLErr GetHistogram( int nXSize, int nYSize,
double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLXMLNode *SerializeToXML( const char *pszVRTPath );
virtual CPLErr XMLInit( CPLXMLNode *, const char * );
@@ -921,17 +904,18 @@ public:
double LookupValue( double dfInput );
void SetLinearScaling( double dfOffset, double dfScale );
void SetPowerScaling( double dfExponent,
double dfSrcMin,
double dfSrcMax,
double dfDstMin,
double dfDstMax );
void SetColorTableComponent( int nComponent );
void SetLinearScaling(double dfOffset, double dfScale);
void SetPowerScaling(double dfExponent,
double dfSrcMin,
double dfSrcMax,
double dfDstMin,
double dfDstMax);
void SetColorTableComponent(int nComponent);
double *m_padfLUTInputs;
double *m_padfLUTOutputs;
int m_nLUTItemCount;
};
/************************************************************************/
@@ -1027,20 +1011,17 @@ public:
virtual double GetMinimum( int nXSize, int nYSize, int *pbSuccess );
virtual double GetMaximum( int nXSize, int nYSize, int *pbSuccess );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK,
double* adfMinMax );
virtual CPLErr ComputeRasterMinMax( int nXSize, int nYSize, int bApproxOK, double* adfMinMax );
virtual CPLErr ComputeStatistics( int nXSize, int nYSize,
int bApproxOK,
double *pdfMin, double *pdfMax,
double *pdfMean, double *pdfStdDev,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
virtual CPLErr GetHistogram( int nXSize, int nYSize,
double dfMin, double dfMax,
int nBuckets, GUIntBig * panHistogram,
int bIncludeOutOfRange, int bApproxOK,
GDALProgressFunc pfnProgress,
void *pProgressData );
GDALProgressFunc pfnProgress, void *pProgressData );
VRTImageReadFunc pfnReadFunc;
void *pCBData;

View File

@@ -1 +0,0 @@
set(DEFAULT_MODULE ON)

View File

@@ -154,8 +154,8 @@ namespace openspace {
}
void TileProviderManager::update() {
for each (auto layerCategory in _layerCategories) {
for each (auto tileProviderWithName in layerCategory) {
for (auto layerCategory : _layerCategories) {
for (auto tileProviderWithName : layerCategory) {
if (tileProviderWithName.isActive) {
tileProviderWithName.tileProvider->update();
}
@@ -168,7 +168,7 @@ namespace openspace {
LayeredTextures::TextureCategory textureCategory)
{
std::vector<std::shared_ptr<TileProvider> > tileProviders;
for each (auto tileProviderWithName in _layerCategories[textureCategory]) {
for (auto tileProviderWithName : _layerCategories[textureCategory]) {
if (tileProviderWithName.isActive) {
tileProviders.push_back(tileProviderWithName.tileProvider);
}

View File

@@ -65,10 +65,10 @@ set(SOURCE_FILES
source_group("Source Files" FILES ${SOURCE_FILES})
set(SHADER_FILES
${CMAKE_CURRENT_SOURCE_DIR}/shaders/cygnetplane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/cygnetplane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/dataplane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/dataplane_vs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/textureplane_fs.glsl
${CMAKE_CURRENT_SOURCE_DIR}/shaders/textureplane_vs.glsl
)
source_group("Shader Files" FILES ${SHADER_FILES})

View File

@@ -1,3 +1,3 @@
set (OPENSPACE_DEPENDENCIES
base
base kameleon
)

View File

@@ -40,15 +40,29 @@ DataCygnet::DataCygnet(const ghoul::Dictionary& dictionary)
:IswaCygnet(dictionary)
,_dataProcessor(nullptr)
,_dataOptions("dataOptions", "Data Options")
,_useLog("useLog","Use Logarithm", false)
,_useHistogram("useHistogram", "Auto Contrast", false)
,_autoFilter("autoFilter", "Auto Filter", true)
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
//FOR TESTING
,_numOfBenchmarks(0)
,_avgBenchmarkTime(0.0f)
{
addProperty(_dataOptions);
addProperty(_useLog);
addProperty(_useHistogram);
addProperty(_autoFilter);
addProperty(_normValues);
addProperty(_backgroundValues);
addProperty(_transferFunctionsFile);
registerProperties();
}
DataCygnet::~DataCygnet(){}
bool DataCygnet::updateTexture(){
std::vector<float*> data = textureData();
if(data.empty())
@@ -86,11 +100,11 @@ bool DataCygnet::updateTexture(){
return texturesReady;
}
bool DataCygnet::downloadTextureResource(){
bool DataCygnet::downloadTextureResource(double timestamp){
if(_futureObject.valid())
return false;
std::future<DownloadManager::MemoryFile> future = IswaManager::ref().fetchDataCygnet(_data->id);
std::future<DownloadManager::MemoryFile> future = IswaManager::ref().fetchDataCygnet(_data->id, timestamp);
if(future.valid()){
_futureObject = std::move(future);
@@ -202,7 +216,7 @@ void DataCygnet::readTransferFunctions(std::string tfPath){
}
void DataCygnet::fillOptions(std::string& source){
std::vector<std::string> options = _dataProcessor->readMetadata(source);
std::vector<std::string> options = _dataProcessor->readMetadata(source, _textureDimensions);
for(int i=0; i<options.size(); i++){
_dataOptions.addOption({i, options[i]});
@@ -217,5 +231,92 @@ void DataCygnet::fillOptions(std::string& source){
}
}
void DataCygnet::setPropertyCallbacks(){
_normValues.onChange([this](){
_dataProcessor->normValues(_normValues.value());
updateTexture();
});
_useLog.onChange([this](){
_dataProcessor->useLog(_useLog.value());
updateTexture();
});
_useHistogram.onChange([this](){
_dataProcessor->useHistogram(_useHistogram.value());
updateTexture();
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
});
_dataOptions.onChange([this](){
if(_dataOptions.value().size() > MAX_TEXTURES)
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
updateTexture();
});
_transferFunctionsFile.onChange([this](){
readTransferFunctions(_transferFunctionsFile.value());
});
}
void DataCygnet::subscribeToGroup(){
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event dataOptionsChanged");
std::vector<int> values;
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
if(success){
_dataOptions.setValue(values);
}
});
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event normValuesChanged");
glm::vec2 values;
bool success = dict.getValue("normValues", values);
if(success){
_normValues.setValue(values);
}
});
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event backgroundValuesChanged");
glm::vec2 values;
bool success = dict.getValue("backgroundValues", values);
if(success){
_backgroundValues.setValue(values);
}
});
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event transferFunctionsChanged");
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
});
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
LDEBUG(name() + " Event useLogChanged");
_useLog.setValue(dict.value<bool>("useLog"));
});
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event useHistogramChanged");
_useHistogram.setValue(dict.value<bool>("useHistogram"));
});
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event autoFilterChanged");
_autoFilter.setValue(dict.value<bool>("autoFilter"));
});
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event updateGroup");
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
updateTexture();
});
}
} //namespace openspace

View File

@@ -60,6 +60,17 @@ protected:
* shader program, this includes both the data and transferfunctions.
*/
void setTextureUniforms();
/**
* Sets and defines the on-change handlers for the gui properties.
*/
void setPropertyCallbacks();
/**
* Subscribes to the group events that are shared by all DataCygnets
*/
void subscribeToGroup();
/**
* Optional interface method. this has an implementation
* in datacygnet.cpp, but needs to be overriden for kameleonplane
@@ -80,13 +91,24 @@ protected:
virtual void setUniforms() = 0;
properties::SelectionProperty _dataOptions;
properties::StringProperty _transferFunctionsFile;
properties::Vec2Property _backgroundValues;
properties::Vec2Property _normValues;
properties::BoolProperty _useLog;
properties::BoolProperty _useHistogram;
properties::BoolProperty _autoFilter;
std::shared_ptr<DataProcessor> _dataProcessor;
std::string _dataBuffer;
glm::size3_t _textureDimensions;
//FOR TESTING
int _numOfBenchmarks;
double _avgBenchmarkTime;
private:
bool readyToRender() const override;
bool downloadTextureResource() override;
bool downloadTextureResource(double timestamp = Time::ref().currentTime()) override;
};
} //namespace openspace

View File

@@ -32,21 +32,7 @@ namespace openspace {
DataPlane::DataPlane(const ghoul::Dictionary& dictionary)
:DataCygnet(dictionary)
,_useLog("useLog","Use Logarithm", false)
,_useHistogram("useHistogram", "Auto Contrast", false)
,_autoFilter("autoFilter", "Auto Filter", true)
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
{
addProperty(_useLog);
addProperty(_useHistogram);
addProperty(_autoFilter);
addProperty(_normValues);
addProperty(_backgroundValues);
addProperty(_transferFunctionsFile);
_programName = "DataPlaneProgram";
_vsPath = "${MODULE_ISWA}/shaders/dataplane_vs.glsl";
_fsPath = "${MODULE_ISWA}/shaders/dataplane_fs.glsl";
@@ -61,13 +47,6 @@ bool DataPlane::initialize(){
_dataProcessor = _group->dataProcessor();
subscribeToGroup();
}else{
OsEng.gui()._iswa.registerProperty(&_useLog);
OsEng.gui()._iswa.registerProperty(&_useHistogram);
OsEng.gui()._iswa.registerProperty(&_autoFilter);
OsEng.gui()._iswa.registerProperty(&_normValues);
OsEng.gui()._iswa.registerProperty(&_backgroundValues);
OsEng.gui()._iswa.registerProperty(&_transferFunctionsFile);
OsEng.gui()._iswa.registerProperty(&_dataOptions);
_dataProcessor = std::make_shared<DataProcessorText>();
//If autofiler is on, background values property should be hidden
@@ -76,42 +55,17 @@ bool DataPlane::initialize(){
// and unregister backgroundvalues property.
if(_autoFilter.value()){
_backgroundValues.setValue(_dataProcessor->filterValues());
OsEng.gui()._iswa.unregisterProperty(&_backgroundValues);
_backgroundValues.setVisible(false);
// else if autofilter is turned off, register backgroundValues
} else {
OsEng.gui()._iswa.registerProperty(&_backgroundValues, &_autoFilter);
_backgroundValues.setVisible(true);
}
});
}
readTransferFunctions(_transferFunctionsFile.value());
_normValues.onChange([this](){
_dataProcessor->normValues(_normValues.value());
updateTexture();
});
_useLog.onChange([this](){
_dataProcessor->useLog(_useLog.value());
updateTexture();
});
_useHistogram.onChange([this](){
_dataProcessor->useHistogram(_useHistogram.value());
updateTexture();
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
});
_dataOptions.onChange([this](){
if(_dataOptions.value().size() > MAX_TEXTURES)
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
updateTexture();
});
_transferFunctionsFile.onChange([this](){
readTransferFunctions(_transferFunctionsFile.value());
});
setPropertyCallbacks();
_autoFilter.setValue(true);
@@ -191,65 +145,27 @@ std::vector<float*> DataPlane::textureData(){
return std::vector<float*>();
}
}
_textureDimensions = _dataProcessor->dimensions();
return _dataProcessor->processData(_dataBuffer, _dataOptions);
}
// _textureDimensions = _dataProcessor->dimensions();
void DataPlane::subscribeToGroup(){
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
LDEBUG(name() + " Event useLogChanged");
_useLog.setValue(dict.value<bool>("useLog"));
});
// FOR TESTING
// ===========
std::chrono::time_point<std::chrono::system_clock> start, end;
start = std::chrono::system_clock::now();
// ===========
std::vector<float*> d = _dataProcessor->processData(_dataBuffer, _dataOptions, _textureDimensions);
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event normValuesChanged");
glm::vec2 values;
bool success = dict.getValue("normValues", values);
if(success){
_normValues.setValue(values);
}
});
// FOR TESTING
// ===========
end = std::chrono::system_clock::now();
_numOfBenchmarks++;
std::chrono::duration<double> elapsed_seconds = end-start;
_avgBenchmarkTime = ( (_avgBenchmarkTime * (_numOfBenchmarks-1)) + elapsed_seconds.count() ) / _numOfBenchmarks;
std::cout << " processData() " << name() << std::endl;
std::cout << "avg elapsed time: " << _avgBenchmarkTime << "s\n";
std::cout << "num Benchmarks: " << _numOfBenchmarks << "\n";
// ===========
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event useHistogramChanged");
_useHistogram.setValue(dict.value<bool>("useHistogram"));
});
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event dataOptionsChanged");
std::vector<int> values;
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
if(success){
_dataOptions.setValue(values);
}
});
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event transferFunctionsChanged");
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
});
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event backgroundValuesChanged");
glm::vec2 values;
bool success = dict.getValue("backgroundValues", values);
if(success){
_backgroundValues.setValue(values);
}
});
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event autoFilterChanged");
_autoFilter.setValue(dict.value<bool>("autoFilter"));
});
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event updateGroup");
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
updateTexture();
});
return d;
}
}// namespace openspace

View File

@@ -26,8 +26,6 @@
#define __DATAPLANE_H__
#include <modules/iswa/rendering/datacygnet.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/selectionproperty.h>
namespace openspace{
/**
@@ -53,14 +51,6 @@ private:
void renderGeometry() const override;
void setUniforms() override;
std::vector<float*> textureData() override;
void subscribeToGroup();
properties::StringProperty _transferFunctionsFile;
properties::Vec2Property _backgroundValues;
properties::Vec2Property _normValues;
properties::BoolProperty _useLog;
properties::BoolProperty _useHistogram;
properties::BoolProperty _autoFilter;
GLuint _quad;
GLuint _vertexPositionBuffer;

View File

@@ -26,6 +26,11 @@
#include <openspace/util/powerscaledsphere.h>
#include <modules/iswa/util/dataprocessorjson.h>
#ifdef WIN32
#define _USE_MATH_DEFINES
#include <math.h>
#endif
namespace {
const std::string _loggerCat = "DataSphere";
}
@@ -34,25 +39,12 @@ namespace openspace {
DataSphere::DataSphere(const ghoul::Dictionary& dictionary)
:DataCygnet(dictionary)
,_useLog("useLog","Use Logarithm", false)
,_useHistogram("useHistogram", "Auto Contrast", false)
,_autoFilter("autoFilter", "Auto Filter", false)
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
,_sphere(nullptr)
{
float radius;
dictionary.getValue("Radius", radius);
_radius = radius;
addProperty(_useLog);
addProperty(_useHistogram);
addProperty(_autoFilter);
addProperty(_normValues);
addProperty(_backgroundValues);
addProperty(_transferFunctionsFile);
_programName = "DataSphereProgram";
_vsPath = "${MODULE_ISWA}/shaders/datasphere_vs.glsl";
_fsPath = "${MODULE_ISWA}/shaders/datasphere_fs.glsl";
@@ -63,18 +55,13 @@ DataSphere::~DataSphere(){}
bool DataSphere::initialize(){
IswaCygnet::initialize();
//rotate 90 degrees because of the texture coordinates in PowerScaledSphere
_rotation = glm::rotate(_rotation, (float)M_PI_2, glm::vec3(1.0, 0.0, 0.0));
if(_group){
_dataProcessor = _group->dataProcessor();
subscribeToGroup();
}else{
OsEng.gui()._iswa.registerProperty(&_useLog);
OsEng.gui()._iswa.registerProperty(&_useHistogram);
OsEng.gui()._iswa.registerProperty(&_autoFilter);
OsEng.gui()._iswa.registerProperty(&_backgroundValues);
OsEng.gui()._iswa.registerProperty(&_normValues);
OsEng.gui()._iswa.registerProperty(&_transferFunctionsFile);
OsEng.gui()._iswa.registerProperty(&_dataOptions);
_dataProcessor = std::make_shared<DataProcessorJson>();
//If autofiler is on, background values property should be hidden
_autoFilter.onChange([this](){
@@ -82,42 +69,17 @@ bool DataSphere::initialize(){
// and unregister backgroundvalues property.
if(_autoFilter.value()){
_backgroundValues.setValue(_dataProcessor->filterValues());
_backgroundValues.setVisible(false);
// else if autofilter is turned off, register backgroundValues
} else {
OsEng.gui()._iswa.registerProperty(&_backgroundValues, &_autoFilter);
_backgroundValues.setVisible(true);
}
});
}
readTransferFunctions(_transferFunctionsFile.value());
_normValues.onChange([this](){
_dataProcessor->normValues(_normValues.value());
updateTexture();
});
_useLog.onChange([this](){
_dataProcessor->useLog(_useLog.value());
updateTexture();
});
_useHistogram.onChange([this](){
_dataProcessor->useHistogram(_useHistogram.value());
updateTexture();
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
});
_dataOptions.onChange([this](){
if(_dataOptions.value().size() > MAX_TEXTURES)
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
updateTexture();
});
_transferFunctionsFile.onChange([this](){
readTransferFunctions(_transferFunctionsFile.value());
});
setPropertyCallbacks();
_useHistogram.setValue(true);
_autoFilter.setValue(true);
@@ -159,8 +121,8 @@ std::vector<float*> DataSphere::textureData(){
return std::vector<float*>();
}
}
_textureDimensions = _dataProcessor->dimensions();
return _dataProcessor->processData(_dataBuffer, _dataOptions);
// _textureDimensions = _dataProcessor->dimensions();
return _dataProcessor->processData(_dataBuffer, _dataOptions, _textureDimensions);
}
void DataSphere::setUniforms(){
@@ -169,60 +131,4 @@ void DataSphere::setUniforms(){
_shader->setUniform("backgroundValues", _backgroundValues.value());
_shader->setUniform("transparency", _alpha.value());
}
void DataSphere::subscribeToGroup(){
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
LDEBUG(name() + " Event useLogChanged");
_useLog.setValue(dict.value<bool>("useLog"));
});
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event normValuesChanged");
glm::vec2 values;
bool success = dict.getValue("normValues", values);
if(success){
_normValues.setValue(values);
}
});
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event useHistogramChanged");
_useHistogram.setValue(dict.value<bool>("useHistogram"));
});
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event dataOptionsChanged");
std::vector<int> values;
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
if(success){
_dataOptions.setValue(values);
}
});
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event transferFunctionsChanged");
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
});
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event backgroundValuesChanged");
glm::vec2 values;
bool success = dict.getValue("backgroundValues", values);
if(success){
_backgroundValues.setValue(values);
}
});
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event autoFilterChanged");
_autoFilter.setValue(dict.value<bool>("autoFilter"));
});
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event updateGroup");
updateTexture();
});
}
} //namespace openspace

View File

@@ -26,8 +26,6 @@
#define __DATASPHERE_H__
#include <modules/iswa/rendering/datacygnet.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/selectionproperty.h>
namespace openspace{
class PowerScaledSphere;
@@ -53,14 +51,6 @@ protected:
void renderGeometry() const override;
void setUniforms() override;
std::vector<float*> textureData() override;
void subscribeToGroup();
properties::StringProperty _transferFunctionsFile;
properties::Vec2Property _backgroundValues;
properties::Vec2Property _normValues;
properties::BoolProperty _useLog;
properties::BoolProperty _useHistogram;
properties::BoolProperty _autoFilter;
std::shared_ptr<PowerScaledSphere> _sphere;
float _radius;

View File

@@ -34,7 +34,6 @@
#include <modules/iswa/rendering/datasphere.h>
#include <modules/iswa/rendering/kameleonplane.h>
namespace {
const std::string _loggerCat = "IswaBaseGroup";
using json = nlohmann::json;
@@ -87,9 +86,6 @@ std::shared_ptr<ghoul::Event<ghoul::Dictionary> > IswaBaseGroup::groupEvent(){
void IswaBaseGroup::registerProperties(){
OsEng.gui()._iswa.registerProperty(&_enabled);
OsEng.gui()._iswa.registerProperty(&_alpha);
_enabled.onChange([this]{
LDEBUG("Group " + name() + " published enabledChanged");
_groupEvent->publish("enabledChanged", ghoul::Dictionary({{"enabled", _enabled.value()}}));
@@ -101,7 +97,6 @@ void IswaBaseGroup::registerProperties(){
});
OsEng.gui()._iswa.registerProperty(&_delete);
_delete.onChange([this]{
clearGroup();
});
@@ -110,7 +105,6 @@ void IswaBaseGroup::registerProperties(){
}
void IswaBaseGroup::unregisterProperties(){
OsEng.gui()._iswa.unregisterProperties(name());
_registered = false;
}

View File

@@ -42,29 +42,29 @@ class IswaCygnet;
class IswaBaseGroup : public properties::PropertyOwner{
public:
IswaBaseGroup(std::string name, std::string type);
~IswaBaseGroup();
bool isType(std::string type);
IswaBaseGroup(std::string name, std::string type);
~IswaBaseGroup();
bool isType(std::string type);
void updateGroup();
virtual void clearGroup();
void updateGroup();
virtual void clearGroup();
std::shared_ptr<DataProcessor> dataProcessor();
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent();
std::shared_ptr<DataProcessor> dataProcessor();
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent();
protected:
void registerProperties();
void unregisterProperties();
void registerProperties();
void unregisterProperties();
properties::BoolProperty _enabled;
properties::FloatProperty _alpha;
properties::BoolProperty _enabled;
properties::FloatProperty _alpha;
properties::TriggerProperty _delete;
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > _groupEvent;
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > _groupEvent;
std::shared_ptr<DataProcessor> _dataProcessor;
bool _registered;
std::string _type;
bool _registered;
std::string _type;
};
} //namespace openspace

View File

@@ -28,7 +28,6 @@
#include <openspace/util/transformationmanager.h>
#include <modules/iswa/rendering/iswabasegroup.h>
namespace {
const std::string _loggerCat = "IswaCygnet";
}
@@ -42,6 +41,7 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
, _shader(nullptr)
, _group(nullptr)
, _textureDirty(false)
, _rotation(glm::mat4(1.0f))
{
std::string name;
dictionary.getValue("Name", name);
@@ -52,6 +52,7 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
// dict.getValue can only set strings in _data directly
float renderableId;
float updateTime;
float xOffset;
glm::vec3 min, max;
glm::vec4 spatialScale;
@@ -62,6 +63,7 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
dictionary.getValue("GridMax", max);
dictionary.getValue("Frame",_data->frame);
dictionary.getValue("CoordinateType", _data->coordinateType);
dictionary.getValue("XOffset", xOffset);
_data->id = (int) renderableId;
_data->updateTime = (int) updateTime;
@@ -79,8 +81,9 @@ IswaCygnet::IswaCygnet(const ghoul::Dictionary& dictionary)
(max.z - min.z)
);
offset = glm::vec3(
(min.x + (std::abs(min.x)+std::abs(max.x))/2.0f),
(min.x + (std::abs(min.x)+std::abs(max.x))/2.0f)+xOffset,
(min.y + (std::abs(min.y)+std::abs(max.y))/2.0f),
(min.z + (std::abs(min.z)+std::abs(max.z))/2.0f)
);
@@ -102,9 +105,6 @@ bool IswaCygnet::initialize(){
if(!_data->groupName.empty()){
initializeGroup();
}else{
OsEng.gui()._iswa.registerProperty(&_alpha);
OsEng.gui()._iswa.registerProperty(&_delete);
_delete.onChange([this](){
deinitialize();
OsEng.scriptEngine().queueScript("openspace.removeSceneGraphNode('" + name() + "')");
@@ -116,7 +116,7 @@ bool IswaCygnet::initialize(){
createShader();
downloadTextureResource();
return true;
return true;
}
bool IswaCygnet::deinitialize(){
@@ -143,12 +143,12 @@ void IswaCygnet::render(const RenderData& data){
psc position = data.position;
glm::mat4 transform = glm::mat4(1.0);
glm::mat4 rot = glm::mat4(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*_rotation;
position += transform*glm::vec4(_data->spatialScale.x*_data->offset, _data->spatialScale.w);
@@ -171,6 +171,13 @@ void IswaCygnet::render(const RenderData& data){
}
void IswaCygnet::update(const UpdateData& data){
if (!_enabled)
return;
// the texture resource is downloaded ahead of time, so we need to
// now if we are going backwards or forwards
double clockwiseSign = (Time::ref().deltaTime()>0) ? 1.0 : -1.0;
_openSpaceTime = Time::ref().currentTime();
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
_stateMatrix = TransformationManager::ref().frameTransformationMatrix(_data->frame, "GALACTIC", _openSpaceTime);
@@ -178,22 +185,19 @@ void IswaCygnet::update(const UpdateData& data){
bool timeToUpdate = (fabs(_openSpaceTime-_lastUpdateOpenSpaceTime) >= _data->updateTime &&
(_realTime.count()-_lastUpdateRealTime.count()) > _minRealTimeUpdateInterval);
if( _data->updateTime != 0 && (Time::ref().timeJumped() || timeToUpdate )){
downloadTextureResource();
_lastUpdateRealTime = _realTime;
_lastUpdateOpenSpaceTime = _openSpaceTime;
}
if(_futureObject.valid() && DownloadManager::futureReady(_futureObject)) {
bool success = updateTextureResource();
if(success)
_textureDirty = true;
}
if(_textureDirty) {
if(_textureDirty && _data->updateTime != 0 && timeToUpdate) {
updateTexture();
_textureDirty = false;
downloadTextureResource(_openSpaceTime + clockwiseSign*_data->updateTime);
_lastUpdateRealTime = _realTime;
_lastUpdateOpenSpaceTime =_openSpaceTime;
}
if(!_transferFunctions.empty())
@@ -208,21 +212,18 @@ bool IswaCygnet::destroyShader(){
renderEngine.removeRenderProgram(_shader);
_shader = nullptr;
}
return true;
return true;
}
void IswaCygnet::registerProperties(){
OsEng.gui()._iswa.registerProperty(&_enabled);
// OsEng.gui()._iswa.registerProperty(&_delete);
}
void IswaCygnet::unregisterProperties(){
OsEng.gui()._iswa.unregisterProperties(name());
}
void IswaCygnet::initializeTime(){
_openSpaceTime = Time::ref().currentTime();
_lastUpdateOpenSpaceTime = _openSpaceTime;
_lastUpdateOpenSpaceTime = 0.0;
_realTime = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch());
_lastUpdateRealTime = _realTime;

View File

@@ -25,10 +25,6 @@
#ifndef __ISWACYGNET_H__
#define __ISWACYGNET_H__
#define _USE_MATH_DEFINES
#include <math.h>
#include <memory>
#include <chrono>
#include <modules/iswa/util/iswamanager.h>
#include <ghoul/designpattern/event.h>
@@ -38,6 +34,7 @@
#include <openspace/properties/triggerproperty.h>
#include <openspace/rendering/renderable.h>
#include <openspace/rendering/transferfunction.h>
#include <openspace/util/time.h>
#include <modules/iswa/rendering/iswabasegroup.h>
#include <modules/iswa/rendering/iswadatagroup.h>
@@ -64,7 +61,6 @@ struct Metadata {
class IswaCygnet : public Renderable, public std::enable_shared_from_this<IswaCygnet> {
friend class IswaBaseGroup;
public:
IswaCygnet(const ghoul::Dictionary& dictionary);
@@ -119,7 +115,7 @@ protected:
* this should be the data file.
* @return true if update was successfull
*/
virtual bool downloadTextureResource() = 0;
virtual bool downloadTextureResource(double timestamp = Time::ref().currentTime()) = 0;
virtual bool readyToRender() const = 0;
/**
* should set all uniforms needed to render
@@ -134,6 +130,21 @@ protected:
std::shared_ptr<Metadata> _data;
std::vector<std::shared_ptr<TransferFunction>> _transferFunctions;
std::future<DownloadManager::MemoryFile> _futureObject;
std::shared_ptr<IswaBaseGroup> _group;
bool _textureDirty;
// Must be set by children.
std::string _vsPath;
std::string _fsPath;
std::string _programName;
glm::mat4 _rotation; //to rotate objects with fliped texture coordniates
private:
bool destroyShader();
glm::dmat3 _stateMatrix;
double _openSpaceTime;
@@ -143,20 +154,6 @@ protected:
std::chrono::milliseconds _lastUpdateRealTime;
int _minRealTimeUpdateInterval;
std::vector<std::shared_ptr<TransferFunction>> _transferFunctions;
std::future<DownloadManager::MemoryFile> _futureObject;
std::shared_ptr<IswaBaseGroup> _group;
bool _textureDirty;
std::string _vsPath;
std::string _fsPath;
std::string _programName;
private:
bool destroyShader();
};
}//namespace openspace

View File

@@ -66,15 +66,15 @@ IswaDataGroup::IswaDataGroup(std::string name, std::string type)
IswaDataGroup::~IswaDataGroup(){}
void IswaDataGroup::registerProperties(){
OsEng.gui()._iswa.registerProperty(&_useLog);
OsEng.gui()._iswa.registerProperty(&_useHistogram);
OsEng.gui()._iswa.registerProperty(&_autoFilter);
if(!_autoFilter.value())
OsEng.gui()._iswa.registerProperty(&_backgroundValues);
// OsEng.gui()._iswa.registerProperty(&_autoFilter);
OsEng.gui()._iswa.registerProperty(&_normValues);
OsEng.gui()._iswa.registerProperty(&_transferFunctionsFile);
OsEng.gui()._iswa.registerProperty(&_dataOptions);
//OsEng.gui()._iswa.registerProperty(&_useLog);
//OsEng.gui()._iswa.registerProperty(&_useHistogram);
//OsEng.gui()._iswa.registerProperty(&_autoFilter);
//if(!_autoFilter.value())
// OsEng.gui()._iswa.registerProperty(&_backgroundValues);
//// OsEng.gui()._iswa.registerProperty(&_autoFilter);
//OsEng.gui()._iswa.registerProperty(&_normValues);
//OsEng.gui()._iswa.registerProperty(&_transferFunctionsFile);
//OsEng.gui()._iswa.registerProperty(&_dataOptions);
_useLog.onChange([this]{
@@ -94,10 +94,10 @@ void IswaDataGroup::registerProperties(){
// and unregister backgroundvalues property.
if(_autoFilter.value()){
_backgroundValues.setValue(_dataProcessor->filterValues());
OsEng.gui()._iswa.unregisterProperty(&_backgroundValues);
_backgroundValues.setVisible(false);
// else if autofilter is turned off, register backgroundValues
} else {
OsEng.gui()._iswa.registerProperty(&_backgroundValues, &_autoFilter);
_backgroundValues.setVisible(true);
}
_groupEvent->publish("autoFilterChanged", ghoul::Dictionary({{"autoFilter", _autoFilter.value()}}));
});

View File

@@ -42,29 +42,29 @@ class IswaCygnet;
class IswaBaseGroup : public properties::PropertyOwner{
public:
IswaBaseGroup(std::string name, std::string type);
~IswaBaseGroup();
bool isType(std::string type);
IswaBaseGroup(std::string name, std::string type);
~IswaBaseGroup();
bool isType(std::string type);
void updateGroup();
virtual void clearGroup();
void updateGroup();
virtual void clearGroup();
std::shared_ptr<DataProcessor> dataProcessor();
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent();
std::shared_ptr<DataProcessor> dataProcessor();
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > groupEvent();
protected:
void registerProperties();
void unregisterProperties();
void registerProperties();
void unregisterProperties();
properties::BoolProperty _enabled;
properties::FloatProperty _alpha;
properties::BoolProperty _enabled;
properties::FloatProperty _alpha;
properties::TriggerProperty _delete;
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > _groupEvent;
std::shared_ptr<ghoul::Event<ghoul::Dictionary> > _groupEvent;
std::shared_ptr<DataProcessor> _dataProcessor;
bool _registered;
std::string _type;
bool _registered;
std::string _type;
};
} //namespace openspace

View File

@@ -41,15 +41,15 @@ namespace {
namespace openspace{
IswaKameleonGroup::IswaKameleonGroup(std::string name, std::string type)
:IswaDataGroup(name, type)
:IswaDataGroup(name, type)
,_resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f)
,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
,_fieldlineIndexFile("")
,_kameleonPath("")
{
addProperty(_resolution);
addProperty(_fieldlines);
registerProperties();
registerProperties();
}
IswaKameleonGroup::~IswaKameleonGroup(){}
@@ -60,7 +60,7 @@ void IswaKameleonGroup::clearGroup(){
}
std::vector<int> IswaKameleonGroup::fieldlineValue(){
return _fieldlines.value();
return _fieldlines.value();
}
void IswaKameleonGroup::setFieldlineInfo(std::string fieldlineIndexFile, std::string kameleonPath){
@@ -78,8 +78,8 @@ void IswaKameleonGroup::setFieldlineInfo(std::string fieldlineIndexFile, std::st
void IswaKameleonGroup::registerProperties(){
OsEng.gui()._iswa.registerProperty(&_resolution);
OsEng.gui()._iswa.registerProperty(&_fieldlines);
//OsEng.gui()._iswa.registerProperty(&_resolution);
//OsEng.gui()._iswa.registerProperty(&_fieldlines);
_resolution.onChange([this]{
LDEBUG("Group " + name() + " published resolutionChanged");
@@ -88,7 +88,7 @@ void IswaKameleonGroup::registerProperties(){
_fieldlines.onChange([this]{
updateFieldlineSeeds();
});
});
}
void IswaKameleonGroup::readFieldlinePaths(std::string indexFile){

View File

@@ -39,25 +39,13 @@ namespace openspace {
KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
:DataCygnet(dictionary)
,_useLog("useLog","Use Logarithm", false)
,_useHistogram("useHistogram", "Auto Contrast", false)
,_autoFilter("autoFilter", "Auto Filter", true)
,_normValues("normValues", "Normalize Values", glm::vec2(1.0,1.0), glm::vec2(0), glm::vec2(5.0))
,_backgroundValues("backgroundValues", "Background Values", glm::vec2(0.0), glm::vec2(0), glm::vec2(1.0))
,_transferFunctionsFile("transferfunctions", "Transfer Functions", "${SCENE}/iswa/tfs/default.tf")
,_fieldlines("fieldlineSeedsIndexFile", "Fieldline Seedpoints")
,_resolution("resolution", "Resolution%", 100.0f, 10.0f, 200.0f)
,_slice("slice", "Slice", 0.0, 0.0, 1.0)
{
addProperty(_useLog);
addProperty(_useHistogram);
addProperty(_autoFilter);
addProperty(_normValues);
addProperty(_backgroundValues);
addProperty(_resolution);
addProperty(_slice);
addProperty(_transferFunctionsFile);
addProperty(_fieldlines);
dictionary.getValue("kwPath", _kwPath);
@@ -68,9 +56,6 @@ KameleonPlane::KameleonPlane(const ghoul::Dictionary& dictionary)
std::string axis;
dictionary.getValue("axisCut", axis);
OsEng.gui()._iswa.registerProperty(&_slice);
if(axis == "x") _cut = 0;
else if (axis == "y") _cut = 1;
else _cut = 2;
@@ -114,15 +99,6 @@ bool KameleonPlane::initialize(){
_dataProcessor = _group->dataProcessor();
subscribeToGroup();
}else{
OsEng.gui()._iswa.registerProperty(&_useLog);
OsEng.gui()._iswa.registerProperty(&_useHistogram);
OsEng.gui()._iswa.registerProperty(&_autoFilter);
OsEng.gui()._iswa.registerProperty(&_normValues);
OsEng.gui()._iswa.registerProperty(&_backgroundValues);
OsEng.gui()._iswa.registerProperty(&_resolution);
OsEng.gui()._iswa.registerProperty(&_transferFunctionsFile);
OsEng.gui()._iswa.registerProperty(&_fieldlines);
OsEng.gui()._iswa.registerProperty(&_dataOptions);
_dataProcessor = std::make_shared<DataProcessorKameleon>();
//If autofiler is on, background values property should be hidden
@@ -131,35 +107,22 @@ bool KameleonPlane::initialize(){
// and unregister backgroundvalues property.
if(_autoFilter.value()){
_backgroundValues.setValue(_dataProcessor->filterValues());
OsEng.gui()._iswa.unregisterProperty(&_backgroundValues);
_backgroundValues.setVisible(false);
// else if autofilter is turned off, register backgroundValues
} else {
OsEng.gui()._iswa.registerProperty(&_backgroundValues, &_autoFilter);
_backgroundValues.setVisible(true);
}
});
}
fillOptions(_kwPath);
readTransferFunctions(_transferFunctionsFile.value());
_normValues.onChange([this](){
_dataProcessor->normValues(_normValues.value());
updateTexture();
});
_useLog.onChange([this](){
_dataProcessor->useLog(_useLog.value());
updateTexture();
});
_useHistogram.onChange([this](){
_dataProcessor->useHistogram(_useHistogram.value());
updateTexture();
});
_transferFunctionsFile.onChange([this](){
readTransferFunctions(_transferFunctionsFile.value());
});
// Set Property Callbacks of DataCygnet (must be called after fillOptions)
setPropertyCallbacks();
// Set Property callback specific to KameleonPlane
_resolution.onChange([this](){
for(int i=0; i<_textures.size(); i++){
_textures[i] = std::move(nullptr);
@@ -178,14 +141,6 @@ bool KameleonPlane::initialize(){
updateFieldlineSeeds();
});
fillOptions(_kwPath);
// Has to be done after fillOptions
_dataOptions.onChange([this](){
if(_dataOptions.value().size() > MAX_TEXTURES)
LWARNING("Too many options chosen, max is " + std::to_string(MAX_TEXTURES));
updateTexture();
});
std::dynamic_pointer_cast<DataProcessorKameleon>(_dataProcessor)->dimensions(_dimensions);
_dataProcessor->addDataValues(_kwPath, _dataOptions);
// if this datacygnet has added new values then reload texture
@@ -195,7 +150,7 @@ bool KameleonPlane::initialize(){
}
updateTextureResource();
return true;
return true;
}
bool KameleonPlane::createGeometry() {
@@ -249,14 +204,14 @@ void KameleonPlane::renderGeometry() const {
}
std::vector<float*> KameleonPlane::textureData() {
return std::dynamic_pointer_cast<DataProcessorKameleon>(_dataProcessor)->processData(_kwPath, _dataOptions, _slice, _dimensions);
return std::dynamic_pointer_cast<DataProcessorKameleon>(_dataProcessor)->processData(_kwPath, _dataOptions, _dimensions, _slice);
};
bool KameleonPlane::updateTextureResource(){
_data->offset[_cut] = _data->gridMin[_cut]+_slice.value()*_scale;
_textureDirty = true;
// _textureDirty = true;
updateTexture();
return true;
}
@@ -319,62 +274,11 @@ void KameleonPlane::readFieldlinePaths(std::string indexFile){
}
void KameleonPlane::subscribeToGroup(){
// Subscribe to DataCygnet events
DataCygnet::subscribeToGroup();
//Add additional Events specific to KameleonPlane
auto groupEvent = _group->groupEvent();
groupEvent->subscribe(name(), "useLogChanged", [&](const ghoul::Dictionary& dict){
LDEBUG(name() + " Event useLogChanged");
_useLog.setValue(dict.value<bool>("useLog"));
});
groupEvent->subscribe(name(), "normValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event normValuesChanged");
glm::vec2 values;
bool success = dict.getValue("normValues", values);
if(success){
_normValues.setValue(values);
}
});
groupEvent->subscribe(name(), "useHistogramChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event useHistogramChanged");
_useHistogram.setValue(dict.value<bool>("useHistogram"));
});
groupEvent->subscribe(name(), "dataOptionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event dataOptionsChanged");
std::vector<int> values;
bool success = dict.getValue<std::vector<int> >("dataOptions", values);
if(success){
_dataOptions.setValue(values);
}
});
groupEvent->subscribe(name(), "transferFunctionsChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event transferFunctionsChanged");
_transferFunctionsFile.setValue(dict.value<std::string>("transferFunctions"));
});
groupEvent->subscribe(name(), "backgroundValuesChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event backgroundValuesChanged");
glm::vec2 values;
bool success = dict.getValue("backgroundValues", values);
if(success){
_backgroundValues.setValue(values);
}
});
groupEvent->subscribe(name(), "autoFilterChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event autoFilterChanged");
_autoFilter.setValue(dict.value<bool>("autoFilter"));
});
groupEvent->subscribe(name(), "updateGroup", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event updateGroup");
if(_autoFilter.value())
_backgroundValues.setValue(_dataProcessor->filterValues());
updateTexture();
});
groupEvent->subscribe(name(), "resolutionChanged", [&](ghoul::Dictionary dict){
LDEBUG(name() + " Event resolutionChanged");
float resolution;
@@ -391,7 +295,6 @@ void KameleonPlane::subscribeToGroup(){
if(success){
changeKwPath(path);
}
updateTexture();
});
}

View File

@@ -26,7 +26,6 @@
#define __KAMELEONPLANE_H__
#include <modules/iswa/rendering/datacygnet.h>
#include <openspace/properties/vectorproperty.h>
#include <openspace/properties/selectionproperty.h>
namespace openspace{
@@ -41,8 +40,8 @@ namespace openspace{
*/
class KameleonPlane : public DataCygnet {
public:
KameleonPlane(const ghoul::Dictionary& dictionary);
~KameleonPlane();
KameleonPlane(const ghoul::Dictionary& dictionary);
~KameleonPlane();
bool initialize() override;
bool deinitialize() override;
@@ -77,21 +76,12 @@ private:
void subscribeToGroup();
void changeKwPath(std::string path);
static int id();
static int id();
properties::FloatProperty _resolution;
properties::FloatProperty _slice;
properties::StringProperty _transferFunctionsFile;
properties::SelectionProperty _fieldlines;
properties::Vec2Property _backgroundValues;
properties::Vec2Property _normValues;
properties::BoolProperty _useLog;
properties::BoolProperty _useHistogram;
properties::BoolProperty _autoFilter;
std::string _kwPath;
glm::size3_t _dimensions;

Some files were not shown because too many files have changed in this diff Show More