public void ComboBoxTeam_SelectedIndexChanged(object sender, EventArgs e) { if (ComboBoxTeam.SelectedIndex == -1) { return; } ProgramIsChangingStuff = true; NumericStartX.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericStartY.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericStartZ.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericStartRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(StartPositions[ComboBoxTeam.SelectedIndex].Pitch); ComboStartMode.SelectedIndex = (int)StartPositions[ComboBoxTeam.SelectedIndex].Mode; NumericStartHold.Value = StartPositions[ComboBoxTeam.SelectedIndex].HoldTime; NumericEndX.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericEndY.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericEndZ.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericEndRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(EndPositions[ComboBoxTeam.SelectedIndex].Pitch); NumericBragX.Value = (decimal)BragPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericBragY.Value = (decimal)BragPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericBragZ.Value = (decimal)BragPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericBragRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(BragPositions[ComboBoxTeam.SelectedIndex].Pitch); ProgramIsChangingStuff = false; }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { this.Position = Position; this.Rotation = Rotation; transformMatrix = Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.Translation(Position); positionsList = new List <Vector3>(NumberOfRings); if (Type == RingType.Normal) // single ring { positionsList.Add(Vector3.Zero); } else if (Type == RingType.Line) // line of rings { if (NumberOfRings < 2) { return; } for (int i = 0; i < NumberOfRings; i++) { positionsList.Add(new Vector3(0, 0, TotalLenght * i / (NumberOfRings - 1))); } } else if (Type == RingType.Circle) // circle { if (NumberOfRings < 1) { return; } for (int i = 0; i < NumberOfRings; i++) { positionsList.Add((Vector3)Vector3.Transform(new Vector3(0, 0, -Radius), Matrix.RotationY(2 * (float)Math.PI * i / NumberOfRings))); } } else if (Type == RingType.Arch) // arch { if (NumberOfRings < 2) { return; } float angle = TotalLenght / Radius; for (int i = 0; i < NumberOfRings; i++) { Matrix Locator = Matrix.Translation(new Vector3(Radius, 0, 0)); positionsList.Add((Vector3)Vector3.Transform(Vector3.Zero, Locator * Matrix.RotationY(angle / (NumberOfRings - 1) * i) * Matrix.Invert(Locator))); } } }
public override void Draw(SharpRenderer renderer, string[][] modelNames, int modelMiscSetting, bool isSelected) { base.Draw(renderer, modelNames, modelMiscSetting, isSelected); string flagModelName = "S01_PN_HATA0.DFF"; if (Type < 8 && Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(flagModelName)) { renderData.worldViewProjection = Matrix.Scaling(Scale) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.RotationY(MathUtil.DegreesToRadians(FlagAngle)) * Matrix.Translation(Position) * renderer.viewProjection; renderData.Color = isSelected ? renderer.selectedObjectColor : Vector4.One; renderer.Device.SetFillModeDefault(); renderer.Device.SetCullModeDefault(); renderer.Device.SetBlendStateAlphaBlend(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderer.Device.UpdateData(renderer.tintedBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.tintedBuffer); renderer.tintedShader.Apply(); Program.MainForm.renderer.dffRenderer.DFFModels[flagModelName].Render(renderer.Device); } }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { this.Position = Position; this.Rotation = Rotation; switch (TriggerShape) { case TriggerLightShape.Sphere: sphereBound = new BoundingSphere(Position, Radius); transformMatrix = Matrix.Scaling(Radius * 2); break; case TriggerLightShape.Cube: transformMatrix = Matrix.Scaling(ScaleX * 2, ScaleY * 2, ScaleZ * 2); break; case TriggerLightShape.Cylinder: transformMatrix = Matrix.Scaling(Radius * 2, Height * 2, Radius * 2); break; case TriggerLightShape.NotInUse: base.CreateTransformMatrix(Position, Rotation); return; } transformMatrix = transformMatrix * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.Translation(Position); }
public void CreateTransformMatrix() { if (TriggerShape == 1) //plane { triggerPosWorld = Matrix.Scaling(TriggerScale.X, TriggerScale.Y, 1f); } else if (TriggerShape == 3) // cube { triggerPosWorld = Matrix.Scaling(TriggerScale); } else if (TriggerShape == 4) // cyl { triggerPosWorld = Matrix.Scaling(TriggerScale.X, TriggerScale.Y, TriggerScale.X); } else // sphere { triggerPosWorld = Matrix.Scaling(TriggerScale / 2); } triggerPosWorld = triggerPosWorld * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(TriggerRotX)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(TriggerRotY)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(TriggerRotZ)) * Matrix.Translation(TriggerPosition); pointAWorld = Matrix.Scaling(5) * Matrix.Translation(PointA); pointBWorld = Matrix.Scaling(5) * Matrix.Translation(PointB); pointCWorld = Matrix.Scaling(5) * Matrix.Translation(PointC); camPosWorld = Matrix.Scaling(5) * Matrix.Translation(CamPos); CreateBounding(); }
public override void CreateTransformMatrix() { transformMatrix = Matrix.RotationZ(ReadWriteCommon.BAMStoRadians((int)Rotation.Z)) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians((int)Rotation.X)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians((int)Rotation.Y) + MathUtil.Pi) * Matrix.Translation(Position); CreateBoundingBox(); }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { this.Position = Position; this.Rotation = Rotation; transformMatrix = Matrix.RotationY(ReadWriteCommon.BAMStoRadians((int)Rotation.Y) + MathUtil.Pi) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians((int)Rotation.X)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians((int)Rotation.Z)) * Matrix.Translation(Position); }
private void NumericBrag_ValueChanged(object sender, EventArgs e) { if (!ProgramIsChangingStuff) { BragPositions[ComboBoxTeam.SelectedIndex].PositionX = (float)NumericBragX.Value; BragPositions[ComboBoxTeam.SelectedIndex].PositionY = (float)NumericBragY.Value; BragPositions[ComboBoxTeam.SelectedIndex].PositionZ = (float)NumericBragZ.Value; BragPositions[ComboBoxTeam.SelectedIndex].Pitch = ReadWriteCommon.DegreesToBAMS((float)NumericBragRot.Value); BragPositions[ComboBoxTeam.SelectedIndex].CreateTransformMatrix(); } }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { this.Position = Position; this.Rotation = Rotation; transformMatrix = Matrix.Scaling(ScaleX, ScaleY, ScaleZ) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.Translation(Position); }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { this.Position = Position; this.Rotation = Rotation; sphereBound = new BoundingSphere(Position, Radius); transformMatrix = Matrix.Scaling(Radius * 2) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.Translation(Position); }
public void SetRenderStuff() { if (splineMesh != null) { splineMesh.Dispose(); } splineMesh = SharpMesh.Create(SharpRenderer.device, Points, ReadWriteCommon.Range(Points.Length), new List <SharpSubSet>() { new SharpSubSet(0, Points.Length, null) }, SharpDX.Direct3D.PrimitiveTopology.LineStrip); }
private void ComboBoxTeam_SelectedIndexChanged(object sender, EventArgs e) { ProgramIsChangingStuff = true; groupBoxEnd.Enabled = true; if (CurrentLevelConfig.Mode == ModeType.SinglePlayer) { groupBoxStart.Enabled = true; groupBoxBrag.Enabled = false; NumericStartX.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericStartY.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericStartZ.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericStartRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(StartPositions[ComboBoxTeam.SelectedIndex].Pitch); ComboStartMode.SelectedIndex = (int)StartPositions[ComboBoxTeam.SelectedIndex].Mode; NumericStartHold.Value = StartPositions[ComboBoxTeam.SelectedIndex].HoldTime; NumericEndX.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericEndY.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericEndZ.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericEndRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(EndPositions[ComboBoxTeam.SelectedIndex].Pitch); } else if (CurrentLevelConfig.Mode == ModeType.MultiPlayer) { if (ComboBoxTeam.SelectedIndex <= 1) { groupBoxStart.Enabled = true; NumericStartX.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericStartY.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericStartZ.Value = (decimal)StartPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericStartRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(StartPositions[ComboBoxTeam.SelectedIndex].Pitch); ComboStartMode.SelectedIndex = (int)StartPositions[ComboBoxTeam.SelectedIndex].Mode; NumericStartHold.Value = StartPositions[ComboBoxTeam.SelectedIndex].HoldTime; } else { groupBoxStart.Enabled = false; } NumericEndX.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericEndY.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericEndZ.Value = (decimal)EndPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericEndRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(EndPositions[ComboBoxTeam.SelectedIndex].Pitch); groupBoxBrag.Enabled = true; NumericBragX.Value = (decimal)BragPositions[ComboBoxTeam.SelectedIndex].PositionX; NumericBragY.Value = (decimal)BragPositions[ComboBoxTeam.SelectedIndex].PositionY; NumericBragZ.Value = (decimal)BragPositions[ComboBoxTeam.SelectedIndex].PositionZ; NumericBragRot.Value = (decimal)ReadWriteCommon.BAMStoDegrees(BragPositions[ComboBoxTeam.SelectedIndex].Pitch); } ProgramIsChangingStuff = false; }
private void NumericEnd_ValueChanged(object sender, EventArgs e) { if (ProgramIsChangingStuff) { return; } if (ComboBoxTeam.SelectedItem == null) { return ; } EndPositions[ComboBoxTeam.SelectedIndex].PositionX = (float)NumericEndX.Value; EndPositions[ComboBoxTeam.SelectedIndex].PositionY = (float)NumericEndY.Value; EndPositions[ComboBoxTeam.SelectedIndex].PositionZ = (float)NumericEndZ.Value; EndPositions[ComboBoxTeam.SelectedIndex].Pitch = ReadWriteCommon.DegreesToBAMS((float)NumericEndRot.Value); EndPositions[ComboBoxTeam.SelectedIndex].CreateTransformMatrix(); }
private void listBoxPoints_SelectedIndexChanged(object sender, EventArgs e) { if (listBoxPoints.SelectedIndex == -1) { groupBoxPitchRoll.Enabled = false; } else { groupBoxPitchRoll.Enabled = true; ProgramIsChangingStuff = true; numericUpDownPitch.Value = (decimal)ReadWriteCommon.BAMStoDegrees(splineEditorFunctions.GetSelected().Points[listBoxPoints.SelectedIndex].Pitch); numericUpDownRoll.Value = (decimal)ReadWriteCommon.BAMStoDegrees(splineEditorFunctions.GetSelected().Points[listBoxPoints.SelectedIndex].Roll); ProgramIsChangingStuff = false; } }
private void numericUpDown_ValueChanged(object sender, EventArgs e) { if (!ProgramIsChangingStuff & CurrentlySelectedCamera != -1) { CameraHeroes current = ListBoxCameras.Items[CurrentlySelectedCamera] as CameraHeroes; current.CameraType = (int)numericUpDownCamType.Value; current.CameraSpeed = (int)numericUpDownCamSpeed.Value; current.Integer3 = (int)numericUpDown3.Value; current.ActivationType = (int)numericUpDownActType.Value; current.TriggerShape = (int)numericUpDownTrigShape.Value; current.TriggerPosition = new Vector3((float)numericUpDownColPosX.Value, (float)numericUpDownColPosY.Value, (float)numericUpDownColPosZ.Value); current.TriggerRotX = ReadWriteCommon.DegreesToBAMS((float)numericUpDownColRotX.Value); current.TriggerRotY = ReadWriteCommon.DegreesToBAMS((float)numericUpDownColRotY.Value); current.TriggerRotZ = ReadWriteCommon.DegreesToBAMS((float)numericUpDownColRotZ.Value); current.TriggerScale = new Vector3((float)numericUpDownColSclX.Value, (float)numericUpDownColSclY.Value, (float)numericUpDownColSclZ.Value); current.CamPos = new Vector3((float)numericUpDownCamPosX.Value, (float)numericUpDownCamPosY.Value, (float)numericUpDownCamPosZ.Value); current.CamRotX = ReadWriteCommon.DegreesToBAMS((float)numericUpDownCamRotX.Value); current.CamRotY = ReadWriteCommon.DegreesToBAMS((float)numericUpDownCamRotY.Value); current.CamRotZ = ReadWriteCommon.DegreesToBAMS((float)numericUpDownCamRotZ.Value); current.PointA = new Vector3((float)numericUpDown21.Value, (float)numericUpDown22.Value, (float)numericUpDown23.Value); current.PointB = new Vector3((float)numericUpDown24.Value, (float)numericUpDown25.Value, (float)numericUpDown26.Value); current.PointC = new Vector3((float)numericUpDown27.Value, (float)numericUpDown28.Value, (float)numericUpDown29.Value); current.Integer30 = (int)numericUpDown30.Value; current.Integer31 = (int)numericUpDown31.Value; current.FloatX32 = (float)numericUpDown32.Value; current.FloatY33 = (float)numericUpDown33.Value; current.FloatX34 = (float)numericUpDown34.Value; current.FloatY35 = (float)numericUpDown35.Value; current.Integer36 = (int)numericUpDown36.Value; current.Integer37 = (int)numericUpDown37.Value; current.Integer38 = (int)numericUpDown38.Value; current.Integer39 = (int)numericUpDown39.Value; current.CreateTransformMatrix(); ListBoxCameras.Items[CurrentlySelectedCamera] = current; } }
public override void Draw(SharpRenderer renderer) { base.Draw(renderer); string flagModelName = "S01_PN_HATA0.DFF"; if (FlagType < 8 && renderer.dffRenderer.DFFModels.ContainsKey(flagModelName)) { SetRendererStates(renderer); renderData.worldViewProjection = Matrix.Scaling(Scale) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.RotationY(MathUtil.DegreesToRadians(FlagAngle)) * Matrix.Translation(Position) * renderer.viewProjection; renderer.Device.UpdateData(renderer.tintedBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.tintedBuffer); renderer.dffRenderer.DFFModels[flagModelName].Render(renderer.Device); } }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { Vector3 box = Program.MainForm.ParticleEditor.GetBoxForSetParticle(Number - 50); if (box != Vector3.Zero) { this.Position = Position; this.Rotation = Rotation; box.X = Math.Max(1f, box.X); box.Y = Math.Max(1f, box.Y); box.Z = Math.Max(1f, box.Z); transformMatrix = Matrix.Scaling(box * 2) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians((int)Rotation.X)) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians((int)Rotation.Y)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians((int)Rotation.Z)) * Matrix.Translation(Position); } else { base.CreateTransformMatrix(Position, Rotation); } }
public Matrix DefaultTransformMatrix(float yAdd = 0) => Matrix.RotationY(ReadWriteCommon.BAMStoRadians((int)Rotation.Y) + yAdd) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians((int)Rotation.X)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians((int)Rotation.Z)) * Matrix.Translation(Position);
public void NewMatrix(Vector3 Position, int Rotation) { world = Matrix.Scaling(20f, 20f, 30f) * Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation)) * Matrix.Translation(Position); }
private void numericUpDown_ValueChanged(object sender, EventArgs e) { if (!ProgramIsChangingStuff && listBoxPoints.SelectedIndex != -1) { splineEditorFunctions.GetSelected().Points[listBoxPoints.SelectedIndex].Pitch = (ushort)ReadWriteCommon.DegreesToBAMS((float)numericUpDownPitch.Value); splineEditorFunctions.GetSelected().Points[listBoxPoints.SelectedIndex].Roll = (ushort)ReadWriteCommon.DegreesToBAMS((float)numericUpDownRoll.Value); } }
public override void CreateTransformMatrix(Vector3 Position, Vector3 Rotation) { this.Position = Position; this.Rotation = Rotation; transformMatrix = Matrix.RotationY(ReadWriteCommon.BAMStoRadians(Rotation.Y)) * Matrix.RotationX(ReadWriteCommon.BAMStoRadians(Rotation.X)) * Matrix.RotationZ(ReadWriteCommon.BAMStoRadians(Rotation.Z)) * Matrix.Translation(Position); positionsList = new List <Matrix>(NumberOfRings); switch (Type) // single ring { case RingType.Normal: positionsList.Add(Matrix.Identity); break; case RingType.Line: // line of rings if (NumberOfRings < 2) { return; } for (int i = 0; i < NumberOfRings; i++) { positionsList.Add(Matrix.Translation(0, 0, TotalLenght * i / (NumberOfRings - 1))); } break; case RingType.Circle: // circle if (NumberOfRings < 1) { return; } for (int i = 0; i < NumberOfRings; i++) { //positionsList.Add(Matrix.Translation((Vector3)Vector3.Transform(new Vector3(0, 0, -Radius), Matrix.RotationY(2 * (float)Math.PI * i / NumberOfRings)))); positionsList.Add(Matrix.Translation(0, 0, -Radius) * Matrix.RotationY(2 * (float)Math.PI * i / NumberOfRings)); } break; case RingType.Arch: // arch if (NumberOfRings < 2) { return; } float angle = TotalLenght / Radius; for (int i = 0; i < NumberOfRings; i++) { Matrix Locator = Matrix.Translation(new Vector3(Radius, 0, 0)); //positionsList.Add((Vector3)Vector3.Transform(Vector3.Zero, Locator // * Matrix.RotationY(angle / (NumberOfRings - 1) * i) // * Matrix.Invert(Locator))); positionsList.Add(Locator * Matrix.RotationY(angle / (NumberOfRings - 1) * i) * Matrix.Invert(Locator)); } break; } }