Quantcast
Channel: Library Questions - Processing 2.x and 3.x Forum
Viewing all articles
Browse latest Browse all 2896

Saito OBJLoader Array

$
0
0

Hello,i have this code

import saito.objloader.*;

OBJModel model ;
OBJModel tmpmodel ;


PVector[] PVArray;
float rotX, rotY;
float k = 0.0;

void setup()
{
  size(800, 600, P3D);
  frameRate(30);
  model = new OBJModel(this, "Model2.obj", "absolute", TRIANGLES);
  model.enableDebug();

  model.scale(100);
  model.translateToCenter();

  tmpmodel = new OBJModel(this, "Model2.obj", "absolute", TRIANGLES);

  tmpmodel.enableDebug();

  tmpmodel.scale(100);

  tmpmodel.translateToCenter();


  frameRate(100);
  stroke(255);
  noStroke();
}



void draw()
{
  background(129);
  lights();
  translate(width/2, height/2, 0);
  //rotX+=0.1;
  rotY+=0.01;
  //rotateX(rotX);
  //rotateY(rotY);


  pushMatrix();


  for (int i = 0; i < model.getVertexCount (); i++) {
    PVector orgv = model.getVertex(i);
    PVector tmpv = new PVector();
    PVArray[i] = new PVector();
    //tmpv.x = mouseY;
    //tmpv.y = mouseY;
    println(orgv);
    tmpv.x = orgv.x *(i*mouseX);
    tmpv.y = orgv.y+ (i*0.01) ;
    tmpv.z = orgv.z;
    tmpmodel.setVertex(i, tmpv);
  }
  k+=0.01;



  popMatrix();

  tmpmodel.draw();
}

I have problem with the model.getVertex(i) function,I want to make an array of the PVectors that it gets,so i can manipulate them individualy,with custom functions.and no as a whole object.Do you have any idea?Or u think its better to use PShapeObj?

Thanks in advance


Viewing all articles
Browse latest Browse all 2896

Trending Articles