diff --git a/Assets/Textures/missing.png b/Assets/Textures/missing.png new file mode 100644 index 0000000..a8d9b95 Binary files /dev/null and b/Assets/Textures/missing.png differ diff --git a/Content/Common/DefaultHudPrefab2.prefab b/Content/Common/DefaultHudPrefab2.prefab new file mode 100644 index 0000000..d64adab --- /dev/null +++ b/Content/Common/DefaultHudPrefab2.prefab @@ -0,0 +1,191 @@ +{ + "ID": "44b0e2e14042c518372ad4a713c03554", + "TypeName": "FlaxEngine.Prefab", + "EngineBuild": 6225, + "Data": [ + { + "ID": "4cf08e994b0aba2a1f27d78581801a15", + "TypeName": "FlaxEngine.UICanvas", + "ParentID": "00000000000000000000000000000000", + "Name": "DefaultHudPrefab", + "Transform": { + "Orientation": { + "X": 1.0, + "Y": 4.3711388286737938e-8, + "Z": 4.3711388286737938e-8, + "W": 1.910685465164705e-15 + } + }, + "V": {} + }, + { + "ID": "f07ac47945765b274830ab9d017a39cb", + "TypeName": "Cabrito.FpsScript", + "ParentID": "4cf08e994b0aba2a1f27d78581801a15", + "V": { + "control": "86b4047b47495cc4b736bf99c1e400ac" + } + }, + { + "ID": "1792e2ec40703885e1d1329311f35adc", + "TypeName": "Cabrito.ConsoleScript", + "ParentID": "4cf08e994b0aba2a1f27d78581801a15", + "V": { + "ConsoleFont": "43f32bec443158643f53699f07b2e09c", + "BackgroundColor": { + "R": 0.0, + "G": 0.0, + "B": 0.0, + "A": 1.0 + } + } + }, + { + "ID": "86b4047b47495cc4b736bf99c1e400ac", + "TypeName": "FlaxEngine.UIControl", + "ParentID": "4cf08e994b0aba2a1f27d78581801a15", + "Name": "FPSUIControl", + "Transform": { + "Translation": { + "X": 0.0, + "Y": 730.0, + "Z": 0.0 + } + }, + "Control": "FlaxEngine.GUI.Label", + "Data": { + "Text": "eFPS: 528\nuFPS: 531\nrFPS: 528\npFPS: 30\nCon: NaNms\nDirectX11\nGC memory: 13.01433MB", + "TextColor": { + "R": 1.0, + "G": 1.0, + "B": 1.0, + "A": 1.0 + }, + "TextColorHighlighted": { + "R": 1.0, + "G": 1.0, + "B": 1.0, + "A": 1.0 + }, + "HorizontalAlignment": 0, + "VerticalAlignment": 0, + "Wrapping": 0, + "Font": { + "Font": "4508d98f4aa1f0bd59362b81d47e38f4", + "Size": 10 + }, + "Material": null, + "Margin": { + "Left": 0.0, + "Right": 0.0, + "Top": 0.0, + "Bottom": 0.0 + }, + "ClipText": false, + "AutoWidth": true, + "AutoHeight": true, + "AutoFitText": false, + "AutoFitTextRange": { + "X": 0.1, + "Y": 100.0 + }, + "ClipChildren": true, + "CullChildren": true, + "AnchorMin": { + "X": 0.0, + "Y": 1.0 + }, + "AnchorMax": { + "X": 0.0, + "Y": 1.0 + }, + "Offsets": { + "Left": 0.0, + "Right": 143.0, + "Top": -80.0, + "Bottom": 112.0 + }, + "Scale": { + "X": 1.0, + "Y": 1.0 + }, + "Pivot": { + "X": 0.5, + "Y": 0.5 + }, + "Shear": { + "X": 0.0, + "Y": 0.0 + }, + "Rotation": 0.0, + "BackgroundColor": { + "R": 0.0, + "G": 0.0, + "B": 0.0, + "A": 0.0 + }, + "Enabled": true, + "Visible": true + } + }, + { + "ID": "20a15fd74b0072c52e00fc85ba8d62a1", + "TypeName": "FlaxEngine.UIControl", + "ParentID": "4cf08e994b0aba2a1f27d78581801a15", + "Name": "UIControl" + }, + { + "ID": "b2561bca4e5afe01ec2e4a96cef38c0b", + "TypeName": "FlaxEngine.UIControl", + "ParentID": "4cf08e994b0aba2a1f27d78581801a15", + "Name": "ContainerControl 0", + "Transform": { + "Translation": { + "X": 45644.0, + "Y": -1.0, + "Z": 0.0 + } + }, + "Control": "FlaxEngine.GUI.ContainerControl", + "Data": { + "ClipChildren": true, + "CullChildren": true, + "AnchorMin": { + "X": 1.0, + "Y": 0.5 + }, + "AnchorMax": { + "X": 1.0, + "Y": 0.5 + }, + "Offsets": { + "Left": 44188.0, + "Right": 100.0, + "Top": -406.0, + "Bottom": 30.0 + }, + "Scale": { + "X": 1.0, + "Y": 1.0 + }, + "Pivot": { + "X": 0.5, + "Y": 0.5 + }, + "Shear": { + "X": 0.0, + "Y": 0.0 + }, + "Rotation": 0.0, + "BackgroundColor": { + "R": 0.0, + "G": 0.0, + "B": 0.0, + "A": 0.0 + }, + "Enabled": true, + "Visible": true + } + } +] +} \ No newline at end of file diff --git a/Content/Materials/missing.flax b/Content/Materials/missing.flax new file mode 100644 index 0000000..b748545 Binary files /dev/null and b/Content/Materials/missing.flax differ diff --git a/Content/Scenes/TestImportScene.scene b/Content/Scenes/AerowalkScene.scene similarity index 94% rename from Content/Scenes/TestImportScene.scene rename to Content/Scenes/AerowalkScene.scene index 26faced..2fb2566 100644 --- a/Content/Scenes/TestImportScene.scene +++ b/Content/Scenes/AerowalkScene.scene @@ -1,7 +1,7 @@ { "ID": "194e05f445ece24ec5448d886e1334df", "TypeName": "FlaxEngine.SceneAsset", - "EngineBuild": 6224, + "EngineBuild": 6225, "Data": [ { "ID": "194e05f445ece24ec5448d886e1334df", @@ -21,9 +21,7 @@ "ID": "c95a3dab492c1b2046ce2191daa2b111", "TypeName": "Game.Q3MapImporter", "ParentID": "194e05f445ece24ec5448d886e1334df", - "V": { - "material": "a1ac1cf4484f3bf8e07c2ea4fddaa74f" -} + "V": {} }, { "ID": "6c66fa4a4a5de8998eb84388d1648317", @@ -32,9 +30,15 @@ "ParentID": "194e05f445ece24ec5448d886e1334df", "Transform": { "Translation": { - "X": -571.0, - "Y": 141.0, - "Z": 587.0 + "X": 55.27312469482422, + "Y": 20.41858673095703, + "Z": -32.30524444580078 + }, + "Orientation": { + "X": 0.0, + "Y": 1.0, + "Z": -0.0, + "W": -4.371138828673793e-8 } }, "StaticFlags": 0 @@ -94,7 +98,7 @@ "ID": "ff6b6db54b5aa08e7286ef86246149ef", "TypeName": "FlaxEngine.UICanvas", "ParentID": "194e05f445ece24ec5448d886e1334df", - "Name": "DefaultHudPrefab 0", + "Name": "DefaultHudPrefab", "Transform": { "Orientation": { "X": 1.0, @@ -141,7 +145,7 @@ }, "Control": "FlaxEngine.GUI.Label", "Data": { - "Text": "eFPS: 121\nuFPS: 120\nrFPS: 120\npFPS: 30\nCon: NaNms\nDirectX11\nGC memory: 23.96294MB", + "Text": "eFPS: 719\nuFPS: 650\nrFPS: 650\npFPS: 30\nCon: NaNms\nDirectX11\nGC memory: 15.66632MB", "TextColor": { "R": 1.0, "G": 1.0, @@ -228,7 +232,7 @@ "Name": "ContainerControl 0", "Transform": { "Translation": { - "X": 44793.0, + "X": 45644.0, "Y": -1.0, "Z": 0.0 } diff --git a/Content/Scenes/CubeScene.scene b/Content/Scenes/CubeScene.scene new file mode 100644 index 0000000..6d31114 --- /dev/null +++ b/Content/Scenes/CubeScene.scene @@ -0,0 +1,329 @@ +{ + "ID": "e7b31f884e9b199f130a00b5bf2b52f0", + "TypeName": "FlaxEngine.SceneAsset", + "EngineBuild": 6225, + "Data": [ + { + "ID": "e7b31f884e9b199f130a00b5bf2b52f0", + "TypeName": "FlaxEngine.Scene", + "LightmapSettings": { + "IndirectLightingIntensity": 1.0, + "GlobalObjectsScale": 1.0, + "ChartsPadding": 3, + "AtlasSize": 1024, + "BounceCount": 1, + "CompressLightmaps": true, + "UseGeometryWithNoMaterials": true, + "Quality": 10 + } + }, + { + "ID": "c95a3dab492c1b2046ce2191daa2b111", + "TypeName": "Game.Q3MapImporter", + "ParentID": "e7b31f884e9b199f130a00b5bf2b52f0", + "V": { + "mapPath": "C:\\dev\\GoakeFlax\\Assets\\Maps\\cube_q3.map" +} + }, + { + "ID": "6c66fa4a4a5de8998eb84388d1648317", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "999a202c47de967d2bdfd09abcc6df4e", + "ParentID": "e7b31f884e9b199f130a00b5bf2b52f0", + "Transform": { + "Translation": { + "X": -571.0, + "Y": 141.0, + "Z": 587.0 + } + }, + "StaticFlags": 0 + }, + { + "ID": "d5c84d67417ddf09908c76b6f0582b43", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "b29a58f545071ca393afaab21faa83ad", + "ParentID": "6c66fa4a4a5de8998eb84388d1648317", + "V": { + "JumpLandSound": "a9ae0bbf438b4e841277f39c3d7c7c8b" +} + }, + { + "ID": "d1a76c334a514c99f8f5b2bd81abae2c", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "a67383834fc3f6f1106e8099e5557e32", + "ParentID": "6c66fa4a4a5de8998eb84388d1648317", + "StaticFlags": 0 + }, + { + "ID": "357077e9405b2a7ba50198bbed8bd5f9", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "b8fc420f4efe96fa2b4042bd98fd3e74", + "ParentID": "d1a76c334a514c99f8f5b2bd81abae2c", + "StaticFlags": 0 + }, + { + "ID": "905d23324e7f98c9f8287e8e49a83981", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "226bdb004e72848777178a9d1f207cbf", + "ParentID": "357077e9405b2a7ba50198bbed8bd5f9", + "StaticFlags": 0 + }, + { + "ID": "89c02cd64b640185d9947ab451453c4c", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "8bd80bca49ac35da66aabaa2e473851d", + "ParentID": "6c66fa4a4a5de8998eb84388d1648317", + "StaticFlags": 0 + }, + { + "ID": "eebdb91647732ad3dfc7528c978cd19c", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "d9d61d314ad79d49ba08059cef50f802", + "ParentID": "6c66fa4a4a5de8998eb84388d1648317", + "StaticFlags": 0 + }, + { + "ID": "3e0f83fe407b2d9ed7c734a62fad0826", + "PrefabID": "2d0e518b47d735c98312dd87cc42d6d7", + "PrefabObjectID": "b377cc03418270d87e8a5b92cb5374ea", + "ParentID": "6c66fa4a4a5de8998eb84388d1648317", + "StaticFlags": 0 + }, + { + "ID": "ff6b6db54b5aa08e7286ef86246149ef", + "TypeName": "FlaxEngine.UICanvas", + "ParentID": "e7b31f884e9b199f130a00b5bf2b52f0", + "Name": "DefaultHudPrefab", + "Transform": { + "Orientation": { + "X": 1.0, + "Y": 4.371138828673793e-8, + "Z": 4.371138828673793e-8, + "W": 1.910685465164705e-15 + } + }, + "V": {} + }, + { + "ID": "791756db4da9af04d7513f9f305e4652", + "TypeName": "Cabrito.FpsScript", + "ParentID": "ff6b6db54b5aa08e7286ef86246149ef", + "V": { + "control": "d15fa816476f9d66ebdfc7ae25c3c6ea" +} + }, + { + "ID": "b20f2b0a486762a15e6a7caf72ae66c2", + "TypeName": "Cabrito.ConsoleScript", + "ParentID": "ff6b6db54b5aa08e7286ef86246149ef", + "V": { + "ConsoleFont": "43f32bec443158643f53699f07b2e09c", + "BackgroundColor": { + "R": 0.0, + "G": 0.0, + "B": 0.0, + "A": 1.0 + } +} + }, + { + "ID": "d15fa816476f9d66ebdfc7ae25c3c6ea", + "TypeName": "FlaxEngine.UIControl", + "ParentID": "ff6b6db54b5aa08e7286ef86246149ef", + "Name": "FPSUIControl", + "Transform": { + "Translation": { + "X": 0.0, + "Y": 730.0, + "Z": 0.0 + } + }, + "Control": "FlaxEngine.GUI.Label", + "Data": { + "Text": "eFPS: 626\nuFPS: 665\nrFPS: 665\npFPS: 30\nCon: NaNms\nDirectX11\nGC memory: 16.89747MB", + "TextColor": { + "R": 1.0, + "G": 1.0, + "B": 1.0, + "A": 1.0 + }, + "TextColorHighlighted": { + "R": 1.0, + "G": 1.0, + "B": 1.0, + "A": 1.0 + }, + "HorizontalAlignment": 0, + "VerticalAlignment": 0, + "Wrapping": 0, + "Font": { + "Font": "4508d98f4aa1f0bd59362b81d47e38f4", + "Size": 10 + }, + "Material": null, + "Margin": { + "Left": 0.0, + "Right": 0.0, + "Top": 0.0, + "Bottom": 0.0 + }, + "ClipText": false, + "AutoWidth": true, + "AutoHeight": true, + "AutoFitText": false, + "AutoFitTextRange": { + "X": 0.1, + "Y": 100.0 + }, + "ClipChildren": true, + "CullChildren": true, + "AnchorMin": { + "X": 0.0, + "Y": 1.0 + }, + "AnchorMax": { + "X": 0.0, + "Y": 1.0 + }, + "Offsets": { + "Left": 0.0, + "Right": 143.0, + "Top": -80.0, + "Bottom": 112.0 + }, + "Scale": { + "X": 1.0, + "Y": 1.0 + }, + "Pivot": { + "X": 0.5, + "Y": 0.5 + }, + "Shear": { + "X": 0.0, + "Y": 0.0 + }, + "Rotation": 0.0, + "BackgroundColor": { + "R": 0.0, + "G": 0.0, + "B": 0.0, + "A": 0.0 + }, + "Enabled": true, + "Visible": true +} + }, + { + "ID": "7261228a42b41682cf48e89d910ddcff", + "TypeName": "FlaxEngine.UIControl", + "ParentID": "ff6b6db54b5aa08e7286ef86246149ef", + "Name": "UIControl" + }, + { + "ID": "bd1e2ea8425a68342d01f4975e4cdf3e", + "TypeName": "FlaxEngine.UIControl", + "ParentID": "ff6b6db54b5aa08e7286ef86246149ef", + "Name": "ContainerControl 0", + "Transform": { + "Translation": { + "X": 45644.0, + "Y": -1.0, + "Z": 0.0 + } + }, + "Control": "FlaxEngine.GUI.ContainerControl", + "Data": { + "ClipChildren": true, + "CullChildren": true, + "AnchorMin": { + "X": 1.0, + "Y": 0.5 + }, + "AnchorMax": { + "X": 1.0, + "Y": 0.5 + }, + "Offsets": { + "Left": 44188.0, + "Right": 100.0, + "Top": -406.0, + "Bottom": 30.0 + }, + "Scale": { + "X": 1.0, + "Y": 1.0 + }, + "Pivot": { + "X": 0.5, + "Y": 0.5 + }, + "Shear": { + "X": 0.0, + "Y": 0.0 + }, + "Rotation": 0.0, + "BackgroundColor": { + "R": 0.0, + "G": 0.0, + "B": 0.0, + "A": 0.0 + }, + "Enabled": true, + "Visible": true +} + }, + { + "ID": "9b0c532d4247061970c809a0af58c82a", + "TypeName": "FlaxEngine.PostFxVolume", + "ParentID": "e7b31f884e9b199f130a00b5bf2b52f0", + "Name": "PostFxVolume 0", + "Size": { + "X": 10.0, + "Y": 10.0, + "Z": 10.0 + }, + "IsBounded": false, + "Settings": { + "AO": { + "OverrideFlags": 1, + "Enabled": false + }, + "Bloom": { + "OverrideFlags": 1, + "Enabled": false + }, + "ToneMapping": { + "OverrideFlags": 4, + "Mode": 0 + }, + "ColorGrading": {}, + "EyeAdaptation": { + "OverrideFlags": 1, + "Mode": 0 + }, + "CameraArtifacts": { + "OverrideFlags": 1, + "VignetteIntensity": 0.0, + "GrainAmount": 0.0 + }, + "LensFlares": {}, + "DepthOfField": {}, + "MotionBlur": { + "OverrideFlags": 1, + "Enabled": false + }, + "SSR": { + "OverrideFlags": 1, + "Intensity": 0.0 + }, + "AA": { + "OverrideFlags": 1, + "Mode": 0 + }, + "PostFxMaterials": {} + } + } + ] +} \ No newline at end of file diff --git a/Content/Settings/EngineSettings/TimeSettings.json b/Content/Settings/EngineSettings/TimeSettings.json index 54914a3..943fcda 100644 --- a/Content/Settings/EngineSettings/TimeSettings.json +++ b/Content/Settings/EngineSettings/TimeSettings.json @@ -3,9 +3,9 @@ "TypeName": "FlaxEditor.Content.Settings.TimeSettings", "EngineBuild": 6224, "Data": { - "UpdateFPS": 0.0, - "PhysicsFPS": 60.0, - "DrawFPS": 0.0, + "UpdateFPS": 240.0, + "PhysicsFPS": 120.0, + "DrawFPS": 240.0, "TimeScale": 1.0, "MaxUpdateDeltaTime": 0.1 } diff --git a/Content/Settings/EngineSettings/WindowsPlatformSettings.json b/Content/Settings/EngineSettings/WindowsPlatformSettings.json index 7773f4a..3ed1e99 100644 --- a/Content/Settings/EngineSettings/WindowsPlatformSettings.json +++ b/Content/Settings/EngineSettings/WindowsPlatformSettings.json @@ -1,7 +1,7 @@ { "ID": "4a5eec97484253fed72934860ae62c40", "TypeName": "FlaxEditor.Content.Settings.WindowsPlatformSettings", - "EngineBuild": 6221, + "EngineBuild": 6225, "Data": { "WindowMode": 0, "ScreenWidth": 1280, diff --git a/Content/Textures/missing.flax b/Content/Textures/missing.flax new file mode 100644 index 0000000..c1d8dbd Binary files /dev/null and b/Content/Textures/missing.flax differ diff --git a/Source/Game/Q3MapImporter.cs b/Source/Game/Q3MapImporter.cs index 99109aa..5917713 100644 --- a/Source/Game/Q3MapImporter.cs +++ b/Source/Game/Q3MapImporter.cs @@ -30,15 +30,15 @@ namespace Game public class Q3MapImporter : Script { //private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q1.map"; - private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q3.map"; + //private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_q3.map"; //private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\cube_valve.map"; //private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\dm4.map"; - //private string mapPath = @"C:\dev\Goake\maps\aerowalk\aerowalk.map"; + public string mapPath = @"C:\dev\Goake\maps\aerowalk\aerowalk.map"; //private string mapPath = @"C:\dev\GoakeFlax\Assets\Maps\problematic.map"; Model model; - public MaterialBase material; + private MaterialBase missingMaterial; static void QuickHull(Vector3[] points, out Vector3[] outVertices) { @@ -188,9 +188,15 @@ namespace Game public override void OnStart() { - byte[] mapChars = File.ReadAllBytes(mapPath); + { + var workDir = Directory.GetCurrentDirectory(); + var matBasePath = Path.Combine(workDir, "Content", "Materials"); + var assetPath = Path.Combine(matBasePath, "missing.flax"); + missingMaterial = Content.Load(assetPath); + } Stopwatch sw = Stopwatch.StartNew(); + byte[] mapChars = File.ReadAllBytes(mapPath); root = MapParser.Parse(mapChars); sw.Stop(); @@ -201,7 +207,6 @@ namespace Game if (!oneMesh) { - Dictionary materials = new Dictionary(); { BrushMaterialList brushMaterialList = Engine.GetCustomSettings("BrushMaterialsLegacy") @@ -213,9 +218,8 @@ namespace Game } } - - var mapRootActor = Actor.AddChild(); - mapRootActor.Name = "MapRootActor"; + var worldSpawnActor = Actor.AddChild(); + worldSpawnActor.Name = "WorldSpawn"; List brushGeometries = new List(root.entities[0].brushes.Count); @@ -262,8 +266,8 @@ namespace Game else { Console.Print("Material '" + textureName + "' not found for brush"); - materials.Add(textureName, material); - brushMaterial = material; + materials.Add(textureName, missingMaterial); + brushMaterial = missingMaterial; } } brushMaterials.Add(textureName, brushMaterial); @@ -416,7 +420,7 @@ namespace Game { StaticModel childModel = Actor.AddChild(); childModel.Name = "Brush_" + brushIndex; - childModel.Parent = mapRootActor; + childModel.Parent = worldSpawnActor; childModel.Model = geom.model; childModel.Position = geom.offset; @@ -582,7 +586,7 @@ namespace Game StaticModel childModel = Actor.AddChild(); childModel.Name = "MapModel"; childModel.Model = model; - childModel.SetMaterial(0, material); + childModel.SetMaterial(0, missingMaterial); CollisionData collisionData = Content.CreateVirtualAsset(); if (collisionData.CookCollision(CollisionDataType.TriangleMesh, vertices.ToArray(),