TSShapeInstance
by Jan Kavan · in Torque Game Engine · 10/08/2004 (9:51 am) · 0 replies
Hi,
sorry for my stupidity, but I'd love to have explained this once for all.
I have a class inherited from GuiTSCtrl. In this class I have overriden processCameraQuery(CameraQuery *query); and renderWorld(const RectI &updateRect);
In constructor I load a Resource and initialize a TSShapeInstance.
From what I thought, the processCameraQuery and renderWorld is a general method how to set a viewport.
When I create TSShapeInstance it is placed somewhere. My questions I was not able to deduce (looks like my misconception) is:
1, how to setup the initial position of shape according to camera.
I'll explain: Right now I am using in renderworld following - glLoadIdentity();glScalef();glRotatef();glTranslatef();TSShapeInstance->Render();
this puts me to a problem, that whatever I try makes the rotation around camera position and not the shape itself. I don't understand this. I thought that the render method should be independent from camera.
What is the other preffered way to handle object rotation around itself. I need to do this in C++.
2, There is one basic thing I can't understand and it's in CameraProcessQuery matrix algebra. Can anyone point me to some reasonable source?
***Snippet from showTSShape***
MatrixF xRot, zRot, newCameraRot;
xRot.set(EulerF(camRot.x, 0, 0));
zRot.set(EulerF(0, 0, camRot.z));
newCameraRot.mul(zRot,xRot);
****************************
I don't know why X and Z is being multiplied and what about Y. I know it's elementary but I am clueless on this and even Finney (where I expect to find some answers) didn't helped much.
If anyone could find time to point me in right directions I would be eternaly grateful.
Thanks a lot
Jan
sorry for my stupidity, but I'd love to have explained this once for all.
I have a class inherited from GuiTSCtrl. In this class I have overriden processCameraQuery(CameraQuery *query); and renderWorld(const RectI &updateRect);
In constructor I load a Resource
From what I thought, the processCameraQuery and renderWorld is a general method how to set a viewport.
When I create TSShapeInstance it is placed somewhere. My questions I was not able to deduce (looks like my misconception) is:
1, how to setup the initial position of shape according to camera.
I'll explain: Right now I am using in renderworld following - glLoadIdentity();glScalef();glRotatef();glTranslatef();TSShapeInstance->Render();
this puts me to a problem, that whatever I try makes the rotation around camera position and not the shape itself. I don't understand this. I thought that the render method should be independent from camera.
What is the other preffered way to handle object rotation around itself. I need to do this in C++.
2, There is one basic thing I can't understand and it's in CameraProcessQuery matrix algebra. Can anyone point me to some reasonable source?
***Snippet from showTSShape***
MatrixF xRot, zRot, newCameraRot;
xRot.set(EulerF(camRot.x, 0, 0));
zRot.set(EulerF(0, 0, camRot.z));
newCameraRot.mul(zRot,xRot);
****************************
I don't know why X and Z is being multiplied and what about Y. I know it's elementary but I am clueless on this and even Finney (where I expect to find some answers) didn't helped much.
If anyone could find time to point me in right directions I would be eternaly grateful.
Thanks a lot
Jan
About the author