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