adding capability to clear images on the fly

- (rest will be done on antons machine)
This commit is contained in:
Michal Marcinkowski
2015-05-13 15:19:41 -04:00
parent 9366fd4b80
commit 1369e5caf5
4 changed files with 20 additions and 3 deletions

View File

@@ -77,7 +77,7 @@ protected:
void textureBind();
void project();
void clearAllProjections();
private:
void imageProjectGPU();
@@ -88,6 +88,8 @@ private:
properties::IntProperty _rotation;
properties::FloatProperty _fadeProjection;
properties::BoolProperty _performProjection;
properties::BoolProperty _clearAllProjections;
ghoul::opengl::ProgramObject* _programObject;
ghoul::opengl::ProgramObject* _fboProgramObject;
@@ -136,6 +138,7 @@ private:
std::string _target;
std::string _frame;
std::string _defaultProjImage;
std::string _clearingImage;
std::string _next;
bool _capture;

View File

@@ -89,6 +89,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
, _rotation("rotation", "Rotation", 0, 0, 360)
, _fadeProjection("fadeProjections", "Image Fading Factor", 0.f, 0.f, 1.f)
, _performProjection("performProjection", "Perform Projections", true)
, _clearAllProjections("clearAllProjections", "Clear Projections", false)
, _programObject(nullptr)
, _fboProgramObject(nullptr)
, _texture(nullptr)
@@ -96,6 +97,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
, _textureProj(nullptr)
, _textureWhiteSquare(nullptr)
, _geometry(nullptr)
, _clearingImage(absPath("${OPENSPACE_DATA}/scene/common/textures/clear.png"))
{
std::string name;
bool success = dictionary.getValue(constants::scenegraphnode::keyName, name);
@@ -166,6 +168,7 @@ RenderablePlanetProjection::RenderablePlanetProjection(const ghoul::Dictionary&
addProperty(_rotation);
addProperty(_fadeProjection);
addProperty(_performProjection);
addProperty(_clearAllProjections);
addProperty(_colorTexturePath);
_colorTexturePath.onChange(std::bind(&RenderablePlanetProjection::loadTexture, this));
@@ -431,12 +434,23 @@ void RenderablePlanetProjection::project(){
_capture = false;
}
void RenderablePlanetProjection::clearAllProjections(){
float tmp = _fadeProjection;
_fadeProjection = 1.f;
_projectionTexturePath = _clearingImage;
imageProjectGPU();
_fadeProjection = tmp;
_clearAllProjections = false;
}
#define GPU_PROJ
void RenderablePlanetProjection::render(const RenderData& data){
if (!_programObject) return;
if (!_textureProj) return;
if (_clearAllProjections) clearAllProjections();
_camScaling = data.camera.scaling();
_up = data.camera.lookUpVector();

View File

@@ -74,7 +74,7 @@ void ImageSequencer2::updateSequencer(double time){
Time::ref().setDeltaTime(0.1);
} // Time is not properly updated when time jump with dt = 0
if (_currentTime < time){
if (_currentTime != time){
_previousTime = _currentTime;
_currentTime = time;
}