• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Object3D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: populateTrackableObjects

import com.threed.jpct.Object3D; //导入依赖的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: localloadModel

import com.threed.jpct.Object3D; //导入依赖的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


示例3: localloadModel

import com.threed.jpct.Object3D; //导入依赖的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


示例4: removeSceneFromWorld

import com.threed.jpct.Object3D; //导入依赖的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


示例5: loadModel

import com.threed.jpct.Object3D; //导入依赖的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


示例6: JpctTest

import com.threed.jpct.Object3D; //导入依赖的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


示例7: loadModel

import com.threed.jpct.Object3D; //导入依赖的package包/类
private Object3D loadModel(String modelFileName) {
  String modelFileNameArray[] = modelFileName.split("\\.");
  String extension = modelFileNameArray[modelFileNameArray.length - 1].toLowerCase();

  Object3D model = null;

  try {
    InputStream modelStream = getContext().getAssets().open(modelFileName);

    switch (extension) {
      case "obj":
        model = Object3D.mergeAll(Loader.loadOBJ(modelStream, null, 1));
        break;
      case "3ds":
        model = Object3D.mergeAll(Loader.load3DS(modelStream, 1));
        break;
      case "md2":
        model = Loader.loadMD2(modelStream, 1);
        break;
      case "asc":
        model = Loader.loadASC(modelStream, 1, false);
        break;
      case "model":
        model = RNGLModelViewModelLoader.loadMODEL(modelStream);
        break;
    }
  } catch (IOException | ModelObjectNotSupportedException e) {
    e.printStackTrace();
  }

  return model;
}
 
开发者ID:rastapasta,项目名称:react-native-gl-model-view,代码行数:33,代码来源:RNGLModelView.java


示例8: getCube

import com.threed.jpct.Object3D; //导入依赖的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: getPlane

import com.threed.jpct.Object3D; //导入依赖的package包/类
private Object3D getPlane() {
    Object3D object3D = Primitives.getPlane(2, 60);
    // Planes are rotated 180 degrees, so we need to flip them
    object3D.rotateX((float) Math.PI);
    // Load the AR Toolkit texture on top of the plane
    Texture texture = new Texture(getResources().getDrawable(R.drawable.artoolkit_logo));
    TextureManager.getInstance().addTexture("artoolkit", texture);

    object3D.setTexture("artoolkit");
    return object3D;
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:12,代码来源:ARSimple.java


示例10: add3DSModel

import com.threed.jpct.Object3D; //导入依赖的package包/类
/**
 * Loads a model on .3ds format and adds it as a child of the trackable object
 *
 * @param c A context, used to access the assets directory
 * @param path The path to the .3ds inside the assets directory (i.e. model.3ds)
 * @param scale The scale to be applied when loading the model
 */
public void add3DSModel(Context c, String path, float scale) {
    try {
        Object3D [] object3D = Loader.load3DS(c.getAssets().open(path), scale);
        for (int i=0; i<object3D.length; i++) {
            addChild(object3D[i]);
        }
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:18,代码来源:TrackableObject3d.java


示例11: JpctMesh

import com.threed.jpct.Object3D; //导入依赖的package包/类
public JpctMesh(World world, JpctTexture texture)
{
	this.world = world;
	
	verts = new ArrayList<Vector3f>();
	colours = new ArrayList<Vector4f>();
	texCoords = new ArrayList<Vector2f>();
	
	object3D = new Object3D(1024);

//	obj.setBaseTexture("box");
	object3D.setCulling(false);
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:14,代码来源:JpctMesh.java


示例12: cloneObject3D

import com.threed.jpct.Object3D; //导入依赖的package包/类
public Object3D cloneObject3D(String objName) {
	if (!containsObject3D(objName))
		throw new RuntimeException("Can't clone mesh " + objName
				+ " because it does not exist in Object3DManager.");

	Object3D cloned = getObject3D(objName).cloneObject();
	cloned.clearRotation();
	cloned.clearTranslation();
	cloned.setScale(1);

	return cloned;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:13,代码来源:Object3DManager.java


示例13: addSceneToWorld

import com.threed.jpct.Object3D; //导入依赖的package包/类
/**
 * Adds everything to the world.
 */
public void addSceneToWorld() {
	if (active)
		throw new RuntimeException(
				"Cannot load Scene! it  already has been loaded!");

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

	for (IActor actor : actors) {
		actor.addToWorld(world);
	}

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

	if (cameras.size() > 0) {
		CameraInfo currentCameraInfo = cameras.get(0);// For now '0' is the
														// default camera.

		world.getCamera().setPosition(currentCameraInfo.getPosition());
		world.getCamera().lookAt(currentCameraInfo.getLookAt());
		
		// FOV tip, by juan from JPCT forum.
		// http://www.jpct.net/forum2/index.php/topic,3711.0.html
		world.getCamera().setFOV(0.914f);
	}

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


示例14: addSceneToWorld

import com.threed.jpct.Object3D; //导入依赖的package包/类
/**
 * Adds everything to the world.
 */
public void addSceneToWorld() {
	if (active)
		throw new RuntimeException(
				"Cannot load Scene! it  already has been loaded!");

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

	for (IActor actor : actors) {
		actor.addToWorld(world);
	}

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

	if (cameras.size() > 0) {
		CameraInfo currentCameraInfo = cameras.get(0);// For now '0' is the
														// default camera.

		world.getCamera().setPosition(currentCameraInfo.getPosition());
		world.getCamera().lookAt(currentCameraInfo.getLookAt());

		// FOV tip, by juan from JPCT forum.
		// http://www.jpct.net/forum2/index.php/topic,3711.0.html
		world.getCamera().setFOV(0.914f);
	}

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


示例15: loadMODEL

import com.threed.jpct.Object3D; //导入依赖的package包/类
/**
 * Loads a .model file
 * @param modelStream the InputStream of the .model file
 * @return the parsed .model file as an Object3D object
 * @throws IOException
 * @throws IndexTypeNotSupportedException
 * @throws PrimitiveTypeNotSupportedException
 * @throws VertexTypeNotSupportedException
 * @throws UVTypeNotSupportedException
 * @throws NormalTypeNotSupportedException
 */
public static Object3D loadMODEL(InputStream modelStream) throws
    IOException,
    IndexTypeNotSupportedException,
    PrimitiveTypeNotSupportedException,
    VertexTypeNotSupportedException,
    UVTypeNotSupportedException,
    NormalTypeNotSupportedException {
  // Note: The .model format byte order is in little endian
  byte[] fileIdentifier = new byte[32];

  // We don't do anything with the version yet. If some .model files don't work in the future,
  // we might need to do a version check
  byte[] majorVersionBytes = new byte[4];
  byte[] minorVersionBytes = new byte[4];

  // Read the header
  modelStream.read(fileIdentifier, 0, 32);
  modelStream.read(majorVersionBytes, 0, 4);
  modelStream.read(minorVersionBytes, 0, 4);

  // Read the table of contents
  byte[] attribHeaderSizeBytes = new byte[4];
  byte[] indexBufferOffsetBytes = new byte[4];
  byte[] vertexBufferOffsetBytes = new byte[4];
  byte[] uvBufferOffsetBytes = new byte[4];
  byte[] normalBufferOffsetBytes = new byte[4];

  modelStream.read(attribHeaderSizeBytes, 0, 4);
  modelStream.read(indexBufferOffsetBytes, 0, 4);
  modelStream.read(vertexBufferOffsetBytes, 0, 4);
  modelStream.read(uvBufferOffsetBytes, 0, 4);
  modelStream.read(normalBufferOffsetBytes, 0, 4);

  int[] indices = getModelIndices(modelStream);
  float[] vertexElements = getModelVertexElements(modelStream);
  float[] uvElements = getModelUVElements(modelStream);
  float[] normalElements = getModelNormalElements(modelStream);

  return new Object3D(vertexElements, normalElements, uvElements, indices, 0);
}
 
开发者ID:rastapasta,项目名称:react-native-gl-model-view,代码行数:52,代码来源:RNGLModelViewModelLoader.java


示例16: setModel

import com.threed.jpct.Object3D; //导入依赖的package包/类
public void setModel(Object3D model) {
  mModel = model;
}
 
开发者ID:rastapasta,项目名称:react-native-gl-model-view,代码行数:4,代码来源:RNGLModelViewRenderer.java


示例17: TrackableObject3d

import com.threed.jpct.Object3D; //导入依赖的package包/类
public TrackableObject3d(String markerString, Object3D child) {
    this(markerString);
    addChild(child);
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:5,代码来源:TrackableObject3d.java


示例18: addChild

import com.threed.jpct.Object3D; //导入依赖的package包/类
@Override
public void addChild(Object3D object3D) {
    super.addChild(object3D);
    // Keep it in a local list
    mChildren.add(object3D);
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:7,代码来源:TrackableObject3d.java


示例19: removeChild

import com.threed.jpct.Object3D; //导入依赖的package包/类
@Override
public void removeChild(Object3D object3D) {
    super.removeChild(object3D);
    // remove it from the local list
    mChildren.remove(object3D);
}
 
开发者ID:plattysoft,项目名称:ArToolKitJpctBaseLib,代码行数:7,代码来源:TrackableObject3d.java


示例20: getObject3D

import com.threed.jpct.Object3D; //导入依赖的package包/类
public Object3D getObject3D()
{
	return object3D;
}
 
开发者ID:tectonicus,项目名称:tectonicus,代码行数:5,代码来源:JpctMesh.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CommandBanIp类代码示例发布时间:2022-05-23
下一篇:
Java Iso4217CurrencyCode类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap