Skip to content

Commit

Permalink
mild tweaking
Browse files Browse the repository at this point in the history
  • Loading branch information
obviousjim committed Nov 7, 2013
1 parent ce1e017 commit 451e0e9
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 37 deletions.
5 changes: 4 additions & 1 deletion CloudsLibrary/src/StoryEngine/CloudsWebSocketConnection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ void CloudsWebSocketConnection::questionAsked(CloudsQuestionEventArgs& args){
}

void CloudsWebSocketConnection::topicChanged(CloudsTopicEventArgs& args){

char message[1024];
sprintf(message, "{ \"topic\" : \"%s\" }", args.topic.c_str() );
server.send( message );
cout << " message " << message << endl;
}

void CloudsWebSocketConnection::preRollRequested(CloudsPreRollEventArgs& args){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,18 +180,23 @@ void CloudsVisualSystemExampleMPMFluid::selfDrawDebug()
// or you can use selfDrawBackground to do 2D drawings that don't use the 3D camera
void CloudsVisualSystemExampleMPMFluid::selfDrawBackground()
{
ofPushStyle();
glPushAttrib(GL_ALL_ATTRIB_BITS);

ofEnableBlendMode(OF_BLENDMODE_ADD);
// These improve the appearance of small lines and/or points.
glDisable(GL_LIGHTING);
glDisable(GL_DEPTH_TEST);
// glDisable(GL_DEPTH_TEST);
glEnable (GL_LINE_SMOOTH);
glEnable (GL_POINT_SMOOTH); // in case you want it
glEnable (GL_MULTISAMPLE);
glEnable (GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
// glEnable (GL_MULTISAMPLE);
// glEnable (GL_BLEND);
// glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);

ofColor c = ofColor::fromHsb(pColor.r, pColor.g, pColor.b);
c.a = 200;
ofSetColor(c);

glLineWidth(lineWidth); // or thicker, if you prefer

ofPushMatrix();
Expand All @@ -202,7 +207,7 @@ void CloudsVisualSystemExampleMPMFluid::selfDrawBackground()
// using their velocity for their length.
vector<ofVec2f> verts;

for (int ip=0; ip<fluid.numParticles; ip++) {
for (int ip = 0; ip < fluid.numParticles; ip++) {
ofxMPMParticle* p = fluid.getParticles()[ip];
verts.push_back(ofVec2f(p->x, p->y));
verts.push_back(ofVec2f(p->x - p->u, p->y - p->v));
Expand All @@ -212,6 +217,9 @@ void CloudsVisualSystemExampleMPMFluid::selfDrawBackground()
glDrawArrays(GL_LINES, 0, verts.size());
glDisableClientState(GL_VERTEX_ARRAY);
ofPopMatrix();

glPopAttrib();
ofPopStyle();
}

// this is called when your system is no longer drawing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,12 @@ void CloudsVisualSystemOpenP5NoiseSphere::selfSetupGui(){
customGui->addLabel("Solid Sphere");
customGui->addSlider("Solid_Sphere_Scale", 0.0, .25, &solidSphereScale);
customGui->addSlider("Solid_Sphere_Alpha", 0.0, 1.0, &solidSphereAlpha);
//customGui->addSlider("Hair count", 3000.0,7000.0, &count);


customGui->addSlider("Noise Speed", 0.0, 10.0, &noiseSpeed);
customGui->addSlider("Noise Scale", 0.0, 4.0, &noiseScale);

customGui->addSlider("Fur Length", 0.0, 4., &furLength);

// customGui->addSlider("Custom Float 1", 1, 1000, &customFloat1);
// customGui->addSlider("Custom Float 2", 1, 1000, &customFloat2);
// customGui->addButton("Custom Button", false);
Expand Down Expand Up @@ -126,14 +127,14 @@ void CloudsVisualSystemOpenP5NoiseSphere::selfUpdate(){
void CloudsVisualSystemOpenP5NoiseSphere::selfDraw(){

ofPushStyle();
glEnable(GL_DEPTH_TEST);

ofFill();
ofSetColor(20,solidSphereAlpha*255.0);

glDisable(GL_LIGHTING);
glEnable(GL_DEPTH_TEST);
ofDisableAlphaBlending();
ofFill();
ofSetColor(bgBri);
ofSphere(0, 0, solidSphereScale*300 );
ofEnableBlendMode(OF_BLENDMODE_SCREEN);


float rxp = ((ofGetMouseX()-(ofGetWidth()/2))*0.3);
float ryp = ((ofGetMouseY()-(ofGetHeight()/2))*0.3);
Expand All @@ -146,11 +147,12 @@ void CloudsVisualSystemOpenP5NoiseSphere::selfDraw(){
ofMesh mesh;
noisePosition += noiseSpeed;
for (int i = 0;i < count; i++) {
list[i].draw(mesh, noisePosition, noiseScale, solidSphereAlpha);
list[i].draw(mesh, noisePosition, noiseScale, solidSphereAlpha, furLength);
}
mesh.setMode(OF_PRIMITIVE_LINES);
mesh.draw();


ofPopStyle();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class Hair {
theta = asin(z/radius);
}

void draw(ofMesh& mesh, float noisePosition, float noiseScale, float solidSphereAlpha) {
void draw(ofMesh& mesh, float noisePosition, float noiseScale, float solidSphereAlpha, float hairScale) {
float off = (ofNoise(noisePosition * 0.0005, sin(phi)) - 0.5) * 0.3 * noiseScale;
float offb = (ofNoise(noisePosition * 0.0007, sin(z) * 0.01)-0.5) * 0.3 * noiseScale;

Expand All @@ -36,6 +36,7 @@ class Hair {
float x = radius * cos(theta) * cos(phi);
float y = radius * cos(theta) * sin(phi);
float z = radius * sin(theta);

//mouse x & y
// float msx= screenX(x, y, z);
// float msy= screenY(x, y, z);
Expand All @@ -44,22 +45,16 @@ class Hair {
float yo = radius * cos(thetaff) * sin(phff);
float zo = radius * sin(thetaff);

float xb = xo * largo;
float yb = yo * largo;
float zb = zo * largo;
float xb = xo * largo * hairScale;
float yb = yo * largo * hairScale;
float zb = zo * largo * hairScale;


mesh.addColor(ofFloatColor::white*solidSphereAlpha);
mesh.addColor(ofFloatColor::black);
mesh.addVertex( ofVec3f(x,y,z) );
mesh.addColor(ofFloatColor::white);
mesh.addVertex( ofVec3f(xb,yb,zb) );

// beginShape(LINES);
// stroke(0);
// vertex(x, y, z);
// stroke(200, 150);
// vertex(xb, yb, zb);
// endShape();
}
};

Expand Down Expand Up @@ -163,6 +158,7 @@ class CloudsVisualSystemOpenP5NoiseSphere : public CloudsVisualSystem {
float noisePosition;
float noiseSpeed;
float noiseScale;
float furLength;

//inner sphere

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ void CloudsVisualSystemOpenP5Sixteen::selfUpdate()
setColor(x, y, ofColor(c, c, c * 2));
}

cout << ofGetFrameRate() << endl;
// cout << ofGetFrameRate() << endl;
}

//--------------------------------------------------------------
Expand All @@ -114,7 +114,12 @@ void CloudsVisualSystemOpenP5Sixteen::selfDrawDebug(){
void CloudsVisualSystemOpenP5Sixteen::selfDrawBackground()
{
tex.loadData(pixels, width, height, GL_RGBA);
tex.draw(0, 0);

ofRectangle textureRect(0,0,width,height);
ofRectangle screenRect(0,0, ofGetWidth(), ofGetHeight());
textureRect.alignTo(screenRect, OF_ALIGN_HORZ_CENTER, OF_ALIGN_VERT_CENTER);

tex.draw(textureRect);
}

// this is called when your system is no longer drawing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ void CloudsVisualSystemOpenP5SpaceJunk::selfDraw(){
ofRotateX(ofRadToDeg(ang)); //X rotation - converts radians to degrees
ofRotateY(ofRadToDeg(ang)); //Y rotation
mat->begin();
ofSetColor(
for (int i = 0;i < limit; i++) {
list[i].draw();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,6 @@
E7C01129180DD5E700B5CEF1 /* 3DModelVisualSystem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C010B7180DD5E700B5CEF1 /* 3DModelVisualSystem.cpp */; };
E7C0112A180DD5E700B5CEF1 /* CloudsOrthoCamera.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C010B9180DD5E700B5CEF1 /* CloudsOrthoCamera.cpp */; };
E7C8AE5F182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C8A9E8182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.cpp */; };
E7C8AE60182AC8FE00AAD6E8 /* DM10PingPongBuffer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C8A9EA182AC8F900AAD6E8 /* DM10PingPongBuffer.cpp */; };
E7C8AEA8182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5Hackpact.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C8AA40182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5Hackpact.cpp */; };
E7C8AF16182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5Machine.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C8AAC0182AC8FA00AAD6E8 /* CloudsVisualSystemOpenP5Machine.cpp */; };
E7C8AF50182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5NoiseSphere.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E7C8AB06182AC8FA00AAD6E8 /* CloudsVisualSystemOpenP5NoiseSphere.cpp */; };
Expand Down Expand Up @@ -972,8 +971,6 @@
E7C010BA180DD5E700B5CEF1 /* CloudsOrthoCamera.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudsOrthoCamera.h; sourceTree = "<group>"; };
E7C8A9E8182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CloudsVisualSystemOpenP5DrawingMachine10.cpp; sourceTree = "<group>"; };
E7C8A9E9182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudsVisualSystemOpenP5DrawingMachine10.h; sourceTree = "<group>"; };
E7C8A9EA182AC8F900AAD6E8 /* DM10PingPongBuffer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DM10PingPongBuffer.cpp; sourceTree = "<group>"; };
E7C8A9EB182AC8F900AAD6E8 /* DM10PingPongBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DM10PingPongBuffer.h; sourceTree = "<group>"; };
E7C8AA40182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5Hackpact.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CloudsVisualSystemOpenP5Hackpact.cpp; sourceTree = "<group>"; };
E7C8AA41182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5Hackpact.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CloudsVisualSystemOpenP5Hackpact.h; sourceTree = "<group>"; };
E7C8AAC0182AC8FA00AAD6E8 /* CloudsVisualSystemOpenP5Machine.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CloudsVisualSystemOpenP5Machine.cpp; sourceTree = "<group>"; };
Expand Down Expand Up @@ -3194,8 +3191,6 @@
children = (
E7C8A9E8182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.cpp */,
E7C8A9E9182AC8F900AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.h */,
E7C8A9EA182AC8F900AAD6E8 /* DM10PingPongBuffer.cpp */,
E7C8A9EB182AC8F900AAD6E8 /* DM10PingPongBuffer.h */,
);
path = vs_src;
sourceTree = "<group>";
Expand Down Expand Up @@ -4612,7 +4607,6 @@
859A45D3181C684700B9F251 /* ofxSimpleSpline.cpp in Sources */,
50EAB5651824309D00BD3C98 /* CloudsPathCamera.cpp in Sources */,
E7C8AE5F182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5DrawingMachine10.cpp in Sources */,
E7C8AE60182AC8FE00AAD6E8 /* DM10PingPongBuffer.cpp in Sources */,
E7C8AEA8182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5Hackpact.cpp in Sources */,
E7C8AF16182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5Machine.cpp in Sources */,
E7C8AF50182AC8FE00AAD6E8 /* CloudsVisualSystemOpenP5NoiseSphere.cpp in Sources */,
Expand Down
2 changes: 1 addition & 1 deletion VSOpenP5Sixteen/OpenP5Sixteen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -766,8 +766,8 @@
640A312E18241EC900DDFBA2 /* vs_src */ = {
isa = PBXGroup;
children = (
640A312F18241EC900DDFBA2 /* CloudsVisualSystemOpenP5Sixteen.cpp */,
640A313018241EC900DDFBA2 /* CloudsVisualSystemOpenP5Sixteen.h */,
640A312F18241EC900DDFBA2 /* CloudsVisualSystemOpenP5Sixteen.cpp */,
);
path = vs_src;
sourceTree = "<group>";
Expand Down

0 comments on commit 451e0e9

Please sign in to comment.