当前位置: 首页>>代码示例>>Java>>正文


Java World.getCamera方法代码示例

本文整理汇总了Java中com.threed.jpct.World.getCamera方法的典型用法代码示例。如果您正苦于以下问题:Java World.getCamera方法的具体用法?Java World.getCamera怎么用?Java World.getCamera使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.threed.jpct.World的用法示例。


在下文中一共展示了World.getCamera方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configureARScene

import com.threed.jpct.World; //导入方法依赖的package包/类
/**
 * Configuration of the AR Scene
 * Initializes jPCT and gets the trackable objects list
 * Registers the markers and adds the objects to the world
 */
@Override
public boolean configureARScene() {
    // Initialize the game world and the camera
    mWorld = new World();
    mCamera = mWorld.getCamera();
    // Set the FOV based on the camera parameters
    // This FOW is correct when using
    android.hardware.Camera.Parameters params = mActivity.getCameraPreview().getCameraParameters();
    // Setting the FOV based on the camera params, this seems to work fine with 640x480
    float fov = params.getHorizontalViewAngle();
    float yfov = params.getVerticalViewAngle();
    mCamera.setFOV(mCamera.convertDEGAngleIntoFOV(fov));
    mCamera.setYFOV(mCamera.convertDEGAngleIntoFOV(yfov));

    mActivity.configureWorld(mWorld);

    // Get the activity list of trackable objects
    mTrackableObjects = mActivity.getTrackableObject3DList();

    // Load all the markers and add the objects to the world
    for (int i=0; i<mTrackableObjects.size(); i++) {
        TrackableObject3d trackableObject = mTrackableObjects.get(i);
        // Load the marker
        if (! trackableObject.registerMarker() ) {
            // If there was a problem, return false
            return false;
        }
        // Add the object to the world, note that mWorld.addObject is not recursive
        trackableObject.addToWorld(mWorld);
    }

    mWorld.buildAllObjects();

    mFovSet = false;

    return true;
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:43,代码来源:ArJcptRenderer.java

示例2: drawScene

import com.threed.jpct.World; //导入方法依赖的package包/类
private void drawScene(){
	world = new World();

	Vector<EditorObject> objects = new Vector<EditorObject>();
	Vector<LightData> lights = new Vector<LightData>();

	
	String flagModeSetting = prefs.getString(Settings.FLAG_MODE_SETTING, Settings.FLAG_MODE_FULLSCREEN);
	String flagSpeedSetting = prefs.getString(Settings.FLAG_SPEED, "normal");
	
	AssetManager assetManager = FlagWallpaperService.context.getAssets();
	objects = Scene.loadSerializedLevel(flagModeSetting+"_"+flagSpeedSetting+".txt", objects, lights, null,null, world, assetManager);

	flag = (Scene.findObject(flagModeSetting+"0", objects));
	Animator.Play(flag, "wave", objects);

	float[] bb = flag.getMesh().getBoundingBox();
	float width = Math.abs(bb[0]-bb[1]);
	Camera cam = world.getCamera();
	float moveout;
	if(flagModeSetting.equals(Settings.FLAG_MODE_FULLSCREEN)){
		pole = null;
		moveout = 30; 
		cam.setPositionToCenter(flag);
		cam.moveCamera(Camera.CAMERA_MOVEOUT, moveout);
		//		cam.setYFOV(cam.convertRADAngleIntoFOV((float) Math.atan(height/(2*moveout))));
		cam.setFOV(cam.convertRADAngleIntoFOV((float) Math.atan(width/(2*moveout))));
		cam.lookAt(flag.getTransformedCenter());
	}else{
		pole = (Scene.findObject("pole", objects));
		float height = Math.abs(bb[2]-bb[3]);
		moveout = 35; 
		cam.setPosition(0, 0, 0);
		cam.moveCamera(Camera.CAMERA_MOVEOUT, moveout);
		cam.moveCamera(Camera.CAMERA_MOVEDOWN, height-5);
		cam.setFOV(cam.convertRADAngleIntoFOV((float) Math.atan(width/(2*moveout))));
		cam.lookAt(new SimpleVector(width/2, -height/2, 0));			
	}

	Light sun = new Light(world);
	SimpleVector sv = new SimpleVector();
	sv.set(flag.getTransformedCenter());
	sv.y += 100;
	sv.x -= 100;
	sv.z -= 30;
	sun.setPosition(sv);
	//		sun.disable();

	MemoryHelper.compact();

}
 
开发者ID:danilox6,项目名称:flag3dlivewallpaperbase,代码行数:52,代码来源:FlagRenderer.java


注:本文中的com.threed.jpct.World.getCamera方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。