Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

tcs

pointer problem

This topic is 6927 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello... And I just have another problem ;-) Take a look at this function: void CMesh::GetFacesWithHSR(const CCamera *Camera, Face *pFacesOut, unsigned int &iFaceCountOut) { //////////////////////////////////////////////////// // Return a PVS for the passed camera object //////////////////////////////////////////////////// if (!Camera) { // No viewpoint is given, return all faces iFaceCountOut = m_iFaceCount; pFacesOut = m_pFaces; if (!pFacesOut) MessageBox(NULL,"","",NULL); } } I want to get a pointer to the m_pFaces list of my CMesh class. So I copy the member pointer into the passed one. I even check if the pointer is copied right. But when the function returns, the passed pointer (pFacesOut) is always unchanged... Am I to damn tired and overlooking something stupid ? Any help would be cool... Tim

Share this post


Link to post
Share on other sites
Advertisement
If you want to change pFacesOut (declared as Face *pFacesOut) the way it looks like you want declare it as Face * &pFacesOut instead. In the function you only change the local pointer pFacesOut. If you do this it will change the pointer sent to the function.

Share this post


Link to post
Share on other sites
Thanks man !

I already relized this, but I never seen such a declaration...

Share this post


Link to post
Share on other sites
I had to use it a few day ago so I know it works. I just had to try because after writing it it looked very strage, but it works just fine.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!