bool Planet::get_color(ColorRGBA& resulting_color, const Vector2& screen, Math::Ray ray, gfloat& distance)const { if(sphere.radius<=0.f) return false; ray.transform(sphere.inv_transformation); if(!sphere.intersects_local(ray, distance)) return false; Vector3 p = ray.origin + ray.dir*distance; p.normalize(); p *= sphere.radius; Vector3 normal = p; normal *= 1.f/sphere.radius; if(Manager::get_settings().get_dbg_normal()) { resulting_color.set_direction(normal); }else { Vector2 uv; vec_to_uv(uv, normal); if(Manager::get_settings().get_dbg_uv()) { resulting_color.set(uv.x, uv.y, 0.f, 1.f); }else { shader(resulting_color, screen, uv, normal, ray); } } return true; }
void ColorHSV::get(ColorRGBA& color) const { color.set(*this); }