コード例 #1
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::getNormalized() const {
	float length = (float)sqrt(x*x + y*y + z*z + w*w);
	if( length > 0 ) {
		return ofxVec4f( x/length, y/length, z/length, w/length );
	} else {
		return ofxVec4f();
	}
}
コード例 #2
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::getScaled( const float length ) const {
	float l = (float)sqrt(x*x + y*y + z*z + w*w);
	if( l > 0 )
		return ofxVec4f( (x/l)*length, (y/l)*length,
						(z/l)*length, (w/l)*length );
	else
		return ofxVec4f();
}
コード例 #3
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::getLimited(float max) const {
	float length = (float)sqrt(x*x + y*y + z*z + w*w);
	if( length > max && length > 0 ) {
		return ofxVec4f( (x/length)*max, (y/length)*max,
						(z/length)*max, (w/length)*max );
	} else {
		return ofxVec4f( x, y, z, w );
	}
}
コード例 #4
0
ファイル: Particle.cpp プロジェクト: dopuskh3/ofx-projects
// ---------------------------------------------------- 
void Particle::update(){

  //ttl--; 

  velocity += accel; 
  position += velocity;
  if(numH > 0){
    hPos.push_back(position); 
    hVel.push_back(velocity); 
    hAc.push_back(accel); 
    hColor.push_back(ofxVec4f(r, g, b, alpha)); 

    while(hPos.size() >= numH){
      hPos.pop_front(); 
      hVel.pop_front();
      hAc.pop_front(); 
      hColor.pop_front();
    }
  }


  //if(fuzz != 0){
  //  ofxVect3f fuzz; 
  //  fuzz.x  = ofRandom(0, 100); 
  //  fuzz.y  = ofRandom(0, 100); 
  //  fuzz.normalize(fuzz); 
  //}
}
コード例 #5
0
ファイル: testApp.cpp プロジェクト: tangible/YES-NO
//--------------------------------------------------------------
void testApp::setup(){

	ofSetDataPathRoot("../Resources/");
//	ofDisableArbTex();
	
	showDepthShader.setup("showdepth");
	
	depthFBO.setup(ofGetWidth(), ofGetHeight());
	
	numObj = 100;
	for (int i = 0; i < numObj; i++) {
		float x = ofRandom(ofGetWidth()/2-200, ofGetWidth()/2+200);
		float y = ofRandom(ofGetHeight()/2-200, ofGetHeight()/2+200);
		float z = ofRandom(-200, 200);
		ofxVec3f pos = ofxVec3f(x,y,z);
		float r = ofRandom(0.0, 255.0);
		float g = ofRandom(0.0, 255.0);
		float b = ofRandom(0.0, 255.0);
		float a = ofRandom(200.0, 255.0);
		ofxVec4f col = ofxVec4f(r,g,b,a);
		int size = ofRandom(10, 50);
		objPos.push_back(pos);
		objCol.push_back(col);
		objSize.push_back(size);
	}	
}
コード例 #6
0
ファイル: testApp.cpp プロジェクト: tangible/YES-NO
//--------------------------------------------------------------
void testApp::setup(){

	ofSetDataPathRoot("../Resources/");
	ofDisableArbTex();
	ofEnableAlphaBlending();
	ofBackground(255, 255, 255);
	
	cam.setup(this, 700);
	
	defaultShader.setup("default");
	showDepthShader.setup("showdepth");
	dofShader.setup("dof");
	
	depthFBO.setup(ofGetWidth(), ofGetHeight());
	colorFBO.setup(ofGetWidth(), ofGetHeight());
	
	numObj = 100;
	for (int i = 0; i < numObj; i++) {
		float x = ofRandom(ofGetWidth()/2-200, ofGetWidth()/2+200);
		float y = ofRandom(ofGetHeight()/2-200, ofGetHeight()/2+200);
		float z = ofRandom(-500, 700);
		ofxVec3f pos = ofxVec3f(x,y,z);
		float r = ofRandom(0.0, 255.0);
		float g = ofRandom(0.0, 255.0);
		float b = ofRandom(0.0, 255.0);
		float a = ofRandom(200.0, 255.0);
		ofxVec4f col = ofxVec4f(r,g,b,a);
		int size = ofRandom(10, 50);
		objPos.push_back(pos);
		objCol.push_back(col);
		objSize.push_back(size);
	}		
	
	//.setNewColumn(true);
	gui.addTitle("Shader Setting");
	gui.addSlider("focus", focus, 0.0, 2.0);
	gui.addSlider("aspectratiox", aspectratiox, 0.0, ofGetWidth());
	gui.addSlider("aspectratioy", aspectratioy, 0.0, ofGetHeight());
	gui.addSlider("blurclamp", blurclamp, 0.0, 1.0);
	gui.addSlider("bias", bias, 0.0, 1.0);
	gui.loadFromXML();
	gui.show();	
	aspectratiox = ofGetWidth();
	aspectratioy = ofGetHeight();	
	//blurclamp = 3.0;
	//bias = 0.6;
	
}
コード例 #7
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
// Additions and Subtractions.
//
//
ofxVec4f ofxVec4f::operator+( const ofxVec4f& vec ) const {
	return ofxVec4f( x+vec.x, y+vec.y, z+vec.z, w+vec.w);
}
コード例 #8
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f operator/( float f, const ofxVec4f& vec ) {
    return ofxVec4f( f/vec.x, f/vec.y, f/vec.z, f/vec.w);
}
コード例 #9
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator/( const float f ) const {
	if(f == 0) return ofxVec4f(x, y, z, w);

	return ofxVec4f( x/f, y/f, z/f, w/f );
}
コード例 #10
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator*( const float f ) const {
	return ofxVec4f( x*f, y*f, z*f, w*f );
}
コード例 #11
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
// Scalings
//
//
ofxVec4f ofxVec4f::operator*( const ofxVec4f& vec ) const {
	return ofxVec4f( x*vec.x, y*vec.y, z*vec.z, w*vec.w );
}
コード例 #12
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator-() const {
	return ofxVec4f( -x, -y, -z, -w );
}
コード例 #13
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator+( const float f ) const {
	return ofxVec4f( x+f, y+f, z+f, w+f );
}
コード例 #14
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator-( const float f ) const {
	return ofxVec4f( x-f, y-f, z-f, w-f );
}
コード例 #15
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator/( const ofxVec4f& vec ) const {
	return ofxVec4f( vec.x!=0 ? x/vec.x : x , vec.y!=0 ? y/vec.y : y, vec.z!=0 ? z/vec.z : z, vec.w!=0 ? w/vec.w : w  );
}
コード例 #16
0
ファイル: ofxVec4f.cpp プロジェクト: 6301158/ofx-dev
ofxVec4f ofxVec4f::operator-( const ofxVec4f& vec ) const {
	return ofxVec4f( x-vec.x, y-vec.y, z-vec.z, w-vec.w );
}
コード例 #17
0
ファイル: testApp.cpp プロジェクト: tangible/YES-NO
//--------------------------------------------------------------
void testApp::setup(){

	ofSetDataPathRoot("../Resources/");
	ofDisableArbTex();
	ofEnableAlphaBlending();
	ofEnableSmoothing();
	ofBackground(255, 255, 255);
	
	cam.setup(this, 700);
	
//	defaultShader.setup("default");
//	showDepthShader.setup("showdepth");
	ssaoShader.setup("ssao");	
	dofShader.setup("dof");
	
	depthFBO.setup(ofGetWidth(), ofGetHeight());
	colorFBO.setup(ofGetWidth(), ofGetHeight());
	ssaoFBO.setup(ofGetWidth(), ofGetHeight());
	
	ofxSetSphereResolution(100);
	numObj = 200;
	for (int i = 0; i < numObj; i++) {
		float x = ofRandom(ofGetWidth()/2-200, ofGetWidth()/2+200);
		float y = ofRandom(ofGetHeight()/2-200, ofGetHeight()/2+200);
		float z = ofRandom(-100, 500);
		ofxVec3f pos = ofxVec3f(x,y,z);
		float r = ofRandom(0.0, 255.0);
		float g = ofRandom(0.0, 255.0);
		float b = ofRandom(0.0, 255.0);
		float a = ofRandom(200.0, 255.0);
		ofxVec4f col = ofxVec4f(r,g,b,a);
		int size = ofRandom(10, 50);
		ofxQuaternion qua = ofxQuaternion(ofRandomf(), ofRandomf(), ofRandomf(), ofRandomf());
		int typ = ofRandom(1, 3);
		objPos.push_back(pos);
		objRot.push_back(qua);
		objCol.push_back(col);
		objSize.push_back(size);
		objType.push_back(typ);
	}		
	
	//.setNewColumn(true);
	gui.addTitle("SSAO Setting");
	gui.addSlider("camerarangex", camerarangex, 0, 10000);
	gui.addSlider("camerarangey", camerarangey, 0, 10000);
	gui.addSlider("aoCap", aoCap, 0.0, 2.0);
	gui.addSlider("aoMultiplier", aoMultiplier, 0.0, 20000.0);
	gui.addSlider("depthTolerance", depthTolerance, 0.000, 0.002);
	gui.addSlider("aorange", aorange, 0.0, 2.0);
	gui.addSlider("readDepthVal", readDepthVal, 0.0, 20.0);
	gui.addTitle("DOF Setting").setNewColumn(true);
	gui.addSlider("focus", focus, 0.0, 2.0);
	gui.addSlider("aspectratiox", aspectratiox, 0.0, ofGetWidth());
	gui.addSlider("aspectratioy", aspectratioy, 0.0, ofGetHeight());
	gui.addSlider("blurclamp", blurclamp, 0.0, 1.0);
	gui.addSlider("bias", bias, 0.0, 1.0);	
	gui.loadFromXML();
	gui.show();		
	camerarangex = 6113.28;
	camerarangey = 4121.09;
	aoCap = 1.8795;
	aoMultiplier = 1523.5625;
	depthTolerance = 0.0001130;
	aorange = 0.285156;
	readDepthVal = 2.0;
	focus = 0.808594;
	aspectratiox = ofGetWidth();
	aspectratioy = ofGetHeight();	
	blurclamp = 0.0253910;
	bias = 0.041016;
	
}