[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) {
|
this(BackgroundProgram program) {
|
||||||
program_ = program;
|
program_ = program;
|
||||||
}
|
|
||||||
|
|
||||||
///
|
|
||||||
void Initialize() {
|
|
||||||
inner_color = vec4(0, 0, 0, 0);
|
inner_color = vec4(0, 0, 0, 0);
|
||||||
outer_color = vec4(0, 0, 0, 0);
|
outer_color = vec4(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
///
|
///
|
||||||
void Draw() {
|
void Draw() {
|
||||||
program_.Draw(inner_color, outer_color);
|
program_.Draw(inner_color, outer_color);
|
||||||
|
@ -22,6 +22,7 @@ alias CircleElementScheduledController = ElementScheduledController!(
|
|||||||
);
|
);
|
||||||
static assert(CircleElementScheduledController.AliveManagementAvailable);
|
static assert(CircleElementScheduledController.AliveManagementAvailable);
|
||||||
static assert(CircleElementScheduledController.MatrixModificationAvailable);
|
static assert(CircleElementScheduledController.MatrixModificationAvailable);
|
||||||
|
static assert(CircleElementScheduledController.AutoInitializationAvailable);
|
||||||
|
|
||||||
///
|
///
|
||||||
alias CircleElementScheduledControllerFactory =
|
alias CircleElementScheduledControllerFactory =
|
||||||
|
@ -35,6 +35,9 @@ class ElementScheduledController(
|
|||||||
enum MatrixModificationAvailable =
|
enum MatrixModificationAvailable =
|
||||||
is(typeof((Element e) => e.matrix)) &&
|
is(typeof((Element e) => e.matrix)) &&
|
||||||
is(ReturnType!((Element e) => e.matrix) == mat3);
|
is(ReturnType!((Element e) => e.matrix) == mat3);
|
||||||
|
///
|
||||||
|
enum AutoInitializationAvailable =
|
||||||
|
is(typeof((Element e) => e.Initialize()));
|
||||||
|
|
||||||
///
|
///
|
||||||
this(
|
this(
|
||||||
@ -47,7 +50,9 @@ class ElementScheduledController(
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
override void PrepareOperation(ref in ParametersBlock params) {
|
override void PrepareOperation(ref in ParametersBlock params) {
|
||||||
element_.Initialize();
|
static if (AutoInitializationAvailable) {
|
||||||
|
element_.Initialize();
|
||||||
|
}
|
||||||
static if (AliveManagementAvailable) {
|
static if (AliveManagementAvailable) {
|
||||||
element_.alive = true;
|
element_.alive = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user