[update] Allowed ElementScheduledController not to require Initialize() method.
This commit is contained in:
parent
32a80bf865
commit
0a864950cd
@ -9,13 +9,11 @@ class Background {
|
||||
///
|
||||
this(BackgroundProgram program) {
|
||||
program_ = program;
|
||||
}
|
||||
|
||||
///
|
||||
void Initialize() {
|
||||
inner_color = vec4(0, 0, 0, 0);
|
||||
outer_color = vec4(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
///
|
||||
void Draw() {
|
||||
program_.Draw(inner_color, outer_color);
|
||||
|
@ -22,6 +22,7 @@ alias CircleElementScheduledController = ElementScheduledController!(
|
||||
);
|
||||
static assert(CircleElementScheduledController.AliveManagementAvailable);
|
||||
static assert(CircleElementScheduledController.MatrixModificationAvailable);
|
||||
static assert(CircleElementScheduledController.AutoInitializationAvailable);
|
||||
|
||||
///
|
||||
alias CircleElementScheduledControllerFactory =
|
||||
|
@ -35,6 +35,9 @@ class ElementScheduledController(
|
||||
enum MatrixModificationAvailable =
|
||||
is(typeof((Element e) => e.matrix)) &&
|
||||
is(ReturnType!((Element e) => e.matrix) == mat3);
|
||||
///
|
||||
enum AutoInitializationAvailable =
|
||||
is(typeof((Element e) => e.Initialize()));
|
||||
|
||||
///
|
||||
this(
|
||||
@ -47,7 +50,9 @@ class ElementScheduledController(
|
||||
|
||||
protected:
|
||||
override void PrepareOperation(ref in ParametersBlock params) {
|
||||
static if (AutoInitializationAvailable) {
|
||||
element_.Initialize();
|
||||
}
|
||||
static if (AliveManagementAvailable) {
|
||||
element_.alive = true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user