Changed packages for relations, renamed Face to ShapePart

- Added BlockRelation as an abstract superclass to existing relations
  - Must be given an absolute "up" direction before use
- Moved AbsFace, AbsRelation and BlockRelation to .world.rels
- Renamed Face to ShapePart to reduce confusion with AbsFace
This commit is contained in:
OLEGSHA 2021-02-01 19:14:49 +03:00
parent 848178b343
commit acef9d32df
Signed by: OLEGSHA
GPG Key ID: E57A4B08D64AFF7A
61 changed files with 305 additions and 239 deletions

View File

@ -29,8 +29,8 @@ import glm.vec._3.Vec3;
import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.Faces;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
import ru.windcorp.progressia.client.graphics.model.Shape;
import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.client.graphics.texture.Texture;
@ -84,7 +84,7 @@ public class RenderTarget {
private final Deque<TransformedMask> maskStack = new LinkedList<>();
private final Deque<Mat4> transformStack = new LinkedList<>();
private final List<Face> currentClipFaces = new ArrayList<>();
private final List<ShapePart> currentClipFaces = new ArrayList<>();
private int depth = 0;
@ -94,8 +94,8 @@ public class RenderTarget {
protected void assembleCurrentClipFromFaces() {
if (!currentClipFaces.isEmpty()) {
Face[] faces = currentClipFaces.toArray(
new Face[currentClipFaces.size()]
ShapePart[] faces = currentClipFaces.toArray(
new ShapePart[currentClipFaces.size()]
);
currentClipFaces.clear();
@ -198,7 +198,7 @@ public class RenderTarget {
);
}
protected void addFaceToCurrentClip(Face face) {
protected void addFaceToCurrentClip(ShapePart face) {
currentClipFaces.add(face);
}
@ -270,7 +270,7 @@ public class RenderTarget {
fill(Colors.toVector(color));
}
public Face createRectagleFace(
public ShapePart createRectagleFace(
int x,
int y,
int width,
@ -280,7 +280,7 @@ public class RenderTarget {
) {
float depth = this.depth--;
return Faces.createRectangle(
return ShapeParts.createRectangle(
FlatRenderProgram.getDefault(),
texture,
color,
@ -291,7 +291,7 @@ public class RenderTarget {
);
}
public Face createRectagleFace(
public ShapePart createRectagleFace(
int x,
int y,
int width,

View File

@ -33,8 +33,8 @@ import gnu.trove.stack.TIntStack;
import gnu.trove.stack.array.TIntArrayStack;
import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.Faces;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
import ru.windcorp.progressia.client.graphics.model.Shape;
import ru.windcorp.progressia.client.graphics.model.ShapeRenderHelper;
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
@ -144,7 +144,7 @@ public abstract class SpriteTypeface extends Typeface {
return new Shape(
Usage.STATIC,
getProgram(),
Faces.createRectangle(
ShapeParts.createRectangle(
getProgram(),
getTexture(c),
Colors.WHITE,
@ -167,7 +167,7 @@ public abstract class SpriteTypeface extends Typeface {
private final Renderable unitLine = new Shape(
Usage.STATIC,
getProgram(),
Faces.createRectangle(
ShapeParts.createRectangle(
getProgram(),
null,
Vectors.UNIT_4,
@ -257,7 +257,7 @@ public abstract class SpriteTypeface extends Typeface {
private class SDWorkspace extends SpriteTypeface.Workspace {
private final Collection<Face> faces = new ArrayList<>();
private final Collection<ShapePart> faces = new ArrayList<>();
private final Vec3 origin = new Vec3();
private final Vec3 width = new Vec3();
@ -298,7 +298,7 @@ public abstract class SpriteTypeface extends Typeface {
workspace.height.sub(workspace.origin);
workspace.faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
getProgram(),
texture,
color,
@ -314,7 +314,7 @@ public abstract class SpriteTypeface extends Typeface {
return new Shape(
Usage.STATIC,
getProgram(),
workspace.faces.toArray(new Face[workspace.faces.size()])
workspace.faces.toArray(new ShapePart[workspace.faces.size()])
);
}

View File

@ -18,12 +18,12 @@
package ru.windcorp.progressia.client.graphics.model;
import static ru.windcorp.progressia.common.world.block.AbsFace.*;
import static ru.windcorp.progressia.common.world.rels.AbsFace.*;
import com.google.common.collect.ImmutableMap;
import glm.vec._3.Vec3;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
class BlockFaceVectors {

View File

@ -30,10 +30,10 @@ import ru.windcorp.progressia.client.graphics.backend.VertexBufferObject;
public class Shape implements Renderable {
private final ShapeRenderProgram program;
private final Face[] faces;
private final ShapePart[] parts;
private final Usage usage;
private FaceGroup[] groups;
private ShapePartGroup[] groups;
private ByteBuffer vertices;
private ShortBuffer indices;
@ -45,33 +45,33 @@ public class Shape implements Renderable {
private VertexBufferObject verticesVbo;
private VertexBufferObject indicesVbo;
public Shape(Usage usage, ShapeRenderProgram program, Face... faces) {
public Shape(Usage usage, ShapeRenderProgram program, ShapePart... parts) {
this.program = program;
this.faces = faces;
this.parts = parts;
this.usage = usage;
configureFaces();
configureParts();
program.preprocess(this);
assembleBuffers();
}
private void configureFaces() {
for (Face face : faces) {
face.setShape(this);
private void configureParts() {
for (ShapePart part : parts) {
part.setShape(this);
}
}
private void assembleBuffers() {
// TODO optimize: only update faces that requested it
sortFaces();
sortParts();
resizeBuffers();
for (Face face : faces) {
assembleVertices(face);
assembleIndices(face);
face.resetUpdateFlags();
for (ShapePart part : parts) {
assembleVertices(part);
assembleIndices(part);
part.resetUpdateFlags();
}
this.vertices.flip();
@ -85,110 +85,110 @@ public class Shape implements Renderable {
private void resizeBuffers() {
int verticesRequired = 0, indicesRequired = 0;
for (Face face : faces) {
verticesRequired += face.getVertices().remaining();
indicesRequired += face.getIndices().remaining();
for (ShapePart part : parts) {
verticesRequired += part.getVertices().remaining();
indicesRequired += part.getIndices().remaining();
}
if (this.vertices == null || vertices.capacity() < verticesRequired) {
if (vertices == null || vertices.capacity() < verticesRequired) {
this.vertices = BufferUtils.createByteBuffer(verticesRequired);
} else {
this.vertices.position(0).limit(verticesRequired);
vertices.position(0).limit(verticesRequired);
}
if (this.indices == null || this.indices.capacity() < indicesRequired) {
if (indices == null || indices.capacity() < indicesRequired) {
this.indices = BufferUtils.createShortBuffer(indicesRequired);
} else {
this.indices.position(0).limit(indicesRequired);
indices.position(0).limit(indicesRequired);
}
}
private void assembleVertices(Face face) {
face.locationOfVertices = this.vertices.position();
private void assembleVertices(ShapePart part) {
part.locationOfVertices = this.vertices.position();
insertVertices(face);
linkVerticesWith(face);
insertVertices(part);
linkVerticesWith(part);
}
private void insertVertices(Face face) {
ByteBuffer faceVertices = face.getVertices();
private void insertVertices(ShapePart part) {
ByteBuffer partVertices = part.getVertices();
faceVertices.mark();
this.vertices.put(faceVertices);
faceVertices.reset();
partVertices.mark();
this.vertices.put(partVertices);
partVertices.reset();
}
private void linkVerticesWith(Face face) {
private void linkVerticesWith(ShapePart part) {
int limit = vertices.limit();
int position = vertices.position();
vertices.limit(position).position(face.getLocationOfVertices());
face.vertices = vertices.slice();
vertices.limit(position).position(part.getLocationOfVertices());
part.vertices = vertices.slice();
vertices.position(position).limit(limit);
}
private void assembleIndices(Face face) {
short vertexOffset = (short) (face.getLocationOfVertices() / program.getBytesPerVertex());
private void assembleIndices(ShapePart part) {
short vertexOffset = (short) (part.getLocationOfVertices() / program.getBytesPerVertex());
face.locationOfIndices = indices.position();
part.locationOfIndices = indices.position();
ShortBuffer faceIndices = face.getIndices();
ShortBuffer partIndices = part.getIndices();
if (faceIndices == null) {
for (int i = 0; i < face.getVertexCount(); ++i) {
if (partIndices == null) {
for (int i = 0; i < part.getVertexCount(); ++i) {
this.indices.put((short) (vertexOffset + i));
}
} else {
for (int i = faceIndices.position(); i < faceIndices.limit(); ++i) {
short faceIndex = faceIndices.get(i);
faceIndex += vertexOffset;
this.indices.put(faceIndex);
for (int i = partIndices.position(); i < partIndices.limit(); ++i) {
short partIndex = partIndices.get(i);
partIndex += vertexOffset;
this.indices.put(partIndex);
}
}
}
private void sortFaces() {
Arrays.sort(faces);
private void sortParts() {
Arrays.sort(parts);
}
private void assembleGroups() {
int unique = countUniqueFaces();
this.groups = new FaceGroup[unique];
int unique = countUniqueParts();
this.groups = new ShapePartGroup[unique];
if (faces.length == 0)
if (parts.length == 0)
return;
int previousHandle = faces[0].getSortingIndex();
int previousHandle = parts[0].getSortingIndex();
int start = 0;
int groupIndex = 0;
for (int i = 1; i < faces.length; ++i) {
if (previousHandle != faces[i].getSortingIndex()) {
for (int i = 1; i < parts.length; ++i) {
if (previousHandle != parts[i].getSortingIndex()) {
groups[groupIndex] = new FaceGroup(faces, start, i);
groups[groupIndex] = new ShapePartGroup(parts, start, i);
start = i;
groupIndex++;
previousHandle = faces[i].getSortingIndex();
previousHandle = parts[i].getSortingIndex();
}
}
assert groupIndex == groups.length - 1;
groups[groupIndex] = new FaceGroup(faces, start, faces.length);
groups[groupIndex] = new ShapePartGroup(parts, start, parts.length);
}
private int countUniqueFaces() {
if (faces.length == 0)
private int countUniqueParts() {
if (parts.length == 0)
return 0;
int result = 1;
int previousHandle = faces[0].getSortingIndex();
int previousHandle = parts[0].getSortingIndex();
for (int i = 1; i < faces.length; ++i) {
if (previousHandle != faces[i].getSortingIndex()) {
for (int i = 1; i < parts.length; ++i) {
if (previousHandle != parts[i].getSortingIndex()) {
result++;
previousHandle = faces[i].getSortingIndex();
previousHandle = parts[i].getSortingIndex();
}
}
@ -238,11 +238,11 @@ public class Shape implements Renderable {
return program;
}
public Face[] getFaces() {
return faces;
public ShapePart[] getParts() {
return parts;
}
public FaceGroup[] getGroups() {
public ShapePartGroup[] getGroups() {
return groups;
}

View File

@ -24,7 +24,7 @@ import java.util.Objects;
import ru.windcorp.progressia.client.graphics.texture.Texture;
public class Face implements Comparable<Face> {
public class ShapePart implements Comparable<ShapePart> {
private static final ShortBuffer GENERATE_SUCCESSIVE_LATER = null;
@ -40,7 +40,7 @@ public class Face implements Comparable<Face> {
private ShortBuffer userIndices;
private boolean userIndicesUpdated = true;
public Face(
public ShapePart(
Texture texture,
ByteBuffer vertices,
ShortBuffer indices
@ -50,7 +50,7 @@ public class Face implements Comparable<Face> {
setIndices(indices);
}
public Face(
public ShapePart(
Texture texture,
ByteBuffer vertices
) {
@ -155,7 +155,7 @@ public class Face implements Comparable<Face> {
return vertices;
}
public Face setVertices(ByteBuffer vertices) {
public ShapePart setVertices(ByteBuffer vertices) {
this.vertices = Objects.requireNonNull(vertices, "vertices");
markForVertexUpdate();
return this;
@ -202,7 +202,7 @@ public class Face implements Comparable<Face> {
return userIndices.remaining();
}
public Face setIndices(ShortBuffer indices) {
public ShapePart setIndices(ShortBuffer indices) {
if (indices == null) {
indices = GENERATE_SUCCESSIVE_LATER;
}
@ -245,7 +245,7 @@ public class Face implements Comparable<Face> {
}
@Override
public int compareTo(Face o) {
public int compareTo(ShapePart o) {
return Integer.compare(getSortingIndex(), o.getSortingIndex());
}

View File

@ -21,13 +21,13 @@ package ru.windcorp.progressia.client.graphics.model;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.client.graphics.texture.TexturePrimitive;
public class FaceGroup {
public class ShapePartGroup {
private final TexturePrimitive texture;
private final int indexCount;
private final int byteOffsetOfIndices;
FaceGroup(Face[] faces, int start, int end) {
ShapePartGroup(ShapePart[] faces, int start, int end) {
Texture t = faces[start].getTexture();
this.texture = t == null ? null : t.getSprite().getPrimitive();
@ -36,7 +36,7 @@ public class FaceGroup {
int indexCount = 0;
for (int i = start; i < end; ++i) {
Face face = faces[i];
ShapePart face = faces[i];
assert this.texture == null
? (face.getTexture() == null)

View File

@ -25,14 +25,14 @@ import glm.vec._3.Vec3;
import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram.VertexBuilder;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class Faces {
public class ShapeParts {
private Faces() {
private ShapeParts() {
}
public static Face createRectangle(
public static ShapePart createRectangle(
ShapeRenderProgram program,
Texture texture,
Vec4 colorMultiplier,
@ -82,14 +82,14 @@ public class Faces {
}
);
return new Face(
return new ShapePart(
texture,
builder.assemble(),
buffer
);
}
public static Face createBlockFace(
public static ShapePart createBlockFace(
ShapeRenderProgram program,
Texture texture,
Vec4 colorMultiplier,

View File

@ -116,7 +116,7 @@ public class ShapeRenderProgram extends Program {
try {
enableAttributes();
for (FaceGroup group : shape.getGroups()) {
for (ShapePartGroup group : shape.getGroups()) {
renderFaceGroup(group);
}
} finally {
@ -182,7 +182,7 @@ public class ShapeRenderProgram extends Program {
indices.bind(BindTarget.ELEMENT_ARRAY);
}
protected void renderFaceGroup(FaceGroup group) {
protected void renderFaceGroup(ShapePartGroup group) {
TexturePrimitive texture = group.getTexture();
if (texture != null) {
@ -206,12 +206,12 @@ public class ShapeRenderProgram extends Program {
}
public void preprocess(Shape shape) {
for (Face face : shape.getFaces()) {
for (ShapePart face : shape.getParts()) {
applySprites(face);
}
}
private void applySprites(Face face) {
private void applySprites(ShapePart face) {
if (face.getTexture() == null)
return;

View File

@ -24,7 +24,7 @@ import glm.vec._3.Vec3;
import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class Shapes {
@ -50,7 +50,7 @@ public class Shapes {
boolean flip
) {
Face top = Faces.createRectangle(
ShapePart top = ShapeParts.createRectangle(
program,
topTexture,
colorMultiplier,
@ -60,7 +60,7 @@ public class Shapes {
flip
);
Face bottom = Faces.createRectangle(
ShapePart bottom = ShapeParts.createRectangle(
program,
bottomTexture,
colorMultiplier,
@ -70,7 +70,7 @@ public class Shapes {
flip
);
Face north = Faces.createRectangle(
ShapePart north = ShapeParts.createRectangle(
program,
northTexture,
colorMultiplier,
@ -80,7 +80,7 @@ public class Shapes {
flip
);
Face south = Faces.createRectangle(
ShapePart south = ShapeParts.createRectangle(
program,
southTexture,
colorMultiplier,
@ -90,7 +90,7 @@ public class Shapes {
flip
);
Face east = Faces.createRectangle(
ShapePart east = ShapeParts.createRectangle(
program,
eastTexture,
colorMultiplier,
@ -100,7 +100,7 @@ public class Shapes {
flip
);
Face west = Faces.createRectangle(
ShapePart west = ShapeParts.createRectangle(
program,
westTexture,
colorMultiplier,

View File

@ -21,7 +21,7 @@ package ru.windcorp.progressia.client.graphics.texture;
import java.util.Map;
import glm.vec._2.Vec2;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class ComplexTexture {

View File

@ -23,8 +23,8 @@ import glm.vec._3.Vec3;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.client.world.WorldRender;
import ru.windcorp.progressia.common.world.BlockRay;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.entity.EntityData;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class Selection {

View File

@ -33,7 +33,7 @@ import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.backend.VertexBufferObject;
import ru.windcorp.progressia.client.graphics.backend.shaders.attributes.*;
import ru.windcorp.progressia.client.graphics.backend.shaders.uniforms.*;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.Shape;
import ru.windcorp.progressia.client.graphics.model.ShapeRenderHelper;
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
@ -138,12 +138,12 @@ public class WorldRenderProgram extends ShapeRenderProgram {
public void preprocess(Shape shape) {
super.preprocess(shape);
for (Face face : shape.getFaces()) {
for (ShapePart face : shape.getParts()) {
computeNormals(face);
}
}
private void computeNormals(Face face) {
private void computeNormals(ShapePart face) {
Vec3 a = Vectors.grab3();
Vec3 b = Vectors.grab3();
Vec3 c = Vectors.grab3();
@ -183,7 +183,7 @@ public class WorldRenderProgram extends ShapeRenderProgram {
normal.normalize();
}
private void loadVertexPosition(Face face, int index, Vec3 result) {
private void loadVertexPosition(ShapePart face, int index, Vec3 result) {
ByteBuffer vertices = face.getVertices();
int offset = vertices.position() + index * getBytesPerVertex();
@ -194,7 +194,7 @@ public class WorldRenderProgram extends ShapeRenderProgram {
);
}
private void saveVertexNormal(Face face, int index, Vec3 normal) {
private void saveVertexNormal(ShapePart face, int index, Vec3 normal) {
ByteBuffer vertices = face.getVertices();
int offset = vertices.position() + index * getBytesPerVertex() + (3 * Float.BYTES +
4 * Float.BYTES +

View File

@ -30,8 +30,8 @@ import ru.windcorp.progressia.client.world.tile.TileRender;
import ru.windcorp.progressia.client.world.tile.TileRenderRegistry;
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericChunk;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileDataStack;
public class ChunkRender

View File

@ -36,7 +36,7 @@ import ru.windcorp.progressia.client.world.tile.TileRender;
import ru.windcorp.progressia.client.world.tile.TileRenderNone;
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class ChunkRenderModel implements Renderable {

View File

@ -22,7 +22,7 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.ChunkDataListener;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
class ChunkUpdateListener implements ChunkDataListener {

View File

@ -19,7 +19,7 @@
package ru.windcorp.progressia.client.world.block;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class BlockRenderOpaqueCube extends BlockRenderTexturedCube {

View File

@ -18,7 +18,7 @@
package ru.windcorp.progressia.client.world.block;
import static ru.windcorp.progressia.common.world.block.AbsFace.*;
import static ru.windcorp.progressia.common.world.rels.AbsFace.*;
import java.util.HashMap;
import java.util.Map;
@ -29,8 +29,8 @@ import glm.vec._3.i.Vec3i;
import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.Faces;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.client.graphics.model.Shape;
import ru.windcorp.progressia.client.graphics.texture.Texture;
@ -38,7 +38,7 @@ import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerSurface.BlockOptimizedSurface;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public abstract class BlockRenderTexturedCube
extends BlockRender
@ -74,21 +74,21 @@ public abstract class BlockRenderTexturedCube
}
@Override
public final void getFaces(
public final void getShapeParts(
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
boolean inner,
Consumer<Face> output,
Consumer<ShapePart> output,
Vec3 offset
) {
output.accept(createFace(chunk, blockInChunk, blockFace, inner, offset));
}
private Face createFace(
private ShapePart createFace(
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
boolean inner,
Vec3 offset
) {
return Faces.createBlockFace(
return ShapeParts.createBlockFace(
WorldRenderProgram.getDefault(),
getTexture(blockFace),
getColorMultiplier(blockFace),
@ -102,7 +102,7 @@ public abstract class BlockRenderTexturedCube
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk) {
boolean opaque = isBlockOpaque();
Face[] faces = new Face[BLOCK_FACE_COUNT + (opaque ? BLOCK_FACE_COUNT : 0)];
ShapePart[] faces = new ShapePart[BLOCK_FACE_COUNT + (opaque ? BLOCK_FACE_COUNT : 0)];
for (int i = 0; i < BLOCK_FACE_COUNT; ++i) {
faces[i] = createFace(chunk, blockInChunk, AbsFace.getFaces().get(i), false, Vectors.ZERO_3);

View File

@ -19,7 +19,7 @@
package ru.windcorp.progressia.client.world.block;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class BlockRenderTransparentCube extends BlockRenderTexturedCube {

View File

@ -24,7 +24,7 @@ import ru.windcorp.progressia.client.world.ChunkRender;
import ru.windcorp.progressia.client.world.block.BlockRender;
import ru.windcorp.progressia.client.world.tile.TileRender;
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
/**
* Chunk render optimizer (CRO) is an object that produces optimized models for

View File

@ -19,8 +19,8 @@
package ru.windcorp.progressia.client.world.cro;
import static ru.windcorp.progressia.common.world.ChunkData.BLOCKS_PER_CHUNK;
import static ru.windcorp.progressia.common.world.block.AbsFace.BLOCK_FACE_COUNT;
import static ru.windcorp.progressia.common.world.generic.GenericTileStack.TILES_PER_FACE;
import static ru.windcorp.progressia.common.world.rels.AbsFace.BLOCK_FACE_COUNT;
import java.util.ArrayList;
import java.util.Collection;
@ -29,7 +29,7 @@ import java.util.function.Consumer;
import glm.vec._3.Vec3;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.client.graphics.model.Shape;
import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
@ -38,7 +38,7 @@ import ru.windcorp.progressia.client.world.block.BlockRender;
import ru.windcorp.progressia.client.world.tile.TileRender;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
@ -52,26 +52,26 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
private static interface OptimizedSurface {
/**
* Creates and outputs a set of faces that correspond to this surface.
* The coordinates of the face vertices must be in chunk coordinate
* system.
* Creates and outputs a set of shape parts that correspond to this
* surface. The coordinates of the face vertices must be in chunk
* coordinate system.
*
* @param chunk the chunk that contains the requested face
* @param blockInChunk the block in chunk
* @param blockFace the requested face
* @param inner whether this face should be visible from inside
* ({@code true}) or outside ({@code false})
* @param output a consumer that the created faces must be given
* to
* @param output a consumer that the created shape parts must be
* given to
* @param offset an additional offset that must be applied to all
* vertices
*/
void getFaces(
void getShapeParts(
ChunkData chunk,
Vec3i blockInChunk,
AbsFace blockFace,
boolean inner,
Consumer<Face> output,
Consumer<ShapePart> output,
Vec3 offset /* kostyl 156% */
);
@ -207,12 +207,12 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
@Override
public Renderable endRender() {
Collection<Face> shapeFaces = new ArrayList<>(
Collection<ShapePart> shapeParts = new ArrayList<>(
BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK * 3
);
Vec3i cursor = new Vec3i();
Consumer<Face> consumer = shapeFaces::add;
Consumer<ShapePart> consumer = shapeParts::add;
for (cursor.x = 0; cursor.x < BLOCKS_PER_CHUNK; ++cursor.x) {
for (cursor.y = 0; cursor.y < BLOCKS_PER_CHUNK; ++cursor.y) {
@ -223,27 +223,27 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
}
}
if (shapeFaces.isEmpty()) {
if (shapeParts.isEmpty()) {
return null;
}
return new Shape(
Usage.STATIC,
WorldRenderProgram.getDefault(),
shapeFaces.toArray(new Face[shapeFaces.size()])
shapeParts.toArray(new ShapePart[shapeParts.size()])
);
}
private void processOuterFaces(
Vec3i blockInChunk,
Consumer<Face> output
Consumer<ShapePart> output
) {
for (AbsFace blockFace : AbsFace.getFaces()) {
processOuterFace(blockInChunk, blockFace, output);
}
}
private void processOuterFace(Vec3i blockInChunk, AbsFace blockFace, Consumer<Face> output) {
private void processOuterFace(Vec3i blockInChunk, AbsFace blockFace, Consumer<ShapePart> output) {
if (!shouldRenderOuterFace(blockInChunk, blockFace))
return;
@ -264,7 +264,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
if (surface == null)
continue; // layer may be BLOCK_LAYER, then block may be null
surface.getFaces(chunk.getData(), blockInChunk, blockFace, false, output, faceOrigin);
surface.getShapeParts(chunk.getData(), blockInChunk, blockFace, false, output, faceOrigin);
faceOrigin.add(offset);
}
@ -272,14 +272,14 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
private void processInnerFaces(
Vec3i blockInChunk,
Consumer<Face> output
Consumer<ShapePart> output
) {
for (AbsFace blockFace : AbsFace.getFaces()) {
processInnerFace(blockInChunk, blockFace, output);
}
}
private void processInnerFace(Vec3i blockInChunk, AbsFace blockFace, Consumer<Face> output) {
private void processInnerFace(Vec3i blockInChunk, AbsFace blockFace, Consumer<ShapePart> output) {
if (!shouldRenderInnerFace(blockInChunk, blockFace))
return;
@ -300,7 +300,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
if (surface == null)
continue; // layer may be BLOCK_LAYER, then block may be null
surface.getFaces(chunk.getData(), blockInChunk, blockFace, true, output, faceOrigin);
surface.getShapeParts(chunk.getData(), blockInChunk, blockFace, true, output, faceOrigin);
faceOrigin.add(offset);
}

View File

@ -24,8 +24,8 @@ import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizer;
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericTile;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TileRender extends Namespaced implements GenericTile {

View File

@ -19,7 +19,7 @@
package ru.windcorp.progressia.client.world.tile;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TileRenderGrass extends TileRenderSurface {

View File

@ -21,7 +21,7 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.client.graphics.model.EmptyModel;
import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TileRenderNone extends TileRender {

View File

@ -19,7 +19,7 @@
package ru.windcorp.progressia.client.world.tile;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TileRenderOpaqueSurface extends TileRenderSurface {

View File

@ -25,8 +25,8 @@ import glm.vec._3.i.Vec3i;
import glm.vec._4.Vec4;
import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.Faces;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
import ru.windcorp.progressia.client.graphics.model.Shape;
import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.client.graphics.texture.Texture;
@ -34,7 +34,7 @@ import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizerSurface.TileOptimizedSurface;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public abstract class TileRenderSurface extends TileRender implements TileOptimizedSurface {
@ -58,21 +58,21 @@ public abstract class TileRenderSurface extends TileRender implements TileOptimi
}
@Override
public final void getFaces(
public final void getShapeParts(
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
boolean inner,
Consumer<Face> output,
Consumer<ShapePart> output,
Vec3 offset
) {
output.accept(createFace(chunk, blockInChunk, blockFace, inner, offset));
}
private Face createFace(
private ShapePart createFace(
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
boolean inner,
Vec3 offset
) {
return Faces.createBlockFace(
return ShapeParts.createBlockFace(
WorldRenderProgram.getDefault(),
getTexture(blockFace),
getColorMultiplier(blockFace),

View File

@ -19,7 +19,7 @@
package ru.windcorp.progressia.client.world.tile;
import ru.windcorp.progressia.client.graphics.texture.Texture;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TileRenderTransparentSurface extends TileRenderSurface {

View File

@ -19,7 +19,7 @@
package ru.windcorp.progressia.common.collision;
import glm.vec._3.Vec3;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public interface AABBoid extends CollisionModel {

View File

@ -20,7 +20,7 @@ package ru.windcorp.progressia.common.collision;
import glm.vec._3.Vec3;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TranslatedAABB implements AABBoid {

View File

@ -25,7 +25,7 @@ import ru.windcorp.progressia.common.collision.colliders.Collider.ColliderWorksp
import ru.windcorp.progressia.common.collision.colliders.Collider.Collision;
import ru.windcorp.progressia.common.util.Matrices;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
class AABBoidCollider {

View File

@ -22,7 +22,7 @@ import glm.vec._3.Vec3;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.VectorUtil;
import ru.windcorp.progressia.common.util.VectorUtil.Axis;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import static java.lang.Math.*;

View File

@ -18,7 +18,7 @@
package ru.windcorp.progressia.common.world;
import static ru.windcorp.progressia.common.world.block.AbsFace.*;
import static ru.windcorp.progressia.common.world.rels.AbsFace.*;
import java.util.ArrayList;
import java.util.Arrays;
@ -31,8 +31,8 @@ import java.util.function.Consumer;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.VectorUtil;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericChunk;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
import ru.windcorp.progressia.common.world.tile.TileDataStack;
import ru.windcorp.progressia.common.world.tile.TileReference;

View File

@ -20,7 +20,7 @@ package ru.windcorp.progressia.common.world;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
public interface ChunkDataListener {

View File

@ -24,7 +24,7 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.VectorUtil;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public interface GenericChunk<Self extends GenericChunk<Self, B, T, TS>, B extends GenericBlock, T extends GenericTile, TS extends GenericTileStack<TS, T, Self>> {

View File

@ -25,7 +25,7 @@ import java.util.function.Consumer;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public abstract class GenericTileStack<Self extends GenericTileStack<Self, T, C>, T extends GenericTile, C extends GenericChunk<C, ?, T, Self>>
extends AbstractList<T>

View File

@ -26,7 +26,7 @@ import glm.vec._3.Vec3;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.Vectors;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public interface GenericWorld<B extends GenericBlock, T extends GenericTile, TS extends GenericTileStack<TS, T, C>, C extends GenericChunk<C, B, T, TS>, E extends GenericEntity> {

View File

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ru.windcorp.progressia.common.world.block;
package ru.windcorp.progressia.common.world.rels;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;

View File

@ -0,0 +1,76 @@
/*
* Progressia
* Copyright (C) 2020-2021 Wind Corporation and contributors
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ru.windcorp.progressia.common.world.rels;
import glm.vec._3.Vec3;
import glm.vec._3.i.Vec3i;
public class AbsRelation extends BlockRelation {
private final Vec3i vector = new Vec3i();
private final Vec3 floatVector = new Vec3();
private final Vec3 normalized = new Vec3();
public AbsRelation(int x, int y, int z) {
vector.set(x, y, z);
floatVector.set(x, y, z);
normalized.set(x, y, z);
if (x != 0 || y != 0 || z != 0) {
normalized.normalize();
}
}
public AbsRelation(Vec3i vector) {
this(vector.x, vector.y, vector.z);
}
@Override
public AbsRelation resolve(AbsFace up) {
return this;
}
@Override
public Vec3i getVector(AbsFace up) {
return vector;
}
@Override
public Vec3 getFloatVector(AbsFace up) {
return floatVector;
}
@Override
public Vec3 getNormalized(AbsFace up) {
return normalized;
}
public Vec3i getVector() {
return vector;
}
public Vec3 getFloatVector() {
return floatVector;
}
public Vec3 getNormalized() {
return normalized;
}
}

View File

@ -15,8 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package ru.windcorp.progressia.common.world.block;
package ru.windcorp.progressia.common.world.rels;
import static java.lang.Math.abs;
import static java.lang.Math.max;
@ -24,34 +23,22 @@ import static java.lang.Math.max;
import glm.vec._3.Vec3;
import glm.vec._3.i.Vec3i;
public class AbsRelation {
public abstract class BlockRelation {
private final Vec3i vector = new Vec3i();
private final Vec3 floatVector = new Vec3();
private final Vec3 normalized = new Vec3();
public AbsRelation(int x, int y, int z) {
vector.set(x, y, z);
floatVector.set(x, y, z);
normalized.set(x, y, z).normalize();
}
public AbsRelation(Vec3i vector) {
this(vector.x, vector.y, vector.z);
}
public Vec3i getVector() {
return vector;
public abstract AbsRelation resolve(AbsFace up);
public Vec3i getVector(AbsFace up) {
return resolve(up).getVector();
}
public Vec3 getFloatVector() {
return floatVector;
public Vec3 getFloatVector(AbsFace up) {
return resolve(up).getFloatVector();
}
public Vec3 getNormalized() {
return normalized;
public Vec3 getNormalized(AbsFace up) {
return resolve(up).getNormalized();
}
/**
* Returns the distance between the source and destination blocks, as
* defined by the Euclidean space. Your everyday distance.
@ -59,7 +46,7 @@ public class AbsRelation {
* @return square root of the sum of the squares of the coordinates
*/
public float getEuclideanDistance() {
return vector.length();
return getVector(AbsFace.POS_Z).length();
}
/**
@ -72,6 +59,7 @@ public class AbsRelation {
* @return the sum of the absolute values of the coordinates
*/
public int getManhattanDistance() {
Vec3i vector = getVector(AbsFace.POS_Z);
return abs(vector.x) + abs(vector.y) + abs(vector.z);
}
@ -83,7 +71,8 @@ public class AbsRelation {
* @return the maximum of the absolute values of the coordinates
*/
public int getChebyshevDistance() {
Vec3i vector = getVector(AbsFace.POS_Z);
return max(abs(vector.x), max(abs(vector.y), abs(vector.z)));
}
}

View File

@ -25,7 +25,7 @@ import java.io.IOException;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.DecodingException;
import ru.windcorp.progressia.common.world.WorldData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class PacketAddTile extends PacketAffectTile {

View File

@ -26,7 +26,7 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.DecodingException;
import ru.windcorp.progressia.common.world.PacketAffectChunk;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public abstract class PacketAffectTile extends PacketAffectChunk {

View File

@ -26,7 +26,7 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.crash.CrashReports;
import ru.windcorp.progressia.common.world.DecodingException;
import ru.windcorp.progressia.common.world.WorldData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class PacketRemoveTile extends PacketAffectTile {

View File

@ -28,8 +28,8 @@ import java.util.function.BiConsumer;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericChunk;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileDataStack;
import ru.windcorp.progressia.common.world.tile.TileReference;
import ru.windcorp.progressia.server.world.block.BlockLogic;

View File

@ -20,8 +20,8 @@ package ru.windcorp.progressia.server.world;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.crash.CrashReports;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.entity.EntityData;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.server.Server;
import ru.windcorp.progressia.server.world.block.BlockLogic;
import ru.windcorp.progressia.server.world.block.BlockTickContext;

View File

@ -25,8 +25,8 @@ import java.util.function.Function;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericTileStack;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileDataStack;
import ru.windcorp.progressia.common.world.tile.TileReference;
import ru.windcorp.progressia.server.Server;

View File

@ -23,7 +23,7 @@ import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.ChunkDataListener;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
import ru.windcorp.progressia.server.Server;

View File

@ -19,8 +19,8 @@
package ru.windcorp.progressia.server.world.block;
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericBlock;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class BlockLogic extends Namespaced implements GenericBlock {

View File

@ -25,8 +25,8 @@ import java.util.function.Function;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.block.AbsRelation;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsRelation;
import ru.windcorp.progressia.server.world.ChunkTickContext;
import ru.windcorp.progressia.server.world.TickContextMutable;
import ru.windcorp.progressia.server.world.tile.TSTickContext;

View File

@ -22,7 +22,7 @@ import java.util.function.Consumer;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.server.Server;
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
import ru.windcorp.progressia.server.world.WorldLogic;

View File

@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.FloatMathUtil;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileDataStack;
import ru.windcorp.progressia.server.Server;
import ru.windcorp.progressia.server.world.ChunkLogic;

View File

@ -22,7 +22,7 @@ import java.util.function.Consumer;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.world.Coordinates;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.server.Server;
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
import ru.windcorp.progressia.server.world.WorldLogic;

View File

@ -24,8 +24,8 @@ import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.util.MultiLOC;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.entity.EntityData;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
import ru.windcorp.progressia.server.Server;

View File

@ -23,7 +23,7 @@ import java.util.function.Consumer;
import java.util.function.Function;
import ru.windcorp.progressia.common.world.ChunkData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileDataStack;
import ru.windcorp.progressia.server.world.ChunkLogic;
import ru.windcorp.progressia.server.world.TickContextMutable;

View File

@ -19,8 +19,8 @@
package ru.windcorp.progressia.server.world.tile;
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.generic.GenericTile;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TileLogic extends Namespaced implements GenericTile {

View File

@ -20,7 +20,7 @@ package ru.windcorp.progressia.test;
import glm.vec._3.i.Vec3i;
import ru.windcorp.progressia.common.comms.controls.ControlData;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
public class ControlPlaceTileData extends ControlData {

View File

@ -18,7 +18,7 @@
package ru.windcorp.progressia.test;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.server.world.block.BlockLogic;
public class TestBlockLogicAir extends BlockLogic {

View File

@ -18,7 +18,7 @@
package ru.windcorp.progressia.test;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.server.world.block.BlockLogic;
public class TestBlockLogicGlass extends BlockLogic {

View File

@ -38,8 +38,8 @@ import ru.windcorp.progressia.common.world.DecodingException;
import ru.windcorp.progressia.common.world.WorldData;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.io.ChunkCodec;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;

View File

@ -51,6 +51,7 @@ import ru.windcorp.progressia.common.world.GravityModelRegistry;
import ru.windcorp.progressia.common.world.block.*;
import ru.windcorp.progressia.common.world.entity.*;
import ru.windcorp.progressia.common.world.io.ChunkIO;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.*;
import ru.windcorp.progressia.server.Server;
import ru.windcorp.progressia.server.comms.controls.*;

View File

@ -25,8 +25,8 @@ import glm.vec._3.Vec3;
import ru.windcorp.progressia.client.graphics.Colors;
import ru.windcorp.progressia.client.graphics.backend.GraphicsInterface;
import ru.windcorp.progressia.client.graphics.backend.Usage;
import ru.windcorp.progressia.client.graphics.model.Face;
import ru.windcorp.progressia.client.graphics.model.Faces;
import ru.windcorp.progressia.client.graphics.model.ShapePart;
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
import ru.windcorp.progressia.client.graphics.model.LambdaModel;
import ru.windcorp.progressia.client.graphics.model.Renderable;
import ru.windcorp.progressia.client.graphics.model.Shape;
@ -39,8 +39,8 @@ import ru.windcorp.progressia.client.world.entity.EntityRender;
import ru.windcorp.progressia.client.world.entity.EntityRenderRegistry;
import ru.windcorp.progressia.client.world.entity.EntityRenderable;
import ru.windcorp.progressia.client.world.entity.QuadripedModel;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.entity.EntityData;
import ru.windcorp.progressia.common.world.rels.AbsFace;
public class TestEntityRenderJavapony extends EntityRender {
@ -124,11 +124,11 @@ public class TestEntityRenderJavapony extends EntityRender {
private static Renderable createMainBody(ComplexTexture texture) {
WorldRenderProgram program = WorldRenderProgram.getDefault();
List<Face> faces = new ArrayList<>();
List<ShapePart> faces = new ArrayList<>();
// F BODY
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(80, 16, 32, 32),
Colors.WHITE,
@ -141,7 +141,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// NECK BASE
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(80, 48, 32, 16),
Colors.WHITE,
@ -154,7 +154,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// T BODY (BACK)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(128, 0, 32, 48),
Colors.WHITE,
@ -167,7 +167,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BOTTOM B (upper)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(144, 48, 32, 16),
Colors.WHITE,
@ -180,7 +180,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BOTTOM B (lower)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(144, 48, 32, 16),
Colors.WHITE,
@ -193,7 +193,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BOTTOM B (stomach)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(144, 48, 32, 16),
Colors.WHITE,
@ -206,7 +206,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// STOMACH
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(224, 96, 32, 32),
Colors.WHITE,
@ -219,7 +219,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BOTTOM F
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(112, 48, 32, 16),
Colors.WHITE,
@ -232,7 +232,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BODY L
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(112, 16, 16, 32),
Colors.WHITE,
@ -245,7 +245,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BODY SIDES (left)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(96, 96, 32, 32),
Colors.WHITE,
@ -258,7 +258,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// QT MARK (left)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(16, 96, 16, 32),
Colors.WHITE,
@ -271,7 +271,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BODY R
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(64, 16, 16, 32),
Colors.WHITE,
@ -284,7 +284,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// BODY SIDES (right)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(96, 96, 32, 32),
Colors.WHITE,
@ -297,7 +297,7 @@ public class TestEntityRenderJavapony extends EntityRender {
// QT MARK (right)
faces.add(
Faces.createRectangle(
ShapeParts.createRectangle(
program,
texture.get(16, 96, 16, 32),
Colors.WHITE,
@ -311,7 +311,7 @@ public class TestEntityRenderJavapony extends EntityRender {
return new Shape(
Usage.STATIC,
program,
faces.toArray(new Face[faces.size()])
faces.toArray(new ShapePart[faces.size()])
);
}

View File

@ -18,7 +18,7 @@
package ru.windcorp.progressia.test;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.server.world.block.BlockLogic;
import ru.windcorp.progressia.server.world.block.BlockTickContext;
import ru.windcorp.progressia.server.world.ticking.TickingPolicy;

View File

@ -33,7 +33,7 @@ import ru.windcorp.progressia.common.world.WorldData;
import ru.windcorp.progressia.common.world.WorldDataListener;
import ru.windcorp.progressia.common.world.block.BlockData;
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
import ru.windcorp.progressia.common.world.block.AbsFace;
import ru.windcorp.progressia.common.world.rels.AbsFace;
import ru.windcorp.progressia.common.world.tile.TileData;
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
import ru.windcorp.progressia.server.world.WorldLogic;