14
stl::vector / ofMesh openFramework Workshop 20.02.2014, Q14

Vector of mesh

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: Vector of mesh

stl::vector / ofMeshopenFramework Workshop

20.02.2014, Q14

Page 2: Vector of mesh

simple 3D Calligraphy

Page 3: Vector of mesh
Page 4: Vector of mesh

• Interaction ← Maus „Drag“

• z-Depth ← Zeitwert

• Einfach 3D Umdrehung ← Tastatur

Konzept

Page 5: Vector of mesh

• struct / class → Datei speichern

• stl::vector ← mouse X, mouse Y, z Depth, movingValue

• ofMesh → OF_PRIMITIVE_TRIANGLE_STRIP

Programmierung

Page 6: Vector of mesh

struct / (class)

Mouse X, Y

3D Calligraphy

vector.push_back( struct / (class) )

mesh.addVertex( vector iterator vec3 x,y,z )

mesh.draw()

Z ← update()

ofRotate ← keyBoard Interaction

remove Vector ofRemove

(mesh Remove)

Page 7: Vector of mesh

struct

saveMouseDataS - x, y, timeclick, movingValue - Die Datei werden in Vector gespeichert.

http://www.cplusplus.com/doc/tutorial/structures/

Page 8: Vector of mesh

vector.push_back( )

Wenn die push_backl() läuft ab, die Datei in vector hingesetzt wird. !vector.at(0) : x : 217, y : 120, timeClick : 0 vector.at(1) : x : 210, y : 130, timeClick : 10 vector.at(2) : x : 180, y : 141, timeClick : 23 vector.at(3) : x : 175, y : 147, timeClick : 30 vector.at(4) : x : 150, y : 151, timeClick : 47 …

Page 9: Vector of mesh

vector.at( ) - für eine Begreifbarkeit

vector.at(i) → Aufzunehmen

vector.at(i).x, vector.at(i).y, vector.at(i).timeClick, vector.at(i).x

Page 10: Vector of mesh

iterator

(*it) ≃ vector.at(i) !(*it).x, (*it).y, (*it).timeClick

http://openframeworks.cc/tutorials/c++%20concepts/001_stl_vectors_basic.html

Page 11: Vector of mesh

ofRemove(saveMouseDataS, shouldRemove);

Ohne die „ofRemove()“ Funktion wird das Size von der „saveMouseDataS (vector)“ groß geworden sein

Page 12: Vector of mesh

openGL OF_PRIMITIVE_TRIANGLE_STRIP

Page 13: Vector of mesh

mesh.draw() / mesh.drawWireframe();

Diese einfache Beispiel braucht „mesh.clear()“

Page 14: Vector of mesh

ohne „mesh.clear()“ langsam (low performance)

!aber

„Interessanter Fehler :-)“

mesh.setMode(OF_PRIMITIVE_POINTS); ! mesh.draw(); // mesh.drawWireframe(); // mesh.clear();