peasycam mixed ortho and perspective
in
Contributed Library Questions
•
1 year ago
Hi all,
I am trying to create a plot of a model (of a temple) and I am using peasycam for camera control. I want to add the three coordinate axis/arrows in the bottom left corner of the screen and have them follow the direction of the camera.
I have more or less succeeded in doing this by using beginHUD() and endHUD(). However, I am having a hard time trying to get the axis to plot in ortho (parallel projection) mode while the rest of the model remains in perspective. As you might imagine having the axis shown in perspective would confuse the user.
Here is my plot code:
- float[] rot = pCamera.getRotations();
- ortho();
- pCamera.beginHUD();
- pushMatrix();
- translate(60, height - 60, 0);
- rotateX(rot[0]);
- rotateY(rot[1]);
- rotateZ(rot[2]);
- strokeWeight(3);
- //x-axis
- stroke(0, 255, 0);
- line(0, 0, 0, 30, 0, 0);
- //y-axis
- stroke(255, 0, 0);
- line(0, 0, 0, 0, 30, 0);
- //z-axis
- stroke(0, 0, 255);
- line(0, 0, 0, 0, 0, -30);
- popMatrix();
- pCamera.endHUD();
- perspective();
Any help is greatly appreciated.
Thanks,
Ali
PS: I had posted this question in the programming section but that was moved into general discussions. This had come up in the course of the thread and there was no solutions. So I am re-posting this particular question here in the hopes that I'll get more input. I hope that is alright with everyone.
1