mirror of
https://github.com/OpenSpace/OpenSpace.git
synced 2026-01-02 01:30:34 -06:00
Transfer function to dataplan and ColorBar
This commit is contained in:
@@ -83,8 +83,10 @@ public:
|
||||
|
||||
static void setPscUniforms(ghoul::opengl::ProgramObject& program, const Camera& camera, const PowerScaledCoordinate& position);
|
||||
|
||||
private:
|
||||
protected:
|
||||
properties::BoolProperty _enabled;
|
||||
|
||||
private:
|
||||
PowerScaledScalar boundingSphere_;
|
||||
std::string _startTime;
|
||||
std::string _endTime;
|
||||
|
||||
@@ -31,6 +31,7 @@ set(HEADER_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/dataplane.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/textureplane.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacecygnet.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/colorbar.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager.h
|
||||
)
|
||||
source_group("Header Files" FILES ${HEADER_FILES})
|
||||
@@ -42,6 +43,7 @@ set(SOURCE_FILES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/dataplane.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/textureplane.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/screenspacecygnet.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/rendering/colorbar.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/util/iswamanager.cpp
|
||||
)
|
||||
source_group("Source Files" FILES ${SOURCE_FILES})
|
||||
@@ -49,6 +51,10 @@ 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/colorbar_fs.glsl
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/shaders/colorbar_vs.glsl
|
||||
)
|
||||
|
||||
source_group("Shader Files" FILES ${SHADER_FILES})
|
||||
|
||||
149
modules/iswa/rendering/colorbar.cpp
Normal file
149
modules/iswa/rendering/colorbar.cpp
Normal file
@@ -0,0 +1,149 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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/iswa/rendering/colorbar.h>
|
||||
#include <openspace/engine/openspaceengine.h>
|
||||
#include <openspace/rendering/renderengine.h>
|
||||
#include <ghoul/opengl/textureunit.h>
|
||||
|
||||
namespace openspace{
|
||||
ColorBar::ColorBar()
|
||||
:_shader(nullptr)
|
||||
,_texture(nullptr)
|
||||
,_quad(0)
|
||||
,_vertexPositionBuffer(0)
|
||||
{}
|
||||
|
||||
bool ColorBar::initialize(){
|
||||
std::cout << "initializeing colorbar" << std::endl;
|
||||
if (_shader == nullptr) {
|
||||
// DatePlane Program
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("ColorBarProgram",
|
||||
"${MODULE_ISWA}/shaders/colorbar_vs.glsl",
|
||||
"${MODULE_ISWA}/shaders/colorbar_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
}
|
||||
|
||||
createPlane();
|
||||
|
||||
glm::size3_t dimensions = glm::size3_t(300,100,1);
|
||||
ghoul::opengl::Texture::FilterMode filtermode = ghoul::opengl::Texture::FilterMode::Linear;
|
||||
ghoul::opengl::Texture::WrappingMode wrappingmode = ghoul::opengl::Texture::WrappingMode::ClampToEdge;
|
||||
|
||||
_texture =
|
||||
std::make_unique<ghoul::opengl::Texture>(dimensions, ghoul::opengl::Texture::Format::Red, GL_RED, GL_FLOAT, filtermode, wrappingmode);
|
||||
if(_texture){
|
||||
|
||||
std::cout << "Texture created" << std::endl;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ColorBar::deinitialize(){
|
||||
glDeleteVertexArrays(1, &_quad);
|
||||
_quad = 0;
|
||||
|
||||
glDeleteBuffers(1, &_vertexPositionBuffer);
|
||||
_vertexPositionBuffer = 0;
|
||||
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
if (_shader) {
|
||||
renderEngine.removeRenderProgram(_shader);
|
||||
_shader = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void ColorBar::render(){
|
||||
|
||||
}
|
||||
|
||||
void ColorBar::render(ColorBarData& data){
|
||||
_shader->activate();
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
glm::mat4 transform = glm::mat4(1.0);
|
||||
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", data.transform);
|
||||
|
||||
_shader->setUniform("top", data.top);
|
||||
_shader->setUniform("mid", data.mid);
|
||||
_shader->setUniform("bot", data.bot);
|
||||
_shader->setUniform("tfValues", data.tfValues);
|
||||
|
||||
setPscUniforms(*_shader.get(), data.camera, data.position);
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
_texture->bind();
|
||||
|
||||
glBindVertexArray(_quad);
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glEnable(GL_CULL_FACE);
|
||||
_shader->deactivate();
|
||||
}
|
||||
|
||||
void ColorBar::setPscUniforms(
|
||||
ghoul::opengl::ProgramObject& program,
|
||||
const Camera& camera,
|
||||
const PowerScaledCoordinate& position)
|
||||
{
|
||||
program.setUniform("campos", camera.position().vec4());
|
||||
program.setUniform("objpos", position.vec4());
|
||||
program.setUniform("camrot", camera.viewRotationMatrix());
|
||||
program.setUniform("scaling", camera.scaling());
|
||||
}
|
||||
|
||||
void ColorBar::createPlane(){
|
||||
glGenVertexArrays(1, &_quad); // generate array
|
||||
glGenBuffers(1, &_vertexPositionBuffer); // generate buffer
|
||||
|
||||
const GLfloat x = 1;
|
||||
const GLfloat y = 3;
|
||||
const GLfloat w = 7.5;
|
||||
|
||||
const GLfloat vertex_data[] = { // square of two triangles (sigh)
|
||||
// x y z w s t
|
||||
-x, -y, 0, w, 0, 1,
|
||||
x, y, 0, w, 1, 0,
|
||||
-x, y, 0, w, 0, 0,
|
||||
-x, -y, 0, w, 0, 1,
|
||||
x, -y, 0, w, 1, 1,
|
||||
x, y, 0, w, 1, 0,
|
||||
};
|
||||
|
||||
glBindVertexArray(_quad); // bind array
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vertexPositionBuffer); // bind buffer
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertex_data), vertex_data, GL_STATIC_DRAW);
|
||||
glEnableVertexAttribArray(0);
|
||||
glVertexAttribPointer(0, 4, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(0));
|
||||
glEnableVertexAttribArray(1);
|
||||
glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, sizeof(GLfloat) * 6, reinterpret_cast<void*>(sizeof(GLfloat) * 4));
|
||||
}
|
||||
|
||||
}//namespace openspace
|
||||
63
modules/iswa/rendering/colorbar.h
Normal file
63
modules/iswa/rendering/colorbar.h
Normal file
@@ -0,0 +1,63 @@
|
||||
// /*****************************************************************************************
|
||||
// * *
|
||||
// * 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 <openspace/util/powerscaledscalar.h>
|
||||
#include <openspace/util/camera.h>
|
||||
#include <ghoul/opengl/programobject.h>
|
||||
#include <ghoul/opengl/texture.h>
|
||||
|
||||
namespace openspace {
|
||||
|
||||
struct ColorBarData {
|
||||
const Camera& camera;
|
||||
psc position;
|
||||
glm::mat4 transform;
|
||||
glm::vec4 top;
|
||||
glm::vec4 mid;
|
||||
glm::vec4 bot;
|
||||
glm::vec2 tfValues;
|
||||
};
|
||||
|
||||
|
||||
class ColorBar{
|
||||
public:
|
||||
ColorBar();
|
||||
|
||||
bool initialize();
|
||||
bool deinitialize();
|
||||
|
||||
void render();
|
||||
void render(ColorBarData& data);
|
||||
// void update();
|
||||
private:
|
||||
void createPlane();
|
||||
static void setPscUniforms(ghoul::opengl::ProgramObject& program, const Camera& camera, const PowerScaledCoordinate& position);
|
||||
|
||||
std::unique_ptr<ghoul::opengl::ProgramObject> _shader;
|
||||
std::unique_ptr<ghoul::opengl::Texture> _texture;
|
||||
|
||||
GLuint _quad;
|
||||
GLuint _vertexPositionBuffer;
|
||||
};
|
||||
}
|
||||
@@ -106,6 +106,7 @@ bool CygnetPlane::createShader(){
|
||||
if (!_shader)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CygnetPlane::destroyShader(){
|
||||
|
||||
@@ -43,10 +43,25 @@ namespace openspace {
|
||||
|
||||
DataPlane::DataPlane(const ghoul::Dictionary& dictionary)
|
||||
:CygnetPlane(dictionary)
|
||||
,_topColor("topColor", "Top Color", glm::vec4(1,0,0,1), glm::vec4(0), glm::vec4(1))
|
||||
,_midColor("midColor", "Mid Color", glm::vec4(0,0,0,0), glm::vec4(0), glm::vec4(1))
|
||||
,_botColor("botColor", "Bot Color", glm::vec4(0,0,1,1), glm::vec4(0), glm::vec4(1))
|
||||
,_tfValues("tfValues", "TF Values", glm::vec2(0.5,0.1), glm::vec2(0), glm::vec2(1))
|
||||
,_colorbar(nullptr)
|
||||
{
|
||||
_id = id();
|
||||
setName("DataPlane" + std::to_string(_id));
|
||||
|
||||
addProperty(_topColor);
|
||||
addProperty(_midColor);
|
||||
addProperty(_botColor);
|
||||
addProperty(_tfValues);
|
||||
|
||||
registerProperties();
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_topColor);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_midColor);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_botColor);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_tfValues);
|
||||
|
||||
dictionary.getValue("kwPath", _kwPath);
|
||||
}
|
||||
@@ -67,7 +82,17 @@ bool DataPlane::initialize(){
|
||||
|
||||
|
||||
createPlane();
|
||||
createShader();
|
||||
|
||||
if (_shader == nullptr) {
|
||||
// DatePlane Program
|
||||
RenderEngine& renderEngine = OsEng.renderEngine();
|
||||
_shader = renderEngine.buildRenderProgram("PlaneProgram",
|
||||
"${MODULE_ISWA}/shaders/dataplane_vs.glsl",
|
||||
"${MODULE_ISWA}/shaders/dataplane_fs.glsl"
|
||||
);
|
||||
if (!_shader)
|
||||
return false;
|
||||
}
|
||||
|
||||
_dimensions = glm::size3_t(500,500,1);
|
||||
float zSlice = 0.5f;
|
||||
@@ -75,6 +100,12 @@ bool DataPlane::initialize(){
|
||||
|
||||
loadTexture();
|
||||
|
||||
std::cout << "Creating Colorbar" << std::endl;
|
||||
_colorbar = std::make_shared<ColorBar>();
|
||||
if(_colorbar){
|
||||
_colorbar->initialize();
|
||||
}
|
||||
|
||||
return isReady();
|
||||
}
|
||||
|
||||
@@ -86,6 +117,9 @@ bool DataPlane::deinitialize(){
|
||||
_kw = nullptr;
|
||||
_memorybuffer = "";
|
||||
|
||||
_colorbar->deinitialize();
|
||||
_colorbar = nullptr;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -133,9 +167,15 @@ void DataPlane::render(const RenderData& data){
|
||||
glEnable(GL_ALPHA_TEST);
|
||||
glDisable(GL_CULL_FACE);
|
||||
|
||||
_shader->setUniform("ViewProjection", OsEng.renderEngine().camera()->viewProjectionMatrix());
|
||||
_shader->setUniform("ViewProjection", data.camera.viewProjectionMatrix());
|
||||
_shader->setUniform("ModelTransform", transform);
|
||||
setPscUniforms(*_shader.get(), *OsEng.renderEngine().camera(), position);
|
||||
|
||||
_shader->setUniform("top", _topColor.value());
|
||||
_shader->setUniform("mid", _midColor.value());
|
||||
_shader->setUniform("bot", _botColor.value());
|
||||
_shader->setUniform("tfValues", _tfValues.value());
|
||||
|
||||
setPscUniforms(*_shader.get(), data.camera, position);
|
||||
|
||||
ghoul::opengl::TextureUnit unit;
|
||||
unit.activate();
|
||||
@@ -146,6 +186,19 @@ void DataPlane::render(const RenderData& data){
|
||||
glDrawArrays(GL_TRIANGLES, 0, 6);
|
||||
glEnable(GL_CULL_FACE);
|
||||
_shader->deactivate();
|
||||
|
||||
position += transform*(glm::vec4(0.5f*_data->scale.x+100.0f ,-0.5f*_data->scale.y, 0.0f, _data->scale.w));
|
||||
// RenderData data = { *_camera, psc(), doPerformanceMeasurements };
|
||||
ColorBarData cbdata = { data.camera,
|
||||
position,
|
||||
transform,
|
||||
_topColor.value(),
|
||||
_midColor.value(),
|
||||
_botColor.value(),
|
||||
_tfValues.value()
|
||||
// transform
|
||||
};
|
||||
_colorbar->render(cbdata);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,7 +235,6 @@ void DataPlane::loadTexture() {
|
||||
|
||||
_texture = std::move(texture);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void DataPlane::updateTexture(){}
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
|
||||
#include <modules/iswa/rendering/cygnetplane.h>
|
||||
#include <modules/kameleon/include/kameleonwrapper.h>
|
||||
#include <openspace/properties/vectorproperty.h>
|
||||
#include <modules/iswa/rendering/colorbar.h>
|
||||
|
||||
namespace openspace{
|
||||
namespace openspace{
|
||||
|
||||
class DataPlane : public CygnetPlane {
|
||||
class DataPlane : public CygnetPlane {
|
||||
public:
|
||||
DataPlane(const ghoul::Dictionary& dictionary);
|
||||
~DataPlane();
|
||||
@@ -46,11 +48,18 @@
|
||||
|
||||
static int id();
|
||||
|
||||
properties::Vec4Property _topColor;
|
||||
properties::Vec4Property _midColor;
|
||||
properties::Vec4Property _botColor;
|
||||
properties::Vec2Property _tfValues;
|
||||
|
||||
std::shared_ptr<KameleonWrapper> _kw;
|
||||
std::string _kwPath;
|
||||
glm::size3_t _dimensions;
|
||||
float* _dataSlice;
|
||||
std::string _var;
|
||||
|
||||
std::shared_ptr<ColorBar> _colorbar;
|
||||
};
|
||||
|
||||
} // namespace openspace
|
||||
|
||||
@@ -72,12 +72,13 @@ ISWACygnet::ISWACygnet(const ghoul::Dictionary& dictionary)
|
||||
ISWACygnet::~ISWACygnet(){}
|
||||
|
||||
void ISWACygnet::registerProperties(){
|
||||
OsEng.gui()._property.registerProperty(&_updateInterval);
|
||||
OsEng.gui()._property.registerProperty(&_delete);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_enabled);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_updateInterval);
|
||||
OsEng.gui()._iSWAproperty.registerProperty(&_delete);
|
||||
}
|
||||
|
||||
void ISWACygnet::unregisterProperties(){
|
||||
OsEng.gui()._property.unregisterProperties(name());
|
||||
OsEng.gui()._iSWAproperty.unregisterProperties(name());
|
||||
}
|
||||
|
||||
}//namespace openspac
|
||||
84
modules/iswa/shaders/colorbar_fs.glsl
Normal file
84
modules/iswa/shaders/colorbar_fs.glsl
Normal file
@@ -0,0 +1,84 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
uniform float time;
|
||||
uniform sampler2D texture1;
|
||||
|
||||
uniform vec4 top;
|
||||
uniform vec4 mid;
|
||||
uniform vec4 bot;
|
||||
uniform vec2 tfValues;
|
||||
|
||||
in vec2 vs_st;
|
||||
in vec4 vs_position;
|
||||
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
#include "fragment.glsl"
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse;
|
||||
// diffuse = top;
|
||||
// diffuse = texture(texture1, vs_st);
|
||||
// float v = texture(texture1, vs_st).r;
|
||||
float v = 1-vs_st.t;
|
||||
float x = tfValues.x;
|
||||
float y = tfValues.y;
|
||||
|
||||
// if(y == 0){
|
||||
// v = v-x;
|
||||
// diffuse = mix(bot, top, v);
|
||||
// }else{
|
||||
if(v > (x+y)){
|
||||
v = v - (x+y);
|
||||
v = v / (x-y);
|
||||
diffuse = mix(mid, top, v);
|
||||
}else if( v < (x-y)){
|
||||
v = v / (x-y);
|
||||
diffuse = mix(bot, mid, v);
|
||||
}else{
|
||||
diffuse = mid;
|
||||
}
|
||||
// }
|
||||
|
||||
// diffuse = vec4(vs_st.s, vs_st.t, 0, 1);
|
||||
// vec4 diffuse = vec4(1,vs_st,1);
|
||||
//vec4 diffuse = vec4(1,0,0,1);
|
||||
// if(position.w > 9.0) {
|
||||
// diffuse = vec4(1,0,0,1);
|
||||
// }
|
||||
|
||||
//diffuse.a = diffuse.r;
|
||||
// float tot = diffuse.r + diffuse.g + diffuse.b;
|
||||
// tot /= 3.0;
|
||||
// if (diffuse.a <= 0.05)
|
||||
// discard;
|
||||
|
||||
Fragment frag;
|
||||
frag.color = diffuse;
|
||||
frag.depth = depth;
|
||||
return frag;
|
||||
|
||||
}
|
||||
49
modules/iswa/shaders/colorbar_vs.glsl
Normal file
49
modules/iswa/shaders/colorbar_vs.glsl
Normal file
@@ -0,0 +1,49 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
|
||||
out vec2 vs_st;
|
||||
out vec4 vs_position;
|
||||
out float s;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 tmp = in_position;
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
|
||||
vs_position = tmp;
|
||||
vs_st = in_st;
|
||||
|
||||
position = ViewProjection * position;
|
||||
gl_Position = z_normalization(position);
|
||||
}
|
||||
77
modules/iswa/shaders/dataplane_fs.glsl
Normal file
77
modules/iswa/shaders/dataplane_fs.glsl
Normal file
@@ -0,0 +1,77 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
uniform float time;
|
||||
uniform sampler2D texture1;
|
||||
|
||||
uniform vec4 top;
|
||||
uniform vec4 mid;
|
||||
uniform vec4 bot;
|
||||
uniform vec2 tfValues;
|
||||
|
||||
in vec2 vs_st;
|
||||
in vec4 vs_position;
|
||||
|
||||
#include "PowerScaling/powerScaling_fs.hglsl"
|
||||
#include "fragment.glsl"
|
||||
|
||||
Fragment getFragment() {
|
||||
vec4 position = vs_position;
|
||||
float depth = pscDepth(position);
|
||||
vec4 diffuse;
|
||||
// diffuse = top;
|
||||
// diffuse = texture(texture1, vs_st);
|
||||
float v = texture(texture1, vs_st).r;
|
||||
float x = tfValues.x;
|
||||
float y = tfValues.y;
|
||||
|
||||
if(v > (x+y)){
|
||||
v = v - (x+y);
|
||||
v = v / (x-y);
|
||||
diffuse = mix(mid, top, v);
|
||||
}else if( v < (x-y)){
|
||||
v = v / (x-y);
|
||||
diffuse = mix(bot, mid, v);
|
||||
}else{
|
||||
diffuse = mid;
|
||||
}
|
||||
|
||||
// vec4 diffuse = vec4(1,vs_st,1);
|
||||
//vec4 diffuse = vec4(1,0,0,1);
|
||||
// if(position.w > 9.0) {
|
||||
// diffuse = vec4(1,0,0,1);
|
||||
// }
|
||||
|
||||
//diffuse.a = diffuse.r;
|
||||
// float tot = diffuse.r + diffuse.g + diffuse.b;
|
||||
// tot /= 3.0;
|
||||
if (diffuse.a <= 0.05)
|
||||
discard;
|
||||
|
||||
Fragment frag;
|
||||
frag.color = diffuse;
|
||||
frag.depth = depth;
|
||||
return frag;
|
||||
|
||||
}
|
||||
49
modules/iswa/shaders/dataplane_vs.glsl
Normal file
49
modules/iswa/shaders/dataplane_vs.glsl
Normal file
@@ -0,0 +1,49 @@
|
||||
/*****************************************************************************************
|
||||
* *
|
||||
* 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. *
|
||||
****************************************************************************************/
|
||||
|
||||
#version __CONTEXT__
|
||||
|
||||
uniform mat4 ViewProjection;
|
||||
uniform mat4 ModelTransform;
|
||||
|
||||
layout(location = 0) in vec4 in_position;
|
||||
layout(location = 1) in vec2 in_st;
|
||||
|
||||
out vec2 vs_st;
|
||||
out vec4 vs_position;
|
||||
out float s;
|
||||
|
||||
#include "PowerScaling/powerScaling_vs.hglsl"
|
||||
|
||||
void main()
|
||||
{
|
||||
vec4 tmp = in_position;
|
||||
vec4 position = pscTransform(tmp, ModelTransform);
|
||||
|
||||
vs_position = tmp;
|
||||
vs_st = in_st;
|
||||
|
||||
position = ViewProjection * position;
|
||||
gl_Position = z_normalization(position);
|
||||
}
|
||||
@@ -59,7 +59,7 @@ return {
|
||||
File = "${BASE_PATH}/Properties.txt"
|
||||
},
|
||||
DownloadRequestURL = "http://openspace.itn.liu.se/request.cgi",
|
||||
RenderingMethod = "ABuffer"
|
||||
RenderingMethod = "Framebuffer"
|
||||
--RenderingMethod = "ABuffer" -- alternative: "Framebuffer"
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user