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:
parent
848178b343
commit
acef9d32df
@ -29,8 +29,8 @@ import glm.vec._3.Vec3;
|
|||||||
import glm.vec._4.Vec4;
|
import glm.vec._4.Vec4;
|
||||||
import ru.windcorp.progressia.client.graphics.Colors;
|
import ru.windcorp.progressia.client.graphics.Colors;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
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.Faces;
|
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Shape;
|
import ru.windcorp.progressia.client.graphics.model.Shape;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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<TransformedMask> maskStack = new LinkedList<>();
|
||||||
private final Deque<Mat4> transformStack = 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;
|
private int depth = 0;
|
||||||
|
|
||||||
@ -94,8 +94,8 @@ public class RenderTarget {
|
|||||||
|
|
||||||
protected void assembleCurrentClipFromFaces() {
|
protected void assembleCurrentClipFromFaces() {
|
||||||
if (!currentClipFaces.isEmpty()) {
|
if (!currentClipFaces.isEmpty()) {
|
||||||
Face[] faces = currentClipFaces.toArray(
|
ShapePart[] faces = currentClipFaces.toArray(
|
||||||
new Face[currentClipFaces.size()]
|
new ShapePart[currentClipFaces.size()]
|
||||||
);
|
);
|
||||||
currentClipFaces.clear();
|
currentClipFaces.clear();
|
||||||
|
|
||||||
@ -198,7 +198,7 @@ public class RenderTarget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void addFaceToCurrentClip(Face face) {
|
protected void addFaceToCurrentClip(ShapePart face) {
|
||||||
currentClipFaces.add(face);
|
currentClipFaces.add(face);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -270,7 +270,7 @@ public class RenderTarget {
|
|||||||
fill(Colors.toVector(color));
|
fill(Colors.toVector(color));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face createRectagleFace(
|
public ShapePart createRectagleFace(
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
@ -280,7 +280,7 @@ public class RenderTarget {
|
|||||||
) {
|
) {
|
||||||
float depth = this.depth--;
|
float depth = this.depth--;
|
||||||
|
|
||||||
return Faces.createRectangle(
|
return ShapeParts.createRectangle(
|
||||||
FlatRenderProgram.getDefault(),
|
FlatRenderProgram.getDefault(),
|
||||||
texture,
|
texture,
|
||||||
color,
|
color,
|
||||||
@ -291,7 +291,7 @@ public class RenderTarget {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face createRectagleFace(
|
public ShapePart createRectagleFace(
|
||||||
int x,
|
int x,
|
||||||
int y,
|
int y,
|
||||||
int width,
|
int width,
|
||||||
|
@ -33,8 +33,8 @@ import gnu.trove.stack.TIntStack;
|
|||||||
import gnu.trove.stack.array.TIntArrayStack;
|
import gnu.trove.stack.array.TIntArrayStack;
|
||||||
import ru.windcorp.progressia.client.graphics.Colors;
|
import ru.windcorp.progressia.client.graphics.Colors;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
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.Faces;
|
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Shape;
|
import ru.windcorp.progressia.client.graphics.model.Shape;
|
||||||
import ru.windcorp.progressia.client.graphics.model.ShapeRenderHelper;
|
import ru.windcorp.progressia.client.graphics.model.ShapeRenderHelper;
|
||||||
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
|
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
|
||||||
@ -144,7 +144,7 @@ public abstract class SpriteTypeface extends Typeface {
|
|||||||
return new Shape(
|
return new Shape(
|
||||||
Usage.STATIC,
|
Usage.STATIC,
|
||||||
getProgram(),
|
getProgram(),
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
getProgram(),
|
getProgram(),
|
||||||
getTexture(c),
|
getTexture(c),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -167,7 +167,7 @@ public abstract class SpriteTypeface extends Typeface {
|
|||||||
private final Renderable unitLine = new Shape(
|
private final Renderable unitLine = new Shape(
|
||||||
Usage.STATIC,
|
Usage.STATIC,
|
||||||
getProgram(),
|
getProgram(),
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
getProgram(),
|
getProgram(),
|
||||||
null,
|
null,
|
||||||
Vectors.UNIT_4,
|
Vectors.UNIT_4,
|
||||||
@ -257,7 +257,7 @@ public abstract class SpriteTypeface extends Typeface {
|
|||||||
|
|
||||||
private class SDWorkspace extends SpriteTypeface.Workspace {
|
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 origin = new Vec3();
|
||||||
private final Vec3 width = new Vec3();
|
private final Vec3 width = new Vec3();
|
||||||
@ -298,7 +298,7 @@ public abstract class SpriteTypeface extends Typeface {
|
|||||||
workspace.height.sub(workspace.origin);
|
workspace.height.sub(workspace.origin);
|
||||||
|
|
||||||
workspace.faces.add(
|
workspace.faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
getProgram(),
|
getProgram(),
|
||||||
texture,
|
texture,
|
||||||
color,
|
color,
|
||||||
@ -314,7 +314,7 @@ public abstract class SpriteTypeface extends Typeface {
|
|||||||
return new Shape(
|
return new Shape(
|
||||||
Usage.STATIC,
|
Usage.STATIC,
|
||||||
getProgram(),
|
getProgram(),
|
||||||
workspace.faces.toArray(new Face[workspace.faces.size()])
|
workspace.faces.toArray(new ShapePart[workspace.faces.size()])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,12 +18,12 @@
|
|||||||
|
|
||||||
package ru.windcorp.progressia.client.graphics.model;
|
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 com.google.common.collect.ImmutableMap;
|
||||||
|
|
||||||
import glm.vec._3.Vec3;
|
import glm.vec._3.Vec3;
|
||||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
class BlockFaceVectors {
|
class BlockFaceVectors {
|
||||||
|
|
||||||
|
@ -30,10 +30,10 @@ import ru.windcorp.progressia.client.graphics.backend.VertexBufferObject;
|
|||||||
public class Shape implements Renderable {
|
public class Shape implements Renderable {
|
||||||
|
|
||||||
private final ShapeRenderProgram program;
|
private final ShapeRenderProgram program;
|
||||||
private final Face[] faces;
|
private final ShapePart[] parts;
|
||||||
private final Usage usage;
|
private final Usage usage;
|
||||||
|
|
||||||
private FaceGroup[] groups;
|
private ShapePartGroup[] groups;
|
||||||
|
|
||||||
private ByteBuffer vertices;
|
private ByteBuffer vertices;
|
||||||
private ShortBuffer indices;
|
private ShortBuffer indices;
|
||||||
@ -45,33 +45,33 @@ public class Shape implements Renderable {
|
|||||||
private VertexBufferObject verticesVbo;
|
private VertexBufferObject verticesVbo;
|
||||||
private VertexBufferObject indicesVbo;
|
private VertexBufferObject indicesVbo;
|
||||||
|
|
||||||
public Shape(Usage usage, ShapeRenderProgram program, Face... faces) {
|
public Shape(Usage usage, ShapeRenderProgram program, ShapePart... parts) {
|
||||||
this.program = program;
|
this.program = program;
|
||||||
this.faces = faces;
|
this.parts = parts;
|
||||||
this.usage = usage;
|
this.usage = usage;
|
||||||
|
|
||||||
configureFaces();
|
configureParts();
|
||||||
program.preprocess(this);
|
program.preprocess(this);
|
||||||
|
|
||||||
assembleBuffers();
|
assembleBuffers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void configureFaces() {
|
private void configureParts() {
|
||||||
for (Face face : faces) {
|
for (ShapePart part : parts) {
|
||||||
face.setShape(this);
|
part.setShape(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assembleBuffers() {
|
private void assembleBuffers() {
|
||||||
// TODO optimize: only update faces that requested it
|
// TODO optimize: only update faces that requested it
|
||||||
|
|
||||||
sortFaces();
|
sortParts();
|
||||||
resizeBuffers();
|
resizeBuffers();
|
||||||
|
|
||||||
for (Face face : faces) {
|
for (ShapePart part : parts) {
|
||||||
assembleVertices(face);
|
assembleVertices(part);
|
||||||
assembleIndices(face);
|
assembleIndices(part);
|
||||||
face.resetUpdateFlags();
|
part.resetUpdateFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.vertices.flip();
|
this.vertices.flip();
|
||||||
@ -85,110 +85,110 @@ public class Shape implements Renderable {
|
|||||||
|
|
||||||
private void resizeBuffers() {
|
private void resizeBuffers() {
|
||||||
int verticesRequired = 0, indicesRequired = 0;
|
int verticesRequired = 0, indicesRequired = 0;
|
||||||
for (Face face : faces) {
|
for (ShapePart part : parts) {
|
||||||
verticesRequired += face.getVertices().remaining();
|
verticesRequired += part.getVertices().remaining();
|
||||||
indicesRequired += face.getIndices().remaining();
|
indicesRequired += part.getIndices().remaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.vertices == null || vertices.capacity() < verticesRequired) {
|
if (vertices == null || vertices.capacity() < verticesRequired) {
|
||||||
this.vertices = BufferUtils.createByteBuffer(verticesRequired);
|
this.vertices = BufferUtils.createByteBuffer(verticesRequired);
|
||||||
} else {
|
} 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);
|
this.indices = BufferUtils.createShortBuffer(indicesRequired);
|
||||||
} else {
|
} else {
|
||||||
this.indices.position(0).limit(indicesRequired);
|
indices.position(0).limit(indicesRequired);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assembleVertices(Face face) {
|
private void assembleVertices(ShapePart part) {
|
||||||
face.locationOfVertices = this.vertices.position();
|
part.locationOfVertices = this.vertices.position();
|
||||||
|
|
||||||
insertVertices(face);
|
insertVertices(part);
|
||||||
linkVerticesWith(face);
|
linkVerticesWith(part);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void insertVertices(Face face) {
|
private void insertVertices(ShapePart part) {
|
||||||
ByteBuffer faceVertices = face.getVertices();
|
ByteBuffer partVertices = part.getVertices();
|
||||||
|
|
||||||
faceVertices.mark();
|
partVertices.mark();
|
||||||
this.vertices.put(faceVertices);
|
this.vertices.put(partVertices);
|
||||||
faceVertices.reset();
|
partVertices.reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkVerticesWith(Face face) {
|
private void linkVerticesWith(ShapePart part) {
|
||||||
int limit = vertices.limit();
|
int limit = vertices.limit();
|
||||||
int position = vertices.position();
|
int position = vertices.position();
|
||||||
|
|
||||||
vertices.limit(position).position(face.getLocationOfVertices());
|
vertices.limit(position).position(part.getLocationOfVertices());
|
||||||
face.vertices = vertices.slice();
|
part.vertices = vertices.slice();
|
||||||
|
|
||||||
vertices.position(position).limit(limit);
|
vertices.position(position).limit(limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assembleIndices(Face face) {
|
private void assembleIndices(ShapePart part) {
|
||||||
short vertexOffset = (short) (face.getLocationOfVertices() / program.getBytesPerVertex());
|
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) {
|
if (partIndices == null) {
|
||||||
for (int i = 0; i < face.getVertexCount(); ++i) {
|
for (int i = 0; i < part.getVertexCount(); ++i) {
|
||||||
this.indices.put((short) (vertexOffset + i));
|
this.indices.put((short) (vertexOffset + i));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (int i = faceIndices.position(); i < faceIndices.limit(); ++i) {
|
for (int i = partIndices.position(); i < partIndices.limit(); ++i) {
|
||||||
short faceIndex = faceIndices.get(i);
|
short partIndex = partIndices.get(i);
|
||||||
faceIndex += vertexOffset;
|
partIndex += vertexOffset;
|
||||||
this.indices.put(faceIndex);
|
this.indices.put(partIndex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void sortFaces() {
|
private void sortParts() {
|
||||||
Arrays.sort(faces);
|
Arrays.sort(parts);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assembleGroups() {
|
private void assembleGroups() {
|
||||||
int unique = countUniqueFaces();
|
int unique = countUniqueParts();
|
||||||
this.groups = new FaceGroup[unique];
|
this.groups = new ShapePartGroup[unique];
|
||||||
|
|
||||||
if (faces.length == 0)
|
if (parts.length == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int previousHandle = faces[0].getSortingIndex();
|
int previousHandle = parts[0].getSortingIndex();
|
||||||
int start = 0;
|
int start = 0;
|
||||||
int groupIndex = 0;
|
int groupIndex = 0;
|
||||||
|
|
||||||
for (int i = 1; i < faces.length; ++i) {
|
for (int i = 1; i < parts.length; ++i) {
|
||||||
if (previousHandle != faces[i].getSortingIndex()) {
|
if (previousHandle != parts[i].getSortingIndex()) {
|
||||||
|
|
||||||
groups[groupIndex] = new FaceGroup(faces, start, i);
|
groups[groupIndex] = new ShapePartGroup(parts, start, i);
|
||||||
start = i;
|
start = i;
|
||||||
groupIndex++;
|
groupIndex++;
|
||||||
|
|
||||||
previousHandle = faces[i].getSortingIndex();
|
previousHandle = parts[i].getSortingIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
assert groupIndex == groups.length - 1;
|
assert groupIndex == groups.length - 1;
|
||||||
groups[groupIndex] = new FaceGroup(faces, start, faces.length);
|
groups[groupIndex] = new ShapePartGroup(parts, start, parts.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
private int countUniqueFaces() {
|
private int countUniqueParts() {
|
||||||
if (faces.length == 0)
|
if (parts.length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
int result = 1;
|
int result = 1;
|
||||||
int previousHandle = faces[0].getSortingIndex();
|
int previousHandle = parts[0].getSortingIndex();
|
||||||
|
|
||||||
for (int i = 1; i < faces.length; ++i) {
|
for (int i = 1; i < parts.length; ++i) {
|
||||||
if (previousHandle != faces[i].getSortingIndex()) {
|
if (previousHandle != parts[i].getSortingIndex()) {
|
||||||
result++;
|
result++;
|
||||||
previousHandle = faces[i].getSortingIndex();
|
previousHandle = parts[i].getSortingIndex();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,11 +238,11 @@ public class Shape implements Renderable {
|
|||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face[] getFaces() {
|
public ShapePart[] getParts() {
|
||||||
return faces;
|
return parts;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FaceGroup[] getGroups() {
|
public ShapePartGroup[] getGroups() {
|
||||||
return groups;
|
return groups;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import java.util.Objects;
|
|||||||
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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;
|
private static final ShortBuffer GENERATE_SUCCESSIVE_LATER = null;
|
||||||
|
|
||||||
@ -40,7 +40,7 @@ public class Face implements Comparable<Face> {
|
|||||||
private ShortBuffer userIndices;
|
private ShortBuffer userIndices;
|
||||||
private boolean userIndicesUpdated = true;
|
private boolean userIndicesUpdated = true;
|
||||||
|
|
||||||
public Face(
|
public ShapePart(
|
||||||
Texture texture,
|
Texture texture,
|
||||||
ByteBuffer vertices,
|
ByteBuffer vertices,
|
||||||
ShortBuffer indices
|
ShortBuffer indices
|
||||||
@ -50,7 +50,7 @@ public class Face implements Comparable<Face> {
|
|||||||
setIndices(indices);
|
setIndices(indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face(
|
public ShapePart(
|
||||||
Texture texture,
|
Texture texture,
|
||||||
ByteBuffer vertices
|
ByteBuffer vertices
|
||||||
) {
|
) {
|
||||||
@ -155,7 +155,7 @@ public class Face implements Comparable<Face> {
|
|||||||
return vertices;
|
return vertices;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face setVertices(ByteBuffer vertices) {
|
public ShapePart setVertices(ByteBuffer vertices) {
|
||||||
this.vertices = Objects.requireNonNull(vertices, "vertices");
|
this.vertices = Objects.requireNonNull(vertices, "vertices");
|
||||||
markForVertexUpdate();
|
markForVertexUpdate();
|
||||||
return this;
|
return this;
|
||||||
@ -202,7 +202,7 @@ public class Face implements Comparable<Face> {
|
|||||||
return userIndices.remaining();
|
return userIndices.remaining();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Face setIndices(ShortBuffer indices) {
|
public ShapePart setIndices(ShortBuffer indices) {
|
||||||
if (indices == null) {
|
if (indices == null) {
|
||||||
indices = GENERATE_SUCCESSIVE_LATER;
|
indices = GENERATE_SUCCESSIVE_LATER;
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ public class Face implements Comparable<Face> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int compareTo(Face o) {
|
public int compareTo(ShapePart o) {
|
||||||
return Integer.compare(getSortingIndex(), o.getSortingIndex());
|
return Integer.compare(getSortingIndex(), o.getSortingIndex());
|
||||||
}
|
}
|
||||||
|
|
@ -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.Texture;
|
||||||
import ru.windcorp.progressia.client.graphics.texture.TexturePrimitive;
|
import ru.windcorp.progressia.client.graphics.texture.TexturePrimitive;
|
||||||
|
|
||||||
public class FaceGroup {
|
public class ShapePartGroup {
|
||||||
|
|
||||||
private final TexturePrimitive texture;
|
private final TexturePrimitive texture;
|
||||||
private final int indexCount;
|
private final int indexCount;
|
||||||
private final int byteOffsetOfIndices;
|
private final int byteOffsetOfIndices;
|
||||||
|
|
||||||
FaceGroup(Face[] faces, int start, int end) {
|
ShapePartGroup(ShapePart[] faces, int start, int end) {
|
||||||
|
|
||||||
Texture t = faces[start].getTexture();
|
Texture t = faces[start].getTexture();
|
||||||
this.texture = t == null ? null : t.getSprite().getPrimitive();
|
this.texture = t == null ? null : t.getSprite().getPrimitive();
|
||||||
@ -36,7 +36,7 @@ public class FaceGroup {
|
|||||||
int indexCount = 0;
|
int indexCount = 0;
|
||||||
|
|
||||||
for (int i = start; i < end; ++i) {
|
for (int i = start; i < end; ++i) {
|
||||||
Face face = faces[i];
|
ShapePart face = faces[i];
|
||||||
|
|
||||||
assert this.texture == null
|
assert this.texture == null
|
||||||
? (face.getTexture() == null)
|
? (face.getTexture() == null)
|
@ -25,14 +25,14 @@ import glm.vec._3.Vec3;
|
|||||||
import glm.vec._4.Vec4;
|
import glm.vec._4.Vec4;
|
||||||
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram.VertexBuilder;
|
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram.VertexBuilder;
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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,
|
ShapeRenderProgram program,
|
||||||
Texture texture,
|
Texture texture,
|
||||||
Vec4 colorMultiplier,
|
Vec4 colorMultiplier,
|
||||||
@ -82,14 +82,14 @@ public class Faces {
|
|||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return new Face(
|
return new ShapePart(
|
||||||
texture,
|
texture,
|
||||||
builder.assemble(),
|
builder.assemble(),
|
||||||
buffer
|
buffer
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Face createBlockFace(
|
public static ShapePart createBlockFace(
|
||||||
ShapeRenderProgram program,
|
ShapeRenderProgram program,
|
||||||
Texture texture,
|
Texture texture,
|
||||||
Vec4 colorMultiplier,
|
Vec4 colorMultiplier,
|
@ -116,7 +116,7 @@ public class ShapeRenderProgram extends Program {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
enableAttributes();
|
enableAttributes();
|
||||||
for (FaceGroup group : shape.getGroups()) {
|
for (ShapePartGroup group : shape.getGroups()) {
|
||||||
renderFaceGroup(group);
|
renderFaceGroup(group);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
@ -182,7 +182,7 @@ public class ShapeRenderProgram extends Program {
|
|||||||
indices.bind(BindTarget.ELEMENT_ARRAY);
|
indices.bind(BindTarget.ELEMENT_ARRAY);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void renderFaceGroup(FaceGroup group) {
|
protected void renderFaceGroup(ShapePartGroup group) {
|
||||||
TexturePrimitive texture = group.getTexture();
|
TexturePrimitive texture = group.getTexture();
|
||||||
|
|
||||||
if (texture != null) {
|
if (texture != null) {
|
||||||
@ -206,12 +206,12 @@ public class ShapeRenderProgram extends Program {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void preprocess(Shape shape) {
|
public void preprocess(Shape shape) {
|
||||||
for (Face face : shape.getFaces()) {
|
for (ShapePart face : shape.getParts()) {
|
||||||
applySprites(face);
|
applySprites(face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applySprites(Face face) {
|
private void applySprites(ShapePart face) {
|
||||||
if (face.getTexture() == null)
|
if (face.getTexture() == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ import glm.vec._3.Vec3;
|
|||||||
import glm.vec._4.Vec4;
|
import glm.vec._4.Vec4;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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 {
|
public class Shapes {
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ public class Shapes {
|
|||||||
boolean flip
|
boolean flip
|
||||||
) {
|
) {
|
||||||
|
|
||||||
Face top = Faces.createRectangle(
|
ShapePart top = ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
topTexture,
|
topTexture,
|
||||||
colorMultiplier,
|
colorMultiplier,
|
||||||
@ -60,7 +60,7 @@ public class Shapes {
|
|||||||
flip
|
flip
|
||||||
);
|
);
|
||||||
|
|
||||||
Face bottom = Faces.createRectangle(
|
ShapePart bottom = ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
bottomTexture,
|
bottomTexture,
|
||||||
colorMultiplier,
|
colorMultiplier,
|
||||||
@ -70,7 +70,7 @@ public class Shapes {
|
|||||||
flip
|
flip
|
||||||
);
|
);
|
||||||
|
|
||||||
Face north = Faces.createRectangle(
|
ShapePart north = ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
northTexture,
|
northTexture,
|
||||||
colorMultiplier,
|
colorMultiplier,
|
||||||
@ -80,7 +80,7 @@ public class Shapes {
|
|||||||
flip
|
flip
|
||||||
);
|
);
|
||||||
|
|
||||||
Face south = Faces.createRectangle(
|
ShapePart south = ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
southTexture,
|
southTexture,
|
||||||
colorMultiplier,
|
colorMultiplier,
|
||||||
@ -90,7 +90,7 @@ public class Shapes {
|
|||||||
flip
|
flip
|
||||||
);
|
);
|
||||||
|
|
||||||
Face east = Faces.createRectangle(
|
ShapePart east = ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
eastTexture,
|
eastTexture,
|
||||||
colorMultiplier,
|
colorMultiplier,
|
||||||
@ -100,7 +100,7 @@ public class Shapes {
|
|||||||
flip
|
flip
|
||||||
);
|
);
|
||||||
|
|
||||||
Face west = Faces.createRectangle(
|
ShapePart west = ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
westTexture,
|
westTexture,
|
||||||
colorMultiplier,
|
colorMultiplier,
|
||||||
|
@ -21,7 +21,7 @@ package ru.windcorp.progressia.client.graphics.texture;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import glm.vec._2.Vec2;
|
import glm.vec._2.Vec2;
|
||||||
import ru.windcorp.progressia.common.world.block.AbsFace;
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
public class ComplexTexture {
|
public class ComplexTexture {
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ import glm.vec._3.Vec3;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.client.world.WorldRender;
|
import ru.windcorp.progressia.client.world.WorldRender;
|
||||||
import ru.windcorp.progressia.common.world.BlockRay;
|
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.entity.EntityData;
|
||||||
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
public class Selection {
|
public class Selection {
|
||||||
|
|
||||||
|
@ -33,7 +33,7 @@ import glm.vec._4.Vec4;
|
|||||||
import ru.windcorp.progressia.client.graphics.backend.VertexBufferObject;
|
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.attributes.*;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.shaders.uniforms.*;
|
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.Shape;
|
||||||
import ru.windcorp.progressia.client.graphics.model.ShapeRenderHelper;
|
import ru.windcorp.progressia.client.graphics.model.ShapeRenderHelper;
|
||||||
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
|
import ru.windcorp.progressia.client.graphics.model.ShapeRenderProgram;
|
||||||
@ -138,12 +138,12 @@ public class WorldRenderProgram extends ShapeRenderProgram {
|
|||||||
public void preprocess(Shape shape) {
|
public void preprocess(Shape shape) {
|
||||||
super.preprocess(shape);
|
super.preprocess(shape);
|
||||||
|
|
||||||
for (Face face : shape.getFaces()) {
|
for (ShapePart face : shape.getParts()) {
|
||||||
computeNormals(face);
|
computeNormals(face);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void computeNormals(Face face) {
|
private void computeNormals(ShapePart face) {
|
||||||
Vec3 a = Vectors.grab3();
|
Vec3 a = Vectors.grab3();
|
||||||
Vec3 b = Vectors.grab3();
|
Vec3 b = Vectors.grab3();
|
||||||
Vec3 c = Vectors.grab3();
|
Vec3 c = Vectors.grab3();
|
||||||
@ -183,7 +183,7 @@ public class WorldRenderProgram extends ShapeRenderProgram {
|
|||||||
normal.normalize();
|
normal.normalize();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadVertexPosition(Face face, int index, Vec3 result) {
|
private void loadVertexPosition(ShapePart face, int index, Vec3 result) {
|
||||||
ByteBuffer vertices = face.getVertices();
|
ByteBuffer vertices = face.getVertices();
|
||||||
int offset = vertices.position() + index * getBytesPerVertex();
|
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();
|
ByteBuffer vertices = face.getVertices();
|
||||||
int offset = vertices.position() + index * getBytesPerVertex() + (3 * Float.BYTES +
|
int offset = vertices.position() + index * getBytesPerVertex() + (3 * Float.BYTES +
|
||||||
4 * Float.BYTES +
|
4 * Float.BYTES +
|
||||||
|
@ -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.TileRenderRegistry;
|
||||||
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
|
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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.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.TileDataStack;
|
||||||
|
|
||||||
public class ChunkRender
|
public class ChunkRender
|
||||||
|
@ -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.TileRenderNone;
|
||||||
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
|
import ru.windcorp.progressia.client.world.tile.TileRenderStack;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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 {
|
public class ChunkRenderModel implements Renderable {
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
import ru.windcorp.progressia.common.world.ChunkData;
|
||||||
import ru.windcorp.progressia.common.world.ChunkDataListener;
|
import ru.windcorp.progressia.common.world.ChunkDataListener;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
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.common.world.tile.TileData;
|
||||||
|
|
||||||
class ChunkUpdateListener implements ChunkDataListener {
|
class ChunkUpdateListener implements ChunkDataListener {
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package ru.windcorp.progressia.client.world.block;
|
package ru.windcorp.progressia.client.world.block;
|
||||||
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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 {
|
public class BlockRenderOpaqueCube extends BlockRenderTexturedCube {
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package ru.windcorp.progressia.client.world.block;
|
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.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@ -29,8 +29,8 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import glm.vec._4.Vec4;
|
import glm.vec._4.Vec4;
|
||||||
import ru.windcorp.progressia.client.graphics.Colors;
|
import ru.windcorp.progressia.client.graphics.Colors;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
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.Faces;
|
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Shape;
|
import ru.windcorp.progressia.client.graphics.model.Shape;
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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.client.world.cro.ChunkRenderOptimizerSurface.BlockOptimizedSurface;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
import ru.windcorp.progressia.common.util.Vectors;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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
|
public abstract class BlockRenderTexturedCube
|
||||||
extends BlockRender
|
extends BlockRender
|
||||||
@ -74,21 +74,21 @@ public abstract class BlockRenderTexturedCube
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void getFaces(
|
public final void getShapeParts(
|
||||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||||
boolean inner,
|
boolean inner,
|
||||||
Consumer<Face> output,
|
Consumer<ShapePart> output,
|
||||||
Vec3 offset
|
Vec3 offset
|
||||||
) {
|
) {
|
||||||
output.accept(createFace(chunk, blockInChunk, blockFace, inner, offset));
|
output.accept(createFace(chunk, blockInChunk, blockFace, inner, offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Face createFace(
|
private ShapePart createFace(
|
||||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||||
boolean inner,
|
boolean inner,
|
||||||
Vec3 offset
|
Vec3 offset
|
||||||
) {
|
) {
|
||||||
return Faces.createBlockFace(
|
return ShapeParts.createBlockFace(
|
||||||
WorldRenderProgram.getDefault(),
|
WorldRenderProgram.getDefault(),
|
||||||
getTexture(blockFace),
|
getTexture(blockFace),
|
||||||
getColorMultiplier(blockFace),
|
getColorMultiplier(blockFace),
|
||||||
@ -102,7 +102,7 @@ public abstract class BlockRenderTexturedCube
|
|||||||
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk) {
|
public Renderable createRenderable(ChunkData chunk, Vec3i blockInChunk) {
|
||||||
boolean opaque = isBlockOpaque();
|
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) {
|
for (int i = 0; i < BLOCK_FACE_COUNT; ++i) {
|
||||||
faces[i] = createFace(chunk, blockInChunk, AbsFace.getFaces().get(i), false, Vectors.ZERO_3);
|
faces[i] = createFace(chunk, blockInChunk, AbsFace.getFaces().get(i), false, Vectors.ZERO_3);
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package ru.windcorp.progressia.client.world.block;
|
package ru.windcorp.progressia.client.world.block;
|
||||||
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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 {
|
public class BlockRenderTransparentCube extends BlockRenderTexturedCube {
|
||||||
|
|
||||||
|
@ -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.block.BlockRender;
|
||||||
import ru.windcorp.progressia.client.world.tile.TileRender;
|
import ru.windcorp.progressia.client.world.tile.TileRender;
|
||||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
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
|
* Chunk render optimizer (CRO) is an object that produces optimized models for
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
package ru.windcorp.progressia.client.world.cro;
|
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.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.generic.GenericTileStack.TILES_PER_FACE;
|
||||||
|
import static ru.windcorp.progressia.common.world.rels.AbsFace.BLOCK_FACE_COUNT;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
@ -29,7 +29,7 @@ import java.util.function.Consumer;
|
|||||||
import glm.vec._3.Vec3;
|
import glm.vec._3.Vec3;
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
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.Renderable;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Shape;
|
import ru.windcorp.progressia.client.graphics.model.Shape;
|
||||||
import ru.windcorp.progressia.client.graphics.world.WorldRenderProgram;
|
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.client.world.tile.TileRender;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
import ru.windcorp.progressia.common.util.Vectors;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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 {
|
public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
||||||
|
|
||||||
@ -52,26 +52,26 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
|||||||
private static interface OptimizedSurface {
|
private static interface OptimizedSurface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates and outputs a set of faces that correspond to this surface.
|
* Creates and outputs a set of shape parts that correspond to this
|
||||||
* The coordinates of the face vertices must be in chunk coordinate
|
* surface. The coordinates of the face vertices must be in chunk
|
||||||
* system.
|
* coordinate system.
|
||||||
*
|
*
|
||||||
* @param chunk the chunk that contains the requested face
|
* @param chunk the chunk that contains the requested face
|
||||||
* @param blockInChunk the block in chunk
|
* @param blockInChunk the block in chunk
|
||||||
* @param blockFace the requested face
|
* @param blockFace the requested face
|
||||||
* @param inner whether this face should be visible from inside
|
* @param inner whether this face should be visible from inside
|
||||||
* ({@code true}) or outside ({@code false})
|
* ({@code true}) or outside ({@code false})
|
||||||
* @param output a consumer that the created faces must be given
|
* @param output a consumer that the created shape parts must be
|
||||||
* to
|
* given to
|
||||||
* @param offset an additional offset that must be applied to all
|
* @param offset an additional offset that must be applied to all
|
||||||
* vertices
|
* vertices
|
||||||
*/
|
*/
|
||||||
void getFaces(
|
void getShapeParts(
|
||||||
ChunkData chunk,
|
ChunkData chunk,
|
||||||
Vec3i blockInChunk,
|
Vec3i blockInChunk,
|
||||||
AbsFace blockFace,
|
AbsFace blockFace,
|
||||||
boolean inner,
|
boolean inner,
|
||||||
Consumer<Face> output,
|
Consumer<ShapePart> output,
|
||||||
Vec3 offset /* kostyl 156% */
|
Vec3 offset /* kostyl 156% */
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -207,12 +207,12 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Renderable endRender() {
|
public Renderable endRender() {
|
||||||
Collection<Face> shapeFaces = new ArrayList<>(
|
Collection<ShapePart> shapeParts = new ArrayList<>(
|
||||||
BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK * 3
|
BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK * BLOCKS_PER_CHUNK * 3
|
||||||
);
|
);
|
||||||
|
|
||||||
Vec3i cursor = new Vec3i();
|
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.x = 0; cursor.x < BLOCKS_PER_CHUNK; ++cursor.x) {
|
||||||
for (cursor.y = 0; cursor.y < BLOCKS_PER_CHUNK; ++cursor.y) {
|
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 null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Shape(
|
return new Shape(
|
||||||
Usage.STATIC,
|
Usage.STATIC,
|
||||||
WorldRenderProgram.getDefault(),
|
WorldRenderProgram.getDefault(),
|
||||||
shapeFaces.toArray(new Face[shapeFaces.size()])
|
shapeParts.toArray(new ShapePart[shapeParts.size()])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void processOuterFaces(
|
private void processOuterFaces(
|
||||||
Vec3i blockInChunk,
|
Vec3i blockInChunk,
|
||||||
Consumer<Face> output
|
Consumer<ShapePart> output
|
||||||
) {
|
) {
|
||||||
for (AbsFace blockFace : AbsFace.getFaces()) {
|
for (AbsFace blockFace : AbsFace.getFaces()) {
|
||||||
processOuterFace(blockInChunk, blockFace, output);
|
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))
|
if (!shouldRenderOuterFace(blockInChunk, blockFace))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -264,7 +264,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
|||||||
if (surface == null)
|
if (surface == null)
|
||||||
continue; // layer may be BLOCK_LAYER, then block may be 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);
|
faceOrigin.add(offset);
|
||||||
}
|
}
|
||||||
@ -272,14 +272,14 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
|||||||
|
|
||||||
private void processInnerFaces(
|
private void processInnerFaces(
|
||||||
Vec3i blockInChunk,
|
Vec3i blockInChunk,
|
||||||
Consumer<Face> output
|
Consumer<ShapePart> output
|
||||||
) {
|
) {
|
||||||
for (AbsFace blockFace : AbsFace.getFaces()) {
|
for (AbsFace blockFace : AbsFace.getFaces()) {
|
||||||
processInnerFace(blockInChunk, blockFace, output);
|
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))
|
if (!shouldRenderInnerFace(blockInChunk, blockFace))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -300,7 +300,7 @@ public class ChunkRenderOptimizerSurface extends ChunkRenderOptimizer {
|
|||||||
if (surface == null)
|
if (surface == null)
|
||||||
continue; // layer may be BLOCK_LAYER, then block may be 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);
|
faceOrigin.add(offset);
|
||||||
}
|
}
|
||||||
|
@ -24,8 +24,8 @@ import ru.windcorp.progressia.client.graphics.model.Renderable;
|
|||||||
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizer;
|
import ru.windcorp.progressia.client.world.cro.ChunkRenderOptimizer;
|
||||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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.generic.GenericTile;
|
||||||
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
public class TileRender extends Namespaced implements GenericTile {
|
public class TileRender extends Namespaced implements GenericTile {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package ru.windcorp.progressia.client.world.tile;
|
package ru.windcorp.progressia.client.world.tile;
|
||||||
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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 {
|
public class TileRenderGrass extends TileRenderSurface {
|
||||||
|
|
||||||
|
@ -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.EmptyModel;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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 {
|
public class TileRenderNone extends TileRender {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package ru.windcorp.progressia.client.world.tile;
|
package ru.windcorp.progressia.client.world.tile;
|
||||||
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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 {
|
public class TileRenderOpaqueSurface extends TileRenderSurface {
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import glm.vec._4.Vec4;
|
import glm.vec._4.Vec4;
|
||||||
import ru.windcorp.progressia.client.graphics.Colors;
|
import ru.windcorp.progressia.client.graphics.Colors;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
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.Faces;
|
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Shape;
|
import ru.windcorp.progressia.client.graphics.model.Shape;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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.client.world.cro.ChunkRenderOptimizerSurface.TileOptimizedSurface;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
import ru.windcorp.progressia.common.util.Vectors;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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 {
|
public abstract class TileRenderSurface extends TileRender implements TileOptimizedSurface {
|
||||||
|
|
||||||
@ -58,21 +58,21 @@ public abstract class TileRenderSurface extends TileRender implements TileOptimi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public final void getFaces(
|
public final void getShapeParts(
|
||||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||||
boolean inner,
|
boolean inner,
|
||||||
Consumer<Face> output,
|
Consumer<ShapePart> output,
|
||||||
Vec3 offset
|
Vec3 offset
|
||||||
) {
|
) {
|
||||||
output.accept(createFace(chunk, blockInChunk, blockFace, inner, offset));
|
output.accept(createFace(chunk, blockInChunk, blockFace, inner, offset));
|
||||||
}
|
}
|
||||||
|
|
||||||
private Face createFace(
|
private ShapePart createFace(
|
||||||
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
ChunkData chunk, Vec3i blockInChunk, AbsFace blockFace,
|
||||||
boolean inner,
|
boolean inner,
|
||||||
Vec3 offset
|
Vec3 offset
|
||||||
) {
|
) {
|
||||||
return Faces.createBlockFace(
|
return ShapeParts.createBlockFace(
|
||||||
WorldRenderProgram.getDefault(),
|
WorldRenderProgram.getDefault(),
|
||||||
getTexture(blockFace),
|
getTexture(blockFace),
|
||||||
getColorMultiplier(blockFace),
|
getColorMultiplier(blockFace),
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package ru.windcorp.progressia.client.world.tile;
|
package ru.windcorp.progressia.client.world.tile;
|
||||||
|
|
||||||
import ru.windcorp.progressia.client.graphics.texture.Texture;
|
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 {
|
public class TileRenderTransparentSurface extends TileRenderSurface {
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
package ru.windcorp.progressia.common.collision;
|
package ru.windcorp.progressia.common.collision;
|
||||||
|
|
||||||
import glm.vec._3.Vec3;
|
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 {
|
public interface AABBoid extends CollisionModel {
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.common.collision;
|
|||||||
|
|
||||||
import glm.vec._3.Vec3;
|
import glm.vec._3.Vec3;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
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 {
|
public class TranslatedAABB implements AABBoid {
|
||||||
|
|
||||||
|
@ -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.collision.colliders.Collider.Collision;
|
||||||
import ru.windcorp.progressia.common.util.Matrices;
|
import ru.windcorp.progressia.common.util.Matrices;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
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 {
|
class AABBoidCollider {
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ import glm.vec._3.Vec3;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.util.VectorUtil;
|
import ru.windcorp.progressia.common.util.VectorUtil;
|
||||||
import ru.windcorp.progressia.common.util.VectorUtil.Axis;
|
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.*;
|
import static java.lang.Math.*;
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package ru.windcorp.progressia.common.world;
|
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.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@ -31,8 +31,8 @@ import java.util.function.Consumer;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.util.VectorUtil;
|
import ru.windcorp.progressia.common.util.VectorUtil;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
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.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.TileData;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
import ru.windcorp.progressia.common.world.tile.TileDataStack;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileReference;
|
import ru.windcorp.progressia.common.world.tile.TileReference;
|
||||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.common.world;
|
|||||||
|
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
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.common.world.tile.TileData;
|
||||||
|
|
||||||
public interface ChunkDataListener {
|
public interface ChunkDataListener {
|
||||||
|
@ -24,7 +24,7 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import ru.windcorp.progressia.common.util.VectorUtil;
|
import ru.windcorp.progressia.common.util.VectorUtil;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
import ru.windcorp.progressia.common.util.Vectors;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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>> {
|
public interface GenericChunk<Self extends GenericChunk<Self, B, T, TS>, B extends GenericBlock, T extends GenericTile, TS extends GenericTileStack<TS, T, Self>> {
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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>>
|
public abstract class GenericTileStack<Self extends GenericTileStack<Self, T, C>, T extends GenericTile, C extends GenericChunk<C, ?, T, Self>>
|
||||||
extends AbstractList<T>
|
extends AbstractList<T>
|
||||||
|
@ -26,7 +26,7 @@ import glm.vec._3.Vec3;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.util.Vectors;
|
import ru.windcorp.progressia.common.util.Vectors;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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> {
|
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> {
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* 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.ImmutableList;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
@ -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;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -15,8 +15,7 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
package ru.windcorp.progressia.common.world.rels;
|
||||||
package ru.windcorp.progressia.common.world.block;
|
|
||||||
|
|
||||||
import static java.lang.Math.abs;
|
import static java.lang.Math.abs;
|
||||||
import static java.lang.Math.max;
|
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.Vec3;
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
|
|
||||||
public class AbsRelation {
|
public abstract class BlockRelation {
|
||||||
|
|
||||||
private final Vec3i vector = new Vec3i();
|
public abstract AbsRelation resolve(AbsFace up);
|
||||||
private final Vec3 floatVector = new Vec3();
|
|
||||||
private final Vec3 normalized = new Vec3();
|
public Vec3i getVector(AbsFace up) {
|
||||||
|
return resolve(up).getVector();
|
||||||
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 Vec3 getFloatVector() {
|
public Vec3 getFloatVector(AbsFace up) {
|
||||||
return floatVector;
|
return resolve(up).getFloatVector();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Vec3 getNormalized() {
|
public Vec3 getNormalized(AbsFace up) {
|
||||||
return normalized;
|
return resolve(up).getNormalized();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the distance between the source and destination blocks, as
|
* Returns the distance between the source and destination blocks, as
|
||||||
* defined by the Euclidean space. Your everyday distance.
|
* 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
|
* @return square root of the sum of the squares of the coordinates
|
||||||
*/
|
*/
|
||||||
public float getEuclideanDistance() {
|
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
|
* @return the sum of the absolute values of the coordinates
|
||||||
*/
|
*/
|
||||||
public int getManhattanDistance() {
|
public int getManhattanDistance() {
|
||||||
|
Vec3i vector = getVector(AbsFace.POS_Z);
|
||||||
return abs(vector.x) + abs(vector.y) + abs(vector.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
|
* @return the maximum of the absolute values of the coordinates
|
||||||
*/
|
*/
|
||||||
public int getChebyshevDistance() {
|
public int getChebyshevDistance() {
|
||||||
|
Vec3i vector = getVector(AbsFace.POS_Z);
|
||||||
return max(abs(vector.x), max(abs(vector.y), abs(vector.z)));
|
return max(abs(vector.x), max(abs(vector.y), abs(vector.z)));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -25,7 +25,7 @@ import java.io.IOException;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.DecodingException;
|
import ru.windcorp.progressia.common.world.DecodingException;
|
||||||
import ru.windcorp.progressia.common.world.WorldData;
|
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 {
|
public class PacketAddTile extends PacketAffectTile {
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
import ru.windcorp.progressia.common.world.Coordinates;
|
||||||
import ru.windcorp.progressia.common.world.DecodingException;
|
import ru.windcorp.progressia.common.world.DecodingException;
|
||||||
import ru.windcorp.progressia.common.world.PacketAffectChunk;
|
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 {
|
public abstract class PacketAffectTile extends PacketAffectChunk {
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
||||||
import ru.windcorp.progressia.common.world.DecodingException;
|
import ru.windcorp.progressia.common.world.DecodingException;
|
||||||
import ru.windcorp.progressia.common.world.WorldData;
|
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 {
|
public class PacketRemoveTile extends PacketAffectTile {
|
||||||
|
|
||||||
|
@ -28,8 +28,8 @@ import java.util.function.BiConsumer;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
import ru.windcorp.progressia.common.world.ChunkData;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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.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.TileDataStack;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileReference;
|
import ru.windcorp.progressia.common.world.tile.TileReference;
|
||||||
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
||||||
|
@ -20,8 +20,8 @@ package ru.windcorp.progressia.server.world;
|
|||||||
|
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.util.crash.CrashReports;
|
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.entity.EntityData;
|
||||||
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
import ru.windcorp.progressia.server.Server;
|
import ru.windcorp.progressia.server.Server;
|
||||||
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
import ru.windcorp.progressia.server.world.block.BlockLogic;
|
||||||
import ru.windcorp.progressia.server.world.block.BlockTickContext;
|
import ru.windcorp.progressia.server.world.block.BlockTickContext;
|
||||||
|
@ -25,8 +25,8 @@ import java.util.function.Function;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
import ru.windcorp.progressia.common.world.ChunkData;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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.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.TileDataStack;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileReference;
|
import ru.windcorp.progressia.common.world.tile.TileReference;
|
||||||
import ru.windcorp.progressia.server.Server;
|
import ru.windcorp.progressia.server.Server;
|
||||||
|
@ -23,7 +23,7 @@ import ru.windcorp.progressia.common.world.ChunkData;
|
|||||||
import ru.windcorp.progressia.common.world.ChunkDataListener;
|
import ru.windcorp.progressia.common.world.ChunkDataListener;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
import ru.windcorp.progressia.common.world.Coordinates;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
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.common.world.tile.TileData;
|
||||||
import ru.windcorp.progressia.server.Server;
|
import ru.windcorp.progressia.server.Server;
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
package ru.windcorp.progressia.server.world.block;
|
package ru.windcorp.progressia.server.world.block;
|
||||||
|
|
||||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
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.generic.GenericBlock;
|
||||||
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
public class BlockLogic extends Namespaced implements GenericBlock {
|
public class BlockLogic extends Namespaced implements GenericBlock {
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ import java.util.function.Function;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
import ru.windcorp.progressia.common.world.Coordinates;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
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.block.AbsRelation;
|
import ru.windcorp.progressia.common.world.rels.AbsRelation;
|
||||||
import ru.windcorp.progressia.server.world.ChunkTickContext;
|
import ru.windcorp.progressia.server.world.ChunkTickContext;
|
||||||
import ru.windcorp.progressia.server.world.TickContextMutable;
|
import ru.windcorp.progressia.server.world.TickContextMutable;
|
||||||
import ru.windcorp.progressia.server.world.tile.TSTickContext;
|
import ru.windcorp.progressia.server.world.tile.TSTickContext;
|
||||||
|
@ -22,7 +22,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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.Server;
|
||||||
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
|
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
|
||||||
import ru.windcorp.progressia.server.world.WorldLogic;
|
import ru.windcorp.progressia.server.world.WorldLogic;
|
||||||
|
@ -28,7 +28,7 @@ import com.google.common.collect.ImmutableList;
|
|||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.util.FloatMathUtil;
|
import ru.windcorp.progressia.common.util.FloatMathUtil;
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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.common.world.tile.TileDataStack;
|
||||||
import ru.windcorp.progressia.server.Server;
|
import ru.windcorp.progressia.server.Server;
|
||||||
import ru.windcorp.progressia.server.world.ChunkLogic;
|
import ru.windcorp.progressia.server.world.ChunkLogic;
|
||||||
|
@ -22,7 +22,7 @@ import java.util.function.Consumer;
|
|||||||
|
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.world.Coordinates;
|
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.Server;
|
||||||
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
|
import ru.windcorp.progressia.server.world.TickAndUpdateUtil;
|
||||||
import ru.windcorp.progressia.server.world.WorldLogic;
|
import ru.windcorp.progressia.server.world.WorldLogic;
|
||||||
|
@ -24,8 +24,8 @@ import glm.vec._3.i.Vec3i;
|
|||||||
import ru.windcorp.progressia.common.util.MultiLOC;
|
import ru.windcorp.progressia.common.util.MultiLOC;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
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.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.TileData;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
||||||
import ru.windcorp.progressia.server.Server;
|
import ru.windcorp.progressia.server.Server;
|
||||||
|
@ -23,7 +23,7 @@ import java.util.function.Consumer;
|
|||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import ru.windcorp.progressia.common.world.ChunkData;
|
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.common.world.tile.TileDataStack;
|
||||||
import ru.windcorp.progressia.server.world.ChunkLogic;
|
import ru.windcorp.progressia.server.world.ChunkLogic;
|
||||||
import ru.windcorp.progressia.server.world.TickContextMutable;
|
import ru.windcorp.progressia.server.world.TickContextMutable;
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
package ru.windcorp.progressia.server.world.tile;
|
package ru.windcorp.progressia.server.world.tile;
|
||||||
|
|
||||||
import ru.windcorp.progressia.common.util.namespaces.Namespaced;
|
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.generic.GenericTile;
|
||||||
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
public class TileLogic extends Namespaced implements GenericTile {
|
public class TileLogic extends Namespaced implements GenericTile {
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ package ru.windcorp.progressia.test;
|
|||||||
|
|
||||||
import glm.vec._3.i.Vec3i;
|
import glm.vec._3.i.Vec3i;
|
||||||
import ru.windcorp.progressia.common.comms.controls.ControlData;
|
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;
|
import ru.windcorp.progressia.common.world.tile.TileData;
|
||||||
|
|
||||||
public class ControlPlaceTileData extends ControlData {
|
public class ControlPlaceTileData extends ControlData {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package ru.windcorp.progressia.test;
|
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.BlockLogic;
|
||||||
|
|
||||||
public class TestBlockLogicAir extends BlockLogic {
|
public class TestBlockLogicAir extends BlockLogic {
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package ru.windcorp.progressia.test;
|
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.BlockLogic;
|
||||||
|
|
||||||
public class TestBlockLogicGlass extends BlockLogic {
|
public class TestBlockLogicGlass extends BlockLogic {
|
||||||
|
@ -38,8 +38,8 @@ import ru.windcorp.progressia.common.world.DecodingException;
|
|||||||
import ru.windcorp.progressia.common.world.WorldData;
|
import ru.windcorp.progressia.common.world.WorldData;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
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.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.TileData;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
||||||
|
|
||||||
|
@ -51,6 +51,7 @@ import ru.windcorp.progressia.common.world.GravityModelRegistry;
|
|||||||
import ru.windcorp.progressia.common.world.block.*;
|
import ru.windcorp.progressia.common.world.block.*;
|
||||||
import ru.windcorp.progressia.common.world.entity.*;
|
import ru.windcorp.progressia.common.world.entity.*;
|
||||||
import ru.windcorp.progressia.common.world.io.ChunkIO;
|
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.common.world.tile.*;
|
||||||
import ru.windcorp.progressia.server.Server;
|
import ru.windcorp.progressia.server.Server;
|
||||||
import ru.windcorp.progressia.server.comms.controls.*;
|
import ru.windcorp.progressia.server.comms.controls.*;
|
||||||
|
@ -25,8 +25,8 @@ import glm.vec._3.Vec3;
|
|||||||
import ru.windcorp.progressia.client.graphics.Colors;
|
import ru.windcorp.progressia.client.graphics.Colors;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.GraphicsInterface;
|
import ru.windcorp.progressia.client.graphics.backend.GraphicsInterface;
|
||||||
import ru.windcorp.progressia.client.graphics.backend.Usage;
|
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.Faces;
|
import ru.windcorp.progressia.client.graphics.model.ShapeParts;
|
||||||
import ru.windcorp.progressia.client.graphics.model.LambdaModel;
|
import ru.windcorp.progressia.client.graphics.model.LambdaModel;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
import ru.windcorp.progressia.client.graphics.model.Renderable;
|
||||||
import ru.windcorp.progressia.client.graphics.model.Shape;
|
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.EntityRenderRegistry;
|
||||||
import ru.windcorp.progressia.client.world.entity.EntityRenderable;
|
import ru.windcorp.progressia.client.world.entity.EntityRenderable;
|
||||||
import ru.windcorp.progressia.client.world.entity.QuadripedModel;
|
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.entity.EntityData;
|
||||||
|
import ru.windcorp.progressia.common.world.rels.AbsFace;
|
||||||
|
|
||||||
public class TestEntityRenderJavapony extends EntityRender {
|
public class TestEntityRenderJavapony extends EntityRender {
|
||||||
|
|
||||||
@ -124,11 +124,11 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
private static Renderable createMainBody(ComplexTexture texture) {
|
private static Renderable createMainBody(ComplexTexture texture) {
|
||||||
WorldRenderProgram program = WorldRenderProgram.getDefault();
|
WorldRenderProgram program = WorldRenderProgram.getDefault();
|
||||||
List<Face> faces = new ArrayList<>();
|
List<ShapePart> faces = new ArrayList<>();
|
||||||
|
|
||||||
// F BODY
|
// F BODY
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(80, 16, 32, 32),
|
texture.get(80, 16, 32, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -141,7 +141,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// NECK BASE
|
// NECK BASE
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(80, 48, 32, 16),
|
texture.get(80, 48, 32, 16),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -154,7 +154,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// T BODY (BACK)
|
// T BODY (BACK)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(128, 0, 32, 48),
|
texture.get(128, 0, 32, 48),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -167,7 +167,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BOTTOM B (upper)
|
// BOTTOM B (upper)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(144, 48, 32, 16),
|
texture.get(144, 48, 32, 16),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -180,7 +180,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BOTTOM B (lower)
|
// BOTTOM B (lower)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(144, 48, 32, 16),
|
texture.get(144, 48, 32, 16),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -193,7 +193,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BOTTOM B (stomach)
|
// BOTTOM B (stomach)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(144, 48, 32, 16),
|
texture.get(144, 48, 32, 16),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -206,7 +206,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// STOMACH
|
// STOMACH
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(224, 96, 32, 32),
|
texture.get(224, 96, 32, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -219,7 +219,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BOTTOM F
|
// BOTTOM F
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(112, 48, 32, 16),
|
texture.get(112, 48, 32, 16),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -232,7 +232,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BODY L
|
// BODY L
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(112, 16, 16, 32),
|
texture.get(112, 16, 16, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -245,7 +245,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BODY SIDES (left)
|
// BODY SIDES (left)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(96, 96, 32, 32),
|
texture.get(96, 96, 32, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -258,7 +258,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// QT MARK (left)
|
// QT MARK (left)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(16, 96, 16, 32),
|
texture.get(16, 96, 16, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -271,7 +271,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BODY R
|
// BODY R
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(64, 16, 16, 32),
|
texture.get(64, 16, 16, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -284,7 +284,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// BODY SIDES (right)
|
// BODY SIDES (right)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(96, 96, 32, 32),
|
texture.get(96, 96, 32, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -297,7 +297,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
|
|
||||||
// QT MARK (right)
|
// QT MARK (right)
|
||||||
faces.add(
|
faces.add(
|
||||||
Faces.createRectangle(
|
ShapeParts.createRectangle(
|
||||||
program,
|
program,
|
||||||
texture.get(16, 96, 16, 32),
|
texture.get(16, 96, 16, 32),
|
||||||
Colors.WHITE,
|
Colors.WHITE,
|
||||||
@ -311,7 +311,7 @@ public class TestEntityRenderJavapony extends EntityRender {
|
|||||||
return new Shape(
|
return new Shape(
|
||||||
Usage.STATIC,
|
Usage.STATIC,
|
||||||
program,
|
program,
|
||||||
faces.toArray(new Face[faces.size()])
|
faces.toArray(new ShapePart[faces.size()])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
|
|
||||||
package ru.windcorp.progressia.test;
|
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.BlockLogic;
|
||||||
import ru.windcorp.progressia.server.world.block.BlockTickContext;
|
import ru.windcorp.progressia.server.world.block.BlockTickContext;
|
||||||
import ru.windcorp.progressia.server.world.ticking.TickingPolicy;
|
import ru.windcorp.progressia.server.world.ticking.TickingPolicy;
|
||||||
|
@ -33,7 +33,7 @@ import ru.windcorp.progressia.common.world.WorldData;
|
|||||||
import ru.windcorp.progressia.common.world.WorldDataListener;
|
import ru.windcorp.progressia.common.world.WorldDataListener;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockData;
|
import ru.windcorp.progressia.common.world.block.BlockData;
|
||||||
import ru.windcorp.progressia.common.world.block.BlockDataRegistry;
|
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.TileData;
|
||||||
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
import ru.windcorp.progressia.common.world.tile.TileDataRegistry;
|
||||||
import ru.windcorp.progressia.server.world.WorldLogic;
|
import ru.windcorp.progressia.server.world.WorldLogic;
|
||||||
|
Reference in New Issue
Block a user