Skip to content

Instantly share code, notes, and snippets.

View patriciogonzalezvivo's full-sized avatar

Patricio Gonzalez Vivo patriciogonzalezvivo

View GitHub Profile
@patriciogonzalezvivo
patriciogonzalezvivo / postgisOSM-LAS.md
Last active May 10, 2022 08:55
Loading OSM and LIDar to PostGIS
@patriciogonzalezvivo
patriciogonzalezvivo / MakingGeometries.md
Last active January 7, 2022 16:58
Creating Geometries in openFrameworks

Face by Face

void addFace(ofMesh& mesh, ofVec3f a, ofVec3f b, ofVec3f c) {
	ofVec3f normal = ((b - a).cross(c - a)).normalize();
	mesh.addNormal(normal);
	mesh.addVertex(a);
	mesh.addNormal(normal);
	mesh.addVertex(b);
	mesh.addNormal(normal);
I am attesting that this GitHub handle patriciogonzalezvivo is linked to the Tezos account tz1NqueFctvNCQrsELm6k4N6XfwAYu5Qp5LN for tzprofiles
sig:edsigtyGKhQWuzB73dYzJfELSjYJt7LwbFEsKD61WF3oVH7Lhok5dgXu3bdZth1U19QwCts7xXwaDyCh7Auqr9Cov1xTXz9Lv4s
@patriciogonzalezvivo
patriciogonzalezvivo / SimpleCameraFollower.md
Last active September 19, 2021 19:20
Simple Camara Follow in OF
cam.setPosition( cam.getPosition()+(targetPos-cam.getPosition())*0.01 );
cam.lookAt(targetPos);
@patriciogonzalezvivo
patriciogonzalezvivo / get string from ofSerial
Created April 27, 2013 15:27
Getting strings from ofSerial
string serialIn;
unsigned char buffer[1];
while( readBytes( buffer, 1) > 0){
if (buffer[0] == '\n'){
break;
}
serialIn.push_back(buffer[0]);
};
@patriciogonzalezvivo
patriciogonzalezvivo / StringShaders.md
Last active February 27, 2021 14:04
GLSL shaders on a strings (OF)

Stringify Macro

#define STRINGIFY(A) #A

Default Vertex

string vertexShader = STRINGIFY(	
@patriciogonzalezvivo
patriciogonzalezvivo / GLSL-geom-billboard.md
Last active February 27, 2021 14:04
GLSL Geom shader billboard
    vec2 offSet[4];
 	offSet[0] = vec2(0.,0.);
    offSet[1] = vec2(0.,1.);
    offSet[2] = vec2(1.,0.);
    offSet[3] = vec2(1.,1.);

	vec3 zAxis = normalize( vNormal[0] );
    vec3 yAxis = vec3( 0.0, 1.0, 0.0 );
 vec3 xAxis = normalize( cross(zAxis, yAxis) );
@patriciogonzalezvivo
patriciogonzalezvivo / toxic
Created June 27, 2015 12:55
Compiling a Tox Client in RPi
git clone git://github.com/jedisct1/libsodium.git
cd libsodium
git checkout tags/1.0.0
./autogen.sh
./configure && make check
sudo checkinstall --install --pkgname libsodium --pkgversion 1.0.0 --nodoc
sudo ldconfig
cd ..
git clone git://github.com/irungentoo/toxcore.git
@patriciogonzalezvivo
patriciogonzalezvivo / billboards.md
Last active July 14, 2018 06:43
Billboards on OF
void billBoard(){
	ofVec3f objectLookAt = ofVec3f(0,0,1);
	ofVec3f objToCam = cam.getGlobalPosition();
	objToCam.normalize();
	float theta = objectLookAt.angle(objToCam);
	
	ofVec3f axisOfRotation = objToCam.crossed(objectLookAt);
	axisOfRotation.normalize();
 
void rotateTo(ofPoint _dir){
ofVec3f newTarget = _dir;
newTarget.normalize();
ofVec3f up( 0, -1, 0 );
ofVec3f axis = up.crossed( newTarget );
axis.normalize();
float angle = up.angle( newTarget );
ofRotate( angle, axis.x, axis.y, axis.z );
}