Skip to content

Commit

Permalink
[#157] Replaced antivignette.png with light.png and scale image to OB…
Browse files Browse the repository at this point in the history
…J-Object
  • Loading branch information
Danielxs01 committed Apr 17, 2024
1 parent 127ffac commit 076337d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions src/main/java/net/landofrails/landofsignals/utils/FlareUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

public class FlareUtils {

private static final Identifier LIGHT_TEX = new Identifier(LandOfSignals.MODID, "textures/light/antivignette.png");
private static final Identifier LIGHT_TEX = new Identifier(LandOfSignals.MODID, "textures/light/light.png");

private static final Map<String, Map<String, List<Flare>>> signalpartFlareCache = new HashMap<>();
private static final Map<String, List<Flare>> signFlareCache = new HashMap<>();
Expand Down Expand Up @@ -165,7 +165,8 @@ public static void renderFlares(Flare[] flares, Vec3i pos, int blockRotate, Vec3
int viewAngle = 45;
float intensity = 1 - Math.abs(Math.max(-viewAngle, Math.min(viewAngle, VecUtil.toWrongYaw(playerOffset) - 90))) / viewAngle;
intensity *= (float) Math.abs(playerOffset.x/50);
intensity = Math.min(intensity, 1.5f);
intensity *= 0.5f;
intensity = Math.min(intensity, 0.25f);

//

Expand Down Expand Up @@ -232,23 +233,7 @@ private static void cacheFlare(Flare flare, String flareId, OBJModel model, Stri
double maxX = flareGroupsOBJGroups.stream().mapToDouble(g -> g.max.x).max().getAsDouble();
double minX = flareGroupsOBJGroups.stream().mapToDouble(g -> g.min.x).min().getAsDouble();

double lampScale = Math.max((maxZ - minZ) * modelScaling[2], (maxX - minX) * modelScaling[0]);

/*
float flareOffset = flare.getOffset();
Set<String> groups = flare.getObjGroups() != null && flare.getObjGroups().length > 0
? Arrays.stream(flare.getObjGroups()).collect(Collectors.toSet())
: model.groups();
Vec3d centerOfModel = model.centerOfGroups(groups);
Vec3d centerOfLightFlare = model.centerOfGroups(flareGroups.keySet());
Vec3d modelOffset = centerOfLightFlare.subtract(centerOfModel);
modelOffset = new Vec3d(modelOffset.x, modelOffset.y, -modelOffset.z - flareOffset);
float yCorrection = 0.5f;
Vec3d flareCenterOffset = new Vec3d(modelTranslation[0], modelTranslation[1] + yCorrection, modelTranslation[2]);
Vec3d combinedOffset = flareCenterOffset.add(modelOffset);
*/
double lampScale = Math.max((maxZ - minZ) * modelScaling[2], (maxX - minX) * modelScaling[0]) * 0.65d;

// Scaling for the flare from the block in the contentpack
Vec3d scaling = new Vec3d(modelScaling[0], modelScaling[1], modelScaling[2]);
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 076337d

Please sign in to comment.