Making a graceful fallback for missing textures.
Change-Id: Ib628d8344ab9bdd5f82c61a599c42a4c7ca3052e
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 8.2 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.7 KiB |
@@ -111,8 +111,8 @@ public class SceneManager extends SceneGraphBase {
|
||||
if (sSceneManager == null) {
|
||||
return null;
|
||||
}
|
||||
if (sSceneManager.sDefaultCube != null) {
|
||||
sSceneManager.sDefault2D = getDefault(true);
|
||||
if (sSceneManager.sDefaultCube == null) {
|
||||
sSceneManager.sDefaultCube = getDefault(true);
|
||||
}
|
||||
return sSceneManager.sDefaultCube;
|
||||
}
|
||||
@@ -156,6 +156,9 @@ public class SceneManager extends SceneGraphBase {
|
||||
|
||||
public static Allocation loadCubemap(String name, RenderScriptGL rs, Resources res) {
|
||||
Bitmap b = loadBitmap(name, res);
|
||||
if (b == null) {
|
||||
return null;
|
||||
}
|
||||
return Allocation.createCubemapFromBitmap(rs, b,
|
||||
MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
|
||||
Allocation.USAGE_GRAPHICS_TEXTURE);
|
||||
@@ -163,6 +166,9 @@ public class SceneManager extends SceneGraphBase {
|
||||
|
||||
public static Allocation loadTexture2D(String name, RenderScriptGL rs, Resources res) {
|
||||
Bitmap b = loadBitmap(name, res);
|
||||
if (b == null) {
|
||||
return null;
|
||||
}
|
||||
return Allocation.createFromBitmap(rs, b,
|
||||
Allocation.MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
|
||||
Allocation.USAGE_GRAPHICS_TEXTURE);
|
||||
@@ -336,10 +342,6 @@ public class SceneManager extends SceneGraphBase {
|
||||
mRenderLoop.set_gVertexParamsScript(mVertexParamsScript);
|
||||
mRenderLoop.set_gCullScript(mCullScript);
|
||||
|
||||
Allocation checker = Allocation.createFromBitmapResource(mRS, mRes, R.drawable.checker,
|
||||
MipmapControl.MIPMAP_ON_SYNC_TO_TEXTURE,
|
||||
Allocation.USAGE_GRAPHICS_TEXTURE);
|
||||
mRenderLoop.set_gTGrid(checker);
|
||||
mRenderLoop.set_gPFSBackground(ProgramStore.BLEND_NONE_DEPTH_TEST(mRS));
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ public class Texture2D extends TextureBase {
|
||||
}
|
||||
|
||||
public void setTexture(Allocation tex) {
|
||||
mData.texture = tex;
|
||||
mData.texture = tex != null ? tex : SceneManager.getDefaultTex2D();
|
||||
if (mField != null) {
|
||||
mField.set_texture(0, mData.texture, true);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class TextureCube extends TextureBase {
|
||||
}
|
||||
|
||||
public void setTexture(Allocation tex) {
|
||||
mData.texture = tex;
|
||||
mData.texture = tex != null ? tex : SceneManager.getDefaultTexCube();
|
||||
if (mField != null) {
|
||||
mField.set_texture(0, mData.texture, true);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ rs_allocation gRenderableObjects;
|
||||
rs_allocation gRenderPasses;
|
||||
|
||||
// Temporary shaders
|
||||
rs_allocation gTGrid;
|
||||
rs_program_store gPFSBackground;
|
||||
|
||||
uint32_t *gFrontToBack;
|
||||
|
||||
Reference in New Issue
Block a user