public TransformController(RenderContext context, TexturedBufferHitChecker hitChecker) { _hitChecker = hitChecker; _type = TransformType.All; TransformRotationSensibility = 1.0f; TransformScalingSensibility = 1.0f; TransformTranslationSensibility = 1.0f; Transformer = new BasicTransformer(); //回転コントロール xRotater = new RotateRingController(context, this, new Vector4(1, 0, 0, 0.7f), new Vector4(1, 1, 0, 0.7f), new SilinderShape.SilinderShapeDescription(0.02f, 30)); yRotater = new RotateRingController(context, this, new Vector4(0, 1, 0, 0.7f), new Vector4(1, 1, 0, 0.7f), new SilinderShape.SilinderShapeDescription(0.02f, 30)); zRotater = new RotateRingController(context, this, new Vector4(0, 0, 1, 0.7f), new Vector4(1, 1, 0, 0.7f), new SilinderShape.SilinderShapeDescription(0.02f, 30)); cross = new CenterCrossLine(context); xRotater.Transformer.Rotation *= Quaternion.RotationAxis(Vector3.UnitZ, (float)(Math.PI / 2)); zRotater.Transformer.Rotation *= Quaternion.RotationAxis(-Vector3.UnitX, -(float)(Math.PI / 2)); xRotater.Transformer.Scale = yRotater.Transformer.Scale = zRotater.Transformer.Scale = new Vector3(1f, 0.1f, 1f) * 20; xRotater.Transformer.Scale *= 0.998f; zRotater.Transformer.Scale *= 0.990f; xRotater.Initialize(); yRotater.Initialize(); zRotater.Initialize(); xRotater.OnRotated += RotationChanged; yRotater.OnRotated += RotationChanged; zRotater.OnRotated += RotationChanged; controllers.Add(xRotater); controllers.Add(yRotater); controllers.Add(zRotater); //平衡移動コントロール xTranslater = new TranslaterConeController(context, this, new Vector4(1, 0, 0, 0.7f), new Vector4(1, 1, 0, 0.7f)); yTranslater = new TranslaterConeController(context, this, new Vector4(0, 1, 0, 0.7f), new Vector4(1, 1, 0, 0.7f)); zTranslater = new TranslaterConeController(context, this, new Vector4(0, 0, 1, 0.7f), new Vector4(1, 1, 0, 0.7f)); xTranslater.Initialize(); yTranslater.Initialize(); zTranslater.Initialize(); xTranslater.Transformer.Scale = yTranslater.Transformer.Scale = zTranslater.Transformer.Scale = new Vector3(2f); xTranslater.Transformer.Rotation *= Quaternion.RotationAxis(Vector3.UnitZ, (float)(Math.PI / 2)); zTranslater.Transformer.Rotation *= Quaternion.RotationAxis(-Vector3.UnitX, -(float)(Math.PI / 2)); MoveTranslater(xTranslater); MoveTranslater(yTranslater); MoveTranslater(zTranslater); xTranslater.OnTranslated += OnTranslated; yTranslater.OnTranslated += OnTranslated; zTranslater.OnTranslated += OnTranslated; controllers.Add(xTranslater); controllers.Add(yTranslater); controllers.Add(zTranslater); scaler = new ScalingCubeController(context, this, new Vector4(0, 1, 1, 0.7f), new Vector4(1, 1, 0, 1)); scaler.Initialize(); scaler.Transformer.Scale = new Vector3(3); scaler.OnScalingChanged += OnScaling; controllers.Add(scaler); hitChecker.CheckTargets.AddRange(controllers); Visibility = true; }
public TransformController(RenderContext context, TexturedBufferHitChecker hitChecker) { this._hitChecker = hitChecker; this._type = TransformType.All; this.TransformRotationSensibility = 1.0f; this.TransformScalingSensibility = 1.0f; this.TransformTranslationSensibility = 1.0f; this.Transformer = new BasicTransformer(); //Rotation control this.xRotater = new RotateRingController(context, this, new Vector4(1, 0, 0, 0.7f), new Vector4(1, 1, 0, 0.7f), new SilinderShape.SilinderShapeDescription(0.02f, 30)); this.yRotater = new RotateRingController(context, this, new Vector4(0, 1, 0, 0.7f), new Vector4(1, 1, 0, 0.7f), new SilinderShape.SilinderShapeDescription(0.02f, 30)); this.zRotater = new RotateRingController(context, this, new Vector4(0, 0, 1, 0.7f), new Vector4(1, 1, 0, 0.7f), new SilinderShape.SilinderShapeDescription(0.02f, 30)); this.cross = new CenterCrossLine(context); this.xRotater.Transformer.Rotation *= Quaternion.RotationAxis(Vector3.UnitZ, (float)(Math.PI / 2)); this.zRotater.Transformer.Rotation *= Quaternion.RotationAxis(-Vector3.UnitX, -(float)(Math.PI / 2)); this.xRotater.Transformer.Scale = this.yRotater.Transformer.Scale = this.zRotater.Transformer.Scale = new Vector3(1f, 0.1f, 1f) * 20; this.xRotater.Transformer.Scale *= 0.998f; this.zRotater.Transformer.Scale *= 0.990f; this.xRotater.Initialize(); this.yRotater.Initialize(); this.zRotater.Initialize(); this.xRotater.OnRotated += RotationChanged; this.yRotater.OnRotated += RotationChanged; this.zRotater.OnRotated += RotationChanged; this.controllers.Add(this.xRotater); this.controllers.Add(this.yRotater); this.controllers.Add(this.zRotater); //Balance transfer control this.xTranslater = new TranslaterConeController(context, this, new Vector4(1, 0, 0, 0.3f), new Vector4(1, 1, 0, 0.7f)); this.yTranslater = new TranslaterConeController(context, this, new Vector4(0, 1, 0, 0.3f), new Vector4(1, 1, 0, 0.7f)); this.zTranslater = new TranslaterConeController(context, this, new Vector4(0, 0, 1, 0.3f), new Vector4(1, 1, 0, 0.7f)); this.xTranslater.Initialize(); this.yTranslater.Initialize(); this.zTranslater.Initialize(); this.xTranslater.Transformer.Scale = this.yTranslater.Transformer.Scale = this.zTranslater.Transformer.Scale = new Vector3(2f); this.xTranslater.Transformer.Rotation *= Quaternion.RotationAxis(Vector3.UnitZ, (float)(Math.PI / 2)); this.zTranslater.Transformer.Rotation *= Quaternion.RotationAxis(-Vector3.UnitX, -(float)(Math.PI / 2)); MoveTranslater(this.xTranslater); MoveTranslater(this.yTranslater); MoveTranslater(this.zTranslater); this.xTranslater.OnTranslated += OnTranslated; this.yTranslater.OnTranslated += OnTranslated; this.zTranslater.OnTranslated += OnTranslated; this.controllers.Add(this.xTranslater); this.controllers.Add(this.yTranslater); this.controllers.Add(this.zTranslater); this.scaler = new ScalingCubeController(context, this, new Vector4(0, 1, 1, 0.7f), new Vector4(1, 1, 0, 1)); this.scaler.Initialize(); this.scaler.Transformer.Scale = new Vector3(3); this.scaler.OnScalingChanged += OnScaling; this.controllers.Add(this.scaler); hitChecker.CheckTargets.AddRange(this.controllers); this.Visibility = true; }