Neural mechanisms for integrating vision and internal state