本文整理汇总了Java中ru.gloomyfolken.tcn2obj.obj.Shape类的典型用法代码示例。如果您正苦于以下问题:Java Shape类的具体用法?Java Shape怎么用?Java Shape使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Shape类属于ru.gloomyfolken.tcn2obj.obj包,在下文中一共展示了Shape类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tcn2obj
import ru.gloomyfolken.tcn2obj.obj.Shape; //导入依赖的package包/类
public ObjModel tcn2obj(JsonModel model, float scale)
{
ObjModel obj = new ObjModel();
this.model = model;
ArrayList<Box> boxes = model.model.getElements();
if (!Main.jsonTexture) preProcess();
for (Box box : boxes)
{
Shape shape = convertBoxToShape(obj, box, scale);
if (shape != null) obj.shapes.add(shape);
}
return obj;
}
示例2: offsetBoxes
import ru.gloomyfolken.tcn2obj.obj.Shape; //导入依赖的package包/类
private void offsetBoxes(JsonTabulaModel model, CubeInfo start, Shape shape)
{
for (CubeInfo cube : cubes)
{
if (cube == start)
{
CubeInfo parent = getParent(cubes, cube);
if (parent != null)
{
offsetToParents(cube, parent, shape);
}
return;
}
}
}
示例3: offsetToParents
import ru.gloomyfolken.tcn2obj.obj.Shape; //导入依赖的package包/类
private void offsetToParents(CubeInfo cube, CubeInfo parent, Shape shape)
{
if (parent != null)
{
applyParentTransforms(parent, shape);
}
}
示例4: 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);
}
}
示例5: 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;
}