ofPlanePrimitiveメモ

前回の続きで3DPrimitivesExsampleについて

まず、ofPlanePrimitiveの場合

//初期に幅、高さなどをセット

plane.set(float width, float height, int columns, int rows);

 

//draw()にて

//3次元位置を決めたり

plane.setPosition(float px, float py, float pz);

//回転させたり

plane.rotate(float degrees, float vx, float vy, float vz);

//plane.rotate(const ofQuaternion &q);

//plane.rotate(float degrees, const ofVec3f &v);

 

//セットする x = columns, y = rows

plane.setResolution( int columns, int rows );

 

//分割した x = columns と y = rowsを取得

plane.getResolution();

 

//分割しているワイヤーフレームを描画

plane.drawWireframe();

 

//サンプルの3DPrimitivesExampleは

//modeが3の時

plane.setMode( OF_PRIMITIVE_TRIANGLE_STRIP );

//void of3dPrimitives::mapTexCoords(float u1, float v1, float u2, float v2);

//planeにはりつける 画像に対するクリップ範囲?? uv座標

plane.mapTexCoords(0, 0, 5, 5);

 

//法線を表示している

//length:表示する法線の長さ

//bSplitFace:falseだと全ての頂点の法線表示?

plane.drawNormals(float length, bool bSplitFaces=false);

 

//3軸(x,y,z)を表示

plane.drawAxes(float a_size)

 

 //メッシュのインデックスindices(面のインデックス)の総数を取得

for(int i = 0; i < deformPlane.getNumIndices(); i++ ) {

 planeAngleX += planeAngleInc;

 

    //インデックス番号取得

     int ii = deformPlane.getIndex( i );

    //インデックス番号により頂点を取得

    vert = deformPlane.getVertex( ii );

    //頂点のz値を変動させる

    vert.z += cos(planeAngleX) * 50;

    //頂点情報をセット

    deformPlane.setVertex( ii, vert );

  }

 

if(mode == 3) {

    //GPUを使かって描画??

    plane.transformGL();

    deformPlane.draw();

    //GPUを使かって描画解除する??

    plane.restoreTransformGL();

} else {

    //普通に描画している

    plane.draw();

}

 

ほかのPrimitiveは気が向いたらします...(´・ω・)