Vertex models for the hard-square and hard-hexagon gases, and critical parameters from the scaling transformation