From 2324ae852d248b7725c6ec4ee2ee353764136db0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Sun, 8 Jan 2023 20:31:43 +0100 Subject: [PATCH] Moved material editing from component window to asset editor - EditorContentManager now returns null if asset wasn't found (instead of crashing) - FixUp asset identifier when dragging from asset browser - Lock current asset in properties editor --- GlitchyEditor/content/Scenes/Simple3D.scene | 154 +++++++++++++++++ GlitchyEditor/src/AssetFile.bf | 6 +- .../src/Assets/MaterialAssetLoader.bf | 162 ++++++++++++++++++ .../src/EditWindows/ComponentEditWindow.bf | 154 +++-------------- .../src/EditWindows/ContentBrowserWindow.bf | 2 + .../src/EditWindows/PropertiesWindow.bf | 36 +++- GlitchyEditor/src/EditorContentManager.bf | 14 +- GlitchyEngine/src/Content/Asset.bf | 1 + Sandbox/src/ExampleLayer.bf | 8 +- 9 files changed, 394 insertions(+), 143 deletions(-) create mode 100644 GlitchyEditor/content/Scenes/Simple3D.scene diff --git a/GlitchyEditor/content/Scenes/Simple3D.scene b/GlitchyEditor/content/Scenes/Simple3D.scene new file mode 100644 index 0000000..e5ff043 --- /dev/null +++ b/GlitchyEditor/content/Scenes/Simple3D.scene @@ -0,0 +1,154 @@ +{ + Name = "Scene name here pls!!!", + Entities = [ + { + Id = 5169765174113462770, + NameComponent = { + Name = "Sphere" + }, + TransformComponent = { + Position = { + X = 0, + Y = 0.5, + Z = 0 + }, + Rotation = { + X = 0, + Y = 0, + Z = 0, + W = 1 + }, + Scale = { + X = 1, + Y = 1, + Z = 1 + }, + EditorEulerRotation = { + X = 0, + Y = 0, + Z = 0 + } + }, + MeshComponent = { + Mesh = "Models\\sphere.glb" + }, + MeshRendererComponent = { + Material = "Textures\\TestMaterial.mat" + } + }, + { + Id = 17158420331978163131, + NameComponent = { + Name = "Light" + }, + TransformComponent = { + Position = { + X = -1, + Y = 4, + Z = -4 + }, + Rotation = { + X = 0.614328, + Y = 0.239776, + Z = 0.031567, + W = 0.751074 + }, + Scale = { + X = 0.999999, + Y = 1, + Z = 1.000001 + }, + EditorEulerRotation = { + X = 1.308998, + Y = 0.349066, + Z = 0.349066 + } + }, + LightComponent = { + LightType = .Directional, + Illuminance = 10, + Color = { + R = 1, + G = 0.991772, + B = 0.740862 + } + } + }, + { + Id = 5556050645816939548, + NameComponent = { + Name = "Plane" + }, + TransformComponent = { + Position = { + X = 0, + Y = 0, + Z = 0 + }, + Rotation = { + X = 0, + Y = 0, + Z = 0, + W = 1 + }, + Scale = { + X = 10, + Y = 1, + Z = 10 + }, + EditorEulerRotation = { + X = 0, + Y = 0, + Z = 0 + } + }, + MeshComponent = { + Mesh = "Models\\plane.glb" + }, + MeshRendererComponent = { + Material = "Textures\\TestMaterial.mat" + } + }, + { + Id = 3947673900993587516, + NameComponent = { + Name = "Camera" + }, + TransformComponent = { + Position = { + X = 0, + Y = 2, + Z = -5 + }, + Rotation = { + X = 0.21644, + Y = 0, + Z = 0, + W = 0.976296 + }, + Scale = { + X = 1, + Y = 1, + Z = 1 + }, + EditorEulerRotation = { + X = 0.436332, + Y = 0, + Z = 0 + } + }, + CameraComponent = { + Primary = true, + ProjectionType = .InfinitePerspective, + PerspectiveFovY = 1.047198, + PerspectiveNearPlane = 0.1, + PerspectiveFarPlane = 10000, + OrthographicHeight = 10, + OrthographicNearPlane = 0, + OrthographicFarPlane = 10, + AspectRatio = 2.156692, + FixedAspectRatio = false + } + } + ] +} \ No newline at end of file diff --git a/GlitchyEditor/src/AssetFile.bf b/GlitchyEditor/src/AssetFile.bf index 8fae083..56e9d38 100644 --- a/GlitchyEditor/src/AssetFile.bf +++ b/GlitchyEditor/src/AssetFile.bf @@ -24,6 +24,7 @@ class AssetFile private EditorContentManager _contentManager; private String _path; + private String _identifier; private String _assetConfigPath; private AssetConfig _assetConfig ~ delete _; @@ -35,6 +36,7 @@ class AssetFile public bool IsDirectory => _isDirectory; public StringView FilePath => _path; + public StringView Identifier => _identifier; public const String ConfigFileExtension = ".ass"; @@ -43,11 +45,13 @@ class AssetFile public Object LoadedAsset => _loadedAsset; [AllowAppend] - public this(EditorContentManager contentManager, StringView path, bool isDirectory) + public this(EditorContentManager contentManager, StringView identifier, StringView path, bool isDirectory) { + String identifierBuffer = append String(identifier); String pathBuffer = append String(path); String configPathBuffer = append String(path.Length + ConfigFileExtension.Length); + _identifier = identifierBuffer; _path = pathBuffer; configPathBuffer..Append(path).Append(ConfigFileExtension); diff --git a/GlitchyEditor/src/Assets/MaterialAssetLoader.bf b/GlitchyEditor/src/Assets/MaterialAssetLoader.bf index 3ad888a..7017ccb 100644 --- a/GlitchyEditor/src/Assets/MaterialAssetLoader.bf +++ b/GlitchyEditor/src/Assets/MaterialAssetLoader.bf @@ -5,11 +5,34 @@ using System.Collections; using System.IO; using GlitchyEngine; using GlitchyEngine.Renderer; +using ImGui; +using GlitchyEngine.Math; namespace GlitchyEditor.Assets; class MaterialAssetPropertiesEditor : AssetPropertiesEditor { + mixin DropAssetTarget() where T : Asset + { + Asset asset = null; + + if (ImGui.BeginDragDropTarget()) + { + ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM"); + + if (payload != null) + { + StringView fullpath = .((char8*)payload.Data, (int)payload.DataSize); + + asset = Content.LoadAsset(fullpath); + } + + ImGui.EndDragDropTarget(); + } + + asset + } + public this(AssetFile asset) : base(asset) { @@ -17,7 +40,146 @@ class MaterialAssetPropertiesEditor : AssetPropertiesEditor public override void ShowEditor() { + Material material = Asset.LoadedAsset as Material; + if (material == null) + return; + + Effect effect = material?.Effect; + + if (effect == null) + return; + + ShowTextures(material, effect); + + ShowVariables(material, effect); + } + + private void ShowTextures(Material material, Effect effect) + { + for (let texture in effect.Textures) + { + ImGui.Button(texture.key); + + if (ImGui.BeginDragDropTarget()) + { + ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM"); + + if (payload != null) + { + StringView path = .((char8*)payload.Data, (int)payload.DataSize); + + using (Texture2D newTexture = Content.LoadAsset(path))//new Texture2D(path, true)) + { + newTexture.SamplerState = SamplerStateManager.AnisotropicWrap; + material.SetTexture(texture.key, newTexture); + } + } + + ImGui.EndDragDropTarget(); + } + } + } + + private void ShowVariables(Material material, Effect effect) + { + bool TryGetValue(Dictionary parameters, String name, out Variant value) + { + if (parameters.TryGetValue(name, let param)) + { + value = param; + return true; + } + + value = ?; + + return false; + } + + for (let (name, arguments) in effect.[Friend]_variableDescriptions) + { + let variable = effect.Variables[name]; + + bool hasPreviewName = TryGetValue(arguments, "Preview", var previewName); + + StringView displayName = hasPreviewName ? previewName.Get() : name; + + bool hasPreviewType = TryGetValue(arguments, "Type", var previewType); + + if (hasPreviewType && previewType.Get() == "Color") + { + Log.EngineLogger.AssertDebug(variable.Type == .Float && variable.Rows == 1); + + if (variable.Columns == 3) + { + material.GetVariable(variable.Name, var value); + + value = (Vector3)ColorRGB.LinearToSRGB((ColorRGB)value); + + if (ImGui.ColorEdit3(displayName.Ptr, *(float[3]*)&value)) + { + value = (Vector3)ColorRGB.SRgbToLinear((ColorRGB)value); + material.SetVariable(variable.Name, value); + } + } + else if (variable.Columns == 4) + { + material.GetVariable(variable.Name, var value); + + value = (Vector4)ColorRGBA.LinearToSRGB((ColorRGBA)value); + + if (ImGui.ColorEdit4(displayName.Ptr, *(float[4]*)&value)) + { + value = (Vector4)ColorRGBA.SRgbToLinear((ColorRGBA)value); + material.SetVariable(variable.Name, value); + } + } + } + else if (variable.Type == .Float && variable.Rows == 1) + { + bool hasMin = TryGetValue(arguments, "Min", var min); + bool hasMax = TryGetValue(arguments, "Max", var max); + + for (int r < variable.Rows) + { + switch (variable.Columns) + { + case 1: + material.GetVariable(variable.Name, var value); + + float[1] minV = hasMin ? min.Get() : .(float.MinValue); + float[1] maxV = hasMax ? max.Get() : .(float.MaxValue); + + if (ImGui.EditVector<1>(displayName, ref *(float[1]*)&value, .(), 0.1f, 100.0f, minV, maxV)) + material.SetVariable(variable.Name, value); + case 2: + material.GetVariable(variable.Name, var value); + + Vector2 minV = hasMin ? min.Get() : .(float.MinValue); + Vector2 maxV = hasMax ? max.Get() : .(float.MaxValue); + + if (ImGui.EditVector2(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV)) + material.SetVariable(variable.Name, value); + case 3: + material.GetVariable(variable.Name, var value); + + Vector3 minV = hasMin ? min.Get() : .(float.MinValue); + Vector3 maxV = hasMax ? max.Get() : .(float.MaxValue); + + if (ImGui.EditVector3(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV)) + material.SetVariable(variable.Name, value); + case 4: + material.GetVariable(variable.Name, var value); + + Vector4 minV = hasMin ? min.Get() : .(float.MinValue); + Vector4 maxV = hasMax ? max.Get() : .(float.MaxValue); + + if (ImGui.EditVector4(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV)) + material.SetVariable(variable.Name, value); + } + } + } + } } public static AssetPropertiesEditor Factory(AssetFile assetFile) diff --git a/GlitchyEditor/src/EditWindows/ComponentEditWindow.bf b/GlitchyEditor/src/EditWindows/ComponentEditWindow.bf index 110eb5e..eaf34eb 100644 --- a/GlitchyEditor/src/EditWindows/ComponentEditWindow.bf +++ b/GlitchyEditor/src/EditWindows/ComponentEditWindow.bf @@ -285,9 +285,14 @@ namespace GlitchyEditor.EditWindows private static void ShowMeshRendererComponentEditor(Entity entity, MeshRendererComponent* meshRendererComponent) { - // TODO: Editing material options obviously shouldn't be part of the meshrenderer-ui + ImGui.TextUnformatted("Material:"); + ImGui.SameLine(); + + Material material = meshRendererComponent.Material; + + StringView identifier = material?.Identifier ?? "None"; + ImGui.Button(identifier.ToScopeCStr!()); - ImGui.Button("Drag Material here!"); if (ImGui.BeginDragDropTarget()) { ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM"); @@ -296,145 +301,21 @@ namespace GlitchyEditor.EditWindows { StringView fullpath = .((char8*)payload.Data, (int)payload.DataSize); - using (Material material = Content.LoadAsset(fullpath)) + using (Material loadedMaterial = Content.LoadAsset(fullpath)) { - meshRendererComponent.Material = material; + meshRendererComponent.Material = loadedMaterial; } } ImGui.EndDragDropTarget(); } - Material material = meshRendererComponent.Material; - - Effect effect = material?.Effect; + /*Effect effect = material?.Effect; if (effect == null) - return; + return;*/ - bool TryGetValue(Dictionary parameters, String name, out Variant value) - { - if (parameters.TryGetValue(name, let param)) - { - value = param; - return true; - } - - value = ?; - - return false; - } - - for (let texture in effect.Textures) - { - //ImGui.Text(texture.key); - ImGui.Button(texture.key); - - if (ImGui.BeginDragDropTarget()) - { - ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM"); - - if (payload != null) - { - Log.EngineLogger.Warning(""); - - StringView path = .((char8*)payload.Data, (int)payload.DataSize); - - using (Texture2D newTexture = Content.LoadAsset(path))//new Texture2D(path, true)) - { - newTexture.SamplerState = SamplerStateManager.AnisotropicWrap; - material.SetTexture(texture.key, newTexture); - } - } - - ImGui.EndDragDropTarget(); - } - } - - for (let (name, arguments) in effect.[Friend]_variableDescriptions) - { - let variable = effect.Variables[name]; - - bool hasPreviewName = TryGetValue(arguments, "Preview", var previewName); - - StringView displayName = hasPreviewName ? previewName.Get() : name; - - bool hasPreviewType = TryGetValue(arguments, "Type", var previewType); - - if (hasPreviewType && previewType.Get() == "Color") - { - Log.EngineLogger.AssertDebug(variable.Type == .Float && variable.Rows == 1); - - if (variable.Columns == 3) - { - material.GetVariable(variable.Name, var value); - - value = (Vector3)ColorRGB.LinearToSRGB((ColorRGB)value); - - if (ImGui.ColorEdit3(displayName.Ptr, *(float[3]*)&value)) - { - value = (Vector3)ColorRGB.SRgbToLinear((ColorRGB)value); - material.SetVariable(variable.Name, value); - } - } - else if (variable.Columns == 4) - { - material.GetVariable(variable.Name, var value); - - value = (Vector4)ColorRGBA.LinearToSRGB((ColorRGBA)value); - - if (ImGui.ColorEdit4(displayName.Ptr, *(float[4]*)&value)) - { - value = (Vector4)ColorRGBA.SRgbToLinear((ColorRGBA)value); - material.SetVariable(variable.Name, value); - } - } - } - else if (variable.Type == .Float && variable.Rows == 1) - { - bool hasMin = TryGetValue(arguments, "Min", var min); - bool hasMax = TryGetValue(arguments, "Max", var max); - - for (int r < variable.Rows) - { - switch (variable.Columns) - { - case 1: - material.GetVariable(variable.Name, var value); - - float[1] minV = hasMin ? min.Get() : .(float.MinValue); - float[1] maxV = hasMax ? max.Get() : .(float.MaxValue); - - if (ImGui.EditVector<1>(displayName, ref *(float[1]*)&value, .(), 0.1f, 100.0f, minV, maxV)) - material.SetVariable(variable.Name, value); - case 2: - material.GetVariable(variable.Name, var value); - - Vector2 minV = hasMin ? min.Get() : .(float.MinValue); - Vector2 maxV = hasMax ? max.Get() : .(float.MaxValue); - - if (ImGui.EditVector2(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV)) - material.SetVariable(variable.Name, value); - case 3: - material.GetVariable(variable.Name, var value); - - Vector3 minV = hasMin ? min.Get() : .(float.MinValue); - Vector3 maxV = hasMax ? max.Get() : .(float.MaxValue); - - if (ImGui.EditVector3(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV)) - material.SetVariable(variable.Name, value); - case 4: - material.GetVariable(variable.Name, var value); - - Vector4 minV = hasMin ? min.Get() : .(float.MinValue); - Vector4 maxV = hasMax ? max.Get() : .(float.MaxValue); - - if (ImGui.EditVector4(displayName, ref value, .Zero, 0.1f, 100.0f, minV, maxV)) - material.SetVariable(variable.Name, value); - } - } - } - } + // Show a preview of the material here! } private static void ShowRigidBody2DComponentEditor(Entity entity, Rigidbody2DComponent* rigidBodyComponent) @@ -580,7 +461,14 @@ namespace GlitchyEditor.EditWindows private static void ShowMeshComponentEditor(Entity entity, MeshComponent* meshComponent) { - ImGui.Button("Drag Mesh here!"); + ImGui.TextUnformatted("Mesh:"); + ImGui.SameLine(); + + GeometryBinding mesh = meshComponent.Mesh; + + StringView identifier = mesh?.Identifier ?? "None"; + ImGui.Button(identifier.ToScopeCStr!()); + if (ImGui.BeginDragDropTarget()) { ImGui.Payload* payload = ImGui.AcceptDragDropPayload("CONTENT_BROWSER_ITEM"); @@ -605,7 +493,7 @@ namespace GlitchyEditor.EditWindows meshComponent.Mesh = geometry; } - // TODO: support multiple primitives (treat every primitive as a single mesh?) + // TODO: support multiple primitives (treat every primitive as a single mesh? or: mesh can have multiple primitives) /*using (GeometryBinding binding = ModelLoader.LoadMesh(filePath, meshName, 0)) { meshComponent.Mesh = binding; diff --git a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf index d2c20f9..1df6c6a 100644 --- a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf +++ b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf @@ -197,6 +197,8 @@ namespace GlitchyEditor.EditWindows if (fullpath.StartsWith(_manager.ContentDirectory, .OrdinalIgnoreCase)) fullpath.Remove(0, _manager.ContentDirectory.Length); + Path.Fixup(fullpath); + ImGui.SetDragDropPayload("CONTENT_BROWSER_ITEM", fullpath.CStr(), (.)fullpath.Length, .Once); ImGui.EndDragDropSource(); diff --git a/GlitchyEditor/src/EditWindows/PropertiesWindow.bf b/GlitchyEditor/src/EditWindows/PropertiesWindow.bf index d10674c..c060a1c 100644 --- a/GlitchyEditor/src/EditWindows/PropertiesWindow.bf +++ b/GlitchyEditor/src/EditWindows/PropertiesWindow.bf @@ -12,6 +12,14 @@ class PropertiesWindow : EditorWindow { private AssetPropertiesEditor _currentPropertiesEditor ~ delete _; + private bool _lockCurrentAsset; + + private bool _selectedNewAsset; + + private append String _selectedFileName = .(); + + private Asset _currentAsset ~ _.ReleaseRef(); + public this(Editor editor) { _editor = editor; @@ -23,6 +31,10 @@ class PropertiesWindow : EditorWindow if(!ImGui.Begin("Properties", &_open, .None)) return; + // TODO: make a little button in title bar? + ImGui.Checkbox("Lock", &_lockCurrentAsset); + ImGui.Separator(); + ShowAssetProperties(); } @@ -30,9 +42,18 @@ class PropertiesWindow : EditorWindow /// @returns the AssetFile for the currently selected asset of null, if no file is selected. private AssetFile GetCurrentAssetFile() { - StringView selectedFileName = _editor.ContentBrowserWindow.SelectedFile; + // Only grab the currently selected file if we aren't locked + if (!_lockCurrentAsset) + { + StringView selectedInFileBrowser = _editor.ContentBrowserWindow.SelectedFile; - Result> treeNode = _editor.ContentManager.AssetHierarchy.GetNodeFromPath(selectedFileName); + if (_selectedFileName != selectedInFileBrowser) + { + _selectedFileName.Set(_editor.ContentBrowserWindow.SelectedFile); + } + } + + Result> treeNode = _editor.ContentManager.AssetHierarchy.GetNodeFromPath(_selectedFileName); if (treeNode case .Ok(let assetNode)) return assetNode->AssetFile; @@ -53,6 +74,13 @@ class PropertiesWindow : EditorWindow if (assetFile == null) return; + // We need the actual asset for preview and sometimes for editing + if (_currentAsset?.Identifier != assetFile.Identifier) + { + _currentAsset?.ReleaseRef(); + _currentAsset = _editor.ContentManager.LoadAsset(assetFile.Identifier); + } + // TODO: allow changing AssetLoader // assetFile.AssetConfig.AssetLoade @@ -63,6 +91,10 @@ class PropertiesWindow : EditorWindow ImGui.SetTooltip("If checked this file will be ignored and not treated as an asset.");*/ ShowPropertiesEditor(assetFile); + + ImGui.Separator(); + + // TODO: preview asset } private void ShowPropertiesEditor(AssetFile assetFile) diff --git a/GlitchyEditor/src/EditorContentManager.bf b/GlitchyEditor/src/EditorContentManager.bf index cf0778e..87a2dc9 100644 --- a/GlitchyEditor/src/EditorContentManager.bf +++ b/GlitchyEditor/src/EditorContentManager.bf @@ -234,7 +234,10 @@ class AssetHierarchy void HandleFile(AssetNode node) { - node.AssetFile = new AssetFile(_contentManager, node.Path, node.IsDirectory); + String identifier = scope .(node.Path.Length); + Path.GetRelativePath(node.Path, _contentDirectory, identifier); + + node.AssetFile = new AssetFile(_contentManager, identifier, node.Path, node.IsDirectory); } /// Determines the files that belong to the given directory and adds them to the tree. @@ -385,7 +388,9 @@ class AssetHierarchy if (!(nodeResult case .Ok(out node))) { - Log.EngineLogger.Error($"Could not find node for file \"{fileNameWithContentRoot}\""); + // This happens, when we create new files. + Log.EngineLogger.Trace($"Could not find node for file \"{fileNameWithContentRoot}\""); + return; } // Don't fire event for directories. @@ -592,7 +597,10 @@ class EditorContentManager : IContentManager Result> resultNode = AssetHierarchy.GetNodeFromPath(filePath); if (resultNode case .Err) - Runtime.FatalError(); + { + Log.EngineLogger.Error($"Could not find asset \"{filePath}\"."); + return null; + } //AssetFile file = scope .(this, filePath, false); AssetFile file = resultNode->Value.AssetFile; diff --git a/GlitchyEngine/src/Content/Asset.bf b/GlitchyEngine/src/Content/Asset.bf index 67a09fd..38a35fc 100644 --- a/GlitchyEngine/src/Content/Asset.bf +++ b/GlitchyEngine/src/Content/Asset.bf @@ -3,6 +3,7 @@ using System; using Bon; using Bon.Integrated; using System.Reflection; +using System.IO; namespace GlitchyEngine.Content; diff --git a/Sandbox/src/ExampleLayer.bf b/Sandbox/src/ExampleLayer.bf index 4652e67..0a832e8 100644 --- a/Sandbox/src/ExampleLayer.bf +++ b/Sandbox/src/ExampleLayer.bf @@ -91,7 +91,7 @@ namespace Sandbox //effectLibrary.LoadNoRefInc("content\\Shaders\\testShader.hlsl"); - var textureEffect = Content.LoadAsset("Shaders\\textureShader.hlsl"); + Effect textureEffect = Content.LoadAsset("Shaders\\textureShader.hlsl"); _depthTarget = new DepthStencilTarget(_context.SwapChain.Width, _context.SwapChain.Height); @@ -214,7 +214,7 @@ namespace Sandbox void TestLoadModel() { - var testEffect = Content.LoadAsset("Shaders\\testShader.hlsl");//Application.Get().EffectLibrary.Get("testShader"); + Effect testEffect = Content.LoadAsset("Shaders\\testShader.hlsl");//Application.Get().EffectLibrary.Get("testShader"); var materialTestMaterial = new Material(testEffect); animationMat = materialTestMaterial; @@ -266,7 +266,7 @@ namespace Sandbox _world.Register(); _world.Register(); - var basicEffect = Content.LoadAsset("Shaders\\basicShader.hlsl");//Application.Get().EffectLibrary.Get("basicShader"); + Effect basicEffect = Content.LoadAsset("Shaders\\basicShader.hlsl");//Application.Get().EffectLibrary.Get("basicShader"); testMaterial1 = new Material(basicEffect); testMaterial1.SetVariable("BaseColor", _squareColor0); @@ -352,7 +352,7 @@ namespace Sandbox RenderCommand.SetBlendState(_opaqueBlendState); - var basicEffect = Content.LoadAsset("Shaders\\basicShader.hlsl");//Application.Get().EffectLibrary.Get("basicShader"); + Effect basicEffect = Content.LoadAsset("Shaders\\basicShader.hlsl");//Application.Get().EffectLibrary.Get("basicShader"); RenderCommand.SetRasterizerState(_rasterizerState);