Picking

Published May 18, 2010
Advertisement
I got picking back in now. I threw out the color picking. It would require too much work to integrate it properly, so I fixed the gluUnProject. I got the code from my friend, Kenneth Gangsto, from the ClanLib GDK.

int PerspectiveCamera::unProject(const siut::simd::Vec3f &win, 			  const siut::simd::Mat4f &modelview, 			  const siut::simd::Mat4f &proj, 			  const GLint viewport[4], 			  siut::simd::Vec3f &obj){	siut::simd::Mat4f matrix = proj * modelview;  	matrix = siut::simd::standard::inverse(matrix);	siut::simd::Vec4f v( 2*(win.x() - (float)viewport[0])/(float)viewport[2] - 1,						 2*(win.y() - (float)(viewport[1]))/(float)viewport[3] - 1,						 2*win.z() - 1,						 1.0f);      siut::simd::Vec4f result = matrix * v; 	 obj = siut::simd::Vec3f(result.x()/result.w(), result.y()/result.w(), result.z()/result.w());	 return GL_TRUE;}


This allowed me to start placing towers again. I exchanged the perimeter circle with a disk that takes a texture, and I animated the perimeter slightly in the vertex shader. Looks a lot better now!

My towers seriously need self-shadowing in order to look better. Their detail is totally lost in lack of shadow depth. Maybe SSAO could fix this, but that implementation didn't work out on first try, and I only have one week left now. No time for SSAO in other words!

Here's what I got after today's trouble:


0 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement