Skip to content

feat(flame_3d)!: Introduce RenderContext to make GraphicsDevice focused#3872

Draft
wolfenrain wants to merge 1 commit intomainfrom
feat(flame_3d)/introduce-render-context
Draft

feat(flame_3d)!: Introduce RenderContext to make GraphicsDevice focused#3872
wolfenrain wants to merge 1 commit intomainfrom
feat(flame_3d)/introduce-render-context

Conversation

@wolfenrain
Copy link
Contributor

Description

Introducing a RenderContext3D that abstracts away actual rendering from the GraphicsDevice. This simplifies both binding, rendering and applying shaders in a way that is more sensible for game developers.

We hide away the complexity of the GraphicsDevice while still allowing complexity for those who need it.

Checklist

  • I have followed the Contributor Guide when preparing my PR.
  • I have updated/added tests for ALL new/updated/fixed functionality.
  • I have updated/added relevant documentation in docs and added dartdoc comments with ///.
  • I have updated/added relevant examples in examples or docs.

Breaking Change?

  • Yes, this PR is a breaking change.
  • No, this PR is not a breaking change.

Related Issues

Comment on lines +32 to +38
void setCamera(Matrix4 viewMatrix, Matrix4 projectionMatrix) {
_viewMatrix.setFrom(viewMatrix);
_projectionMatrix.setFrom(projectionMatrix);
_cameraPosition.setFrom(
Matrix4.inverted(viewMatrix).transform3(Vector3.zero()),
);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I was thinking of moving this into CameraComponent3D but then accessing the cameraComponent requires look-ups. That is the current approach that we already have in Flame(2d) so it would align more if we did that, but wanted to know y'all opinion @spydon @luanpotter @erickzanardo @renancaraujo @ufrshubham.

Right now this gets sets when renderFromCamera happens, which is in the World and if it was in the camera we kinda have to do world.context.viewMatrix.setFrom etc in camera which feels low-key disgusting (and would not allow users to build non-component based 3d games)

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.

1 participant