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: