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


Java Object3D.rotateZ方法代码示例

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


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

示例1: parseInstances

import com.threed.jpct.Object3D; //导入方法依赖的package包/类
/**
 * Loads all meshs and add them to the MeshsManager. Also returns a a list
 * of configured (pos/rot/scale/texture) Object3D's.
 * 
 * @param xmlInstances
 *            instances root xml node
 * @return all loaded instances as a strings list
 */
private ArrayList<Object3D> parseInstances(Node xmlInstances) {
	ArrayList<Object3D> instancesList = new ArrayList<Object3D>();

	NodeList childs = xmlInstances.getChildNodes();

	for (int i = 0, len = childs.getLength(); i < len; i++) {
		Node node = childs.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE
				&& node.getNodeName().equals("instance")) {

			String meshFile = getAttrValue("mesh_name", node) + ".3ds";

			Object3D obj = null;

			// If object not loaded: load and use, else: clone and use
			if (!Object3DManager.getInstance().containsObject3D(meshFile)) {
				// try to load resource from assets folder.
				InputStream is = null;
				try {
					is = assets.open(sceneBasePath + "meshs"
							+ File.separator + meshFile);
				} catch (IOException e) {
					e.printStackTrace();
				}
				// Configured blender to export one object per file, so
				// loads just index [0]
				obj = Loader.load3DS(is, 1.0f)[0];
				Object3DManager.getInstance().putObject3D(meshFile, obj);
			} else {
				obj = Object3DManager.getInstance().cloneObject3D(meshFile);
			}

			obj.translate(getAttrValueSimpleVector("position", node));

			SimpleVector rot = getAttrValueSimpleVector("rotation", node);

			obj.rotateX(rot.x);
			obj.rotateY(rot.y);
			obj.rotateZ(rot.z);

			// TODO: create scale method
			// JPCT does not support 3 axis scale? :(
			// disabled for now..
			// obj.scale(getAttrValueSimpleVector("scale", node).x);

			String textureName = getAttrValue("texture", node);
			obj.setTexture(textureName);

			//alpha to "png" textures
			if (textureName.length() > 3) {

				String ext = getAttrValue("texture", node).substring(
						textureName.length() - 3, textureName.length());

				if (ext.equals("png"))
					obj.setTransparency(10);
			}

			instancesList.add(obj);
		}
	}

	return instancesList;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:73,代码来源:JPCTBlendScene.java

示例2: parseInstances

import com.threed.jpct.Object3D; //导入方法依赖的package包/类
/**
 * Loads all meshs and add them to the MeshsManager. Also returns a a list
 * of configured (pos/rot/scale/texture) Object3D's.
 * 
 * @param xmlInstances
 *            instances root xml node
 * @return all loaded instances as a strings list
 */
private ArrayList<Object3D> parseInstances(Node xmlInstances) {
	ArrayList<Object3D> instancesList = new ArrayList<Object3D>();

	NodeList childs = xmlInstances.getChildNodes();

	for (int i = 0, len = childs.getLength(); i < len; i++) {
		Node node = childs.item(i);
		if (node.getNodeType() == Node.ELEMENT_NODE
				&& node.getNodeName().equals("instance")) {

			String meshFile = getAttrValue("mesh_name", node) + ".3ds";

			Object3D obj = null;
			
			// Configured blender to export one object per file, so
			// loads just index [0]
			obj = Loader.load3DS(sceneBasePath + "meshs" + File.separator
					+ meshFile, 1.0f)[0];
			
			Object3DManager.getInstance().putObject3D(meshFile, obj);

			obj.translate(getAttrValueSimpleVector("position", node));

			SimpleVector rot = getAttrValueSimpleVector("rotation", node);

			obj.rotateX(rot.x);
			obj.rotateY(rot.y);
			obj.rotateZ(rot.z);

			// TODO: create scale method
			// JPCT does not support 3 axis scale? :(
			// disabled for now..
			// obj.scale(getAttrValueSimpleVector("scale", node).x);

			String textureName = getAttrValue("texture", node);
			obj.setTexture(textureName);

			//alpha to "png" textures
			if (textureName.length() > 3) {

				String ext = getAttrValue("texture", node).substring(
						textureName.length() - 3, textureName.length());

				if (ext.equals("png"))
					obj.setTransparency(10);
			}

			instancesList.add(obj);
		}
	}

	return instancesList;
}
 
开发者ID:andresjesse,项目名称:jpctblend,代码行数:62,代码来源:JPCTBlendScene.java


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