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

fix(engine/rendering): Fix ChunkMeshRenderer listens to wrong deactivate event #4932

Merged

Conversation

opl-
Copy link
Contributor

@opl- opl- commented Oct 25, 2021

Contains

Fixes ChunkMeshRenderer reacting to removals of MeshComponent instead of ChunkMeshComponent.

@DarkWeird DarkWeird added Topic: Rendering Requests, Issues and Changes related to lighting, meshes, camera, etc. Type: Bug Issues reporting and PRs fixing problems labels Oct 25, 2021
@pollend
Copy link
Member

pollend commented Oct 25, 2021

looks straightforward.

@@ -51,7 +51,7 @@ public void onNewMesh(OnActivatedComponent event, EntityRef entity, ChunkMeshCom
disposalSet.add(new BuffersReference(mesh.mesh, disposalQueue));
}

@ReceiveEvent(components = {MeshComponent.class, LocationComponent.class})
@ReceiveEvent(components = {ChunkMeshComponent.class, LocationComponent.class})
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
@ReceiveEvent(components = {ChunkMeshComponent.class, LocationComponent.class})
@ReceiveEvent(components = {ChunkMeshComponent.class})

I think this is better @skaldarnar

Copy link
Contributor Author

Choose a reason for hiding this comment

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

EntityBasedRenderableChunk depends on the existence of a LocationComponent, meaning psudoChunks will never contain an entity which doesn't have a LocationComponent, and that removing it from here would result in reacting to events which don't affect our state.

Copy link
Member

Choose a reason for hiding this comment

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

BeforeDeactivateComponent is called when a component is removed from an entity. you would get this hit if either LocationComponent or ChunkMeshComponent is removed. I guess in either case this would be valid behavior? would help to have some unit test verify the behavior. the fix is good as it is at the moment.

@pollend pollend merged commit 977860a into MovingBlocks:develop Nov 7, 2021
@pollend pollend added this to the v5.2.0 milestone Nov 7, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Topic: Rendering Requests, Issues and Changes related to lighting, meshes, camera, etc. Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants