Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Send copies of vertexes instead of pointers to changing vertices pt 2 electric boogaoo + some other rendering stuff maybe? #296

Open
wants to merge 1 commit into
base: 1.20
Choose a base branch
from

Conversation

superpowers04
Copy link
Contributor

pull/295 but less bad maybe

Comment on lines +564 to +570
public Float x,y,z;
public Float r,g,b,a;
public Float uvX,uvY;
public int overlay;
public int light;
public Float nX,nY,nZ;
public boolean consumed;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason these are capital Float (the box type) instead of lowercase float (the primitive)? none of them look nullable to me

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo, Used to other languages using Float instead of float

Copy link
Member

@UnlikePaladin UnlikePaladin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please read the observations

@@ -181,8 +180,7 @@ protected PartCustomization setupRootCustomization(double vertOffset) {
customization.setPrimaryRenderType(RenderTypes.TRANSLUCENT);
customization.setSecondaryRenderType(RenderTypes.EMISSIVE);

double s = 1.0 / 16;
customization.positionMatrix.scale(s, s, s);
customization.positionMatrix.scale(0.0625, 0.0625, 0.0625);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Either add a comment explaining why the 0.0625, that is clarify it stands for 1 / 16, or undo the change. The compiler or jvm probably inline this anyway because it's a constant so it's an unnecessary change that makes it less clear and makes changes in the future harder because no one will know what 0.062 is or stands for.

int sky = l.getBrightness(LightLayer.SKY, pos.asBlockPos());
customizationStack.peek().light = LightTexture.pack(block, sky);
var pos = part.savedPartToWorldMat.apply(0d, 0d, 0d).asBlockPos();
customizationStack.peek().light = LightTexture.pack(l.getBrightness(LightLayer.BLOCK, pos), l.getBrightness(LightLayer.SKY, pos));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use things such as var, this is not JS and I have to back port all these changes to Java 8 later, there's no good reason to. Also why inline these? They're locals and get destroyed after they go out of scope anyway, it's not optimizing anything

@@ -542,32 +529,81 @@ private void pushToBuffer(int faceCount, VertexData vertexData, PartCustomizatio

int overlay = customization.overlay;
int light = vertexData.fullBright ? LightTexture.FULL_BRIGHT : customization.light;
ToBeConsumedVertexData[] vertexDatas = new ToBeConsumedVertexData[vertCount]; // why the fuck did i use duckai for this
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please provide a visual example of what the change is actually fixing or doing, I understand you're "copying" the data to consume it later but it is less than clear why you are doing so. Explain why the vertices change, etc.

@superpowers04
Copy link
Contributor Author

superpowers04 commented Jan 17, 2025

This doesn't actually fix the issue at the moment, the requested changes have been made but I don't have enough time at the moment to fix the issue :c_:, I'll push the changes when it's done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants