Skip to content

Commit

Permalink
depth of fieldness
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed May 6, 2012
1 parent 3ae95ae commit 1f3df6c
Show file tree
Hide file tree
Showing 5 changed files with 215 additions and 27 deletions.
93 changes: 93 additions & 0 deletions CloudsChaos/CloudsInterlude.xcodeproj/project.pbxproj
Expand Up @@ -61,6 +61,21 @@
E704A2CA147AACF9002064D0 /* ofxGameCamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E704A2C6147AACF9002064D0 /* ofxGameCamera.cpp */; };
E73BE0B314A3B784004FE0E5 /* ofxDepthImageCompressor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E73BE0B114A3B784004FE0E5 /* ofxDepthImageCompressor.cpp */; };
E791C1EE1555A1DA00DDE2C7 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = E791C1ED1555A1DA00DDE2C7 /* libz.dylib */; };
E791C1F11555DADC00DDE2C7 /* unproject.frag in Sources */ = {isa = PBXBuildFile; fileRef = E791C1EF1555DADB00DDE2C7 /* unproject.frag */; };
E791C1F21555DADC00DDE2C7 /* unproject.vert in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F01555DADB00DDE2C7 /* unproject.vert */; };
E791C1FB1555DC5700DDE2C7 /* dofblur.frag in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F31555DC5700DDE2C7 /* dofblur.frag */; };
E791C1FC1555DC5700DDE2C7 /* dofblur.vert in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F41555DC5700DDE2C7 /* dofblur.vert */; };
E791C1FD1555DC5700DDE2C7 /* DOFCloud.frag in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F51555DC5700DDE2C7 /* DOFCloud.frag */; };
E791C1FE1555DC5700DDE2C7 /* DOFCloud.vert in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F61555DC5700DDE2C7 /* DOFCloud.vert */; };
E791C1FF1555DC5700DDE2C7 /* dofrange.frag in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F71555DC5700DDE2C7 /* dofrange.frag */; };
E791C2001555DC5700DDE2C7 /* dofrange.vert in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F81555DC5700DDE2C7 /* dofrange.vert */; };
E791C2011555DC5700DDE2C7 /* unproject.frag in Sources */ = {isa = PBXBuildFile; fileRef = E791C1F91555DC5700DDE2C7 /* unproject.frag */; };
E791C2021555DC5700DDE2C7 /* unproject.vert in Sources */ = {isa = PBXBuildFile; fileRef = E791C1FA1555DC5700DDE2C7 /* unproject.vert */; };
E791C2171555FAC100DDE2C7 /* ofxBaseGui.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E791C20C1555FAC100DDE2C7 /* ofxBaseGui.cpp */; };
E791C2181555FAC100DDE2C7 /* ofxButton.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E791C20E1555FAC100DDE2C7 /* ofxButton.cpp */; };
E791C2191555FAC100DDE2C7 /* ofxPanel.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E791C2111555FAC100DDE2C7 /* ofxPanel.cpp */; };
E791C21A1555FAC100DDE2C7 /* ofxSlider.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E791C2131555FAC100DDE2C7 /* ofxSlider.cpp */; };
E791C21B1555FAC100DDE2C7 /* ofxToggle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E791C2151555FAC100DDE2C7 /* ofxToggle.cpp */; };
E7DF569A147CA28300A3A9C7 /* ofxTimeline.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7DF5677147CA28300A3A9C7 /* ofxTimeline.cpp */; };
E7DF569C147CA28300A3A9C7 /* ofxTLElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7DF567C147CA28300A3A9C7 /* ofxTLElement.cpp */; };
E7DF569D147CA28300A3A9C7 /* ofxTLElementHeader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7DF567E147CA28300A3A9C7 /* ofxTLElementHeader.cpp */; };
Expand Down Expand Up @@ -307,6 +322,29 @@
E73BE0B114A3B784004FE0E5 /* ofxDepthImageCompressor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxDepthImageCompressor.cpp; sourceTree = "<group>"; };
E73BE0B214A3B784004FE0E5 /* ofxDepthImageCompressor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxDepthImageCompressor.h; sourceTree = "<group>"; };
E791C1ED1555A1DA00DDE2C7 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; };
E791C1EF1555DADB00DDE2C7 /* unproject.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = unproject.frag; sourceTree = "<group>"; };
E791C1F01555DADB00DDE2C7 /* unproject.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = unproject.vert; sourceTree = "<group>"; };
E791C1F31555DC5700DDE2C7 /* dofblur.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dofblur.frag; sourceTree = "<group>"; };
E791C1F41555DC5700DDE2C7 /* dofblur.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dofblur.vert; sourceTree = "<group>"; };
E791C1F51555DC5700DDE2C7 /* DOFCloud.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = DOFCloud.frag; sourceTree = "<group>"; };
E791C1F61555DC5700DDE2C7 /* DOFCloud.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = DOFCloud.vert; sourceTree = "<group>"; };
E791C1F71555DC5700DDE2C7 /* dofrange.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dofrange.frag; sourceTree = "<group>"; };
E791C1F81555DC5700DDE2C7 /* dofrange.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = dofrange.vert; sourceTree = "<group>"; };
E791C1F91555DC5700DDE2C7 /* unproject.frag */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = unproject.frag; sourceTree = "<group>"; };
E791C1FA1555DC5700DDE2C7 /* unproject.vert */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.glsl; path = unproject.vert; sourceTree = "<group>"; };
E791C20A1555FAC100DDE2C7 /* ofOscParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofOscParameter.h; sourceTree = "<group>"; };
E791C20B1555FAC100DDE2C7 /* ofParameter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofParameter.h; sourceTree = "<group>"; };
E791C20C1555FAC100DDE2C7 /* ofxBaseGui.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxBaseGui.cpp; sourceTree = "<group>"; };
E791C20D1555FAC100DDE2C7 /* ofxBaseGui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxBaseGui.h; sourceTree = "<group>"; };
E791C20E1555FAC100DDE2C7 /* ofxButton.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxButton.cpp; sourceTree = "<group>"; };
E791C20F1555FAC100DDE2C7 /* ofxButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxButton.h; sourceTree = "<group>"; };
E791C2101555FAC100DDE2C7 /* ofxGui.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxGui.h; sourceTree = "<group>"; };
E791C2111555FAC100DDE2C7 /* ofxPanel.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxPanel.cpp; sourceTree = "<group>"; };
E791C2121555FAC100DDE2C7 /* ofxPanel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxPanel.h; sourceTree = "<group>"; };
E791C2131555FAC100DDE2C7 /* ofxSlider.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxSlider.cpp; sourceTree = "<group>"; };
E791C2141555FAC100DDE2C7 /* ofxSlider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxSlider.h; sourceTree = "<group>"; };
E791C2151555FAC100DDE2C7 /* ofxToggle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxToggle.cpp; sourceTree = "<group>"; };
E791C2161555FAC100DDE2C7 /* ofxToggle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxToggle.h; sourceTree = "<group>"; };
E7DF5677147CA28300A3A9C7 /* ofxTimeline.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxTimeline.cpp; sourceTree = "<group>"; };
E7DF5678147CA28300A3A9C7 /* ofxTimeline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxTimeline.h; sourceTree = "<group>"; };
E7DF567C147CA28300A3A9C7 /* ofxTLElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxTLElement.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -848,6 +886,16 @@
A69D77DC14E0E5A900963BF2 /* shaders */ = {
isa = PBXGroup;
children = (
E791C1F31555DC5700DDE2C7 /* dofblur.frag */,
E791C1F41555DC5700DDE2C7 /* dofblur.vert */,
E791C1F51555DC5700DDE2C7 /* DOFCloud.frag */,
E791C1F61555DC5700DDE2C7 /* DOFCloud.vert */,
E791C1F71555DC5700DDE2C7 /* dofrange.frag */,
E791C1F81555DC5700DDE2C7 /* dofrange.vert */,
E791C1F91555DC5700DDE2C7 /* unproject.frag */,
E791C1FA1555DC5700DDE2C7 /* unproject.vert */,
E791C1EF1555DADB00DDE2C7 /* unproject.frag */,
E791C1F01555DADB00DDE2C7 /* unproject.vert */,
);
path = shaders;
sourceTree = "<group>";
Expand Down Expand Up @@ -891,6 +939,7 @@
BB4B014C10F69532006C3DED /* addons */ = {
isa = PBXGroup;
children = (
E791C2081555FAC100DDE2C7 /* ofxGui */,
A6EE319A14E21B030068A5E7 /* ofxCameraTrack */,
F39CB64014C76F1700E2DB17 /* ofxRange */,
E7F4F31014AFF9C200198383 /* ofxMSAInteractiveObject */,
Expand Down Expand Up @@ -1008,6 +1057,35 @@
path = src;
sourceTree = "<group>";
};
E791C2081555FAC100DDE2C7 /* ofxGui */ = {
isa = PBXGroup;
children = (
E791C2091555FAC100DDE2C7 /* src */,
);
name = ofxGui;
path = ../../../addons/ofxGui;
sourceTree = "<group>";
};
E791C2091555FAC100DDE2C7 /* src */ = {
isa = PBXGroup;
children = (
E791C20A1555FAC100DDE2C7 /* ofOscParameter.h */,
E791C20B1555FAC100DDE2C7 /* ofParameter.h */,
E791C20C1555FAC100DDE2C7 /* ofxBaseGui.cpp */,
E791C20D1555FAC100DDE2C7 /* ofxBaseGui.h */,
E791C20E1555FAC100DDE2C7 /* ofxButton.cpp */,
E791C20F1555FAC100DDE2C7 /* ofxButton.h */,
E791C2101555FAC100DDE2C7 /* ofxGui.h */,
E791C2111555FAC100DDE2C7 /* ofxPanel.cpp */,
E791C2121555FAC100DDE2C7 /* ofxPanel.h */,
E791C2131555FAC100DDE2C7 /* ofxSlider.cpp */,
E791C2141555FAC100DDE2C7 /* ofxSlider.h */,
E791C2151555FAC100DDE2C7 /* ofxToggle.cpp */,
E791C2161555FAC100DDE2C7 /* ofxToggle.h */,
);
path = src;
sourceTree = "<group>";
};
E7DF5672147CA27600A3A9C7 /* ofxTimeline */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -1378,6 +1456,21 @@
A6ECC6BD15300A820009D0D9 /* ofxDepthHoleFiller.cpp in Sources */,
A6A315BB1554886E003D7222 /* ofxRGBDRenderSettings.cpp in Sources */,
A6A315BE155488A3003D7222 /* ofxRGBDMediaTake.cpp in Sources */,
E791C1F11555DADC00DDE2C7 /* unproject.frag in Sources */,
E791C1F21555DADC00DDE2C7 /* unproject.vert in Sources */,
E791C1FB1555DC5700DDE2C7 /* dofblur.frag in Sources */,
E791C1FC1555DC5700DDE2C7 /* dofblur.vert in Sources */,
E791C1FD1555DC5700DDE2C7 /* DOFCloud.frag in Sources */,
E791C1FE1555DC5700DDE2C7 /* DOFCloud.vert in Sources */,
E791C1FF1555DC5700DDE2C7 /* dofrange.frag in Sources */,
E791C2001555DC5700DDE2C7 /* dofrange.vert in Sources */,
E791C2011555DC5700DDE2C7 /* unproject.frag in Sources */,
E791C2021555DC5700DDE2C7 /* unproject.vert in Sources */,
E791C2171555FAC100DDE2C7 /* ofxBaseGui.cpp in Sources */,
E791C2181555FAC100DDE2C7 /* ofxButton.cpp in Sources */,
E791C2191555FAC100DDE2C7 /* ofxPanel.cpp in Sources */,
E791C21A1555FAC100DDE2C7 /* ofxSlider.cpp in Sources */,
E791C21B1555FAC100DDE2C7 /* ofxToggle.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 3 additions & 0 deletions CloudsChaos/bin/data/shaders/DOFCloud.frag
@@ -0,0 +1,3 @@
void main() {
gl_FragColor = gl_Color;
}
29 changes: 29 additions & 0 deletions CloudsChaos/bin/data/shaders/DOFCloud.vert
@@ -0,0 +1,29 @@
//uniform sampler2DRect src_tex_unit0;

uniform float focalDistance;
uniform float focalRange;
uniform float maxSize;
uniform float minSize;

const float PI = 3.14159265;
//const float maxSize = 32.;

void main() {
//get the homogeneous 2d position
//gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
// use the distance from the camera and aperture to determine the radius
// the +1 is because point sizes <1 are rendered differently than those >1
//gl_PointSize = min(maxSize, abs(gl_Position.z - focalDistance) * aperture + 1.);
gl_Position = ftransform();
gl_PointSize = min(maxSize, abs(gl_Position.z - focalDistance) / focalRange + minSize);
gl_FrontColor = gl_Color;
float radius = gl_PointSize / 2.;

//gl_FrontColor = texture2DRect(src_tex_unit0, gl_MultiTexCoord0.xy);
// divide the color alpha by the area
//gl_FrontColor.a *= focalRange;
//gl_FrontColor.a /= PI * radius * radius;
gl_FrontColor.a = 1.0 - (gl_PointSize - minSize) / (maxSize - minSize);
//gl_PointSize = 4.0;
//gl_FrontColor = vec4(1.0);
}
99 changes: 75 additions & 24 deletions CloudsChaos/src/testApp.cpp
Expand Up @@ -29,32 +29,43 @@ void testApp::setup(){
timeline.setDurationInFrames(500);
timeline.setOffset(ofVec2f(0,0));

int absoluteMaxParticles = 1000000;
useShader = false;

int absoluteMaxParticles = 40000;
depthImages.setup();
timeline.setPageName("Source");
timeline.addElement("Depth", &depthImages);
timeline.addKeyframes("Simplify", "zthreshold.xml", ofRange(0, 8 ), 2);
timeline.addKeyframes("Z Threshold", "zthreshold.xml", ofRange(0, sqrtf(5000) ), sqrtf(5000));
timeline.addKeyframes("Edge Snip", "edgesnip.xml", ofRange(0, sqrtf(2000) ), sqrtf(2000));



timeline.addPage("Particles");
timeline.addKeyframes("Max Particles", "maxParticles.xml", ofRange(10, absoluteMaxParticles) );
timeline.addKeyframes("Birthrate", "particleBirthrate.xml", ofRange(.001, .01) );
timeline.addKeyframes("Lifespan", "particleLifespan.xml", ofRange(2, 300) );
timeline.addKeyframes("Lifespan Variance", "particleLifespanVariance.xml", ofRange(0, 100) );
timeline.addKeyframes("Drag Force", "particleDragFroce.xml", ofRange(0, 1.0), 0);

timeline.addPage("DOF");
timeline.addKeyframes("Focal Distance", "dofFocalDistance.xml", ofRange(0, 2000));
timeline.addKeyframes("Focal Range", "dofFocalRange.xml", ofRange(0, 500));
timeline.addKeyframes("Min Point Size", "dofMinPoint.xml", ofRange(1, 5));
timeline.addKeyframes("Max Point Size", "dofMaxPoint.xml", ofRange(10, 45));

timeline.addPage("Perlin");
timeline.addKeyframes("Perlin Amplitude", "perlinAmplitude.xml", ofRange(1, sqrtf(200)) );
timeline.addKeyframes("Perlin Amplitude", "perlinAmplitude.xml", ofRange(0, sqrtf(200)) );
timeline.addKeyframes("Perlin Density", "perlinDensity.xml", ofRange(0, sqrtf(2000)));
timeline.addKeyframes("Perlin Speed", "perlinSpeed.xml", ofRange(0, sqrtf(5)), 0);

timeline.addPage("Attractors");
timeline.addKeyframes("Mesh Attract", "meshAttractScale.xml", ofRange(0, 2000));
timeline.addKeyframes("Min Radius", "meshMinRadius.xml", ofRange(0, 6000));

timeline.setCurrentPage(0);

// timeline.addPage("Luminosity");
// timeline.addKeyframes("Lumin Mid", "Lumin Mid", <#ofRange valueRange#>)

ofxXmlSettings defaults;
defaults.loadFile("defaults.xml");
string defaultTake = defaults.getValue("take", "");
Expand All @@ -65,6 +76,17 @@ void testApp::setup(){

renderer.setDepthImage(depthImages.currentDepthRaw);
timeline.setDurationInFrames(depthImages.videoThumbs.size());

// alignment.loadPairingFile(take.pairingsFile);

// movie.loadMovie(take.lowResVideoPath);
// movie.setUseTexture(false);
// movie.play();
// movie.setSpeed(0);

// playerElement.setVideoPlayer(movie, take.videoThumbsPath);
// timeline.addElement("Video", &playerElement);
// timeline.setDurationInFrames(movie.getDuration());
}

for(int i = 0; i < 50; i++){
Expand All @@ -77,8 +99,8 @@ void testApp::setup(){

//setup forces
perlinForce = new CloudInterludeForcePerlin();
dragForce = new CloudInterludeForceDrag();
meshForce = new CloudInterludeForceMeshAttractor();
dragForce = new CloudInterludeForceDrag();
meshForce = new CloudInterludeForceMeshAttractor();
meshForce->mesh = &renderer.getMesh();

for(int i = 0; i < 640*480; i++){
Expand All @@ -94,23 +116,20 @@ void testApp::setup(){
mesh.addColor(ofFloatColor(1.0,1.0,1.0,1.0));
}

// generator.addForce(perlinForce);
// generator.addForce(dragForce);
// generator.addForce(meshForce);
//
// generator.position = ofVec3f(0,0,0);
// generator.direction = ofVec3f(0,0,1);

loadShaders();
}

//--------------------------------------------------------------
void testApp::update(){

if(!take.valid()){
return;
}

//VIEW
cam.applyRotation = cam.applyTranslation = fboRect.inside(ofGetMouseX(),ofGetMouseY());
fboRect = ofRectangle(timeline.getDrawRect().x, timeline.getDrawRect().height, 1920/2, 1080/2);


dragForce->dragForce = powf( timeline.getKeyframeValue("Drag Force"), 2.0);

perlinForce->amplitude = powf( timeline.getKeyframeValue("Perlin Amplitude"), 2.0);
Expand Down Expand Up @@ -146,7 +165,6 @@ void testApp::update(){
g.lifespanVariance = lifeSpanVariance;
g.position = renderer.getMesh().getVertex( renderer.vertexIndex(i) );
g.remainingParticles = maxParticles - totalParticles;
//g.remainingParticles = maxParticles - g.particles.size();
}
}

Expand All @@ -169,15 +187,19 @@ void testApp::update(){
needsUpdate = true;
}

if(depthImages.isLoaded() && depthImages.isFrameNew()){
// movie.update();
if(take.valid() && depthImages.isFrameNew()){
renderer.setDepthImage(depthImages.currentDepthRaw);
needsUpdate = true;
}

if(needsUpdate){
renderer.update();
}

}

void testApp::loadShaders(){
pointCloudDOF.load("shaders/DOFCloud");
}

//--------------------------------------------------------------
Expand All @@ -187,23 +209,40 @@ void testApp::draw(){
ofClear(0);

cam.begin(ofRectangle(0,0,1920,1080));
ofDrawGrid();
// ofDrawGrid();

if(depthImages.isLoaded()){
ofPushStyle();
ofSetColor(255);
// renderer.drawWireFrame(false);
ofPopStyle();

//for(int i = 0; i < debugNodes.size(); i++) debugNodes[i].draw();
}

//RENDERER
glPointSize(4);
//glPointSize(4);
ofPushStyle();
glPushMatrix();
glScalef(1,-1,1);
if(useShader){
pointCloudDOF.begin();
pointCloudDOF.setUniform1f("minSize", timeline.getKeyframeValue("Min Point Size"));
pointCloudDOF.setUniform1f("maxSize", timeline.getKeyframeValue("Max Point Size"));
pointCloudDOF.setUniform1f("focalRange", timeline.getKeyframeValue("Focal Range"));
pointCloudDOF.setUniform1f("focalDistance", timeline.getKeyframeValue("Focal Distance"));
}
else{
glPointSize(4);
}
ofEnableBlendMode(OF_BLENDMODE_ADD);
glEnable(GL_POINT_SMOOTH); // makes circular points
glEnable(GL_VERTEX_PROGRAM_POINT_SIZE_ARB); // allows per-point size
mesh.drawVertices();
if(useShader){
pointCloudDOF.end();
}
glPopMatrix();
ofPopStyle();

//debugDrawOrigins();

Expand Down Expand Up @@ -268,9 +307,6 @@ void testApp::copyVertsToMesh(){
}

memset(&(meshColors[meshIndex].r), 0, sizeof(ofFloatColor)*(meshColors.size()-meshIndex));
// for(int i = meshIndex; i < meshVertices.size(); i++){
//
// }
}

//--------------------------------------------------------------
Expand All @@ -295,7 +331,14 @@ void testApp::keyPressed(int key){

if(key == ' '){
timeline.togglePlay();
}
// if(movie.getSpeed() != 0.0){
// movie.setSpeed(0);
// }
// else{
// movie.play();
// movie.setSpeed(1.0);
// }
}

if(key == 'f'){
ofToggleFullscreen();
Expand All @@ -310,6 +353,14 @@ void testApp::keyPressed(int key){
emmiters[i].particles.clear();
}
}

if(key == 'L'){
loadShaders();
}

if(key == 'N'){
useShader = !useShader;
}
}

//--------------------------------------------------------------
Expand Down

0 comments on commit 1f3df6c

Please sign in to comment.