-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Rendering logic must be factored into its own class #524
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
Comments
Thanks for opening this. I'm overdue for working on this. Here's my proposal. I think that each class should preferably do one thing only.
So, the dataflow would look like this:
Note: this refactor of Note: in the case of a GL backend, I think that This is what @eulertour and I discussed some weeks ago. Final note: if left to my own devices, I would honestly make |
I'm currently working on this refactor. The idea is like this Then we can swap the CairoRenderer for a ThreeJsRenderer, ModernGLRenderer, LivestreamRenderer as desired. Some things I wanted to say about @leotrs response:
When using OpenGL, the GL context would be the renderer, so there wouldn't be a substantial difference in the above diagram. |
That's what I meant :)
I misunderstood you in the past, I thought OpenGL could do that on its own.
Agreed! |
@eulertour This seems awesome, Personnaly, I think it could be useful if we had more than one feature that touches SceneFileWriter, but if we have only LiveStream .. It could be overkill. But still good to have nevertheless. |
The renderer controls the way the video is outputted as well. But if streaming with Cairo uses the same rendering logic as normal use there's no need to make a class for that. |
We already have a renderer class. As I see no clear To Do item here other than that, I'm closing this. Please reopen if I missed anything. |
So we have been discussing about refactoring SceneFileWriter into some subclasses, such as a Renderer class and an abstract SceneFIleWriter class.
But this is still well, abstract.
Doing this would clean up the code of sceneFileWriter, which is very messy, and will make a lot easier the implementation of new feratures that change the way that the videos are rendered, such as LiveStreaming (or even ModernGL, who knows ^^). Some basic stuff would be subclassed, such as open_movie_pipe, etc.
First of all, we have to discuss before any concrete consideration, on what do we want each class to do.
Now, the process is that scene update the frame, which call Camera that capture the mobjects on camera. Afterward, scene call (again..) SceneFileWriter and ask it to write the frame. (No interaction is made between Camera and SceneFileWriter which is .. weird).
What we could do is : Scene process the mobjects (i.e sorting them, etc blahblah) and only calls Renderer to update the frame. Then, Renderer will see what needs to be done depending on some parameters (eg, skip_animation, caching) and then will ONLY call for camera to capture mobjects. Camera will then return the frame, and then Renderer will call the instance of SceneFileWriter that will write to the actual output stream.
So, scene does not have any direct interaction with SceneFileWriter, only with Renderer.
We would also create a new directory to sort this stuff apart from
manim/scene
.The text was updated successfully, but these errors were encountered: