Add simple tile visibility checking in the ViewModule

Yep but those references are over a decade old, so I wonder if they still
apply. Bit-shifting is an old x86 technique, I use it out of habit. I
wonder though if the compiler won't apply these optimizations automatically
anyway... worth reading up on just to know.

On Mon, Sep 15, 2014 at 9:45 PM, Varun <notifications@github.com> wrote:

> In core/viewModule/viewModule.cpp:
>
> > @@ -60,3 +62,47 @@ glm::mat2 ViewModule::getBoundsRect() {
> >  	return glm::mat2(m_pos.x - hw, m_pos.y - hh, m_pos.x + hw, m_pos.y + hh);
> >
> >  }
> > +
> > +const std::vector<glm::ivec3>& ViewModule::getVisibleTiles() {
> > +
> > +	if (!m_dirty) {
> > +		return m_visibleTiles;
> > +	}
> > +
> > +	m_visibleTiles.clear();
> > +
> > +	float tileSize = 2 * PI * EARTH_RADIUS_M / pow(2, m_zoom);
>
> yup... hence use of bitwise operators is also recommended. (multiplication
> by 2 should be replaced with one right shift, and division by 2 should be
> replaced by one left shift)..
>
> there are many more such optimizations ...
>
> http://books.google.com/books?id=IRN0IEXJzKEC&pg=PA92&lpg=PA92&dq=floating+point+division+multiplication+optimization+c%2B%2B&source=bl&ots=P1mjHg8EAs&sig=sZD71hukKFcJ6RaBJz4Q5awC9gs&hl=en&sa=X&ei=hZUXVNvRENSn8QGvq4HoBw&ved=0CFEQ6AEwBw#v=onepage&q=floating%20point%20division%20multiplication%20optimization%20c%2B%2B&f=false
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/tangram-map/tangram-es/pull/5/files#r17579753>.
>