本文整理汇总了Java中org.rajawali3d.loader.LoaderAWD类的典型用法代码示例。如果您正苦于以下问题:Java LoaderAWD类的具体用法?Java LoaderAWD怎么用?Java LoaderAWD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
LoaderAWD类属于org.rajawali3d.loader包,在下文中一共展示了LoaderAWD类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initScene
import org.rajawali3d.loader.LoaderAWD; //导入依赖的package包/类
@Override
protected void initScene() {
try {
mLight = new DirectionalLight(0.1f, -1.0f, -1.0f);
mLight.setColor(1.0f, 1.0f, 1.0f);
mLight.setPower(1);
getCurrentScene().addLight(mLight);
final LoaderAWD parser = new LoaderAWD(mContext.getResources(), mTextureManager, R.raw.head_object_new);
parser.parse();
mMonkey = parser.getParsedObject();
mMonkey.setScale(0.005f);
//mMonkey.setZ(-2f);
// getCurrentScene().addChild(mMonkey);
int[] resourceIds = new int[]{R.drawable.posx, R.drawable.negx,
R.drawable.posy, R.drawable.negy, R.drawable.posz,
R.drawable.negz};
Material material = new Material();
material.enableLighting(true);
material.setDiffuseMethod(new DiffuseMethod.Lambert());
CubeMapTexture envMap = new CubeMapTexture("environmentMap",
resourceIds);
envMap.isEnvironmentTexture(true);
material.addTexture(envMap);
material.setColorInfluence(0);
mMonkey.setMaterial(material);
LoaderOBJ objParser1 = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.glasses_obj);
objParser1.parse();
mGlasses = objParser1.getParsedObject();
mGlasses.setScale(0.005f);
//mGlasses.setZ(-0.2f);
mGlasses.setZ(0.3f);
mGlasses.rotate(Vector3.Axis.X, -90.0f);
LoaderOBJ objParser2 = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.hair_band_obj);
objParser2.parse();
mHairBand = objParser2.getParsedObject();
mHairBand.setScale(0.006f);
mHairBand.setY(0.27f);
mHairBand.setZ(-0.25f);
mHairBand.rotate(Vector3.Axis.X, -90.0f);
LoaderOBJ objParser3 = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.moustache_obj);
objParser3.parse();
mMoustache = objParser3.getParsedObject();
mMoustache.setScale(0.007f);
mMoustache.setY(-0.25f);
mMoustache.setZ(0.3f);
mMoustache.rotate(Vector3.Axis.X, -90.0f);
mContainer = new Object3D();
mContainer.addChild(mMonkey);
mContainer.addChild(mGlasses);
mContainer.addChild(mHairBand);
mContainer.addChild(mMoustache);
getCurrentScene().addChild(mContainer);
//getCurrentCamera().setZ(20);
} catch (Exception e) {
e.printStackTrace();
}
// -- set the background color to be transparent
// you need to have called setGLBackgroundTransparent(true); in the activity
// for this to work.
getCurrentScene().setBackgroundColor(0);
}
示例2: makeMothership
import org.rajawali3d.loader.LoaderAWD; //导入依赖的package包/类
private void makeMothership() {
try {
CatmullRomCurve3D path;
LoaderAWD loader = new LoaderAWD(mContext.getResources(),
mRenderer.getTextureManager(), R.raw.capital);
loader.parse();
Material capitalMaterial = new Material();
capitalMaterial.setDiffuseMethod(new DiffuseMethod.Lambert());
capitalMaterial.setColorInfluence(0);
capitalMaterial.enableLighting(true);
capitalMaterial.addTexture(new Texture("capitalTex", R.drawable.hullw));
capitalMaterial.addTexture(new NormalMapTexture("capitalNormTex", R.drawable.hulln));
mMothershipObj = loader.getParsedObject();
mMothershipObj.setMaterial(capitalMaterial);
mMothershipObj.setScale(5);
mMothershipObj.enableLookAt();
mRenderer.getCurrentScene().addChild(mMothershipObj);
path = new CatmullRomCurve3D();
path.addPoint(new Vector3(0, 15, 100));
path.addPoint(new Vector3(-100, 15, 0));
path.addPoint(new Vector3(0, 15, -100));
path.addPoint(new Vector3(100, 15, 0));
path.isClosedCurve(true);
mMothershipAnim = new SplineTranslateAnimation3D(path);
mMothershipAnim.setDurationMilliseconds(ANIM_DURATION);
mMothershipAnim.setRepeatMode(Animation.RepeatMode.INFINITE);
mMothershipAnim.setOrientToPath(true);
mMothershipAnim.setTransformable3D(mMothershipObj);
mRenderer.getCurrentScene().registerAnimation(mMothershipAnim);
mMothershipAnim.play();
mMothership = new Mothership(mMothershipObj);
} catch (Exception e) {
e.printStackTrace();
}
}