diff --git a/GlitchyEditor/src/Assets/AssetCache.bf b/GlitchyEditor/src/Assets/AssetCache.bf index 453a2f9..6730870 100644 --- a/GlitchyEditor/src/Assets/AssetCache.bf +++ b/GlitchyEditor/src/Assets/AssetCache.bf @@ -310,7 +310,7 @@ class AssetCache Try!(compressedStream.TryRead(compressedData)); MemoryStream ms = new MemoryStream(asset.UncompressedByteCount); - ms.Memory.GrowUnitialized(asset.UncompressedByteCount); + ms.Memory.GrowUninitialized(asset.UncompressedByteCount); LZ4.LZ4F_dctx* context; LZ4.LZ4F_CreateDecompressionContext(out context); diff --git a/GlitchyEditor/src/Assets/Importers/DdsImporter.bf b/GlitchyEditor/src/Assets/Importers/DdsImporter.bf index 9235dc4..b47770f 100644 --- a/GlitchyEditor/src/Assets/Importers/DdsImporter.bf +++ b/GlitchyEditor/src/Assets/Importers/DdsImporter.bf @@ -630,7 +630,7 @@ static class DdsImporter surfaces.Reserve(surfaceCount); uint32 scanLineSize = 0; - uint32 slicePitch = 0; + //uint32 slicePitch = 0; uint64 numBytes = 0; uint32 blockSize = 0; // Block size in bytes. diff --git a/GlitchyEditor/src/Assets/Importers/MaterialImporter.bf b/GlitchyEditor/src/Assets/Importers/MaterialImporter.bf index ad5eeeb..a80bc0f 100644 --- a/GlitchyEditor/src/Assets/Importers/MaterialImporter.bf +++ b/GlitchyEditor/src/Assets/Importers/MaterialImporter.bf @@ -97,7 +97,7 @@ class MaterialVariable Result rowsResult = int.Parse(rowsString); - if (rowsResult case .Err(let error)) + if (rowsResult case .Err(var error)) { switch (error) { @@ -114,7 +114,7 @@ class MaterialVariable Result columnsResult = int.Parse(columnsString); - if (columnsResult case .Err(let error)) + if (columnsResult case .Err(out error)) { switch (error) { diff --git a/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf b/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf index 84a4e54..87ffaf1 100644 --- a/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf +++ b/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf @@ -226,7 +226,7 @@ extension ShaderCompiler Try!(ShaderCodePreprocessor.ProcessFileContent(shaderCode, context.VsName, context.PsName, context.Variables, context.BufferNames, context.EngineBuffers)); - using (let includer = PreprocessingIncluder(directory, context)) + using (var includer = PreprocessingIncluder(directory, context)) { var result = D3DCompiler.D3DCompile(code.Ptr, (.)code.Length, fileName.FullIdentifier.ToScopeCStr!(), nativeMacros, &includer, entryPoint.ToScopeCStr!(), compileTarget.ToScopeCStr!(), DefaultCompileFlags /* Pass down compile flags? */, .None, &outShader._shaderBlob, &errorBlob); diff --git a/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf b/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf index f208772..8072850 100644 --- a/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf +++ b/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf @@ -205,14 +205,14 @@ class ShaderProcessor : IAssetProcessor ProcessedShader.ConstantBufferEntry constantBufferEntry = .Default; - if (vsBufferResult case .Ok(let vsBuffer) && psBufferResult case .Ok(let psBuffer)) + if (vsBufferResult case .Ok(var vsBuffer) && psBufferResult case .Ok(let psBuffer)) { // Choose larger buffer constantBufferEntry.ConstantBuffer = (vsBuffer.Size >= psBuffer.Size) ? vsBuffer : psBuffer; constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint; constantBufferEntry.PixelShaderBindPoint = (.)psBuffer.BindPoint; } - else if (vsBufferResult case .Ok(let vsBuffer)) + else if (vsBufferResult case .Ok(out vsBuffer)) { constantBufferEntry.ConstantBuffer = vsBuffer; constantBufferEntry.VertexShaderBindPoint = (.)vsBuffer.BindPoint; diff --git a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf index ba9652b..5ea9775 100644 --- a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf +++ b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf @@ -465,7 +465,7 @@ namespace GlitchyEditor.EditWindows _selectedFiles.ClearAndDeleteItems(); } - if (currentDirectoryNode case .Ok(TreeNode currentDirectory)) + if (currentDirectoryNode case .Ok(out currentDirectory)) { FileDropTarget(currentDirectory, .External); } diff --git a/GlitchyEditor/src/EditWindows/EditorViewportWindow.bf b/GlitchyEditor/src/EditWindows/EditorViewportWindow.bf index 90a29c5..662a56d 100644 --- a/GlitchyEditor/src/EditWindows/EditorViewportWindow.bf +++ b/GlitchyEditor/src/EditWindows/EditorViewportWindow.bf @@ -168,7 +168,7 @@ namespace GlitchyEditor.EditWindows let mousePos = (float2)ImGui.GetMousePos(); - let globalToImGuiMouse = (float2)globalMousePosition - mousePos; + //let globalToImGuiMouse = (float2)globalMousePosition - mousePos; let winPos = (float2)ImGui.GetWindowPos(); let regionMin = winPos + (float2)ImGui.GetWindowContentRegionMin(); diff --git a/GlitchyEditor/src/EditWindows/InspectorWindow.bf b/GlitchyEditor/src/EditWindows/InspectorWindow.bf index d2039d8..b18013e 100644 --- a/GlitchyEditor/src/EditWindows/InspectorWindow.bf +++ b/GlitchyEditor/src/EditWindows/InspectorWindow.bf @@ -119,11 +119,11 @@ class InspectorWindow : EditorWindow { ShowAssetProperties(assetHandle, editor); } - else if (object case .Entity(let entityId)) + else if (object case .Entity(var entityId)) { ShowEntityProperties(entityId, editor); } - else if (object case .Component(let entityId, let componentType)) + else if (object case .Component(out entityId, let componentType)) { ShowEntityProperties(entityId, editor, componentType); } @@ -156,7 +156,7 @@ class InspectorWindow : EditorWindow if (assetFile.LoadedAsset != null) { // TODO: Where do we get the asset editor from? - if (let mat = assetFile.LoadedAsset as Material) + if (assetFile.LoadedAsset is Material) { MaterialEditor.ShowEditor(assetFile); //ImGui.TextUnformatted(assetFile.LoadedAsset.Identifier); diff --git a/GlitchyEditor/src/EditorContentManager.bf b/GlitchyEditor/src/EditorContentManager.bf index d5d4b12..cb2275b 100644 --- a/GlitchyEditor/src/EditorContentManager.bf +++ b/GlitchyEditor/src/EditorContentManager.bf @@ -972,14 +972,14 @@ class EditorContentManager : IContentManager { Runtime.NotImplemented(); - if (oldIdentifier == newIdentifier) + /*if (oldIdentifier == newIdentifier) return; Log.EngineLogger.Assert(_identiferToHandle.ContainsKey(newIdentifier), "An asset with the same identifier is already managed by this content manager."); // Since all we do in order to track assets is add them to a dictionary we can simply unmanage and manage it again. //UnmanageAsset(asset); - //ManageAsset(asset); + //ManageAsset(asset);*/ } // TODO: obviously use a map or something... diff --git a/GlitchyEditor/src/EditorLayer.bf b/GlitchyEditor/src/EditorLayer.bf index 437c7c7..877ddfd 100644 --- a/GlitchyEditor/src/EditorLayer.bf +++ b/GlitchyEditor/src/EditorLayer.bf @@ -589,7 +589,7 @@ namespace GlitchyEditor /// @remarks If the creation fails at any point the entire directory will be deleted. private Result CreateNewProject(StringView workspaceDirectory, StringView projectName) { - if (Directory.CreateDirectory(workspaceDirectory) case .Err(let error)) + if (Directory.CreateDirectory(workspaceDirectory) case .Err(var error)) { Log.ClientLogger.Error($"Failed to create directory \"{workspaceDirectory}\". ({error})"); return .Err; @@ -610,9 +610,9 @@ namespace GlitchyEditor // If the project couldn't be created or initialization failed, we delete the workspace directory. if (newProjectResult == .Err) { - if (Directory.DelTree(workspaceDirectory) case .Err(let error)) + if (Directory.DelTree(workspaceDirectory) case .Err(out error)) { - Log.EngineLogger.Error($"Failed to delete workspace ({workspaceDirectory})."); + Log.EngineLogger.Error($"Failed to delete workspace ({workspaceDirectory}). ({error})"); } return .Err; diff --git a/GlitchyEditor/src/ImGui/ImGuiExtension.bf b/GlitchyEditor/src/ImGui/ImGuiExtension.bf index 7e182c1..22e1270 100644 --- a/GlitchyEditor/src/ImGui/ImGuiExtension.bf +++ b/GlitchyEditor/src/ImGui/ImGuiExtension.bf @@ -276,10 +276,10 @@ namespace ImGui const String[?] componentNames = .("X", "Y", "Z", "W"); const String[?] componentIds = .("##X", "##Y", "##Z", "##W"); - static int mouseLockId = 0; + //static int mouseLockId = 0; bool changed = false; - bool deactivated = false; + //bool deactivated = false; if (!label.IsEmpty) { diff --git a/GlitchyEditor/src/Settings/SettingsWindow.bf b/GlitchyEditor/src/Settings/SettingsWindow.bf index 1e424e1..d727159 100644 --- a/GlitchyEditor/src/Settings/SettingsWindow.bf +++ b/GlitchyEditor/src/Settings/SettingsWindow.bf @@ -311,7 +311,7 @@ namespace GlitchyEditor switch (fieldType) { case typeof(bool): - let value = GetSettingValue!(); + bool value = GetSettingValue!(); if (!ImGui.Checkbox(scope $"##{setting.Name}", &value)) break; diff --git a/GlitchyEngine/src/Content/ModelLoader.bf b/GlitchyEngine/src/Content/ModelLoader.bf index 955fc15..4852899 100644 --- a/GlitchyEngine/src/Content/ModelLoader.bf +++ b/GlitchyEngine/src/Content/ModelLoader.bf @@ -98,7 +98,7 @@ namespace GlitchyEngine.Content for (var mesh in modelData.Meshes) { - var name = StringView(mesh.Name); + //var name = StringView(mesh.Name); //if (name == meshName) { @@ -616,7 +616,7 @@ namespace GlitchyEngine.Content CGLTF.AccessorReadFloat(accessor, (uint)index, (float*)&result, 16); case typeof(uint16): CGLTF.AccessorReadUint(accessor, (uint)index, (uint32*)&result, 2); - case default: + default: uint8* data = (uint8*)accessor.BufferView.Buffer.Data; data += accessor.BufferView.Offset; diff --git a/GlitchyEngine/src/Content/TextureLoader.bf b/GlitchyEngine/src/Content/TextureLoader.bf index 92b6dd7..0fc2c14 100644 --- a/GlitchyEngine/src/Content/TextureLoader.bf +++ b/GlitchyEngine/src/Content/TextureLoader.bf @@ -15,7 +15,11 @@ class TextureLoader : IProcessedAssetLoader Format pixelFormat = Try!(dataStream.Read()); uint32 width = Try!(dataStream.Read()); uint32 height = Try!(dataStream.Read()); - uint32 depth = Try!(dataStream.Read()); + + // TODO: We don't need the depth-value? + //uint32 depth = + Try!(dataStream.Read()); + uint32 arraySize = Try!(dataStream.Read()); uint32 mipMapCount = Try!(dataStream.Read()); bool isCubemap = Try!(dataStream.Read()); diff --git a/GlitchyEngine/src/Extension/Box2D/b2Color.bf b/GlitchyEngine/src/Extension/Box2D/b2Color.bf new file mode 100644 index 0000000..e9d2e14 --- /dev/null +++ b/GlitchyEngine/src/Extension/Box2D/b2Color.bf @@ -0,0 +1,10 @@ +using System; +using GlitchyEngine.Math; +namespace Box2D; + +extension b2Color +{ + [Inline] +#unwarn + public static explicit operator ColorRGBA(b2Color color) => ColorRGBA(color.r, color.g, color.b, color.a); +} diff --git a/GlitchyEngine/src/Math/Math.bf b/GlitchyEngine/src/Math/Math.bf index 72840c4..10a0b0e 100644 --- a/GlitchyEngine/src/Math/Math.bf +++ b/GlitchyEngine/src/Math/Math.bf @@ -929,10 +929,5 @@ static return (int64)gcd((uint64)Math.Abs(u), (uint64)Math.Abs(v)); } - public static this() - { - int64 i = (int64)gcd(38, 123); - } - #endregion } \ No newline at end of file diff --git a/GlitchyEngine/src/Math/Matrix.bf b/GlitchyEngine/src/Math/Matrix.bf index 6798998..586e746 100644 --- a/GlitchyEngine/src/Math/Matrix.bf +++ b/GlitchyEngine/src/Math/Matrix.bf @@ -476,7 +476,7 @@ public struct Matrix float3 right = normalize(cross(up, forward)); - float3 newUp = normalize(cross(forward, right)); + //float3 newUp = normalize(cross(forward, right)); Matrix result = .Identity; diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11SwapChain.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11SwapChain.bf index 20400f0..d7c6d53 100644 --- a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11SwapChain.bf +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11SwapChain.bf @@ -68,7 +68,7 @@ namespace GlitchyEngine.Renderer uint32 backBufferCount = 2; Format backBufferFormat = .R8G8B8A8_UNorm; - Format backBufferViewFormat = .R8G8B8A8_UNorm; // _SRGB + //Format backBufferViewFormat = .R8G8B8A8_UNorm; // _SRGB if(nativeSwapChain != null) { diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Texture.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Texture.bf index 1caa48d..19749f6 100644 --- a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Texture.bf +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11Texture.bf @@ -335,7 +335,7 @@ namespace GlitchyEngine.Renderer { Debug.Profiler.ProfileResourceFunction!(); - SubresourceData resData = .(data, linePitch, slicePitch); + //SubresourceData resData = .(data, linePitch, slicePitch); // If data is null, set subresourceData null SubresourceData* resDataPtr = null;//data == null ? null : &resData; diff --git a/GlitchyEngine/src/Platform/Windows/WindowsInput.bf b/GlitchyEngine/src/Platform/Windows/WindowsInput.bf index 25c5d3c..7180385 100644 --- a/GlitchyEngine/src/Platform/Windows/WindowsInput.bf +++ b/GlitchyEngine/src/Platform/Windows/WindowsInput.bf @@ -131,7 +131,7 @@ namespace GlitchyEngine keycode = VK_XBUTTON1; case .XButton2: keycode = VK_XBUTTON2; - case default: + default: return false; } diff --git a/GlitchyEngine/src/Renderer/Renderer2D.bf b/GlitchyEngine/src/Renderer/Renderer2D.bf index ade8f22..741b90d 100644 --- a/GlitchyEngine/src/Renderer/Renderer2D.bf +++ b/GlitchyEngine/src/Renderer/Renderer2D.bf @@ -1205,12 +1205,12 @@ namespace GlitchyEngine.Renderer #endif Runtime.FatalError("Circle renderer currently broken, do we need it?"); - QueueCircleInstance(transform, color, texture, null, transform.Translation.Z, uvTransform, innerRadius, entityId); + /*QueueCircleInstance(transform, color, texture, null, transform.Translation.Z, uvTransform, innerRadius, entityId); if(s_drawOrder == .Immediate) { DrawDeferred(); - } + }*/ } public struct Statistics diff --git a/GlitchyEngine/src/Renderer/Text/FontRenderer.bf b/GlitchyEngine/src/Renderer/Text/FontRenderer.bf index 45dbe8a..17fb592 100644 --- a/GlitchyEngine/src/Renderer/Text/FontRenderer.bf +++ b/GlitchyEngine/src/Renderer/Text/FontRenderer.bf @@ -242,7 +242,7 @@ namespace GlitchyEngine.Renderer.Text StyleStack richTextStack = scope .(true); // TODO: color stack not used?! - StyleStack fontColorStack = scope .(textRenderer.Color); + //StyleStack fontColorStack = scope .(textRenderer.Color); StyleStack fontSizeStack = scope .(textRenderer.FontSize); diff --git a/GlitchyEngine/src/Scripting/ScriptGlue.bf b/GlitchyEngine/src/Scripting/ScriptGlue.bf index 8b5257f..4f0adcc 100644 --- a/GlitchyEngine/src/Scripting/ScriptGlue.bf +++ b/GlitchyEngine/src/Scripting/ScriptGlue.bf @@ -117,8 +117,6 @@ struct EngineFunctionsGeneratorAttribute : Attribute, IComptimeTypeApply { String parameters = new String(); - StringView str = method.Name; - for (int i < method.ParamCount) { if (i != 0) diff --git a/GlitchyEngine/src/Serialization/SerializedObject.bf b/GlitchyEngine/src/Serialization/SerializedObject.bf index 83f9081..6f5d7f2 100644 --- a/GlitchyEngine/src/Serialization/SerializedObject.bf +++ b/GlitchyEngine/src/Serialization/SerializedObject.bf @@ -247,6 +247,7 @@ class SerializedObject static T GetFieldDataAs(FieldData fieldData) { +#unwarn return *(T*)&fieldData.RawData; } @@ -323,7 +324,7 @@ class SerializedObject Serialize.Value(writer, ValueView(typeof(StringView), &dataView), environment); case .EngineObjectReference: writer.Type("EngineObject"); - if (field.Data.EngineObject.FullTypeName != null) + if (field.Data.EngineObject.FullTypeName.IsEmpty) writer.Type((StringView)field.Data.ListEngineObject.FullTypeName); Serialize.Value(writer, field.Data.EngineObject.ID, environment); case .ObjectReference: diff --git a/GlitchyEngine/src/World/Scene.bf b/GlitchyEngine/src/World/Scene.bf index 05f183b..ee30b41 100644 --- a/GlitchyEngine/src/World/Scene.bf +++ b/GlitchyEngine/src/World/Scene.bf @@ -322,12 +322,12 @@ namespace GlitchyEngine.World let start = vertices[i - 1]; let end = vertices[i]; - Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); + Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), (ColorRGBA)color); } let start = vertices[vertexCount - 1]; let end = vertices[0]; - Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); + Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f),(ColorRGBA)color); }; draw.drawSolidPolygonCallback = (vertices, vertexCount, color, userData) => { @@ -336,20 +336,20 @@ namespace GlitchyEngine.World let start = vertices[i - 1]; let end = vertices[i]; - Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); + Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f),(ColorRGBA)color); } let start = vertices[vertexCount - 1]; let end = vertices[0]; - Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f), *(ColorRGBA*)&color); + Renderer2D.DrawLine(float3(start.x, start.y, 0.0f), float3(end.x, end.y, 0.0f),(ColorRGBA)color); }; draw.drawCircleCallback = (center, radius, color, userData) => { - Renderer2D.DrawCircle(center, radius.XX, *(ColorRGBA*)&color, 0.1f); + Renderer2D.DrawCircle(center, radius.XX, (ColorRGBA)color, 0.1f); }; draw.drawSolidCircleCallback = (center, radius, axis, color, userData) => { - Renderer2D.DrawCircle(center, radius.XX, *(ColorRGBA*)&color); + Renderer2D.DrawCircle(center, radius.XX, (ColorRGBA)color); }; draw.drawSegmentCallback = (p1, p2, color, userData) => { @@ -723,7 +723,7 @@ namespace GlitchyEngine.World b2Body* body = rigidbody.RuntimeBody; b2Vec2 position = Box2D.Body.GetPosition(body); - float angle = Box2D.Body.GetAngle(body); + //float angle = Box2D.Body.GetAngle(body); b2Transform bodyTransform = Box2D.Body.GetTransform(body); float cos = sqrt((1 + bodyTransform.q.c) / 2);