I'm working for graphic rendering part of my program, and got into several severe problems with my previous design.
So, I want to ask how to design structures of renderers and models. Or is there specific design pattern to handle this case?
Currently I have hierarchical implementations of
- Renderers (Graphics)
- Models (Data to Render, Receive Updates)
I accepted hierarchy since rendered contents can be classified, and should be managed separately.
There are several limiting conditions:
- Rendering is done on rendering loop.
- There could be many types of renderers and models, and the design should not be aware of them.
- There could be various reasons to update models.
- Update reasons should not be specified in the design itself, since various reasons can be added.
- Models are aware of possible update reasons for itself.
- Renderers have Render Passes and Render Helpers.
- Types of Render Passes are dependent to the Classes(groups) of renderers.
- Render Helpers should be provided, and each renderer should be able to use different version of it.
EDIT: Source to explain current situation.
Renderer:
public interface IRenderer<Settings, Pass, Model, Helper> {
public void initialize(Settings settings);
public void preRender(Settings settings, Helper info);
public void renderPass(Model model, Pass pass, Helper info);
public void postRender(Settings settings, Helper info);
}
Model:
public interface IModel<Settings, UpdateInfo> {
public void initialize(Settings settings);
public void update(Settings settings, UpdateInfo update);
}
Aucun commentaire:
Enregistrer un commentaire