10 namespace droid.Runtime.Prototyping.Configurables.Experimental {
14 [AddComponentMenu(ConfigurableComponentMenuPath._ComponentMenuPath
16 + ConfigurableComponentMenuPath._Postfix)]
17 [RequireComponent(typeof(Camera))]
32 string _sensor_width_str;
36 string _sensor_height_str;
40 string _lens_shift_y_str;
44 string _lens_shift_x_str;
48 [SerializeField] Camera _camera;
50 [SerializeField]
Space1 _fov_space =
new Space1 {_Min_Value = 60f, _Max_Value = 90f};
51 [SerializeField]
Space1 _focal_space =
new Space1 {_Min_Value = 2f, _Max_Value = 3f};
54 Space2 _sensor_size_space =
55 new Space2(2) {_Min_Values =
new Vector2(2.5f, 2.5f), _Max_Values =
new Vector2(5, 5)};
59 new Space2(3) {_Min_Values =
new Vector2(-0.1f, -0.1f), _Max_Values =
new Vector2(0.1f, 0.1f)};
61 [SerializeField]
Space1 _gate_fit_space =
new Space1(0) {_Min_Value = 0f, _Max_Value = 4f};
67 this._fov_str = this.Identifier +
"Fov";
68 this._focal_str = this.Identifier +
"Focal";
69 this._sensor_width_str = this.Identifier +
"SensorWidth";
70 this._sensor_height_str = this.Identifier +
"SensorHeight";
71 this._lens_shift_x_str = this.Identifier +
"LensShiftX";
72 this._lens_shift_y_str = this.Identifier +
"LensShiftY";
73 this._gate_fit_str = this.Identifier +
"GateFit";
75 this._camera = this.GetComponent<Camera>();
79 this._syncer = this.GetComponent<SynchroniseCameraProperties>();
87 if (!this._camera.usePhysicalProperties) {
88 this.ParentEnvironment =
89 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._fov_str);
91 this.ParentEnvironment =
92 NeodroidUtilities.RegisterComponent(this.ParentEnvironment, (
Configurable)
this, this._focal_str);
93 this.ParentEnvironment =
94 NeodroidUtilities.RegisterComponent(this.ParentEnvironment,
96 this._sensor_width_str);
97 this.ParentEnvironment =
98 NeodroidUtilities.RegisterComponent(this.ParentEnvironment,
100 this._sensor_height_str);
101 this.ParentEnvironment =
102 NeodroidUtilities.RegisterComponent(this.ParentEnvironment,
104 this._lens_shift_x_str);
105 this.ParentEnvironment =
106 NeodroidUtilities.RegisterComponent(this.ParentEnvironment,
108 this._lens_shift_y_str);
109 this.ParentEnvironment =
110 NeodroidUtilities.RegisterComponent(this.ParentEnvironment,
120 if (!this._camera.usePhysicalProperties) {
121 this.ParentEnvironment?.UnRegister(
this, this._fov_str);
123 this.ParentEnvironment?.UnRegister(
this, this._focal_str);
124 this.ParentEnvironment?.UnRegister(
this, this._sensor_width_str);
125 this.ParentEnvironment?.UnRegister(
this, this._sensor_height_str);
126 this.ParentEnvironment?.UnRegister(
this, this._lens_shift_x_str);
127 this.ParentEnvironment?.UnRegister(
this, this._lens_shift_y_str);
128 this.ParentEnvironment?.UnRegister(
this, this._gate_fit_str);
132 public override ISpace ConfigurableValueSpace {
get; }
139 if (this.Debugging) {
140 DebugPrinting.ApplyPrint(this.Debugging, configuration, this.Identifier);
149 var a = this._camera.sensorSize;
151 this._camera.sensorSize = a;
153 var a = this._camera.sensorSize;
155 this._camera.sensorSize = a;
157 var a = this._camera.lensShift;
159 this._camera.lensShift = a;
161 var a = this._camera.lensShift;
163 this._camera.lensShift = a;
166 out Camera.GateFitMode gate_fit_mode);
167 this._camera.gateFit = gate_fit_mode;
181 if (!this._camera.usePhysicalProperties) {
185 var r =
Random.Range(0, 6);
190 return new[] {
new Configuration(this._sensor_width_str, this._sensor_size_space.
Sample().x)};
193 return new[] {
new Configuration(this._sensor_height_str, this._sensor_size_space.
Sample().y)};
196 return new[] {
new Configuration(this._lens_shift_x_str, this._lens_shift_space.
Sample().x)};
199 return new[] {
new Configuration(this._lens_shift_y_str, this._lens_shift_space.
Sample().y)};
204 throw new IndexOutOfRangeException();
override void RegisterComponent()
override void UnRegisterComponent()
override Configuration [] SampleConfigurations()
override void ApplyConfiguration(IConfigurableConfiguration configuration)