I have a camera class that has two pointers as parameters:
Camera::Camera(
float fOVDeg, float nearCull, float farCull,
float xPos, float yPos, float zPos,
D3DMATRIX* matProjection, D3DMATRIX* matView)
{
this->SetCamera(fOVDeg, nearCull, farCull);
this->AdjustCamera(xPos, yPos, zPos);
matProjection = &(this->projection);//gets the addresses of two private members
matView = &(this->view);
}
and this is the code that calls it:
D3DMATRIX* matProjection,* matView;
//called once
void Initialise(HWND hWnd)
{
camera = new Camera(
45.0f, 1.0f, 100.0f,
0.0f, 9.0f, 24.0f,
matProjection, matView);
...rest of code...
basically the problem is that I want the two pointers in the code that calls the camera constructor to retain the memory addresses of the camera classes two private members so I can do stuff with 'em! trouble is, this works fine, but as soon as the constructor is finished the pointers become null (0x00000000). I have no idea why! The camera's private members still have values because I was just grabbing their values with getters before and it worked fine.