mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-06 03:29:44 -06:00
solve merge conflict
This commit is contained in:
Submodule ext/ghoul updated: ba88e7fb74...ef1063b4af
@@ -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, vs_st);
|
||||
frag.color = texture(texture1, vec2(vs_st.s, 1-vs_st.t));
|
||||
frag.color.a = (frag.color.a != 0.0f) ? Alpha : frag.color.a;
|
||||
if(frag.color.a == 0.0f){
|
||||
discard;
|
||||
|
||||
@@ -38,8 +38,8 @@ public:
|
||||
virtual bool isReady() const override;
|
||||
|
||||
protected:
|
||||
virtual void loadTexture() = 0;
|
||||
virtual void updateTexture() = 0;
|
||||
virtual bool loadTexture() = 0;
|
||||
virtual bool updateTexture() = 0;
|
||||
|
||||
void createPlane();
|
||||
void destroyPlane();
|
||||
|
||||
@@ -231,17 +231,17 @@ void DataPlane::update(const UpdateData& data){
|
||||
}
|
||||
}
|
||||
|
||||
if(_futureData && _futureData->isFinished){
|
||||
if(_futureData && _futureData->isFinished && _memorybuffer != ""){
|
||||
if(!_dataOptions.options().size()){
|
||||
readHeader();
|
||||
}
|
||||
loadTexture();
|
||||
_futureData = nullptr;
|
||||
|
||||
if(loadTexture())
|
||||
_futureData = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void DataPlane::readHeader(){
|
||||
// std::cout << "In the read header function" << std::endl;
|
||||
if(!_memorybuffer.empty()){
|
||||
std::stringstream memorystream(_memorybuffer);
|
||||
std::string line;
|
||||
@@ -249,9 +249,7 @@ void DataPlane::readHeader(){
|
||||
int numOptions = 0;
|
||||
while(getline(memorystream,line)){
|
||||
if(line.find("#") == 0){
|
||||
// std::cout << "Comment line" << std::endl;
|
||||
if(line.find("# Output data:") == 0){
|
||||
// std::cout << "the line with the good stuff" << std::endl;
|
||||
|
||||
line = line.substr(26);
|
||||
std::stringstream ss(line);
|
||||
@@ -271,7 +269,6 @@ void DataPlane::readHeader(){
|
||||
ss = std::stringstream(line);
|
||||
std::string option;
|
||||
while(ss >> option){
|
||||
// std::cout << option << std::endl;
|
||||
if(option != "x" && option != "y" && option != "z"){
|
||||
_dataOptions.addOption({numDataOptions, option});
|
||||
numDataOptions++;
|
||||
@@ -286,7 +283,7 @@ void DataPlane::readHeader(){
|
||||
}
|
||||
}
|
||||
}else{
|
||||
LERROR("Noting in memory buffer, are you connected to the information super highway?");
|
||||
LWARNING("Noting in memory buffer, are you connected to the information super highway?");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -336,8 +333,10 @@ float* DataPlane::readData(){
|
||||
}
|
||||
}
|
||||
|
||||
if(numValues != _dimensions.x*_dimensions.y)
|
||||
LERROR("Number of values read and expected are not the same");
|
||||
if(numValues != _dimensions.x*_dimensions.y){
|
||||
LWARNING("Number of values read and expected are not the same");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for(int i=0; i< numValues; i++){
|
||||
combinedValues[i] = 0;
|
||||
@@ -350,19 +349,26 @@ float* DataPlane::readData(){
|
||||
return combinedValues;
|
||||
|
||||
}else{
|
||||
LERROR("Noting in memory buffer, are you connected to the information super highway?");
|
||||
LWARNING("Noting in memory buffer, are you connected to the information super highway?");
|
||||
}
|
||||
}
|
||||
|
||||
void DataPlane::loadTexture() {
|
||||
bool DataPlane::loadTexture() {
|
||||
float* values = readData();
|
||||
if(!values){
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_texture) {
|
||||
ghoul::opengl::Texture::FilterMode filtermode = ghoul::opengl::Texture::FilterMode::Linear;
|
||||
ghoul::opengl::Texture::WrappingMode wrappingmode = ghoul::opengl::Texture::WrappingMode::ClampToEdge;
|
||||
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture =
|
||||
std::make_unique<ghoul::opengl::Texture>(values, _dimensions, ghoul::opengl::Texture::Format::Red, GL_RED, GL_FLOAT, filtermode, wrappingmode);
|
||||
std::unique_ptr<ghoul::opengl::Texture> texture = std::make_unique<ghoul::opengl::Texture>(
|
||||
values,
|
||||
_dimensions,
|
||||
ghoul::opengl::Texture::Format::Red,
|
||||
GL_RED,
|
||||
GL_FLOAT,
|
||||
ghoul::opengl::Texture::FilterMode::Linear,
|
||||
ghoul::opengl::Texture::WrappingMode::ClampToEdge
|
||||
);
|
||||
|
||||
if(texture){
|
||||
texture->uploadTexture();
|
||||
@@ -373,15 +379,19 @@ void DataPlane::loadTexture() {
|
||||
_texture->setPixelData(values);
|
||||
_texture->uploadTexture();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void DataPlane::updateTexture(){
|
||||
bool DataPlane::updateTexture(){
|
||||
_memorybuffer = "";
|
||||
std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadDataToMemory(_data->id, _memorybuffer);
|
||||
|
||||
if(future){
|
||||
_futureData = future;
|
||||
return (_memorybuffer != "");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int DataPlane::id(){
|
||||
|
||||
@@ -44,8 +44,8 @@ class DataPlane : public CygnetPlane {
|
||||
virtual void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
virtual void loadTexture() override;
|
||||
virtual void updateTexture() override;
|
||||
virtual bool loadTexture() override;
|
||||
virtual bool updateTexture() override;
|
||||
void readHeader();
|
||||
float* readData();
|
||||
|
||||
|
||||
@@ -154,7 +154,7 @@ void TexturePlane::update(const UpdateData& data){
|
||||
}
|
||||
}
|
||||
|
||||
void TexturePlane::loadTexture() {
|
||||
bool TexturePlane::loadTexture() {
|
||||
// std::cout << _data->path << std::endl;
|
||||
// std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath(_data->path));
|
||||
//std::unique_ptr<ghoul::opengl::Texture> texture = ghoul::io::TextureReader::ref().loadTexture(absPath("${OPENSPACE_DATA}/GM_openspace_Z0_20150315_000000.png"));
|
||||
@@ -168,18 +168,26 @@ void TexturePlane::loadTexture() {
|
||||
texture->setFilter(ghoul::opengl::Texture::FilterMode::Linear);
|
||||
|
||||
_texture = std::move(texture);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void TexturePlane::updateTexture(){
|
||||
bool TexturePlane::updateTexture(){
|
||||
_memorybuffer = "";
|
||||
std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImageToMemory(_data->id, _memorybuffer);
|
||||
|
||||
// std::shared_ptr<DownloadManager::FileFuture> future = ISWAManager::ref().downloadImage(_data->id, absPath(_data->path));
|
||||
if(future){
|
||||
_futureTexture = future;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
int TexturePlane::id(){
|
||||
|
||||
@@ -43,8 +43,8 @@
|
||||
virtual void update(const UpdateData& data) override;
|
||||
|
||||
private:
|
||||
virtual void loadTexture() override;
|
||||
virtual void updateTexture() override;
|
||||
virtual bool loadTexture() override;
|
||||
virtual bool updateTexture() override;
|
||||
|
||||
static int id();
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse;
|
||||
diffuse = texture(texture1, vs_st);
|
||||
diffuse = texture(texture1, vec2(vs_st.s, 1-vs_st.t));
|
||||
|
||||
//vec4 diffuse = vec4(1,vs_st,1);
|
||||
//vec4 diffuse = vec4(1,0,0,1);
|
||||
|
||||
@@ -41,7 +41,7 @@ Fragment getFragment() {
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse;
|
||||
// diffuse = top;
|
||||
diffuse = texture(texture1, vs_st);
|
||||
diffuse = texture(texture1, vec2(vs_st.s, 1-vs_st.t));
|
||||
//float v = texture(texture1, vs_st).r;
|
||||
//float x = tfValues.x;
|
||||
//float y = tfValues.y;
|
||||
|
||||
@@ -204,7 +204,7 @@ namespace openspace{
|
||||
}else if ((*it)->type == "DATA"){
|
||||
createPlane((*it)->id,(*it)->json,std::string("DataPlane"));
|
||||
} else {
|
||||
LDEBUG("\""+ (*it)->type + "\" is not a valid type");
|
||||
LERROR("\""+ (*it)->type + "\" is not a valid type");
|
||||
}
|
||||
it = _metaFutures.erase( it );
|
||||
}else{
|
||||
|
||||
Reference in New Issue
Block a user