mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
"Fix" warnings
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ class MaterialVariable
|
||||
|
||||
Result<int, Int.ParseError> 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<int, Int.ParseError> columnsResult = int.Parse(columnsString);
|
||||
|
||||
if (columnsResult case .Err(let error))
|
||||
if (columnsResult case .Err(out error))
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -465,7 +465,7 @@ namespace GlitchyEditor.EditWindows
|
||||
_selectedFiles.ClearAndDeleteItems();
|
||||
}
|
||||
|
||||
if (currentDirectoryNode case .Ok(TreeNode<AssetNode> currentDirectory))
|
||||
if (currentDirectoryNode case .Ok(out currentDirectory))
|
||||
{
|
||||
FileDropTarget(currentDirectory, .External);
|
||||
}
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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...
|
||||
|
||||
@@ -589,7 +589,7 @@ namespace GlitchyEditor
|
||||
/// @remarks If the creation fails at any point the entire directory will be deleted.
|
||||
private Result<void> 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;
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -311,7 +311,7 @@ namespace GlitchyEditor
|
||||
switch (fieldType)
|
||||
{
|
||||
case typeof(bool):
|
||||
let value = GetSettingValue!<bool>();
|
||||
bool value = GetSettingValue!<bool>();
|
||||
|
||||
if (!ImGui.Checkbox(scope $"##{setting.Name}", &value))
|
||||
break;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -15,7 +15,11 @@ class TextureLoader : IProcessedAssetLoader
|
||||
Format pixelFormat = Try!(dataStream.Read<Format>());
|
||||
uint32 width = Try!(dataStream.Read<uint32>());
|
||||
uint32 height = Try!(dataStream.Read<uint32>());
|
||||
uint32 depth = Try!(dataStream.Read<uint32>());
|
||||
|
||||
// TODO: We don't need the depth-value?
|
||||
//uint32 depth =
|
||||
Try!(dataStream.Read<uint32>());
|
||||
|
||||
uint32 arraySize = Try!(dataStream.Read<uint32>());
|
||||
uint32 mipMapCount = Try!(dataStream.Read<uint32>());
|
||||
bool isCubemap = Try!(dataStream.Read<bool>());
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -131,7 +131,7 @@ namespace GlitchyEngine
|
||||
keycode = VK_XBUTTON1;
|
||||
case .XButton2:
|
||||
keycode = VK_XBUTTON2;
|
||||
case default:
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -242,7 +242,7 @@ namespace GlitchyEngine.Renderer.Text
|
||||
StyleStack<bool> richTextStack = scope .(true);
|
||||
|
||||
// TODO: color stack not used?!
|
||||
StyleStack<ColorRGBA> fontColorStack = scope .(textRenderer.Color);
|
||||
//StyleStack<ColorRGBA> fontColorStack = scope .(textRenderer.Color);
|
||||
|
||||
StyleStack<float> fontSizeStack = scope .(textRenderer.FontSize);
|
||||
|
||||
|
||||
@@ -117,8 +117,6 @@ struct EngineFunctionsGeneratorAttribute : Attribute, IComptimeTypeApply
|
||||
{
|
||||
String parameters = new String();
|
||||
|
||||
StringView str = method.Name;
|
||||
|
||||
for (int i < method.ParamCount)
|
||||
{
|
||||
if (i != 0)
|
||||
|
||||
@@ -247,6 +247,7 @@ class SerializedObject
|
||||
|
||||
static T GetFieldDataAs<T>(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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user