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
#include "ofMain.h" | |
#include "DKAppController.h" | |
#include "DKTimelineController.h" | |
#include "ofAppGLFWWindow.h" | |
//======================================================================== | |
int main( ){ | |
int guiPanelWidth = 454; | |
ofGLFWWindowSettings settings; | |
settings.width = 1920-guiPanelWidth; |
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
cpp | |
ofLight myLight; | |
ofEnableLight(); | |
myLight.begin(); --> registers the light with the ofGLRenderer | |
myShader.begin(); --> register the shader with ofGLRrenderer, which then passing all enabled lights to it as a uniform | |
myMaterial.begin(); --> registers |
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
float depthValueFromSample( vec2 depthPos){ | |
vec2 halfvec = vec2(.5,.5); | |
vec3 hsl = rgb2hsl( texture2DRect(texture, floor(depthPos) + halfvec ).xyz ); | |
float depth = hsl.r; | |
if(hsl.b > .2){ | |
return depth * ( maxDepth - minDepth ) + minDepth; | |
} | |
else { | |
return 0.0; | |
} |
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
DRAW CODE: | |
cam.begin(); | |
glPointSize(4); | |
ofSetColor(ofColor::green, 128); | |
West_SouthWest.checkPointMesh.drawVertices(); | |
West_SouthWest.renderer.getMesh().drawVertices(); | |
ofPushMatrix(); |
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
//Convert an RGB vec3 to an HSL vec3. We use the HUE value to encode depth, while SATURATION and BRIGHTNESS are always maxed out | |
vec3 rgb2hsl( vec3 _input ){ | |
float h = 0.0; | |
float s = 0.0; | |
float l = 0.0; | |
float r = _input.r; | |
float g = _input.g; | |
float b = _input.b; |
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
vec3 rgb2hsl( vec3 _input ){ | |
float h = 0.0; | |
float s = 0.0; | |
float l = 0.0; | |
float r = _input.r; | |
float g = _input.g; | |
float b = _input.b; | |
float cMin = min( r, min( g, b ) ); | |
float cMax = max( r, max( g, b ) ); |
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
// This makes relative paths work in C++ in Xcode by changing directory to the Resources folder inside the .app bundle | |
// this way you can include your images in the copy phase of the project and don't have to rely on a data/ folder for distribution | |
#ifdef TARGET_OSX | |
ofDisableDataPath(); | |
CFBundleRef mainBundle = CFBundleGetMainBundle(); | |
CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL(mainBundle); | |
char path[PATH_MAX]; | |
CFURLGetFileSystemRepresentation(resourcesURL, TRUE, (UInt8 *)path, PATH_MAX); | |
CFRelease(resourcesURL); |