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

Make vacollect a full class #267

Merged
merged 11 commits into from
Oct 22, 2023
Merged

Make vacollect a full class #267

merged 11 commits into from
Oct 22, 2023

Conversation

no-lex
Copy link
Member

@no-lex no-lex commented Sep 15, 2023

Merges VA collection functions with the object containing its relevant data, allowing the vacollect object to have full encapsulation of its fields. Moves the vacollect object into its own file, separating it from other behavior in octarender.cpp.

No change in the outward behavior of the vertex array collection part of the code is changed; this is a pure refactor besides the changes to the class interface.

src/engine/render/vacollect.cpp Outdated Show resolved Hide resolved
}
if(x.tex == y.tex)
{
if(x.orient < y.orient)
Copy link
Member

Choose a reason for hiding this comment

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

Can't we return false if they're both equal, then simply go:

return x.orient < y.orient;

or even:

return x.orient != y.orient && x.orient < y.orient;

This is also applicable elsewhere in this file. It's pretty clear in my opinion, I don't think it obscures the code, yet reduces line count.

Copy link
Member

Choose a reason for hiding this comment

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

As discussed, these two options are a good way to inform the reader that the blocks are part of the same logic, by getting rid of the code blocks.

This will not only shorten the file a bit, but will make the code more legible.

{
return true;
}
else
Copy link
Member

Choose a reason for hiding this comment

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

useless "else" block


VARFN(vbosize, maxvbosize, 0, 1<<14, 1<<16, rootworld.allchanged());

//vbo (vertex buffer object) enum is local to this file
Copy link
Member

Choose a reason for hiding this comment

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

why? is it literally used nowhere else?

@no-lex no-lex marked this pull request as ready for review October 22, 2023 18:49
@no-lex no-lex merged commit f3b29ad into main Oct 22, 2023
4 checks passed
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.

2 participants