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


Java SimpleVector类代码示例

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


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

示例1: populateTrackableObjects

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
protected void populateTrackableObjects(List<TrackableObject3d> list) {
    ARToolKit.getInstance().setPatternDetectionMode(NativeInterface.AR_MATRIX_CODE_DETECTION);
    ARToolKit.getInstance().setMatrixCodeType(NativeInterface.AR_MATRIX_CODE_3x3);

    TrackableObject3d tckobj = new TrackableObject3d("multi;Data/cubeMarkerConfig.dat");

    Object3D object3D = Primitives.getCube(60);
    object3D.setTransparency(10);
    object3D.setTransparencyMode(Object3D.TRANSPARENCY_MODE_DEFAULT);
    object3D.rotateY((float) Math.PI / 4);
    object3D.setOrigin(new SimpleVector(0, 0, -60));

    tckobj.addChild(object3D);

    list.add(tckobj);
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:17,代码来源:MainActivity.java

示例2: setCameraMatrix

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
@Override
	public void setCameraMatrix(Matrix4f matrix, Vector3f lookAt, Vector3f eye, Vector3f up)
	{
		// TODO: OrthoCamera sets the position *way* far out and we look everything
		// behind the far plane.
		// Figure out how to adjust jpct's near/far planes
		
		world.setClippingPlanes(1.0f, 2000);
		
		float fov = (float)Math.PI/180f;
		world.getCamera().setFOV(fov);
		world.getCamera().setFOVLimits(fov, fov);
		
		world.getCamera().setPosition(eye.x, eye.y, eye.z);
		world.getCamera().lookAt(new SimpleVector(lookAt.x, lookAt.y, lookAt.z));
		
/*		
		eye = new Vector3f(50, -120, 100);
		Vector3f target = new Vector3f(50, 0, 50);
		
		world.getCamera().setPosition(eye.x, eye.y, eye.z);
		world.getCamera().lookAt(new SimpleVector(target.x, target.y, target.z));
*/
	}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:25,代码来源:JpctRasteriser.java

示例3: localloadModel

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
public Object3D localloadModel(String filename, float scale) throws IOException {
      
String file = "res/raw/" + filename;

      InputStream stream = this.getClass().getClassLoader().getResourceAsStream(file);
      
      System.out.println("The code is executed");
   		   
       Object3D[] model = Loader.load3DS(stream, scale);
       Object3D o3d = new Object3D(0);
       Object3D temp = null;
       for (int i = 0; i < model.length; i++) {
           temp = model[i];
           temp.setCenter(SimpleVector.ORIGIN);
           temp.rotateX((float)( -.5*Math.PI));
           temp.rotateMesh();
           temp.setRotationMatrix(new Matrix());
           o3d = Object3D.mergeObjects(o3d, temp);
           o3d.build();
       }
       return o3d;
   }
 
开发者ID:huberflores,项目名称:MeshOffloading,代码行数:23,代码来源:Model3D.java

示例4: localloadModel

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
public Object3D localloadModel(String filename, float scale) throws IOException {
      
String file = "res/raw/" + filename;

      InputStream stream = this.getClass().getClassLoader().getResourceAsStream(file);
      
      System.out.println("File is executed");
   		   
       Object3D[] model = Loader.load3DS(stream, scale);
       Object3D o3d = new Object3D(0);
       Object3D temp = null;
       for (int i = 0; i < model.length; i++) {
           temp = model[i];
           temp.setCenter(SimpleVector.ORIGIN);
           temp.rotateX((float)( -.5*Math.PI));
           temp.rotateMesh();
           temp.setRotationMatrix(new Matrix());
           o3d = Object3D.mergeObjects(o3d, temp);
           o3d.build();
       }
       return o3d;
   }
 
开发者ID:huberflores,项目名称:MeshOffloading,代码行数:23,代码来源:Model3D.java

示例5: removeSceneFromWorld

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
/**
 * Removes everything to the world. Reset camera pos/lookAt.
 */
public void removeSceneFromWorld() {
	if (!active)
		throw new RuntimeException(
				"Cannot remove scene! It has already been removed!");

	for (Object3D instance : instances) {
		world.removeObject(instance);
	}

	for (IActor actor : actors) {
		actor.removeFromWorld();
	}

	for (Light light : lights) {
		light.dispose();
	}

	world.getCamera().setPosition(0, 0, 0);
	world.getCamera().lookAt(new SimpleVector(0, 0, 1));

	active = false;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:26,代码来源:JPCTBlendScene.java

示例6: loadModel

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
private Object3D loadModel(String filename, float scale){
InputStream stream = getResources().openRawResource(R.raw.monster);
      Object3D[] model = Loader.load3DS(stream, scale);
      Object3D o3d = new Object3D(0);
      Object3D temp = null;
      for (int i = 0; i < model.length; i++) {
          temp = model[i];
          temp.setCenter(SimpleVector.ORIGIN);
          temp.rotateX((float)( -.5*Math.PI));
          temp.rotateMesh();
          temp.setRotationMatrix(new Matrix());
          o3d = Object3D.mergeObjects(o3d, temp);
          o3d.build();
      }
      return o3d;
  }
 
开发者ID:JA0L,项目名称:3DSModel-AR,代码行数:17,代码来源:MainActivity.java

示例7: populateTrackableObjects

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
protected void populateTrackableObjects(List<TrackableObject3d> list) {
    TrackableObject3d tckobj = new TrackableObject3d("single;Data/patt.hiro;80", getCube());

    TrackableLight light = new TrackableLight();
    light.setIntensity(0, 0, 255);
    light.setPosition(new SimpleVector(0, 0, 100));
    tckobj.addLight(light);

    list.add(tckobj);

    TrackableObject3d trackablePlane = new TrackableObject3d("single;Data/patt.kanji;80", getPlane());
    list.add(trackablePlane);
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:14,代码来源:ARSimple.java

示例8: getCube

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
private Object3D getCube() {
    int scale = 40;
    Object3D object3D = Primitives.getCube(scale);
    // Cubes in jpct are rotated by 45 degrees when created.
    object3D.rotateY((float) Math.PI / 4);
    object3D.setOrigin(new SimpleVector(0, 0, scale));
    return object3D;
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:9,代码来源:ARSimple.java

示例9: update

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
public void update(SimpleVector translation) {
    if (mLight != null) {
        mCurrentLocation.set(mPosition);
        mCurrentLocation.add(translation);
        mLight.setPosition(mCurrentLocation);
    }
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:8,代码来源:TrackableLight.java

示例10: draw

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
/**
 * Override the draw function from ARRenderer
 * This one sets the correct position and orientation from the camera
 * For each trackable object, checks if the marker is visible and if so, updates the object
 */
@Override
public final void draw(GL10 gl) {
    mBuffer.clear();

    float[] projection = ARToolKit.getInstance().getProjectionMatrix();
    projMatrix.setDump(projection);
    SimpleVector translation = projMatrix.getTranslation();

    if (!mFovSet) {
        // Calculate FOV based on projection values, but do it only once
        float value1 = projection[5];
        float vFov = (float) Math.atan2(1, value1)*2;
        mCamera.setYFovAngle(vFov);
        float aspect = projection[5] / projection[0];
        float fov = (float) (2 * Math.atan2(mCamera.getYFOV() , 2 ) * aspect);
        mCamera.setFovAngle(fov);
        mFovSet = true;
    }

    SimpleVector dir = projMatrix.getZAxis();
    SimpleVector up = projMatrix.getYAxis();
    mCamera.setPosition(translation);
    mCamera.setOrientation(dir, up);

    for (int i=0; i<mTrackableObjects.size(); i++) {
        TrackableObject3d trackableObject = mTrackableObjects.get(i);
        trackableObject.updateMarkerTransformation();
    }

    mWorld.renderScene(mBuffer);
    mWorld.draw(mBuffer);
    mBuffer.display();
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:39,代码来源:ArJcptRenderer.java

示例11: getAttrValueSimpleVector

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
/**
 * 
 * @param name
 *            Attribute name
 * @param node
 *            Container node
 * @return SimpleVector with the value, null otherwise
 */
public static SimpleVector getAttrValueSimpleVector(String name, Node node) {
	Node attr = findAttribute(name, node);
	if (attr != null) {
		String tk[] = attr.getNodeValue().split(",");
		SimpleVector vec = new SimpleVector(Float.parseFloat(tk[0]),
				Float.parseFloat(tk[1]), Float.parseFloat(tk[2]));
		return vec;
	} else
		return null;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:19,代码来源:JPCTBlendScene.java

示例12: setPosition

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
public void setPosition(SimpleVector newPosition) {
    mPosition.set(newPosition);
    if (mLight != null) {
        mLight.setPosition(mPosition);
    }
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:7,代码来源:TrackableLight.java

示例13: addVertex

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
@Override
public void addVertex(Vector3f position, Vector4f colour, float u, float v)
{
	verts.add(position);
	colours.add(colour);
	texCoords.add(new Vector2f(u, v));
	
	if (verts.size() == 4)
	{
		final int textureId = 0; // TODO!
		
		Vector3f v0 = verts.get(0);
		Vector3f v1 = verts.get(1);
		Vector3f v2 = verts.get(2);
		Vector3f v3 = verts.get(3);
		
	//	Vector4f c0 = colours.get(0);
	//	Vector4f c1 = colours.get(1);
	//	Vector4f c2 = colours.get(2);
	//	Vector4f c3 = colours.get(3);
		
		Vector2f uv0 = texCoords.get(0);
		Vector2f uv1 = texCoords.get(1);
		Vector2f uv2 = texCoords.get(2);
		Vector2f uv3 = texCoords.get(3);
		
		// TODO: Figure out how to add vertex colours
		
		object3D.addTriangle(	new SimpleVector(v0.x, v0.y, v0.z), uv0.x, uv0.y,
								new SimpleVector(v1.x, v1.y, v1.z), uv1.x, uv1.y,
								new SimpleVector(v2.x, v2.y, v2.z), uv2.x, uv2.y,
								textureId);
		
		object3D.addTriangle(	new SimpleVector(v2.x, v2.y, v2.z), uv2.x, uv2.y,
								new SimpleVector(v3.x, v3.y, v3.z), uv3.x, uv3.y,
								new SimpleVector(v0.x, v0.y, v0.z), uv0.x, uv0.y,
								textureId);
		
		verts.clear();
		colours.clear();
		texCoords.clear();
	}
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:44,代码来源:JpctMesh.java

示例14: JpctTest

import com.threed.jpct.SimpleVector; //导入依赖的package包/类
public JpctTest() throws Exception
{
	jframe = new JFrame("Hello world");
	jframe.setSize(800, 600);
	jframe.setVisible(true);
	jframe.setDefaultCloseOperation(JFrame.HIDE_ON_CLOSE);
	
	world = new com.threed.jpct.World();
	world.setAmbientLight(0, 255, 0);

	
	Image img = ImageIO.read( getClass().getClassLoader().getResourceAsStream("Images/FullHeart.png") );
	assert (img != null);
	TextureManager.getInstance().addTexture("box", new Texture(img) );
	int id = TextureManager.getInstance().getTextureID("box");
	
	// Make a quad from (0,0) to (100, 100)
	Object3D obj = new Object3D(128);
	obj.addTriangle(new SimpleVector(0, 0, 0), 0, 0,
					new SimpleVector(100, 0, 0), 1, 0,
					new SimpleVector(0, 0, 100), 0, 1,
					id);
	obj.addTriangle(new SimpleVector(0, 0, 100), 0, 1,
					new SimpleVector(100, 0, 0), 1, 0,
					new SimpleVector(100, 0, 100), 1, 1,
					id);
	obj.setBaseTexture("box");
	obj.setCulling(false);
	obj.build();
	world.addObject(obj);
	
	world.setAmbientLight(255, 255, 255);

	box = Primitives.getBox(2f, 2f);
	box.setAdditionalColor(Color.red);
	box.setLighting(Object3D.LIGHTING_NO_LIGHTS);
	box.build();
	world.addObject(box);

	
	Vector3f eye = new Vector3f(50, -120, 100);
	Vector3f target = new Vector3f(50, 0, 50);
	
	// TODO: Make this work somehow
	Matrix4f camMatrix = MatrixUtil.createLookAt(eye, target, new Vector3f(0, 1, 0));
	Matrix ownLookAt = toJptcMatrix(camMatrix);
	world.getCamera().setBack(ownLookAt);
	
	world.getCamera().setPosition(eye.x, eye.y, eye.z);
	world.getCamera().lookAt(new SimpleVector(target.x, target.y, target.z));
	Matrix jptcLookAt = world.getCamera().getBack();
	System.out.println(jptcLookAt);
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:54,代码来源:JpctTest.java

示例15: drawScene

import com.threed.jpct.SimpleVector; //导入依赖的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.SimpleVector类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。