Permalink
Browse files

particle/force/generator setup

  • Loading branch information...
1 parent fe3f034 commit d2761f696ccf9be5f134b7ae601e8d132ccae7a6 @obviousjim committed May 5, 2012
@@ -269,6 +269,10 @@
A6A315BA1554886E003D7222 /* ofxRGBDRenderSettings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxRGBDRenderSettings.cpp; sourceTree = "<group>"; };
A6A315BC1554887C003D7222 /* ofxRGBDRenderSettings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxRGBDRenderSettings.h; sourceTree = "<group>"; };
A6A315BD155488A2003D7222 /* ofxRGBDMediaTake.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxRGBDMediaTake.cpp; sourceTree = "<group>"; };
+ A6A315BF1554A34E003D7222 /* CloudInterludeParticleGenerator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudInterludeParticleGenerator.h; sourceTree = "<group>"; };
+ A6A315C01554AB2E003D7222 /* CloudInterludeForce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudInterludeForce.h; sourceTree = "<group>"; };
+ A6A315C11554B97E003D7222 /* CloudInterludeForcePerlin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudInterludeForcePerlin.h; sourceTree = "<group>"; };
+ A6A315C21554CC35003D7222 /* CloudInterludeForceDrag.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudInterludeForceDrag.h; sourceTree = "<group>"; };
A6ECC6BB15300A820009D0D9 /* ofxDepthHoleFiller.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxDepthHoleFiller.cpp; sourceTree = "<group>"; };
A6ECC6BC15300A820009D0D9 /* ofxDepthHoleFiller.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ofxDepthHoleFiller.h; sourceTree = "<group>"; };
A6EE319D14E21B030068A5E7 /* ofxTLCameraTrack.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ofxTLCameraTrack.cpp; sourceTree = "<group>"; };
@@ -963,6 +967,10 @@
E4B69E1F0A3A1BDC003C02F2 /* testApp.h */,
E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */,
A6A315B515548137003D7222 /* CloudInterludeParticle.h */,
+ A6A315BF1554A34E003D7222 /* CloudInterludeParticleGenerator.h */,
+ A6A315C01554AB2E003D7222 /* CloudInterludeForce.h */,
+ A6A315C11554B97E003D7222 /* CloudInterludeForcePerlin.h */,
+ A6A315C21554CC35003D7222 /* CloudInterludeForceDrag.h */,
);
path = src;
sourceTree = SOURCE_ROOT;
@@ -0,0 +1,14 @@
+<positions>
+ <element name="Birthrate">
+ <x>0</x>
+ <y>80</y>
+ <width>1920</width>
+ <height>75</height>
+ </element>
+ <element name="Lifespan">
+ <x>0</x>
+ <y>185</y>
+ <width>1920</width>
+ <height>75</height>
+ </element>
+</positions>
@@ -1,25 +1,25 @@
<positions>
<element name="Depth">
<x>0</x>
- <y>50</y>
+ <y>80</y>
<width>1920</width>
<height>75</height>
</element>
<element name="Edge Snip">
<x>0</x>
- <y>365</y>
+ <y>395</y>
<width>1920</width>
<height>75</height>
</element>
<element name="Simplify">
<x>0</x>
- <y>155</y>
+ <y>185</y>
<width>1920</width>
<height>75</height>
</element>
<element name="Z Threshold">
<x>0</x>
- <y>260</y>
+ <y>290</y>
<width>1920</width>
<height>75</height>
</element>
@@ -1,12 +1,12 @@
<camera>
<position>
- <X>156.441</X>
- <Y>-105.94</Y>
- <Z>1012.79</Z>
+ <X>528.045</X>
+ <Y>-43.3222</Y>
+ <Z>1179.58</Z>
</position>
<rotation>
- <X>245.55</X>
- <Y>6.15</Y>
- <Z>64</Z>
+ <X>-37.383</X>
+ <Y>5.70801</Y>
+ <Z>0</Z>
</rotation>
</camera>
@@ -0,0 +1,8 @@
+<keyframes>
+ <key>
+ <x>0.102729</x>
+ <y>0.4</y>
+ <easefunc>0</easefunc>
+ <easetype>0</easetype>
+ </key>
+</keyframes>
@@ -0,0 +1,8 @@
+<keyframes>
+ <key>
+ <x>0.0980728</x>
+ <y>0.48</y>
+ <easefunc>0</easefunc>
+ <easetype>0</easetype>
+ </key>
+</keyframes>
@@ -0,0 +1,14 @@
+//
+// CloudInterludeForce.h
+// CloudsInterlude
+//
+// Created by James George on 5/4/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef CloudsInterlude_CloudInterludeForce_h
+#define CloudsInterlude_CloudInterludeForce_h
+
+
+
+#endif
@@ -0,0 +1,14 @@
+//
+// CloudInterludeForceDrag.h
+// CloudsInterlude
+//
+// Created by James George on 5/4/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef CloudsInterlude_CloudInterludeForceDrag_h
+#define CloudsInterlude_CloudInterludeForceDrag_h
+
+
+
+#endif
@@ -0,0 +1,14 @@
+//
+// CloudInterludeForcePerlin.h
+// CloudsInterlude
+//
+// Created by James George on 5/4/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef CloudsInterlude_CloudInterludeForcePerlin_h
+#define CloudsInterlude_CloudInterludeForcePerlin_h
+
+
+
+#endif
@@ -13,13 +13,25 @@
class CloudInterludeParticle {
public:
- CloudInterludeParticle();
+ CloudInterludeParticle(){
+ energy = 0;
+ position = ofVec3f(0,0,0);
+ velocity = ofVec3f(0,0,0);
+ force = ofVec3f(0,0,0);
+ }
- void update();
+ void update(){
+ velocity += force;
+ position += velocity;
+ force = ofVec3f(0,0,0);
+ energy--;
+ }
+ float energy;
ofVec3f position;
ofVec3f velocity;
ofVec3f force;
+
};
@@ -0,0 +1,14 @@
+//
+// CloudInterludeParticleGenerator.h
+// CloudsInterlude
+//
+// Created by James George on 5/4/12.
+// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
+//
+
+#ifndef CloudsInterlude_CloudInterludeParticleGenerator_h
+#define CloudsInterlude_CloudInterludeParticleGenerator_h
+
+
+
+#endif
@@ -3,7 +3,7 @@
//--------------------------------------------------------------
void testApp::setup(){
ofSetFrameRate(60);
- ofBackground(100);
+ ofBackground(30);
ofToggleFullscreen();
@@ -14,11 +14,15 @@ void testApp::setup(){
cam.setup();
cam.usemouse = true;
- cam.loadCameraPosition();
cam.autosavePosition = true;
cam.speed = 20;
cam.setScale(1, -1, 1);
cam.targetNode.setScale(1, -1, 1);
+ cam.loadCameraPosition();
+ cam.maximumY = 120;
+ cam.minimumY = -120;
+ cam.rollSpeed = 1;
+ cam.loadCameraPosition();
timeline.setup();
timeline.setDurationInFrames(500);
@@ -30,10 +34,12 @@ void testApp::setup(){
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("Birthrate", "particleBirthrate.xml", ofRange(.1, sqrtf(20)) );
+ timeline.addKeyframes("Lifespan", "particleLifespan.xml", ofRange(100, 2000));
-// timeline.addKeyframes("X Rot", "xrot.xml", ofRange(0, 360 ), 0);
-// timeline.addKeyframes("Y Rot", "yrot.xml", ofRange(0, 360 ), 0);
-// timeline.addKeyframes("Z Rot", "zrot.xml", ofRange(0, 360 ), 0);
+ timeline.setCurrentPage(0);
ofxXmlSettings defaults;
defaults.loadFile("defaults.xml");
@@ -54,17 +60,34 @@ void testApp::setup(){
ofRandom(-200,200) );
debugNodes.push_back( n );
}
+
+
+ //setup forces
+ perlinForce = new CloudInterludeForcePerlin(renderer.getMesh());
+ perlinForce->amplitude = 2;
+ perlinForce->density = 400;
+ perlinForce->speed = 10;
+
+ generator.position = ofVec3f(0,0,0);
+ generator.direction = ofVec3f(0,0,1);
+
+ generator.addForce(perlinForce);
}
//--------------------------------------------------------------
void testApp::update(){
- fboRect = ofRectangle(timeline.getDrawRect().x,
- timeline.getDrawRect().height, 1920/2, 1080/2);
-
+ //VIEW
cam.applyRotation = cam.applyTranslation = fboRect.inside(ofGetMouseX(),ofGetMouseY());
+ fboRect = ofRectangle(timeline.getDrawRect().x, timeline.getDrawRect().height, 1920/2, 1080/2);
- bool needsUpdate = false;
+ //GENERATOR
+ generator.birthRate = timeline.getKeyframeValue("Birthrate");
+ generator.lifespan = timeline.getKeyframeValue("Lifespan");
+ generator.update();
+
+ //RENDERER
+ bool needsUpdate = false;
renderer.farClip = powf(timeline.getKeyframeValue("Z Threshold"), 2.0);
renderer.edgeCull = powf(timeline.getKeyframeValue("Edge Snip"), 2.0);
if(renderer.getSimplification() != (int)timeline.getKeyframeValue("Simplify")){
@@ -83,6 +106,7 @@ void testApp::update(){
if(needsUpdate){
renderer.update();
}
+
}
//--------------------------------------------------------------
@@ -103,12 +127,23 @@ void testApp::draw(){
//for(int i = 0; i < debugNodes.size(); i++) debugNodes[i].draw();
}
+ //RENDERER
+ generator.drawDebug();
+ generator.drawParticleDebug();
+
cam.end();
renderTarget.end();
+
+ ofPushStyle();
+ ofSetColor(0);
+ ofRect(fboRect);
+ ofPopStyle();
+
renderTarget.getTextureReference().draw(fboRect);
+
+ generator.drawTextDebug(fboRect.x+fboRect.width + 10, fboRect.y+ 15);
timeline.draw();
-
}
//--------------------------------------------------------------
View
@@ -7,8 +7,11 @@
#include "ofxTimeline.h"
#include "ofxTLDepthImageSequence.h"
+#include "CloudInterludeParticleGenerator.h"
+#include "CloudInterludeForcePerlin.h"
-class testApp : public ofBaseApp{
+class testApp : public ofBaseApp
+{
public:
void setup();
void update();
@@ -34,4 +37,9 @@ class testApp : public ofBaseApp{
vector<ofNode> debugNodes;
ofRectangle fboRect;
+
+ //forces
+ CloudInterludeParticleGenerator generator;
+ CloudInterludeForcePerlin* perlinForce;
+
};

0 comments on commit d2761f6

Please sign in to comment.