Jump to content

Recommended Posts

Posted

Hi Ubu,

 

I was just looking at the code of your library and noticed that CameraProject and CameraUnproject return void and take only two parameters (camera and position). As far as I can see, position is either used to specify the position to project/unproject or to store the results in.

 

Is this intended? How would I project/unproject a position?

 

Great work on the wrapper though!

 

Cheers!

Posted

The command replaces the values in the vec3 you pass in to the projected/unprojected coordinates respectively.

 

Kind of sloppy, but passing my reference is indeed faster than it returning a copy of the vec3.

52t__nvidia.png nVidia 530M cpu.gif Intel Core i7 - 2.3Ghz 114229_30245_16_hardware_memory_ram_icon.png 8GB DDR3 RAM Windows7_Start.gif Windows 7 Ultimate (64x)

-----

IconVisualStudio16.png Visual Studio 2010 Ultimate google-Chrome.png Google Chrome PhotoshopLinkIndicator.png Creative Suite 5 icon28.gif FL Studio 10 MicrosoftOfficeLive.png Office 15

-----

csharp.png Expert cpp.png Professional lua_icon.png Expert BMX Programmer

-----

i-windows-live-messenger-2009.pngskype-icon16.pngaim_online.pnggmail.pngicon_48x48_prism-facebook.pngtunein-web.pngyahoo.giftwitter16.png

Posted

These were indeed marked "To review" in my code. Tell me if that seems to fit you more, it will be in the next version:


	public Vector3 Project(Vector3 position)
	{
		float[] result = new float[3];
		Core.CameraProject(this.Pointer, result);
		return new Vector3(result);
	}

	public Vector3 Unproject(Vector3 position)
	{
		float[] result = new float[3];
		Core.CameraUnproject(this.Pointer, result);
		return new Vector3(result);
	}

 

 

Thanks for reporting bugs Laurens :unsure:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...