mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13:01:52 +00:00
Compare commits
10
Commits
fd2b990a8f
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8c53dcb9ca | ||
|
|
5577aa6e11 | ||
|
|
6a60fae5d5 | ||
|
|
7b82e738eb | ||
|
|
c81e695981 | ||
|
|
2a90374b5b | ||
|
|
39d78ab4c1 | ||
|
|
836c926a22 | ||
|
|
e451864908 | ||
|
|
229629a587 |
@@ -14,6 +14,7 @@ Xml-Beef = "*"
|
||||
ImGuiImplDX11 = "*"
|
||||
ImGuiImplWin32 = "*"
|
||||
ImGuizmo = "*"
|
||||
"Beef.Linq" = "*"
|
||||
|
||||
[Platform.Windows]
|
||||
IconFile = "$(ProjectDir)/Resources/Textures/GlitchyEngineIcon.ico"
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -497,7 +497,7 @@ class AssetHierarchy
|
||||
void AddEntryToTree(String filePath, bool isDirectory, TreeNode<AssetNode> parentNode)
|
||||
{
|
||||
// Try to find the node for the specified path in the given parent
|
||||
TreeNode<AssetNode> treeNode = parentNode.Children.Where(scope (node) => node.Value.Path == filePath).FirstOrDefault();
|
||||
TreeNode<AssetNode> treeNode = parentNode.Children.Where((node) => node.Value.Path == filePath).FirstOrDefault();
|
||||
|
||||
// If no node was found -> create one
|
||||
if (treeNode == null)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -243,7 +243,7 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
for (StringView entryName in assetCreator.Name.Split('/'))
|
||||
{
|
||||
AssetCreatorTree nextNode = tree.Children.Where(scope (node) => node->Name == entryName).FirstOrDefault();
|
||||
AssetCreatorTree nextNode = tree.Children.Where((node) => node->Name == entryName).FirstOrDefault();
|
||||
|
||||
// Create new node if we didn't find it
|
||||
nextNode ??= tree.AddChild((entryName, null));
|
||||
@@ -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);
|
||||
}
|
||||
@@ -720,7 +720,7 @@ namespace GlitchyEditor.EditWindows
|
||||
|
||||
ImGui.TreeNodeFlags flags = .OpenOnArrow | .SpanAvailWidth;
|
||||
|
||||
if(tree.Children.Where(scope (node) => node->IsDirectory).Count() == 0)
|
||||
if(tree.Children.Where((node) => node->IsDirectory).Count() == 0)
|
||||
flags |= .Leaf;
|
||||
|
||||
if (tree->Path == CurrentDirectory)
|
||||
@@ -1390,7 +1390,7 @@ namespace GlitchyEditor.EditWindows
|
||||
private void CopySelectedFiles(bool cutFiles)
|
||||
{
|
||||
_filesToCopy.ClearAndDeleteItems();
|
||||
_selectedFiles.Select(scope (file) => new String(file)).ToList(_filesToCopy);
|
||||
_selectedFiles.Select((file) => new String(file)).ToList(_filesToCopy);
|
||||
_cutFiles = cutFiles;
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -139,7 +139,7 @@ namespace GlitchyEditor
|
||||
_componentEditWindow = new ComponentEditWindow();
|
||||
_contentBrowserWindow = new ContentBrowserWindow(this, (.)Application.Instance.ContentManager, _thumbnailManager);
|
||||
_inspectorWindow = new InspectorWindow(this);
|
||||
_assetViewer = new AssetViewer((.)Application.Get().ContentManager);
|
||||
_assetViewer = new AssetViewer((.)Application.Instance.ContentManager);
|
||||
_logWindow = new LogWindow();
|
||||
_settingsWindow = new SettingsWindow();
|
||||
}
|
||||
|
||||
@@ -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...
|
||||
|
||||
@@ -295,7 +295,7 @@ namespace GlitchyEditor
|
||||
|
||||
private void InitGraphics()
|
||||
{
|
||||
_context = Application.Get().Window.Context..AddRef();
|
||||
_context = Application.Instance.Window.Context..AddRef();
|
||||
|
||||
RasterizerStateDescription rsDesc = .(.Solid, .Back, true);
|
||||
_rasterizerState = new RasterizerState(rsDesc);
|
||||
@@ -426,6 +426,9 @@ namespace GlitchyEditor
|
||||
// Clear the swapchain-buffer
|
||||
RenderCommand.Clear(null, .Color | .Depth, .(0.2f, 0.2f, 0.2f), 1.0f, 0);
|
||||
|
||||
// Explicitly set the swap chain as render target, because we end a frame with it bound and the RTV might stop existing if we resized the swapchain between frames.
|
||||
// TODO: maybe we need to be smarter about how we handle resizing in general: should the RenderTarget check during resize whether it is bound and update the GraphicsContext?!
|
||||
RenderCommand.SetRenderTarget(null);
|
||||
RenderCommand.SetBlendState(_alphaBlendState);
|
||||
RenderCommand.SetDepthStencilState(_depthStencilState);
|
||||
|
||||
@@ -586,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;
|
||||
@@ -607,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)
|
||||
{
|
||||
|
||||
@@ -57,7 +57,7 @@ namespace GlitchyEditor.ImGui
|
||||
}
|
||||
|
||||
#if BF_PLATFORM_WINDOWS
|
||||
ImGuiImplWin32.Init(Application.Get().Window.NativeWindow);
|
||||
ImGuiImplWin32.Init(Application.Instance.Window.NativeWindow);
|
||||
#endif
|
||||
|
||||
#if GE_GRAPHICS_DX11
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
FileVersion = 1
|
||||
Dependencies = {corlib = "*", "Beef.Linq" = "*", GlitchyEngine = "*"}
|
||||
|
||||
[Project]
|
||||
Name = "GlitchyEngine.Benchmark"
|
||||
StartupObject = "GlitchyEngine.Benchmark.BenchmarkApp"
|
||||
|
||||
[Dependencies]
|
||||
corlib = "*"
|
||||
GlitchyEngine = "*"
|
||||
|
||||
[Configs.Debug.Win64]
|
||||
DebugWorkingDirectory = "d:\\Development\\Projects\\Beef\\GlitchyEngine\\GlitchyEditor"
|
||||
|
||||
|
||||
@@ -55,10 +55,20 @@ class StdDevResultColumn : IResultColumn
|
||||
{
|
||||
TimeSpan meanTime = runToCalculate.ResultColumnValue[MeanTimeResultColumn.ColumnName];
|
||||
|
||||
int64 variance = runToCalculate.RunDurations.Select(scope (d) => {
|
||||
// For some reason we need to specify the type arguments here.
|
||||
/*int64 variance = runToCalculate.RunDurations.Sum<TimeSpan[], TimeSpan, delegate int64(TimeSpan), int64>(scope [=meanTime, =runToCalculate] (d) => {
|
||||
TimeSpan delta = d - meanTime;
|
||||
return (delta * delta).Ticks / runToCalculate.RunCount;
|
||||
}).Sum();
|
||||
});*/
|
||||
|
||||
int64 variance = 0;
|
||||
|
||||
for (let duration in runToCalculate.RunDurations)
|
||||
{
|
||||
TimeSpan delta = duration - meanTime;
|
||||
variance += (delta * delta).Ticks / runToCalculate.RunCount;
|
||||
}
|
||||
|
||||
return TimeSpan((int64)Math.Sqrt((double)variance));
|
||||
}
|
||||
}
|
||||
@@ -204,7 +214,7 @@ class BenchmarkResult
|
||||
defer delete columnsToSort;
|
||||
columnsToSort.Sort(scope (a, b) => a.Depth <=> b.Depth);
|
||||
|
||||
outColumnCalculationPlan.AddRange(columnsToSort.Select(scope (a) => a.Column));
|
||||
outColumnCalculationPlan.AddRange(columnsToSort.Select((a) => a.Column));
|
||||
}
|
||||
|
||||
private void CalculateStats(Span<IResultColumn> customColumns)
|
||||
|
||||
@@ -129,7 +129,7 @@ class ScriptEngineTestBase
|
||||
TimeSpan totalRunTime = _runDurations.Sum();
|
||||
TimeSpan meanRunTime = TimeSpan(totalRunTime.Ticks / runs);
|
||||
|
||||
double varianceMs = _runDurations.Select(scope (d) => Math.Pow((d - meanRunTime).TotalMilliseconds, 2)).Sum() / runs;
|
||||
double varianceMs = _runDurations.Select((d) => Math.Pow((d - meanRunTime).TotalMilliseconds, 2)).Sum() / runs;
|
||||
TimeSpan stdDeviation = TimeSpan.FromMilliseconds(Math.Sqrt(varianceMs));
|
||||
|
||||
Console.WriteLine($"Results:");
|
||||
|
||||
@@ -16,9 +16,11 @@ LodePng = "*"
|
||||
GlitchyEngineHelper = "*"
|
||||
bon = "*"
|
||||
box2d-beef = "*"
|
||||
"Beef.Linq" = "*"
|
||||
NetHostBeef = "*"
|
||||
ImGuiImplWin32 = "*"
|
||||
"Beef.Linq" = "*"
|
||||
ImGui = "*"
|
||||
ImGuiImplDX11 = "*"
|
||||
|
||||
[Configs.Paranoid.Win32]
|
||||
PreprocessorMacros = ["DEBUG", "PARANOID", "GE_WINDOWS"]
|
||||
|
||||
@@ -38,9 +38,6 @@ namespace GlitchyEngine
|
||||
|
||||
public GameTime GameTime => _gameTime;
|
||||
|
||||
[Inline, Obsolete("Use Application.Instance instead.", false), NoShow]
|
||||
public static Application Get() => s_Instance;
|
||||
|
||||
public static Application Instance => s_Instance;
|
||||
|
||||
public this()
|
||||
|
||||
@@ -115,7 +115,7 @@ struct AssetHandle<T> where T : Asset
|
||||
_contentManager = _asset?.ContentManager;
|
||||
if (_contentManager == null)
|
||||
_contentManager = contentManager;
|
||||
//_currentFrame = (uint8)Application.Get().GameTime.FrameCount;
|
||||
//_currentFrame = (uint8)Application.Instance.GameTime.FrameCount;
|
||||
}
|
||||
|
||||
// Creates a new invalid asset handle
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace GlitchyEngine.Content
|
||||
var contentManager;
|
||||
|
||||
if (contentManager == null)
|
||||
contentManager = Application.Get().ContentManager;
|
||||
contentManager = Application.Instance.ContentManager;
|
||||
|
||||
AssetHandle handle = contentManager.LoadAsset(assetHandle, blocking);
|
||||
|
||||
@@ -86,7 +86,7 @@ namespace GlitchyEngine.Content
|
||||
var contentManager;
|
||||
|
||||
if (contentManager == null)
|
||||
contentManager = Application.Get().ContentManager;
|
||||
contentManager = Application.Instance.ContentManager;
|
||||
|
||||
AssetHandle handle = contentManager.LoadAsset(assetIdentifier, blocking);
|
||||
|
||||
@@ -134,7 +134,7 @@ namespace GlitchyEngine.Content
|
||||
var contentManager;
|
||||
|
||||
if (contentManager == null)
|
||||
contentManager = Application.Get().ContentManager;
|
||||
contentManager = Application.Instance.ContentManager;
|
||||
|
||||
contentManager.ManageAsset(asset);
|
||||
}*/
|
||||
|
||||
@@ -92,13 +92,13 @@ namespace GlitchyEngine.Content
|
||||
// TODO: load with content manager
|
||||
|
||||
result = CGLTF.LoadBuffers(options, modelData, (char8*)null);
|
||||
//result = LoadBuffersWithContentManager(options, modelData, meshName, Application.Get().ContentManager);
|
||||
//result = LoadBuffersWithContentManager(options, modelData, meshName, Application.Instance.ContentManager);
|
||||
|
||||
GeometryBinding geoBinding = null;
|
||||
|
||||
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);
|
||||
}
|
||||
@@ -2,16 +2,6 @@ namespace System
|
||||
{
|
||||
public extension Array1<T>
|
||||
{
|
||||
/// Returns the index of the given element or -1 if it is not in this array.
|
||||
public int IndexOf(T element)
|
||||
{
|
||||
for(int i < mLength)
|
||||
if(Ptr[i] == element)
|
||||
return i;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uses Binary Search to find the index of the given Element.
|
||||
* @param element The element whose element will be returned.
|
||||
|
||||
@@ -10,53 +10,4 @@ extension Directory
|
||||
// TODO: This is obviously windows only
|
||||
return PathIsDirectoryEmptyW(fileName.ToScopedNativeWChar!());
|
||||
}
|
||||
|
||||
public static Result<void, Platform.BfpFileResult> Copy(StringView fromPath, StringView toPath)
|
||||
{
|
||||
if (fromPath.Length <= 2)
|
||||
return .Err(.InvalidParameter);
|
||||
if ((fromPath[0] != '/') && (fromPath[0] != '\\'))
|
||||
{
|
||||
if (fromPath[1] == ':')
|
||||
{
|
||||
if (fromPath.Length < 3)
|
||||
return .Err(.InvalidParameter);
|
||||
}
|
||||
}
|
||||
|
||||
if (!Directory.Exists(fromPath))
|
||||
return .Err(.NotFound);
|
||||
|
||||
Try!(Directory.CreateDirectory(toPath));
|
||||
|
||||
for (var directoryEntry in Directory.EnumerateDirectories(fromPath))
|
||||
{
|
||||
let dirFromPath = scope String();
|
||||
directoryEntry.GetFilePath(dirFromPath);
|
||||
|
||||
let dirName = scope String();
|
||||
directoryEntry.GetFileName(dirName);
|
||||
|
||||
let dirToPath = scope String();
|
||||
Path.Combine(dirToPath, toPath, dirName);
|
||||
|
||||
Try!(Copy(dirFromPath, dirToPath));
|
||||
}
|
||||
|
||||
for (var fileEntry in Directory.EnumerateFiles(fromPath))
|
||||
{
|
||||
let fileFromPath = scope String();
|
||||
fileEntry.GetFilePath(fileFromPath);
|
||||
|
||||
let fileName = scope String();
|
||||
fileEntry.GetFileName(fileName);
|
||||
|
||||
let fileToPath = scope String();
|
||||
Path.Combine(fileToPath, toPath, fileName);
|
||||
|
||||
Try!(File.Copy(fileFromPath, fileToPath));
|
||||
}
|
||||
|
||||
return .Ok;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace GlitchyEngine
|
||||
{
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
if(Application.Get().Window.IsActive)
|
||||
if(Application.Instance.Window.IsActive)
|
||||
{
|
||||
float3 movement = .();
|
||||
|
||||
|
||||
@@ -98,7 +98,7 @@ namespace GlitchyEngine
|
||||
{
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
if(Application.Get().Window.IsActive)
|
||||
if(Application.Instance.Window.IsActive)
|
||||
{
|
||||
float3 movement = .();
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ namespace GlitchyEngine.Renderer
|
||||
internal DxDSSDesc nativeDescription;
|
||||
internal ID3D11DepthStencilState* nativeDepthStencilState ~ _?.Release();
|
||||
|
||||
public this(GEDSSDesc description)
|
||||
public override this(GEDSSDesc description)
|
||||
{
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
|
||||
@@ -73,6 +73,8 @@ namespace GlitchyEngine.Renderer
|
||||
PlatformCreateTexture();
|
||||
}
|
||||
|
||||
SetDebugNames();
|
||||
|
||||
if(_description.DepthStencilFormat != .Unknown)
|
||||
{
|
||||
_depthStenilTarget = new DepthStencilTarget(_description.Width, _description.Height, _description.DepthStencilFormat);
|
||||
@@ -131,6 +133,18 @@ namespace GlitchyEngine.Renderer
|
||||
}
|
||||
}
|
||||
|
||||
private void SetDebugNames()
|
||||
{
|
||||
_nativeTexture.SetDebugName(Identifier);
|
||||
_nativeResourceView.SetDebugName(scope $"{Identifier}: SRV");
|
||||
_nativeRenderTargetView.SetDebugName(scope $"{Identifier}: RTV");
|
||||
|
||||
if (_depthStenilTarget != null)
|
||||
{
|
||||
_depthStenilTarget.nativeView.SetDebugName(scope $"{Identifier}: DSV");
|
||||
}
|
||||
}
|
||||
|
||||
protected override TextureViewBinding PlatformGetViewBinding()
|
||||
{
|
||||
return new .(_nativeResourceView, _samplerState?.nativeSamplerState);
|
||||
@@ -255,6 +269,7 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
ID3D11Texture2D* texture = null;
|
||||
var result = NativeDevice.CreateTexture2D(ref desc, null, &texture);
|
||||
texture.SetDebugName(target.DebugName);
|
||||
Log.EngineLogger.Assert(result.Succeeded, "Failed to create RenderTarget2D");
|
||||
|
||||
// TODO: calculate the max mip level
|
||||
|
||||
@@ -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)
|
||||
{
|
||||
@@ -118,6 +118,7 @@ namespace GlitchyEngine.Renderer
|
||||
_backBuffer = new RenderTarget2D(desc);
|
||||
_backBuffer.Identifier = "Back buffer";
|
||||
_backBuffer.SamplerState = SamplerStateManager.LinearClamp;
|
||||
_backBuffer.ApplyChanges();
|
||||
}
|
||||
|
||||
_backBufferViewport = GlitchyEngine.Renderer.Viewport(0, 0, _width, _height, 0.0f, 1.0f);
|
||||
@@ -135,7 +136,7 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
nativeSwapChain.Present(Application.Get().Window.IsVSync ? 1 : 0, .None);
|
||||
nativeSwapChain.Present(Application.Instance.Window.IsVSync ? 1 : 0, .None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ namespace GlitchyEngine
|
||||
|
||||
public override static void SetMousePosition(int2 pos)
|
||||
{
|
||||
HWnd windowHandle = (HWnd)(int)Application.Get().Window.NativeWindow;
|
||||
HWnd windowHandle = (HWnd)(int)Application.Instance.Window.NativeWindow;
|
||||
|
||||
var pos;
|
||||
|
||||
@@ -213,7 +213,7 @@ namespace GlitchyEngine
|
||||
|
||||
public override static void Impl_NewFrame()
|
||||
{
|
||||
Window window = Application.Get().Window;
|
||||
Window window = Application.Instance.Window;
|
||||
|
||||
Debug.Profiler.ProfileFunction!();
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace GlitchyEngine
|
||||
|
||||
public override static void Impl_EndFrame()
|
||||
{
|
||||
Application.Get().Window.[Friend]_rawMouseMovementAccumulator = .Zero;
|
||||
Application.Instance.Window.[Friend]_rawMouseMovementAccumulator = .Zero;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ namespace GlitchyEngine
|
||||
[CLink]
|
||||
static extern IntBool IsWindowUnicode(HWND whnd);
|
||||
|
||||
public Result<void> SetIcon(StringView filePath)
|
||||
public override Result<void> SetIcon(StringView filePath)
|
||||
{
|
||||
HICON hIcon = LoadImageW(0, filePath.ToScopedNativeWChar!(), .Icon, 0, 0, .LoadFromFile);
|
||||
if (hIcon == 0)
|
||||
|
||||
@@ -62,8 +62,6 @@ namespace GlitchyEngine.Renderer
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
_description = description;
|
||||
|
||||
ApplyChanges();
|
||||
}
|
||||
|
||||
/// Recreates the render target using the current description
|
||||
|
||||
@@ -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);
|
||||
|
||||
Vendored
+1
-1
Submodule GlitchyEngine/vendor/Beef.Linq updated: 22534361f3...b121df75e9
Vendored
+1
-1
Submodule GlitchyEngine/vendor/directx updated: 6de8938190...7686e20bbe
Vendored
+1
-1
Submodule GlitchyEngine/vendor/freetype updated: 5d9f44bf6d...0a59914c37
Vendored
+1
-1
Submodule GlitchyEngine/vendor/imgui updated: 8c5d1f8872...7da37052af
Reference in New Issue
Block a user