-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
ShuttleOFX
committed
Jun 28, 2016
0 parents
commit dfa7ef5
Showing
10 changed files
with
923 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Compiled Object files | ||
*.slo | ||
*.lo | ||
*.o | ||
*.obj | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Compiled Dynamic libraries | ||
*.so | ||
*.dylib | ||
*.dll | ||
|
||
# Fortran module files | ||
*.mod | ||
|
||
# Compiled Static libraries | ||
*.lai | ||
*.la | ||
*.a | ||
*.lib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
[submodule "openfx"] | ||
path = openfx | ||
url = https://github.com/tuttleofx/openfx.git | ||
branch = addCMakeFiles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
sudo: required | ||
services: | ||
- docker | ||
|
||
language: cpp | ||
|
||
os: | ||
- linux | ||
|
||
compiler: | ||
- gcc | ||
- clang | ||
|
||
env: | ||
global: | ||
- PLUGIN_BUILD=${TRAVIS_BUILD_DIR}/build | ||
- PLUGIN_INSTALL=${TRAVIS_BUILD_DIR}/install | ||
|
||
# This results in a 2x2 build matrix. | ||
# Where the variables are: os / compiler | ||
|
||
script: | ||
- mkdir ${PLUGIN_BUILD} | ||
- cd ${PLUGIN_BUILD} | ||
- cmake .. -DCMAKE_INSTALL_PREFIX=${PLUGIN_INSTALL} | ||
- make all install | ||
|
||
after_success: | ||
- tar -cvzf HdrCalib.tar.gz $PLUGIN_INSTALL | ||
- curl -s -o /dev/null -w "%{http_code}" -X POST -F "file=@HdrCalib.tar.gz" http://shuttleofx.org/upload/automated/$TOKEN |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
project(HdrCalibPlugin) | ||
|
||
# Check that submodule have been initialized and updated | ||
if(NOT EXISTS ${PROJECT_SOURCE_DIR}/openfx/include) | ||
message(FATAL_ERROR | ||
"\n submodule(s) are missing, please update your repository:\n" | ||
" > git submodule update -i\n") | ||
endif() | ||
|
||
# Add openfx subdirectory | ||
add_subdirectory("${PROJECT_SOURCE_DIR}/openfx") | ||
|
||
# Build HdrCalib plugin | ||
create_ofx_plugin(HdrCalibPlugin src/) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
HdrCalib | ||
============ | ||
|
||
HdrCalib is used to compute the response function of a couple (camera / lens) from multiple groups of multi-bracketing images. This response function is a requirement in order to do a proper color calibration of an HDR. | ||
|
||
[HdrCalib on ShuttleOFX.](http://shuttleofx.org/plugin/tuttleofx.hdrcalib) | ||
|
||
## Compilation | ||
|
||
``` | ||
git submodule update -i | ||
mkdir build | ||
cd build | ||
cmake .. -DCMAKE_INSTALL_PREFIX=../install | ||
make install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
#include "HdrCalibInteract.hpp" | ||
|
||
using namespace OFX; | ||
|
||
template <class T> inline T | ||
Minimum(T a, T b) { return (a < b) ? a : b;} | ||
|
||
template <class T> inline T | ||
Absolute(T a) { return (a < 0) ? -a : a;} | ||
|
||
|
||
bool HdrCalibInteract::draw(const OFX::DrawArgs &args) | ||
{ | ||
OfxRGBColourF col; | ||
switch(_state) | ||
{ | ||
case eInActive: col.r = col.g = col.b = 0.0f; break; | ||
case ePoised: col.r = col.g = col.b = 0.5f; break; | ||
case ePicked: col.r = col.g = col.b = 1.0f; break; | ||
} | ||
|
||
// make the box a constant size on screen by scaling by the pixel scale | ||
float dx = (float)(kBoxSize.x * args.pixelScale.x); | ||
float dy = (float)(kBoxSize.y * args.pixelScale.y); | ||
|
||
// Draw a cross hair, the current coordinate system aligns with the image plane. | ||
glPushMatrix(); | ||
|
||
// draw the bo | ||
glColor3f(col.r, col.g, col.b); | ||
glTranslated(_position.x, _position.y, 0); | ||
glBegin(GL_POLYGON); | ||
glVertex2f(-dx, -dy); | ||
glVertex2f(-dx, dy); | ||
glVertex2f( dx, dy); | ||
glVertex2f( dx, -dy); | ||
glEnd(); | ||
glPopMatrix(); | ||
|
||
glPushMatrix(); | ||
// draw a complementary outline | ||
glColor3f(1.0f - col.r, 1.0f - col.g, 1.0f - col.b); | ||
glTranslated(_position.x, _position.y, 0); | ||
glBegin(GL_LINE_LOOP); | ||
glVertex2f(-dx, -dy); | ||
glVertex2f(-dx, dy); | ||
glVertex2f( dx, dy); | ||
glVertex2f( dx, -dy); | ||
glEnd(); | ||
glPopMatrix(); | ||
|
||
return true; | ||
} | ||
|
||
// overridden functions from OFX::Interact to do things | ||
bool HdrCalibInteract::penMotion(const OFX::PenArgs &args) | ||
{ | ||
// figure the size of the box in cannonical coords | ||
float dx = (float)(kBoxSize.x * args.pixelScale.x); | ||
float dy = (float)(kBoxSize.y * args.pixelScale.y); | ||
|
||
// pen position is in cannonical coords | ||
OfxPointD penPos = args.penPosition; | ||
|
||
switch(_state) { | ||
case eInActive: | ||
case ePoised: | ||
{ | ||
// are we in the box, become 'poised' | ||
StateEnum newState; | ||
penPos.x -= _position.x; | ||
penPos.y -= _position.y; | ||
if(Absolute(penPos.x) < dx && | ||
Absolute(penPos.y) < dy) { | ||
newState = ePoised; | ||
} | ||
else { | ||
newState = eInActive; | ||
} | ||
|
||
if(_state != newState) { | ||
// we have a new state | ||
_state = newState; | ||
|
||
// and force an overlay redraw | ||
_effect->redrawOverlays(); | ||
} | ||
} | ||
break; | ||
case ePicked: | ||
{ | ||
// move our position | ||
_position = penPos; | ||
|
||
// and force an overlay redraw | ||
_effect->redrawOverlays(); | ||
} | ||
break; | ||
} | ||
|
||
// we have trapped it only if the mouse ain't over it or we are actively dragging | ||
return _state != eInActive; | ||
} | ||
|
||
bool HdrCalibInteract::penDown(const OFX::PenArgs &args) | ||
{ | ||
// this will refigure the state | ||
penMotion(args); | ||
|
||
// if poised means we were over it when the pen went down, so pick it | ||
if(_state == ePoised) { | ||
// we are now picked | ||
_state = ePicked; | ||
|
||
// move our position | ||
_position = args.penPosition; | ||
|
||
// and request a redraw just incase | ||
_effect->redrawOverlays(); | ||
} | ||
|
||
return _state == ePicked; | ||
} | ||
|
||
bool HdrCalibInteract::penUp(const OFX::PenArgs &args) | ||
{ | ||
if(_state == ePicked) { | ||
// reset to poised for a moment | ||
_state = ePoised; | ||
|
||
// this will refigure the state | ||
penMotion(args); | ||
|
||
// and redraw for good measure | ||
_effect->redrawOverlays(); | ||
|
||
// we did trap it | ||
return true; | ||
} | ||
|
||
// we didn't trap it | ||
return false; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#pragma once | ||
|
||
#ifdef _WINDOWS | ||
#include <windows.h> | ||
#endif | ||
#ifdef __APPLE__ | ||
#include <OpenGL/gl.h> | ||
#else | ||
#include <GL/gl.h> | ||
#endif | ||
|
||
#include "ofxsImageEffect.h" | ||
#include "ofxsInteract.h" | ||
|
||
//////////////////////////////////////////////////////////////////////////////// | ||
// a dumb interact that just draw's a square you can drag | ||
static const OfxPointD kBoxSize = {20, 20}; | ||
|
||
class HdrCalibInteract : public OFX::OverlayInteract | ||
{ | ||
protected: | ||
enum StateEnum { | ||
eInActive, | ||
ePoised, | ||
ePicked | ||
}; | ||
|
||
OfxPointD _position; | ||
StateEnum _state; | ||
|
||
public: | ||
HdrCalibInteract(OfxInteractHandle handle, OFX::ImageEffect* /*effect*/) | ||
: OFX::OverlayInteract(handle) | ||
, _state(eInActive) | ||
{ | ||
_position.x = 0; | ||
_position.y = 0; | ||
} | ||
|
||
// overridden functions from OFX::Interact to do things | ||
virtual bool draw(const OFX::DrawArgs &args); | ||
virtual bool penMotion(const OFX::PenArgs &args); | ||
virtual bool penDown(const OFX::PenArgs &args); | ||
virtual bool penUp(const OFX::PenArgs &args); | ||
}; | ||
|
||
class HdrCalibOverlayDescriptor : public OFX::DefaultEffectOverlayDescriptor<HdrCalibOverlayDescriptor, HdrCalibInteract> | ||
{}; |
Oops, something went wrong.