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


Java Shape.rotate方法代码示例

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


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

示例1: applyParentTransforms

import ru.gloomyfolken.tcn2obj.obj.Shape; //导入方法依赖的package包/类
private void applyParentTransforms(CubeInfo parent, Shape shape)
{
	Vector3f parentRotation = getFromDoubleArr(parent.rotation);
	Vector3f parentPosition = getFromDoubleArr(parent.position);
	shape.rotate(-parentRotation.x, 1, 0, 0);
	shape.rotate(-parentRotation.y, 0, 1, 0);
	shape.rotate(-parentRotation.z, 0, 0, 1);
	shape.translate(parentPosition);
	CubeInfo parentparent = getParent(cubes, parent);
	if (parentparent != null)
	{
		applyParentTransforms(parentparent, shape);
	}
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:15,代码来源:TblConverter.java

示例2: convertBoxToShape

import ru.gloomyfolken.tcn2obj.obj.Shape; //导入方法依赖的package包/类
private Shape convertBoxToShape(ObjModel model, TechneBox box, float scale){
	Shape shape = new Shape(model, box.name);
	
	Vertex frontTopLeft = new Vertex(box.offsetX, box.offsetY, box.offsetZ);
	Vertex frontTopRight = new Vertex(box.offsetX+box.sizeX, box.offsetY, box.offsetZ);
	Vertex frontBottomRight = new Vertex(box.offsetX+box.sizeX, box.offsetY+box.sizeY, box.offsetZ);
	Vertex frontBottomLeft = new Vertex(box.offsetX, box.offsetY+box.sizeY, box.offsetZ);
	Vertex backTopLeft = new Vertex(box.offsetX, box.offsetY, box.offsetZ+box.sizeZ);
	Vertex backTopRight = new Vertex(box.offsetX+box.sizeX, box.offsetY, box.offsetZ+box.sizeZ);
	Vertex backBottomRight = new Vertex(box.offsetX+box.sizeX, box.offsetY+box.sizeY, box.offsetZ+box.sizeZ);
	Vertex backBottomLeft = new Vertex(box.offsetX, box.offsetY+box.sizeY, box.offsetZ+box.sizeZ);
	
	if (box.sizeX > 0 && box.sizeY > 0){
		//front
		shape.faces.add(new Face(shape)
			.append(frontBottomLeft, createUV(box, box.sizeZ, box.sizeZ+box.sizeY, box.sizeX, false))
			.append(frontBottomRight, createUV(box, box.sizeZ+box.sizeX, box.sizeZ+box.sizeY, -box.sizeX, false))
			.append(frontTopRight, createUV(box, box.sizeZ+box.sizeX, box.sizeZ, -box.sizeX, false))
			.append(frontTopLeft, createUV(box, box.sizeZ, box.sizeZ, box.sizeX, false))
			);
		//back
		shape.faces.add(new Face(shape)
			.append(backBottomRight, createUV(box, box.sizeZ*2+box.sizeX, box.sizeZ+box.sizeY, box.sizeX, false))
			.append(backBottomLeft, createUV(box, box.sizeZ*2+box.sizeX*2, box.sizeZ+box.sizeY, -box.sizeX, false))
			.append(backTopLeft, createUV(box, box.sizeZ*2+box.sizeX*2, box.sizeZ, -box.sizeX, false))
			.append(backTopRight, createUV(box, box.sizeZ*2+box.sizeX, box.sizeZ, box.sizeX, false))
			);
	}
	
	if (box.sizeX > 0 && box.sizeZ > 0){
		//top
		shape.faces.add(new Face(shape)
			.append(frontTopLeft, createUV(box, box.sizeZ, box.sizeZ, box.sizeX, false))
			.append(frontTopRight, createUV(box, box.sizeZ+box.sizeX, box.sizeZ, -box.sizeX, false))
			.append(backTopRight, createUV(box, box.sizeZ+box.sizeX, 0, -box.sizeX, false))
			.append(backTopLeft, createUV(box, box.sizeZ, 0, box.sizeX, false))
			);
		
		//bottom
		shape.faces.add(new Face(shape)
			.append(backBottomLeft, createUV(box, box.sizeZ+box.sizeX, box.sizeZ, box.sizeX, false))
			.append(backBottomRight, createUV(box, box.sizeZ+box.sizeX*2, box.sizeZ, -box.sizeX, false))
			.append(frontBottomRight, createUV(box, box.sizeZ+box.sizeX*2, 0, -box.sizeX, false))
			.append(frontBottomLeft, createUV(box, box.sizeZ+box.sizeX, 0, box.sizeX, false))
			);
	}
	
	if (box.sizeY > 0 && box.sizeZ > 0){
		//left
		shape.faces.add(new Face(shape)
			.append(backBottomLeft, createUV(box, 0, box.sizeZ+box.sizeY, box.sizeX+box.sizeZ*2, true))
			.append(frontBottomLeft, createUV(box, box.sizeZ, box.sizeZ+box.sizeY, box.sizeX, true))
			.append(frontTopLeft, createUV(box, box.sizeZ, box.sizeZ, box.sizeX, true))
			.append(backTopLeft, createUV(box, 0, box.sizeZ, box.sizeX+box.sizeZ*2, true))
			);
		
		//right
		shape.faces.add(new Face(shape)
			.append(frontBottomRight, createUV(box, box.sizeZ+box.sizeX, box.sizeZ+box.sizeY, -box.sizeX, true))
			.append(backBottomRight, createUV(box, box.sizeZ*2+box.sizeX, box.sizeZ+box.sizeY, -box.sizeX-box.sizeZ*2, true))
			.append(backTopRight, createUV(box, box.sizeZ*2+box.sizeX, box.sizeZ, -box.sizeX-box.sizeZ*2, true))
			.append(frontTopRight, createUV(box, box.sizeZ+box.sizeX, box.sizeZ, -box.sizeX, true))
			);
	}
	
	shape.rotate(-box.rotateAngleX, 1, 0, 0);
	shape.rotate(-box.rotateAngleY, 0, 1, 0);
	shape.rotate(-box.rotateAngleZ, 0, 0, 1);
	
	shape.translate(new Vector3f(box.rotationPointX, box.rotationPointY, box.rotationPointZ));
	
	
	//fix Y axis direction
	shape.rotate(180, 0, 0, 1);
	
	shape.scale(new Vector3f(box.parentModel.scaleX*scale, 
			box.parentModel.scaleY*scale, 
			box.parentModel.scaleZ*scale));
	
	return shape;
}
 
开发者ID:ObsidianSuite,项目名称:ObsidianSuite,代码行数:82,代码来源:TcnConverter.java


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