Skip to content

Commit

Permalink
fix render error
Browse files Browse the repository at this point in the history
  • Loading branch information
dfdyz committed Aug 17, 2024
1 parent 82ac7e7 commit b1aa577
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ protected void renderSafe(HologramTE te, float partialTicks, PoseStack stack, Mu
n.mul(nor);
VertexConsumer buf = bufferSource.getBuffer(RenderType.entityTranslucent(tex));


float z = 0F;
float w = te.width / 32.f * te.scalex;
float h = te.high / 32.f * te.scaley;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import org.jetbrains.annotations.Nullable;
import org.valkyrienskies.core.impl.shadow.M;
import org.valkyrienskies.core.impl.shadow.S;
import org.yaml.snakeyaml.error.Mark;

import java.io.UnsupportedEncodingException;
import java.nio.ByteBuffer;
Expand Down Expand Up @@ -156,8 +157,7 @@ public void Text(IArguments param) throws LuaException {
}
Font.CharMat cm = Font.getMat(ch);
int edgeR = Math.min(ay + cm.bitmap.length, te.high);


MarkDirtyXYWH(tmpx, ay, cm.width, cm.bitmap.length);
for (int y = Math.max(ay, 0); y < edgeR; y++) {
int offD = y * te.width;
int edgeD = Math.min(te.width, tmpx + cm.width);
Expand All @@ -169,7 +169,6 @@ public void Text(IArguments param) throws LuaException {
}

tmpx += cm.width;
MarkDirtyXYWH(tmpx, ay, cm.width, cm.bitmap.length);
}
}
else if(mode == 2){ // blend
Expand All @@ -184,7 +183,7 @@ else if(mode == 2){ // blend
}
Font.CharMat cm = Font.getMat(ch);
int edgeR = Math.min(ay + cm.bitmap.length, te.high);

MarkDirtyXYWH(tmpx, ay, cm.width, cm.bitmap.length);
for (int y = Math.max(ay, 0); y < edgeR; y++) {
int offD = y * te.width;
int edgeD = Math.min(te.width, tmpx + cm.width);
Expand All @@ -194,9 +193,7 @@ else if(mode == 2){ // blend
}
}
}

tmpx += cm.width;
MarkDirtyXYWH(tmpx, ay, cm.width, cm.bitmap.length);
}
}

Expand Down Expand Up @@ -289,6 +286,9 @@ else if (mode == 2){ //blend
} catch (LuaException e) {
throw new RuntimeException(e);
}
MarkDirtyXYWH(ax, ay, w, h);
System.out.println(dirty_ex+" "+dirty_ey);
//System.out.println(ax + " " + ay + " " + (ax+w) + " " + (ay+h));
}

final Set<IComputerAccess> computers = Sets.newConcurrentHashSet();
Expand Down Expand Up @@ -333,6 +333,7 @@ SP_HologramUpdate GetLazyPack(HologramTE te){
dirty_ey-dirty_y,
buffer
);
//Debug.PrintMsg(pack);
dirty_x = te.width;
dirty_ex = 0;
dirty_y = te.high;
Expand All @@ -353,10 +354,11 @@ public void MarkDirtyXYWH(int x, int y, int w, int h){
dirty_y = Math.min(y, dirty_y);
dirty_ex = Math.max(x+w, dirty_ex);
dirty_ey = Math.max(y+h, dirty_ey);

dirty_x = Math.max(dirty_x, 0);
dirty_y = Math.max(dirty_y, 0);
dirty_ex = Math.min(te.width, dirty_ex);
dirty_ey = Math.min(te.high, dirty_ey);
dirty_ex = Math.min(dirty_ex, te.width);
dirty_ey = Math.min(dirty_ey, te.high);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/dfdyz/void_power/registry/VPBlocks.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public class VPBlocks {
.initialProperties(SharedProperties::stone)
.transform(TagGen.axeOrPickaxe())
.blockstate(BlockStateGen.horizontalBlockProvider(true))
.addLayer(() -> RenderType::translucent)
//.addLayer(() -> RenderType::translucent)
//.transform(BlockStressDefaults.setImpact(8.0))
.item()
.transform(customItemModel())
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/dfdyz/void_power/utils/Debug.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public static void PrintIntArray(int[] array, int line){

public static void PrintMsg(SP_HologramUpdate msg){
System.out.println(msg.x + " " + msg.y + " " + msg.w + " " + msg.h + (msg.lazy ? "Lazy" : "Full"));
PrintIntArray(msg.buffer, msg.w);
//PrintIntArray(msg.buffer, msg.w);
}

public static void PrintMap(Map<?,?> map){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.dfdyz.void_power.network.PacketManager;
import com.dfdyz.void_power.network.SP.SP_HologramPoseUpdate;
import com.dfdyz.void_power.network.SP.SP_HologramUpdate;
import com.dfdyz.void_power.utils.Debug;
import com.dfdyz.void_power.utils.ParamUtils;
import com.dfdyz.void_power.utils.SyncLocker;
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
Expand Down Expand Up @@ -140,10 +141,12 @@ public void addBehaviours(List<BlockEntityBehaviour> behaviours) {

public void BlitBuffer(int ax, int ay, int w, int h, int[] src){
int[] buffer = this.buffer;
for(int y = Math.max(ay, 0); y < high && y < h; ++y){
int edgeD = Math.min(high, ay+h);
for(int y = Math.max(ay, 0); y < edgeD; ++y){
int offO = (y - ay) * w;
int offD = y * width;
for(int x = Math.max(ax, 0); x < width && x < w; ++x){
int edgeR = Math.min(width, ax+w);
for(int x = Math.max(ax, 0); x < edgeR; ++x){
buffer[offD + x] = src[offO + x - ax];
}
}
Expand Down

0 comments on commit b1aa577

Please sign in to comment.