我想在动态壁纸中加载一个 3d .obj 文件并为其设置动画。我使用 RAJAWALI 库来加载它。问题是 3d obj 文件已成功加载和动画,但在某些 android 设备中未加载加载背景图像。代码如下:
protected void initScene() {
DirectionalLight localDirectionalLight = new DirectionalLight(0.0F, 0.6F, 0.4F);
localDirectionalLight.setPower(3.0F);
PointLight mLight = new PointLight();
mLight.setPosition(0, 0, 0);
mLight.setPower(13);
Plane plane = new Plane(70, 70, 1, 1, 1);
plane.addLight(mLight);
plane.setMaterial(new SimpleMaterial());
plane.addTexture(mTextureManager.addTexture(BitmapFactory.decodeResource(mContext.getResources(), R.drawable.pozadina)));
addChild(plane);
plane.setZ(10);
try
{
ObjParser localObjParser = new ObjParser(this.mContext.getResources(), this.mTextureManager, R.raw.allah);
localObjParser.parse();
this.strela = localObjParser.getParsedObject();
this.strela.addLight(localDirectionalLight);
if (this.tekstura == null)
{
BitmapFactory.Options localOptions2 = new BitmapFactory.Options();
localOptions2.inPurgeable = true;
this.strela.setColor(Color.WHITE);
}
this.strela.setScale(2.0F);
addChild(this.strela);
this.mCamera.setPosition(0.0F, 0.0F, -50.0F);
this.mCamera.setFarPlane(1000.0F);
Number3D localNumber3D = new Number3D(0.0F, 1.0F, 0.0F);
localNumber3D.normalize();
this.mAnim = new RotateAnimation3D(localNumber3D, 360.0F);
this.mAnim.setDuration(10000L);
this.mAnim.setRepeatCount(-1);
this.mAnim.setTransformable3D(this.strela);
return;
}
catch (Exception localException)
{
while (true)
localException.printStackTrace();
}
}
它在 SAMSUNG NEXUS android v4.1 上出现问题。
请帮助我该怎么做?