本文整理汇总了Java中org.rajawali3d.Object3D类的典型用法代码示例。如果您正苦于以下问题:Java Object3D类的具体用法?Java Object3D怎么用?Java Object3D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Object3D类属于org.rajawali3d包,在下文中一共展示了Object3D类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initScene
import org.rajawali3d.Object3D; //导入依赖的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);
mContainer = new Object3D();
showMaskModel();
getCurrentScene().addChild(mContainer);
} catch (Exception e) {
e.printStackTrace();
}
getCurrentScene().setBackgroundColor(0);
}
示例2: setAnimationSequence
import org.rajawali3d.Object3D; //导入依赖的package包/类
/**
* Sets a new {@link SkeletalAnimationSequence}. It will use this one immediately no
* blending will be done.
*
* @param sequence The new {@link SkeletalAnimationSequence} to use.
*/
public void setAnimationSequence(SkeletalAnimationSequence sequence)
{
mSequence = sequence;
if (sequence != null && sequence.getFrames() != null)
{
mNumFrames = sequence.getFrames().length;
for (Object3D child : mChildren)
{
if (child instanceof SkeletalAnimationChildObject3D)
((SkeletalAnimationChildObject3D) child).setAnimationSequence(sequence);
}
}
}
示例3: parseBlock
import org.rajawali3d.Object3D; //导入依赖的package包/类
public void parseBlock(AWDLittleEndianDataInputStream dis, BlockHeader blockHeader) throws Exception {
mBaseObject = new Object3D();
mSceneGraphBlock = new SceneGraphBlock();
mSceneGraphBlock.readGraphData(blockHeader, dis);
// TODO need to 'getAssetByID' which appears to be the implemented method for referencing other parsed objects
// Container properties did not exist until 2.1, as such the container will be default 0, 0, 0
if (blockHeader.awdVersion == 2 && blockHeader.awdRevision == 1) {
// FIXME will have to implement this
dis.readProperties();
} else {
dis.readProperties();
}
mBaseObject.setVisible(dis.readByte() != 0);
mBaseObject.isContainer(true);
}
示例4: getNumObjects
import org.rajawali3d.Object3D; //导入依赖的package包/类
/**
* Retrieve the number of objects on the screen, recursive method
*
* @return int the total object count for the screen.
*/
public int getNumObjects() {
int objectCount = 0;
ArrayList<Object3D> children = getChildrenCopy();
for (int i = 0, j = children.size(); i < j; i++) {
Object3D child = children.get(i);
if (child.getGeometry() != null && child.getGeometry().getVertices() != null && child.isVisible())
if (child.getNumChildren() > 0) {
objectCount += child.getNumObjects() + 1;
} else {
objectCount++;
}
}
return objectCount;
}
示例5: EnemySpaceship
import org.rajawali3d.Object3D; //导入依赖的package包/类
/**
* This class holds status parameters of enemy and controls the movement
* @param x x axis value of initial position
* @param y y axis value of initial position
* @param z z axis value of initial position
* @param offset minimum distance to target (height(y axis) value)
* @param max_velocity max velocity
* @param delay delay object movement for specified time (milli-second)
* @param obj 3D object instance
*/
public EnemySpaceship(double x, double y, double z, double offset, double max_velocity, long delay, Object3D obj) {
super(obj);
loc = new Vector3(x, y, z);
pre_loc = new Vector3(x, y, z);
velo = new Vector3(0,0,0);
target = new Vector3(0,0,0);
attack = new Vector3(0,0,0);
y_offset = offset;
y_offset_temp = offset;
max_velo = max_velocity;
start_time = System.currentTimeMillis() + delay;
if(max_velo <= 0) max_velo = MAX_SPEED;
mode = MODE_ATTACK;
}
示例6: getNumTriangles
import org.rajawali3d.Object3D; //导入依赖的package包/类
/**
* Retrieve the number of triangles this scene contains, recursive method
*
* @return int the total triangle count for the scene.
*/
public int getNumTriangles() {
int triangleCount = 0;
ArrayList<Object3D> children = getChildrenCopy();
for (int i = 0, j = children.size(); i < j; i++) {
Object3D child = children.get(i);
if (child.getGeometry() != null && child.getGeometry().getVertices() != null && child.isVisible())
if (child.getNumChildren() > 0) {
triangleCount += child.getNumTriangles();
} else {
triangleCount += child.getGeometry().getVertices().limit() / 9;
}
}
return triangleCount;
}
示例7: Scene
import org.rajawali3d.Object3D; //导入依赖的package包/类
public Scene(Renderer renderer) {
mRenderer = renderer;
mAlpha = 0;
mAnimations = Collections.synchronizedList(new CopyOnWriteArrayList<Animation>());
mPreCallbacks = Collections.synchronizedList(new CopyOnWriteArrayList<ASceneFrameCallback>());
mPreDrawCallbacks = Collections.synchronizedList(new CopyOnWriteArrayList<ASceneFrameCallback>());
mPostCallbacks = Collections.synchronizedList(new CopyOnWriteArrayList<ASceneFrameCallback>());
mChildren = Collections.synchronizedList(new CopyOnWriteArrayList<Object3D>());
mPlugins = Collections.synchronizedList(new CopyOnWriteArrayList<IRendererPlugin>());
mCameras = Collections.synchronizedList(new CopyOnWriteArrayList<Camera>());
mLights = Collections.synchronizedList(new CopyOnWriteArrayList<ALight>());
mFrameTaskQueue = new LinkedList<>();
mCamera = new Camera();
mCamera.setZ(mEyeZ);
mCameras.add(mCamera);
mAntiAliasingConfig = ISurface.ANTI_ALIASING_CONFIG.NONE; // Default to none
}
示例8: attackDestroyer
import org.rajawali3d.Object3D; //导入依赖的package包/类
private void attackDestroyer(double x, double y, double z) {
// Make target vector
Random rand = new Random();
Vector3 targetVec = new Vector3(mDestroyer.object.getX()+rand.nextInt(20),
mDestroyer.object.getY()+rand.nextInt(20),
mDestroyer.object.getZ()+rand.nextInt(20));
targetVec.subtract(x, y, z);
targetVec.normalize();
targetVec.multiply(3);
// clone object and add to scene
Object3D missileObj = mMissileObj.clone();
missileObj.setX(x+targetVec.x);
missileObj.setY(y+targetVec.y);
missileObj.setZ(z+targetVec.z);
missileObj.setColor(FRIENDLY_MISSILE_COLOR);
mRenderer.getCurrentScene().addChild(missileObj);
//mMissileObj.addChild(missileObj);
// make Missile instance and set location and target
Missile missile = new Missile(x+targetVec.x, y+targetVec.y, z+targetVec.z,
Missile.FROM_MOTHERSHIP, missileObj);
targetVec.multiply(20);
missile.setTarget(targetVec.x, targetVec.y, targetVec.z);
synchronized (mMissiles) {
mMissiles.add(missile);
}
}
示例9: getNumObjects
import org.rajawali3d.Object3D; //导入依赖的package包/类
/**
* Retrieve the number of objects on the screen, recursive method
*
* @return int the total object count for the screen.
*/
public int getNumObjects() {
int objectCount = 0;
ArrayList<Object3D> children = getChildrenCopy();
for (int i = 0, j = children.size(); i < j; i++) {
Object3D child = children.get(i);
if (child.getGeometry() != null && child.getGeometry().getVertices() != null && child.isVisible())
if (child.getNumChildren() > 0) {
objectCount += child.getNumObjects() + 1;
} else {
objectCount++;
}
}
return objectCount;
}
示例10: fire
import org.rajawali3d.Object3D; //导入依赖的package包/类
public void fire() {
if(mLastFireTime + MISSILE_INTERVAL > System.currentTimeMillis()) {
return;
}
// clone object and add to scene
Object3D missileObj = mMissileObj.clone();
missileObj.setX(mCameraBox.getX());
missileObj.setY(mCameraBox.getY());
missileObj.setZ(mCameraBox.getZ());
missileObj.setColor(FRIENDLY_MISSILE_COLOR);
mRenderer.getCurrentScene().addChild(missileObj);
//mMissileObj.addChild(missileObj);
// make Missile instance and set location and target
Missile missile = new Missile(mCameraBox.getX(), mCameraBox.getY(), mCameraBox.getZ(),
Missile.FROM_FRIENDLY, missileObj);
Vector3 targetVec = new Vector3(mHeadViewForward);
targetVec.normalize();
targetVec.multiply(30);
missile.setTarget(mCameraBox.getX() + targetVec.x,
mCameraBox.getY() + targetVec.y,
mCameraBox.getZ() + targetVec.z);
synchronized (mMissiles) {
mMissiles.add(missile);
}
}
示例11: loadModel
import org.rajawali3d.Object3D; //导入依赖的package包/类
@NonNull
private Object3D loadModel() {
LoaderOBJ objParser = new LoaderOBJ(mContext.getResources(), mTextureManager, R.raw.head_obj);
try {
return objParser.parse().getParsedObject();
} catch (ParsingException e) {
throw new RuntimeException("could not load 3D head obj-file", e);
}
}
示例12: setTransformable3D
import org.rajawali3d.Object3D; //导入依赖的package包/类
@Override
public void setTransformable3D(ATransformable3D transformable3D) {
super.setTransformable3D(transformable3D);
if (!(transformable3D instanceof Object3D)) {
throw new RuntimeException(
"ColorAnimation3D requires the passed transformable3D to be an instance of "
+ Object3D.class.getSimpleName());
}
}
示例13: applyTransformation
import org.rajawali3d.Object3D; //导入依赖的package包/类
@Override
protected void applyTransformation() {
mMultipliedColor[0] = mDiffColor[0] * (float) mInterpolatedTime;
mMultipliedColor[1] = mDiffColor[1] * (float) mInterpolatedTime;
mMultipliedColor[2] = mDiffColor[2] * (float) mInterpolatedTime;
mMultipliedAlpha = (int) (mDiffAlpha * (float) mInterpolatedTime);
mAddedColor[0] = mFromColor[0] + mMultipliedColor[0];
mAddedColor[1] = mFromColor[1] + mMultipliedColor[1];
mAddedColor[2] = mFromColor[2] + mMultipliedColor[2];
((Object3D) mTransformable3D).setColor(Color.HSVToColor(mMultipliedAlpha + mFromAlpha, mAddedColor));
}
示例14: setSkeleton
import org.rajawali3d.Object3D; //导入依赖的package包/类
public void setSkeleton(Object3D skeleton) {
if (skeleton instanceof SkeletalAnimationObject3D) {
mSkeleton = (SkeletalAnimationObject3D) skeleton;
}
else
throw new RuntimeException(
"Skeleton must be of type AnimationSkeleton!");
}
示例15: play
import org.rajawali3d.Object3D; //导入依赖的package包/类
public void play() {
if (mSequence == null)
{
RajLog.e("[BoneAnimationObject3D.play()] Cannot play animation. No sequence was set.");
return;
}
super.play();
for (Object3D child : mChildren)
{
if (child instanceof AAnimationObject3D)
((AAnimationObject3D) child).play();
}
}