Closed cansik closed 7 years ago
I'd guess that instead of canvas.camera = p.camera
you'd have to copy the peasycam camera, as in canvas.camera = new PMatrix3D(p.camera)
.
But this is just a guess.
Found this as solution. Works great!
cam.getState().apply(canvas);
Oh, yeah. That's what that's for. :)
At the moment I am working on a multi-pass rendering in processing. There I have to use a new
PGraphics3D
canvas and I can not use the defaultg
object. After the rendering and shading, I'm just going to "print" it on to theg
object again as texture:Now I have the problem that things like peasycam do not work anymore because they are attached to the original
g
and do not transform the camera matrix of my canvas.So I tried to use the camera matrix of the original graphics and copy it to my canvas:
This did not work, maybe because peasycam is doing something special and it does not change the original camera matrix. So my next idea was to use the static
apply
method from peasy cam. I had to copy the function out of the original code and make it public:Here the
apply
method:There I always have a zero norm for rotation (Arithmetic Exception). So my final idea was to just copy all the rotations and translation to my camera matrix:
So now I could rotate my cube, but it was not accurate and I think there is something wrong with some axis.
I would like to ask if someone has done this before and if there is a simple method to do this?