Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into spike/jmx
Browse files Browse the repository at this point in the history
  • Loading branch information
keturn committed Dec 19, 2021
2 parents 7b2feb8 + 7583454 commit af908f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ private static void buildBlockMesh(StandardMeshData mesh, float size, Rectanglef
Vector3f pos = new Vector3f();
Vector3f norm = new Vector3f();
Vector2f texCoord = new Vector2f();
final float sizeHalf = size / 2;
final float sizeHalf = (size / 2) + .001f;

int firstIndex = mesh.position.getPosition();

Expand All @@ -81,7 +81,7 @@ private static void buildBlockMesh(StandardMeshData mesh, float size, Rectanglef
mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY));
mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY));
mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY));
mesh.uv0.put(texCoord.set(texRect.minY, texRect.minY));
mesh.uv0.put(texCoord.set(texRect.minX, texRect.minY));
for (int i = 0; i < 4; i++) {
mesh.normal.put(norm.set(-1.0f, 0, 0));
mesh.color0.put(c);
Expand Down Expand Up @@ -123,7 +123,7 @@ private static void buildBlockMesh(StandardMeshData mesh, float size, Rectanglef
mesh.uv0.put(texCoord.set(texRect.minX, texRect.maxY));
mesh.uv0.put(texCoord.set(texRect.maxX, texRect.maxY));
mesh.uv0.put(texCoord.set(texRect.maxX, texRect.minY));
mesh.uv0.put(texCoord.set(texRect.minY, texRect.minY));
mesh.uv0.put(texCoord.set(texRect.minX, texRect.minY));
for (int i = 0; i < 4; i++) {
mesh.normal.put(norm.set(0, 0, 1.0f));
mesh.color0.put(c);
Expand Down
23 changes: 5 additions & 18 deletions engine/src/main/java/org/terasology/engine/world/block/Block.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,12 @@
import org.terasology.engine.math.Rotation;
import org.terasology.engine.math.Side;
import org.terasology.engine.physics.shapes.CollisionShape;
import org.terasology.engine.rendering.assets.mesh.Mesh;
import org.terasology.engine.rendering.primitives.BlockMeshGenerator;
import org.terasology.engine.rendering.primitives.BlockMeshGeneratorSingleShape;
import org.terasology.engine.rendering.primitives.Tessellator;
import org.terasology.engine.world.block.family.BlockFamily;
import org.terasology.engine.world.block.shapes.BlockMeshPart;
import org.terasology.engine.world.block.sounds.BlockSounds;
import org.terasology.engine.world.chunks.Chunks;
import org.terasology.gestalt.assets.ResourceUrn;
import org.terasology.joml.geom.AABBf;
import org.terasology.math.TeraMath;
import org.terasology.nui.Color;
Expand Down Expand Up @@ -225,15 +222,17 @@ public void setTranslucent(boolean translucent) {
}

/**
* @return The BlockMeshGenerator that is used in rendering, null if invisible.
* MeshGenerator drives how the mesh is produced for this single block.
* by default this uses {@link BlockMeshGeneratorSingleShape} and can't be set to null.
*
* @return The BlockMeshGenerator that is used in rendering.
*/
public BlockMeshGenerator getMeshGenerator() {
return meshGenerator;
}

/**
* @param meshGenerator The new BlockMeshGenerator to use in rendering this block.
* If meshGenerator is null then this block is invisible.
* @param meshGenerator The new {@link BlockMeshGenerator} to use in rendering this block.
*/
public void setMeshGenerator(BlockMeshGenerator meshGenerator) {
Preconditions.checkNotNull(meshGenerator);
Expand Down Expand Up @@ -524,18 +523,6 @@ public void setColorOffsets(Colorc color) {
}
}

/**
* @return Standalone mesh
* @deprecated Use getMeshGenerator() instead.
*/
@Deprecated
public Mesh getMesh() {
if (meshGenerator != null) {
return meshGenerator.getStandaloneMesh();
}
return new Tessellator().generateMesh(new ResourceUrn("engine", "blockmesh", uri.toString()));
}

public BlockMeshPart getLowLiquidMesh(Side side) {
return lowLiquidMesh[side.ordinal()];
}
Expand Down

0 comments on commit af908f9

Please sign in to comment.