Displaying thumbnails in a grid
A thumbnail is a mini version of the full image. Therefore, we don't need to load a full-sized texture bitmap. For the sake of simplicity, let's just always sample it down by 4 (to 1/16th the original size).
The thumbnail image
In the Image
class, the show
method loads the full texture. Let's write a similar showThumbnail
method that uses a smaller sampling. In the Image
class, add the following code:
public void showThumbnail(CardboardView cardboardView, Plane thumb) { loadTexture(cardboardView, 4); BorderMaterial material = (BorderMaterial) thumb.getMaterial(); material.setTexture(textureHandle); calcRotation(thumb); calcScale(thumb); }
The Thumbnail class
Create a new Thumbnail
class for the project that will contain a small Plane
object and an Image
object to show on it. It also gets the current cardboardView
instance, which Image
will require:
public class Thumbnail { final static String TAG = "Thumbnail"...