-
Notifications
You must be signed in to change notification settings - Fork 67
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
Add branch block type #1118
Add branch block type #1118
Conversation
@careeoki opinion on this? |
I would like this block implemented with a new rotation mode that connects to itself as proposed in #194. That would make it more versatile and unique. |
Should just be trees that have a height of 1 |
6be4bbc
to
c2131f2
Compare
Let me ping you guys 😄 I consider the texture temporary, It definitely needs love I can't give it no matter how hard I try. |
Looks good. I agree that Carrie should probably do a PR for its textures, or it could just use the existing wood textures. |
It can't use current wood textures as they are one directional (top-down) and this is two directionaly (top-down AND left-right), It looks awkward, I have checked and thats why I committed that atrocity of a texture 😅 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would also be great if you could figure out Carrie's suggestion. That would probably require working with the generateData
function as well.
The directional thing is tricky, because you would have to stop a block from being updated in a situation like this: This is currently not possible because you don't know the source of block update. If I understand correctly Logs work because existing logs don't have to be updated to connect to new logs, since they are full blocks and they are automatically connected to all neighbor blocks. We would need something like directional, that do full block update only a block that is behind placing direction, while other blocks have partial updates if necessary (lighting and stuff? idk, didn't read all the code yet :P ) |
Yee this is why you are the maintainer and I am the contributor 😄 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some proposals to simplify the code:
Instead of defining your own packed struct, you could use just a u6
and Neighbor.bitMask
to avoid those big, space-consuming switches. And it would also avoid some of the bitcasting.
To change a direction value:
currentData &= ~bitMask;
if(condition) currentData |= bitMask;
To check if a direction is set:
if(data & Neighbor.dirNegX.bitMask() != 0)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we shouldn't have the extra face on the outside, if this is used everywhere in the forest, we need to save every triangle we can. Sure it disables some potential future terrain options, but if we ever do want them I'd prefer adding them with an extra bit for it in the rotation mode, instead of always dragging around these extra faces.
Furthermore I still think that branches should not connect to viewThrough blocks, this is even more true with the extra face due to z-fighting:
Extra faces removed, code cleaned. If we don't connect to viewThrough blocks player can never connect a branch to leaves. You can generate them in worldgen since you don't cause block updates and you can insert any data you want, but it is kind of inconvenient. Maybe we could add exception for them at some point? |
Yeah, I think branches connecting to leaves is important. I didn't find it too noticeable that there was open faces when connecting to leaves, since the leaf texture is in the way. |
I would prefer branches having like one leaf block around it if they are inside the tree. This would also allow for branches without making the leaf culling any less efficient. (but that shouldn't be done in this PR, since it requires some other stuff) |
Ok, I think we should keep it as is for now (ie. no player created leaves connections) and possibly tweak it further down the road, so this PR can be finally merged. We will see how important that actually is after biomes and structures are adapted to presence of new block. If players even notice this we will surely get an issue for that anyway. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some more small things
Please rebase the PR to fix merge conflicts, and also fix all the formatting issues that will likely follow. |
That: fn branchTransform(quad: *main.models.QuadInfo, data: BranchData) void {
for(&quad.corners) |*corner| {
- if(
- (!data.isConnected(Neighbor.dirNegX) and corner[0] == 0)
- or (!data.isConnected(Neighbor.dirPosX) and corner[0] == 1)
- or (!data.isConnected(Neighbor.dirNegY) and corner[1] == 0)
- or (!data.isConnected(Neighbor.dirPosY) and corner[1] == 1)
- or (!data.isConnected(Neighbor.dirDown) and corner[2] == 0)
- or (!data.isConnected(Neighbor.dirUp) and corner[2] == 1)
- ) return degenerateQuad(quad);
+ if((!data.isConnected(Neighbor.dirNegX) and corner[0] == 0) or (!data.isConnected(Neighbor.dirPosX) and corner[0] == 1) or (!data.isConnected(Neighbor.dirNegY) and corner[1] == 0) or (!data.isConnected(Neighbor.dirPosY) and corner[1] == 1) or (!data.isConnected(Neighbor.dirDown) and corner[2] == 0) or (!data.isConnected(Neighbor.dirUp) and corner[2] == 1)) return degenerateQuad(quad);
}
} ain't happening. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Functionally it seems to work great now, just a few more small fixes and I am ready to merge this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good now, thank you for working on this, and thank you for bearing through the review process.
This pull request adds a branch block. Branch blocks work similarly to fences but connect in all 3 directions:
Image show a 3D cross made out of automatically connecting branch blocks.
Image shows a base form of branch block when not connected to any block, compared to solid oak log block.
Tree with detailed branches made out of oak branch block.