[update] Implemented getting matrix values as a variable.
This commit is contained in:
parent
7f2ada6982
commit
ab889c2e1c
@ -70,8 +70,13 @@ class ScheduledController(
|
||||
case map_name:
|
||||
return mixin("target_."~code);
|
||||
}
|
||||
default: return super.GetVariable(name);
|
||||
default:
|
||||
}
|
||||
static if (MatrixModificationAvailable) {
|
||||
const value = matrix_factory_.GetValueByName(name);
|
||||
if (!value.isNull) return value.get;
|
||||
}
|
||||
return super.GetVariable(name);
|
||||
}
|
||||
override void SetParameter(ref in Parameter param, ref in VarStore vars) {
|
||||
switch (param.name) {
|
||||
|
@ -1,6 +1,8 @@
|
||||
/// License: MIT
|
||||
module sjplayer.util.MatrixFactory;
|
||||
|
||||
import std.typecons;
|
||||
|
||||
import gl4d;
|
||||
|
||||
///
|
||||
@ -17,6 +19,20 @@ struct MatrixFactory {
|
||||
return m;
|
||||
}
|
||||
|
||||
///
|
||||
Nullable!float GetValueByName(string name) const {
|
||||
switch (name) {
|
||||
case "scale_x": return Nullable!float(scale.x);
|
||||
case "scale_y": return Nullable!float(scale.y);
|
||||
case "rotation_x": return Nullable!float(rotation.x);
|
||||
case "rotation_y": return Nullable!float(rotation.y);
|
||||
case "rotation_z": return Nullable!float(rotation.z);
|
||||
case "translation_x": return Nullable!float(translation.x);
|
||||
case "translation_y": return Nullable!float(translation.y);
|
||||
default: return Nullable!float.init;
|
||||
}
|
||||
}
|
||||
|
||||
///
|
||||
vec3 scale = vec3(1, 1, 1);
|
||||
///
|
||||
|
Reference in New Issue
Block a user