Support for 3d background: 2048px 6-side horizontal cubemap

Adding support for 2D texture that represents 6-sided cube (2048px per side) as a horizontal layout:
[ +x ]  [ -x ]  [ +y ]  [ -y ]  [ +z ]  [ -z ]

This is the recommended representation of cube map as it is more efficient in terms of memory.
This commit is contained in:
tverona1
2019-11-02 10:58:59 -07:00
parent 95f9b1be78
commit fa1f67cfc2
2 changed files with 46 additions and 12 deletions
+2 -3
View File
@@ -273,7 +273,7 @@ public class AppInfo extends UnityPlayerActivity {
}
}
public static DecodedBitmap loadRawImage(String imagePath, int maxWidth, int maxHeight) {
public static DecodedBitmap loadRawImage(String imagePath, int maxPixels) {
Log.v(TAG, "Decoding image at " + imagePath);
try {
@@ -290,8 +290,7 @@ public class AppInfo extends UnityPlayerActivity {
// Calculate the largest inSampleSize value that is a power of 2 and keeps both
// height and width smaller than the requested height and width.
options.inSampleSize = 1;
while ((height / options.inSampleSize) >= maxHeight
|| (width / options.inSampleSize) >= maxWidth) {
while (height / options.inSampleSize * width / options.inSampleSize > maxPixels) {
options.inSampleSize *= 2;
}
Log.v(TAG, "Image sample size: " + options.inSampleSize);