internal void RenderSplines(SharpRenderer sharpRenderer) { if (SplineEditor != null) { SplineEditor.RenderSplines(sharpRenderer); } }
public void RenderCollisionModel(SharpRenderer renderer) { if (collisionMesh == null) { return; } sceneInformation = new CollisionRenderData() { viewProjection = renderer.viewProjection, ambientColor = new Vector4(0.1f, 0.1f, 0.3f, 1f), lightDirection = new Vector4(-renderer.Camera.GetForward(), 1f), lightDirection2 = new Vector4(renderer.Camera.GetUp(), 1f) }; renderer.Device.SetDefaultBlendState(); renderer.Device.SetCullModeDefault(); renderer.Device.SetFillModeDefault(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderer.Device.UpdateData(renderer.collisionBuffer, sceneInformation); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.collisionBuffer); renderer.collisionShader.Apply(); collisionMesh.Draw(renderer.Device); }
public MainForm() { StartPosition = FormStartPosition.CenterScreen; InitializeComponent(); renderer = new SharpRenderer(renderPanel) { dffRenderer = new DFFRenderer(this) }; showObjectsGToolStripMenuItem.CheckState = CheckState.Indeterminate; AboutBox = new AboutBox(); ViewConfig = new ViewConfig(renderer.Camera); ConfigEditor = new ConfigEditor.ConfigEditor(); LevelEditor = new LevelEditor.LevelEditor(); CollisionEditorDict = new Dictionary <ToolStripDropDownItem, CollisionEditor.CollisionEditor>(); LayoutEditorDict = new Dictionary <ToolStripDropDownItem, LayoutEditor.LayoutEditor>(); CameraEditor = new CameraEditor.CameraEditor(); ParticleEditor = new ParticleEditor.ParticleMenu(); TexturePatternEditor = new TexturePatternEditor.TexturePatternEditor(); LightEditor = new LightEditor.LightMenu(); SetIdTableEditor = new SetIdTableEditor.SetIdTableEditor(); }
public void OpenONEHeroesFile(string fileName, SharpRenderer renderer) { SetHeroesMode(); openONEfilePath = fileName; SetFilenamePrefix(openONEfilePath); byte[] fileBytes = File.ReadAllBytes(openONEfilePath); bspRenderer.SetHeroesBSPList(renderer.Device, Archive.FromONEFile(ref fileBytes)); InitBSPList(); string SupposedBLK = Path.GetDirectoryName(openONEfilePath) + "\\" + bspRenderer.currentFileNamePrefix + "_blk.bin"; if (File.Exists(SupposedBLK)) { initVisibilityEditor(false, SupposedBLK); } foreach (string s in TextureManager.OpenTXDfiles) { if (Path.GetFileNameWithoutExtension(s).ToLower() == bspRenderer.currentFileNamePrefix.ToLower()) { return; } } string SupposedTXD = Path.GetDirectoryName(openONEfilePath) + "\\textures\\" + bspRenderer.currentFileNamePrefix + ".txd"; if (File.Exists(SupposedTXD)) { TextureManager.LoadTexturesFromTXD(SupposedTXD, renderer, bspRenderer); } }
public Spline(SplineVertex[] vertices, SplineType splineType, SharpRenderer renderer) { Points = vertices; Type = splineType; SetRenderStuff(renderer); }
protected void DrawCube(SharpRenderer renderer, bool isSelected) { renderData.worldViewProjection = Matrix.Scaling(5) * transformMatrix * renderer.viewProjection; if (isSelected) { renderData.Color = renderer.selectedColor; } else { renderData.Color = renderer.normalColor; } renderer.Device.SetFillModeDefault(); renderer.Device.SetCullModeNone(); renderer.Device.SetBlendStateAlphaBlend(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderer.Device.UpdateData(renderer.basicBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.basicBuffer); renderer.basicShader.Apply(); renderer.Cube.Draw(renderer.Device); }
public void Draw(SharpRenderer renderer, bool drawEveryObject) { if (drawEveryObject || !DontDraw(renderer.Camera.GetPosition())) { Draw(renderer); } }
public void RenderSplines(SharpRenderer renderer) { foreach (Spline s in SplineList) { s.Render(renderer); } }
public void Render(SharpRenderer renderer) { renderData.worldViewProjection = chunkTransform * renderer.viewProjection; if (isSelected) { renderData.Color = selectedChunkColor; } else { renderData.Color = chunkColor; } renderer.Device.SetFillModeDefault(); renderer.Device.SetCullModeNone(); renderer.Device.SetBlendStateAlphaBlend(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderer.Device.UpdateData(renderer.basicBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.basicBuffer); renderer.Cube.Draw(renderer.Device); renderer.Device.SetFillModeWireframe(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderData.Color = Vector4.One; renderer.Device.UpdateData(renderer.basicBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.basicBuffer); renderer.Cube.Draw(renderer.Device); }
public override void Draw(SharpRenderer renderer, bool drawEveryObject) { if (drawEveryObject || !DontDraw(renderer.Camera.GetPosition())) { objectManager.Draw(renderer, ModelNames, ModelMiscSetting, isSelected); } }
public void Draw(SharpRenderer renderer) { if (Vector3.Distance(renderer.Camera.GetPosition(), TriggerPosition) <= 15000f) { if (TriggerShape == 1) //plane { renderer.DrawCubeTrigger(triggerPosWorld, isSelected); } else if (TriggerShape == 3) // cube { renderer.DrawCubeTrigger(triggerPosWorld, isSelected); } else if (TriggerShape == 4) // cyl { renderer.DrawCylinderTrigger(triggerPosWorld, isSelected); } else // sphere { renderer.DrawSphereTrigger(triggerPosWorld, isSelected); } } if (isSelected) { DrawCube(renderer, pointAWorld, Color.Red.ToVector4()); DrawCube(renderer, pointBWorld, Color.Blue.ToVector4()); DrawCube(renderer, pointCWorld, Color.Green.ToVector4()); DrawCube(renderer, camPosWorld, Color.Pink.ToVector4()); } }
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 Draw(SharpRenderer renderer, string[][] modelNames, int modelMiscSetting, bool isSelected) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(modelNames[0][0])) { if (isSelected) { renderData.Color = renderer.selectedObjectColor; } else { renderData.Color = Vector4.One; } renderer.Device.SetCullModeDefault(); renderer.Device.SetDefaultBlendState(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); renderer.tintedShader.Apply(); foreach (Matrix i in positionsList) { renderData.worldViewProjection = i * transformMatrix * renderer.viewProjection; renderer.Device.UpdateData(renderer.tintedBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.tintedBuffer); Program.MainForm.renderer.dffRenderer.DFFModels[modelNames[0][0]].Render(renderer.Device); } } else { if (isSelected) { renderData.Color = renderer.selectedColor; } else { renderData.Color = renderer.normalColor; } renderer.Device.SetFillModeDefault(); renderer.Device.SetCullModeNone(); renderer.Device.SetBlendStateAlphaBlend(); renderer.Device.ApplyRasterState(); renderer.Device.UpdateAllStates(); foreach (Matrix i in positionsList) { renderData.worldViewProjection = Matrix.Scaling(4) * i * transformMatrix * renderer.viewProjection; renderer.Device.UpdateData(renderer.basicBuffer, renderData); renderer.Device.DeviceContext.VertexShader.SetConstantBuffer(0, renderer.basicBuffer); renderer.basicShader.Apply(); renderer.Cube.Draw(renderer.Device); } } }
public void RenderChunkModels(SharpRenderer renderer) { renderer.basicShader.Apply(); for (int j = 0; j < ChunkList.Count; j++) { ChunkList[j].Render(renderer); } }
public override void Draw(SharpRenderer renderer) { base.Draw(renderer); if (isSelected) { renderer.DrawSphereTrigger(destinationMatrix, isSelected); } }
public override void Draw(SharpRenderer renderer, string[][] modelNames, int miscSettingByte, bool isSelected) { base.Draw(renderer, modelNames, miscSettingByte, isSelected); if (isSelected) { renderer.DrawSphereTrigger(triggerMatrix, true); } }
public override void Draw(SharpRenderer renderer) { renderer.DrawSphereTrigger(transformMatrix, isSelected); if (isSelected) { renderer.DrawCubeTrigger(destinationMatrix, isSelected); } }
public override void Draw(SharpRenderer renderer) { base.Draw(renderer); if (isSelected) { renderer.DrawSphereTrigger(triggerMatrix, true); } }
public override void Draw(string[] modelNames, bool isSelected) { base.Draw(modelNames, isSelected); if (isSelected) { SharpRenderer.DrawSphereTrigger(triggerMatrix, true); } }
public static Spline FromFile(string FileName, SharpRenderer renderer) { string[] SplineFile = File.ReadAllLines(FileName); Spline Temp = new Spline(); List <SplineVertex> Points = new List <SplineVertex>(); Temp.Type = SplineType.Null; foreach (string j in SplineFile) { if (j.StartsWith("SPLINE_TYPE=")) { if (j.Substring(j.IndexOf("=") + 1) == "Null") { Temp.Type = SplineType.Null; } else if (j.Substring(j.IndexOf("=") + 1) == "Loop") { Temp.Type = SplineType.Loop; } else if (j.Substring(j.IndexOf("=") + 1) == "Rail") { Temp.Type = SplineType.Rail; } else if (j.Substring(j.IndexOf("=") + 1) == "Ball") { Temp.Type = SplineType.Ball; } } else if (j.StartsWith("v")) { string[] a = Regex.Replace(j, @"\s+", " ").Split(); Points.Add(new SplineVertex(Convert.ToSingle(a[1]), Convert.ToSingle(a[2]), Convert.ToSingle(a[3]))); } } if (Temp.Type == SplineType.Null) { if (FileName.ToLower().Contains("loop")) { Temp.Type = SplineType.Loop; } if (FileName.ToLower().Contains("rail") || FileName.ToLower().Contains("grind")) { Temp.Type = SplineType.Rail; } if (FileName.ToLower().Contains("ball")) { Temp.Type = SplineType.Ball; } } Temp.Points = Points.ToArray(); Temp.SetRenderStuff(renderer); return(Temp); }
public void SetRenderStuff(SharpRenderer renderer) { List <Vector3> vertices = new List <Vector3>(Points.Length); foreach (var v in Points) { vertices.Add(new Vector3(v.Position.X, v.Position.Y, v.Position.Z)); } CreateMesh(renderer, vertices.ToArray()); }
public void SetRenderStuff(SharpRenderer renderer) { List <Vector3> vertices = new List <Vector3>(Vertices.Length); foreach (ShadowSplineVertex v in Vertices) { vertices.Add(v.Position); } CreateMesh(renderer, vertices.ToArray()); }
public static Spline Blank(SharpRenderer renderer) { Spline result = new Spline { Points = new SplineVertex[] { new SplineVertex(0, 0, 0), new SplineVertex(0, 0, 0) } }; result.SetRenderStuff(renderer); return(result); }
public void AddSplines(string[] fileNames, SharpRenderer renderer) { foreach (string i in fileNames) { Spline s = Spline.FromFile(i, renderer); if (s.Points.Length < 2) { MessageBox.Show("Error: file " + i + " has less than two vertices. Skipping..."); continue; } SplineList.Add(s); } }
public override void Draw(SharpRenderer renderer) { if (BaseType == BaseTypeEnum.None) { DrawCube(renderer); } else if (BaseType == BaseTypeEnum.Floor) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(FloorBase)) { Draw(renderer, FloorBase); } if (IsBlue) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(FloorBase)) { Draw(renderer, FloorBlue); } } else { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(FloorRed)) { Draw(renderer, FloorRed); } } } else if (BaseType == BaseTypeEnum.Air) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(AirBase)) { Draw(renderer, AirBase); } if (IsBlue) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(AirBase)) { Draw(renderer, AirBlue); } } else { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(AirRed)) { Draw(renderer, AirRed); } } } }
public override void Draw(SharpRenderer renderer, string[][] modelNames, int modelMiscSetting, bool isSelected) { if (BaseType == BaseTypeEnum.None) { DrawCube(renderer, isSelected); } else if (BaseType == BaseTypeEnum.Floor) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(FloorBase)) { Draw(renderer, FloorBase, isSelected); } if (IsBlue) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(FloorBase)) { Draw(renderer, FloorBlue, isSelected); } } else { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(FloorRed)) { Draw(renderer, FloorRed, isSelected); } } } else if (BaseType == BaseTypeEnum.Air) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(AirBase)) { Draw(renderer, AirBase, isSelected); } if (IsBlue) { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(AirBase)) { Draw(renderer, AirBlue, isSelected); } } else { if (Program.MainForm.renderer.dffRenderer.DFFModels.ContainsKey(AirRed)) { Draw(renderer, AirRed, isSelected); } } } }
public void RenderStartPositions(SharpRenderer renderer) { foreach (StartPositionEntry p in StartPositions) { p.Render(renderer); } foreach (EndPositionEntry p in EndPositions) { p.Render(renderer); } foreach (EndPositionEntry p in BragPositions) { p.Render(renderer); } }
protected void SetRendererStates(SharpRenderer renderer) { renderData.worldViewProjection = transformMatrix * 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(); }
public void RenderSetObjects(SharpRenderer renderer, bool drawEveryObject) { if (checkBoxDrawObjs.Checked) { layoutSystem.RenderSetObjects(renderer, drawEveryObject); if (DrawGizmos) { foreach (Gizmo g in gizmos) { g.Draw(renderer); } } } }
public void RenderCameras(SharpRenderer renderer) { Vector4 oldColor = renderer.normalColor; renderer.normalColor = new Vector4(0.6f, 0.25f, 0.7f, 0.8f); foreach (ShadowCamera c in ListBoxCameras.Items) { if (renderer.frustum.Intersects(ref c.boundingBox)) { c.Draw(renderer); } } renderer.normalColor = oldColor; }