Author SHA1 Message Date
Simon Lübeß 5d8c1b111a Project user settings, load recent scenes, properly cleanup ScriptEngine when switching scenes 2023-07-31 20:09:56 +02:00
Simon Lübeß 3298053d9d Fixed Asset Drag'n'Drop 2023-07-31 20:07:12 +02:00
Simon Lübeß adccb74f44 Editor Layer cleanup 2023-07-31 18:48:36 +02:00
Simon Lübeß 97113b5df6 Start of Create Asset Context Menu
+ Asset Hierarchy: Fixed Assets in Folder-Root not being shown
2023-07-31 17:40:05 +02:00
Simon Lübeß c374d86ec7 Cleanup 2023-07-31 16:40:27 +02:00
Simon Lübeß 803fd7f8ba Fixed crash when ScriptComponent has no Instance in Play Mode 2023-07-31 16:36:02 +02:00
Simon Lübeß 11a57f5285 Fixed ComponentEditWindow showing component editor after it was deleted 2023-07-31 16:35:38 +02:00
Simon Lübeß 0d015b485e Basic project creation
+ Added TreeNode.RemoveChild
+ Added Directory.Copy
+ Path.Combine now replaces alt directory separator
+ Project: Renamed ProjectName to Name
+ Project.Load: Save settings, if file doesn't exist
2023-07-31 16:35:12 +02:00
Simon Lübeß 17e4a6a589 Updated Beef.Linq 2023-07-30 20:32:19 +02:00
Simon Lübeß c1a87ed946 Separated Assets to Resources (Engine assets) and Assets (Project specific)
+ AssetHierarchy: Exposed RootNode
+ ContentBrowserWindow: Fixed Empty Folder not being Leaf-Node
+ TreeNode: Added IsParentOf, IsChildOf and IsInSubtree.
    + Fixed InternalDeleteTreeAndChildren for null trees
2023-07-30 20:30:06 +02:00
Simon Lübeß 20dae92be7 Fixed Assets having scrollbars in content browser 2023-07-30 13:55:50 +02:00
Simon Lübeß df67f32399 Start of project system
+ added Directory.IsEmpty
2023-07-30 13:23:34 +02:00
Simon Lübeß 14a802d057 Added new line to EditorLogger 2023-07-30 13:21:33 +02:00
Simon Lübeß 12d6df3edf Fixed crash when AssetViewer has size of 0 (RTFM) 2023-07-29 18:54:45 +02:00
Simon Lübeß 2838449186 Ignore MonoDebugger.log 2023-07-28 21:15:23 +02:00
Simon Lübeß 75513bea3d Removed obsolete texture viewer 2023-07-28 21:09:33 +02:00
Simon Lübeß 16c3d7c44d Updated ImGui 2023-07-28 13:38:59 +02:00
Simon Lübeß 7ae069baf6 Fixed loading UI font 2023-07-28 12:26:15 +02:00
Simon Lübeß 00dc3faa19 Failed to show and edit script sctruct
+ SizeInBytes for MonoFields
2023-07-28 11:48:01 +02:00
Simon Lübeß f39acdadb3 Show enum fields in Edit mode 2023-07-28 00:07:10 +02:00
Simon Lübeß 1254d01545 Handle exceptions from C# Scripts + Log window + EditorLogger
+ Renamed Platform/DX11/ImGui.bf to .../Dx11ImGui.bf for clarity
+ ImGuiExtension: ImageButtonEx thata takes a TextureViewBinding
+ EditorLogger that logs to the LogWindow
+ Current logger can now be changed
+ Info, Trace, Warning and Error Icons
2023-07-27 21:58:42 +02:00
Simon Lübeß 0bc517842f Allow changing logger 2023-07-27 00:42:42 +02:00
Simon Lübeß 3e63281508 Fixed mono debugging... 2023-07-26 22:56:43 +02:00
Simon Lübeß ef486b7082 Basic entity highlighting 2023-07-25 19:37:13 +02:00
Simon Lübeß 81a61d5a90 Drag'n'drop for components
+ Added CreateInstance to ScriptClass
+ Added CreateComponentInstance to ScriptInstance
2023-07-25 16:37:41 +02:00
Simon Lübeß 37197cbdf1 Allow dragging and dropping of Entities in editor
+ New Dictionary Helpers
+ Made ImGui Payloads safer
+ Start of Component drag'n'drop
2023-07-24 23:17:00 +02:00
Simon Lübeß b53ed2d8f2 Made script deserialization more robust 2023-07-24 21:28:58 +02:00
Simon Lübeß 457b43352a Debugging, but it doesn't work for some reason 2023-07-21 16:16:24 +02:00
Simon Lübeß cc7fb7311f Added single step for simulation and play mode
+ Added ManualStepTime to GameTime
2023-07-20 23:21:21 +02:00
Simon Lübeß 5f27b8001a Automatic script assembly reloading 2023-07-20 22:11:11 +02:00
Simon Lübeß 0cbb8a4966 Fixed C# -> Beef Type mapping 2023-07-20 17:53:32 +02:00
Simon Lübeß 79adc70f01 Gitignores and missing updates to scripts 2023-07-20 17:51:06 +02:00
Simon Lübeß 78ba016b03 Log Exceptions in thrown by Script OnUpdate-Function 2023-07-20 17:48:50 +02:00
Simon Lübeß 3e55a1614a Shader like vectors for C# Scripting 2023-07-20 17:48:28 +02:00
Simon Lübeß f0de874572 Start of generate vectors for C# 2023-07-19 18:43:26 +02:00
Simon Lübeß 6e02a04a4f Changed ScriptCore to DotNet Standard 2.0 2023-07-19 15:45:36 +02:00
Simon Lübeß cd1562f372 Basic Script reloading
+ ScriptComponent now saves script name instead of direct ScriptClass reference
+ Added ClearDictionaryAndDeleteKeys helper
+ Moved ScriptFieldType to separate file
+ _ScriptFieldMap now uses String as Key
2023-07-18 22:06:34 +02:00
Simon Lübeß e8505f6bdb Scripting: FindEntityWithName and get script instance
+ Some C# UUID stuff
+ Added some Mono functions
+ ScriptEngine:
  + ID -> ScriptInstance map in ScriptEngine
  + GetManagedInstance

+ Fixed Scene not visible after loading a new scene
  + Renamed OnViewportResize to SetViewportSize for Scene and SceneRenderer
2023-07-17 20:27:18 +02:00
Simon Lübeß 66d66d3308 Serialize script fields in "array" + more forgiving deserialization 2023-07-17 04:04:01 +02:00
Simon Lübeß 88b393157a Make sure we always initialize with a scene 2023-07-17 04:00:30 +02:00
Simon Lübeß 28155ec92c Allow opening a scene on launch
+ don't resize on load/new scene
2023-07-17 02:19:49 +02:00
Simon Lübeß 1641bafd06 Don't instantiate scripts for Editor + ScriptComponent Serialzation + Don't crash when scene loading failed 2023-07-17 01:27:58 +02:00
Simon Lübeß 76bff3a6c1 Texture importer now supports mip maps 2023-07-06 17:06:59 +02:00
Simon Lübeß a507eeb1cd Kind of fixed a memory leak 2023-07-01 12:49:17 +02:00
Simon Lübeß 77c45db122 Replaced IntX by intX, Basic AssetViewer (can view Textures, kind of) 2023-07-01 00:15:01 +02:00
Simon Lübeß e12fcaacff Added Math min/max for float 2023-06-28 22:03:43 +02:00
Simon Lübeß b31d43820a Support emissive materials 2023-06-28 19:33:39 +02:00
Simon Lübeß 334c2c0366 Search in Content Browser (and added ForEach in TreeNode) 2023-06-28 19:27:52 +02:00
Simon Lübeß bb520b43ec Added support for Cube Textures, Improved dds import (and textures in general), Texture refactoring and DX11 DeviceContext synchronization 2023-06-25 17:58:16 +02:00
Simon Lübeß 46693666aa Fixed current directories context menu not opening
i.e. when right clicking the background of the current directory
2023-06-25 03:20:35 +02:00
Simon Lübeß 9e1f648aa0 Transitioned from VectorX to floatX
And some trying to update Rigidbody when transform changes
2023-06-25 02:47:33 +02:00
Simon Lübeß 5f5da2ed35 Moved vector type files 2023-06-25 01:11:06 +02:00
Simon Lübeß fa2277cd99 Start of shader like vectors + added 16 bit float 2023-06-24 23:45:56 +02:00
Simon Lübeß 54936d5744 Fixed crash when viewport size is negative 2023-06-24 13:07:07 +02:00
Simon Lübeß 04d69717a3 Automatically pull and build mono once + .gitignore 2023-06-18 21:03:59 +02:00
Simon Lübeß 3becc1e25b fixed Settings-File not being created and start of Recent-Projects-Menu 2023-06-18 16:05:03 +02:00
Simon Lübeß e8e6207bc1 Merge branch 'scripting' of github.com:aharabada/glitchy-engine-beef into scripting
# Conflicts:
#	GlitchyEngine/src/Scripting/ScriptClass.bf
#	GlitchyEngine/src/Scripting/ScriptEngine.bf
#	GlitchyEngine/src/Scripting/ScriptInstance.bf
#	GlitchyEngine/src/World/Scene.bf
#	GlitchyEngineHelper/src/Mono/Mono.bf
2023-06-18 14:33:28 +02:00
Simon Lübeß f4c5bf9c2d Added binding for mono_field_get_value_object 2023-06-18 14:24:26 +02:00
Simon Lübeß f4607a6210 Script default values after init, Fix memory leak, Copy Script values on Play 2023-05-31 14:38:07 +02:00
Simon Lübeß 6a59deb9e2 Weiß ich nicht, ist Monate her... 2023-05-30 16:54:57 +02:00
Simon Lübeß ac1817fe33 Weiß ich nicht, ist Monate her... 2023-05-30 16:52:27 +02:00
Simon Lübeß 5855b13873 Wer weiß, was ich alles so gemacht hatte...
- Fixed crash caused by early ScriptEngine shutdown
2023-05-30 16:50:22 +02:00
Simon Lübeß ef5e4ba64f Fixed ScriptClass leaking 2023-03-30 15:13:21 +02:00
Simon Lübeß 4fd9a924a0 Added basic component access in Scripts 2023-03-29 16:32:46 +02:00
Simon Lübeß e60d74fccd Basic entity scripting 2023-03-29 13:33:34 +02:00
Simon Lübeß 5e5134a607 Added Mono for C# scripting 2023-03-26 13:11:44 +02:00
Simon Lübeß fd6826785a Updated submodules again? 2023-03-25 13:24:50 +01:00
Simon Lübeß 43bcf01299 Merge branch 'asset_handle' into main 2023-03-25 13:20:40 +01:00
Simon Lübeß 81ae5f1135 Updated submodules 2023-03-25 13:19:59 +01:00
Simon Lübeß 0ee2f5fa9e Merge branch 'asset_handle' into main 2023-03-25 13:15:56 +01:00
Simon Lübeß b76d4cd558 Merge remote-tracking branch 'origin/asset_handle' into asset_handle 2023-03-25 13:04:52 +01:00
Simon Lübeß 5893cfb74a Refactor 2023-03-25 13:04:02 +01:00
Simon Lübeß ed952155b6 Refactor 2023-03-25 00:41:34 +01:00
Simon Lübeß d54cdf43ee Simulation mode and pause/resume 2023-03-24 23:50:46 +01:00
Simon Lübeß f16fbc3984 Separated window for game and editor 2023-03-24 22:48:55 +01:00
Simon Lübeß 184480243f Collider rendering 2023-03-24 19:13:32 +01:00
Simon Lübeß fc1875ed96 Added Line batch rendering 2023-03-24 12:54:46 +01:00
Simon Lübeß 5733166b74 Fixed uint render targets always being cleared to zero 2023-03-19 12:49:12 +01:00
Simon Lübeß 2ba4b68e09 Split up sprite and circle renderer component 2023-03-19 12:19:22 +01:00
Simon Lübeß edcec02e94 Fixed AssetHandle serialization
- Serialize MeshComponents
- Fixed handling renamed files
2023-03-19 01:04:32 +01:00
Simon Lübeß c164aeecaa Copy scene when entering play mode 2023-03-18 23:30:57 +01:00
Simon Lübeß 793aa40975 Add up button und split scrolling in content browser
- Add Parent to TreeNode
- Start of Rename handling
2023-03-18 19:59:56 +01:00
Simon Lübeß 50714976e9 Start of async asset loading
- Refactored content manager and asset loaders
- Asset placeholder
- Error asset
2023-03-18 18:59:30 +01:00
Simon Lübeß 7b6662cbc4 Fixed Textures in Materials 2023-03-16 23:32:02 +01:00
Simon Lübeß cfa046d2ea Refactored EditorContentManager 2023-03-16 23:31:19 +01:00
Simon Lübeß b22f73a156 Handles barely work now, mostly no crashes 2023-03-16 17:57:23 +01:00
Simon Lübeß c3fb9bbd5d More asset handles 2023-03-13 20:35:36 +01:00
Simon Lübeß c22d122921 Start of asset handles 2023-03-13 20:35:30 +01:00
Simon Lübeß ad14c9f6ed AssetHandle Code snippets for design reference 2023-03-13 15:56:31 +01:00
Simon Lübeß 2ce357cd12 Basic material serialisation 2023-03-05 16:38:50 +01:00
Simon Lübeß 2324ae852d 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
2023-01-08 20:31:43 +01:00
Simon Lübeß d3d284256c Fixed WorldEnumerator crashes if one of the components doesn't exist 2023-01-08 20:29:06 +01:00
Simon Lübeß e38373dccf Serialize Mesh and MeshRenderer in scene + fixed Light serialization 2023-01-08 19:31:01 +01:00
Simon Lübeß b5ca86d8de Fixed scope of full path 2023-01-08 16:48:38 +01:00
Simon Lübeß 4589030da6 Load effects via content manager + virtual InitContentManager in App 2023-01-08 00:17:04 +01:00
Simon Lübeß 3da60355df Model and Material loading via content manager 2023-01-07 12:15:14 +01:00
Simon Lübeß ee30920b56 Crappy hot reloading of textures and Properties editor for textures 2023-01-03 22:21:26 +01:00
Simon Lübeß 427323744b Fixed Sampler State filters + Documentation 2023-01-03 22:18:43 +01:00
Simon Lübeß 9d97579857 More content browser stuff
- Seperate AssetHierarchy from EditorContentManager
- Make files selectable and context menu
2023-01-02 20:00:48 +01:00
Simon Lübeß fdf680508d Don't recreate the entire asset tree 2023-01-01 18:25:36 +01:00
Simon Lübeß 0b3f242082 Added Submodule "Beef.Linq" 2023-01-01 18:18:27 +01:00
Simon Lübeß 502cee47e7 EditorContentManager Part 2 2023-01-01 16:53:58 +01:00
Simon Lübeß c389a77274 EditorContentManager Part 1 2023-01-01 16:53:45 +01:00
Simon Lübeß dffd43a36f RenderAPI changes and removed Context parameter from Effect and Material 2022-11-27 17:18:16 +01:00
Simon Lübeß d47ac23e1b Raw Input and some ImGuiExtension changes 2022-11-26 15:24:33 +01:00
Simon Lübeß 8f22cbb8bc Fixed circle rendering and added 2D circle collider 2022-11-26 12:17:31 +01:00
Simon Lübeß 0155a38ae6 UUID 2022-11-16 13:09:26 +01:00
Simon Lübeß a42544f171 2D Physics 2022-10-08 16:56:15 +02:00
Simon Lübeß 202083930a Play Button 2022-10-06 16:33:33 +02:00
Simon Lübeß 6958d27c30 Fixed editor camera for real 2022-09-29 16:39:58 +02:00
Simon Lübeß f8544c8f64 Updated imgui 2022-09-28 22:02:37 +02:00
Simon Lübeß e95c5731b6 Basic Model drag'n'drop 2022-09-27 20:24:03 +02:00
Simon Lübeß 3ec537762a Overload '->' operator for TreeNode 2022-09-27 00:01:05 +02:00
Simon Lübeß e035832ab0 Fixed mouse wrapping when scene viewport is inactive 2022-09-27 00:00:17 +02:00
Simon Lübeß 0f1eddad5f Updated submodule DirectX 2022-09-07 18:28:40 +02:00
Simon Lübeß d2dca12d0c Use corrent RefCounter 2022-08-19 20:01:05 +02:00
Simon Lübeß 0588a93ec4 Use ACES tone mapping 2022-08-18 14:03:33 +02:00
Simon Lübeß 42e386a142 Fixed component name 2022-08-18 13:51:40 +02:00
Simon Lübeß 21c8d839ef Fixed mouse picking 2022-08-18 13:51:12 +02:00
Simon Lübeß bc1f466d18 Drag drop Texture 2022-08-13 13:47:58 +02:00
Simon Lübeß 8495c6db28 Drag Texture 2022-07-26 08:00:17 +02:00
Simon Lübeß bff4418b84 Content browser 2022-07-25 17:03:28 +02:00
Simon Lübeß 0339ae4422 Adjust to fix in beef mixins 2022-06-15 15:31:44 +02:00
Simon Lübeß eb03eca4dd Manual constant buffer binding 2022-06-13 14:10:54 +02:00
Simon Lübeß a926ef4af2 Updated gltf 2022-06-13 13:26:04 +02:00
Simon Lübeß 866353a157 Refactored Effects + start of EngineBuffers (I hate it) 2022-06-07 13:12:03 +02:00
Simon Lübeß a80018e80c Removed redundant Point struct and SceneViewport improvements
- Keyboard shortcuts for Gizmo control
- Improved mousepick-blocking
2022-06-02 12:17:57 +02:00
Simon Lübeß e41645e12a Composit Target and gamma correct rendering 2022-05-31 22:41:20 +02:00
Simon Lübeß 8db2ce1d05 Mouse picking 2022-05-30 14:06:52 +02:00
Simon Lübeß 47fdce0a7e Triangle fullscreen quad 2022-05-28 15:53:35 +02:00
Simon Lübeß d212576719 Render EntityIDs (breaks post processing) 2022-05-28 15:42:48 +02:00
Simon Lübeß 164d420a25 DX11: Automatically validate input layouts against vertex shaders 2022-05-26 11:27:02 +02:00
Simon Lübeß 28f1fad464 RenderTargetGroup GetData, Shader uint support 2022-05-25 22:00:11 +02:00
Simon Lübeß 1418063d68 RenderTargetGroup 2022-05-20 18:37:59 +02:00
Simon Lübeß 4cd0bff91d Fixed editorcamera stuttering, Added editor icons 2022-05-18 14:12:26 +02:00
Simon Lübeß 5d8a4ad3a7 Editor camera and Editor/Runtime scene update separation 2022-05-17 19:06:28 +02:00
Simon Lübeß ccea61fb79 Updated bon 2022-05-16 19:23:45 +02:00
Simon Lübeß de3da8ded8 Gizmo angle snapping 2022-05-16 10:11:33 +02:00
Simon Lübeß 62bb5baac9 Gizmo improvements 2022-05-15 14:36:07 +02:00
Simon Lübeß 3956080520 Start of serializaation
- Allow enumerating over unregistered components
- Refactored Editor a bit
2022-05-14 23:01:08 +02:00
Simon Lübeß 1d3d30f88d Desketchified DX11 shader binding 2022-05-13 15:13:09 +02:00
Simon Lübeß b1a1268319 Terrible postprocessing and start of Editor GUI for lights 2022-05-11 22:49:36 +02:00
Simon Lübeß 56e92a7d67 Added Lights 2022-05-11 11:39:59 +02:00
Simon Lübeß f4c9dd8ade MeshRendererComponentEditor
- Explicit conversion from VectorX to float[X]
- Expose "Columns" and "Rows" properties of BufferVariable
- Effects: VariableDescriptors
2022-05-10 22:29:40 +02:00
Simon Lübeß 2e0cc289df Material.GetVariable and (maybe) fixed SetVariable for Matrix3x3 2022-05-10 22:06:07 +02:00
Simon Lübeß 336e52fbac Fix Modelloader 2022-05-10 11:48:16 +02:00
Simon Lübeß f527af13c3 EnsureTypeMatch speedup 2022-05-09 22:58:22 +02:00
Simon Lübeß fe0d5fa529 More profiling 2022-05-09 22:53:48 +02:00
Simon Lübeß b37b1b4bf9 UnbindTexture, PBR changes, Test scene 2022-05-09 22:11:46 +02:00
Simon Lübeß 3c2c37b270 Shader #include + Remved unused Dx11Effect 2022-05-09 18:19:24 +02:00
Simon Lübeß dc235399c8 Start of PBR 2022-05-09 16:45:16 +02:00
Simon Lübeß 2817c5b1a1 Start of 3d renderer integration 2022-05-04 18:38:59 +02:00
Simon Lübeß 412d0ea965 Fixed release build and automatic compiling of CPP Helper 2022-05-04 18:34:56 +02:00
Simon Lübeß 9e23ac0fcf Removed dangling DXTK-project dependencie 2022-05-04 18:33:43 +02:00
Simon Lübeß a43572817d Vector tweaks 2022-05-04 17:46:15 +02:00
Simon Lübeß 805423a64e Rendertarget inherits from texture 2022-05-04 14:53:31 +02:00
Simon Lübeß 9c93ccee47 Removed redundant submodule-entry 2022-04-13 12:32:42 +02:00
Simon Lübeß f1ce63ee3b Removed submodule GlitchyEngine/vendor/DirectXTK 2022-04-13 00:01:05 +02:00
Simon Lübeß e685b4fbba Added DirectXTK to GlitchyEngineHelper 2022-04-13 00:00:41 +02:00
Simon Lübeß 9105c12e33 Added buildcommand 2022-04-12 14:32:00 +02:00
Simon Lübeß 863c264001 UI Tweaks, ChildEnumerator, ComponentAdded-Handlers 2022-04-12 00:48:20 +02:00
Simon Lübeß bec202e23a Settings / SettingsWindow 2022-04-10 13:12:09 +02:00
Simon Lübeß bca72cf0d4 Add / Remove Components 2022-04-10 12:18:43 +02:00
Simon Lübeß af37154071 Better Transform component and edit gui 2022-04-09 12:35:36 +02:00
Simon Lübeß c7fde476e8 Updated DX11 Bindings 2022-04-09 12:34:28 +02:00
Simon Lübeß 604e34a12a Start of ContentManager 2022-04-09 12:34:09 +02:00
Simon Lübeß b94c84d304 GlitchyEngineHelper project 2022-04-09 12:33:05 +02:00
Simon Lübeß d47bc37886 SpriteRenderer Editor, enabled alpha-blending and depth 2022-04-02 00:10:00 +02:00
Simon Lübeß c13b0a26d1 Overhauled component editors 2022-04-01 23:29:35 +02:00
Simon Lübeß e82f70ba02 Native scripting 2022-03-03 01:39:04 +01:00
Simon Lübeß cbee9f59d8 Many ecs, component and editor changes 2022-03-02 01:59:51 +01:00
Simon Lübeß afe36b19df Removed unnecessary "override extern"s 2022-03-02 01:57:04 +01:00
Simon Lübeß 9197a209d6 Ecs changes
- BitArray has always at least sizeof(uint) bits
- Renamed Entity to EcsEntity
- Added value parameter to EcsWorld.AssignComponent
- Matched EcsWorld generic parameters
- Added Scene
- Added Entity
2022-02-28 23:34:52 +01:00
Simon Lübeß ba5ccd7107 Editor window 2022-02-28 18:08:13 +01:00
Simon Lübeß c80ca4d9a1 Cleaned up DX11 report 2022-02-28 12:13:44 +01:00
Simon Lübeß 92fd8bb572 Removed Bind from Texture 2022-02-27 12:30:09 +01:00
Simon Lübeß b341c70a26 Editor changes
- Updated Renderer2D shaders
- Fixed scene viewport having resolution
- Show Grid even if no entity is selected
- Explicit conversion from ImGui.VecX <-> VectorX
- Simplified EditorLayer
2022-02-27 12:21:30 +01:00
Simon Lübeß 8c8f0d9fc7 Basic tilemap 2022-02-26 18:05:56 +01:00
Simon Lübeß 8638b7ac3b ImGuiLayer cleanup 2022-02-26 18:05:47 +01:00
Simon Lübeß be7c3d1d8b Subtextures 2022-02-23 13:41:59 +01:00
Simon Lübeß 699522ff67 Fixed textureviewer 2022-02-22 20:18:37 +01:00
Simon Lübeß 6f999da1b8 Fixed fallback font rendering 2022-02-22 20:18:06 +01:00
Simon Lübeß 373980d5ad SwizzleVectorAttribute no longer generates invalid setters 2022-02-21 17:06:48 +01:00
Simon Lübeß 0db85de067 Release build fixes + ImGui build flag
Fonts still not working
2022-02-18 16:03:24 +01:00
Simon Lübeß fae2bdf084 Updated submodules
Updated submodule GlitchyEngine/vendor/imgui
Updated submodule GlitchyEngine/vendor/msdfgen
2022-02-17 01:12:02 +01:00
Simon Lübeß 0f0afc2a90 Renderer2D improvements + stats 2022-02-16 20:44:31 +01:00
Simon Lübeß 66dad82dc6 Added ColorHSV 2022-02-14 20:40:50 +01:00
Simon Lübeß 0e684af17d Added Window.SetIcon 2022-02-14 20:38:01 +01:00
Simon Lübeß 82898f1d5c Added DeltaTime 2022-02-14 20:37:31 +01:00
370 changed files with 39957 additions and 4574 deletions
+4
View File
@@ -5,3 +5,7 @@ build/
recovery/
vendor/directx
imgui.ini
GlitchyEditor/resources/scripts/ScriptCore.dll
GlitchyEditor/resources/scripts/ScriptCore.pdb
GlitchyEditor/settings.bon
GlitchyEditor/MonoDebugger.log
+16 -7
View File
@@ -1,15 +1,9 @@
[submodule "GlitchyEngine/vendor/directx"]
path = GlitchyEngine/vendor/directx
url = https://github.com/aharabada/directx-beef.git
[submodule "GlitchyEngine/vendor/DirectXTK"]
path = GlitchyEngine/vendor/DirectXTK
url = https://github.com/aharabada/DirectXTK-beef.git
[submodule "vendor/lodepng-beef"]
path = vendor/lodepng-beef
url = https://github.com/aharabada/lodepng-beef.git
[submodule "GlitchyEngine\\vendor\\freetype"]
path = GlitchyEngine\\vendor\\freetype
url = https://github.com/aharabada/FreeType-beef.git
[submodule "GlitchyEngine/vendor/freetype"]
path = GlitchyEngine/vendor/freetype
url = https://github.com/aharabada/FreeType-beef.git
@@ -21,4 +15,19 @@
url = https://github.com/aharabada/msdfgen-beef.git
[submodule "GlitchyEngine/vendor/imgui"]
path = GlitchyEngine/vendor/imgui
url = https://github.com/aharabada/ImGui_GlitchyEngine.git
url = https://github.com/aharabada/ImGui_GlitchyEngine.git
[submodule "GlitchyEngineHelper/vendor/xxHash"]
path = GlitchyEngineHelper/vendor/xxHash
url = https://github.com/Cyan4973/xxHash.git
[submodule "GlitchyEngine/vendor/bon"]
path = GlitchyEngine/vendor/bon
url = https://github.com/EinScott/bon.git
[submodule "GlitchyEngineHelper/vendor/DirectXTK"]
path = GlitchyEngineHelper/vendor/DirectXTK
url = https://github.com/microsoft/DirectXTK.git
[submodule "GlitchyEngine/vendor/box2D"]
path = GlitchyEngine/vendor/box2D
url = https://github.com/jazzbre/box2d-beef.git
[submodule "GlitchyEngine/vendor/Beef.Linq"]
path = GlitchyEngine/vendor/Beef.Linq
url = https://github.com/aharabada/Beef.Linq.git
+7 -2
View File
@@ -1,5 +1,10 @@
FileVersion = 1
Projects = {Sandbox = {Path = "Sandbox"}, GlitchyEngine = {Path = "GlitchyEngine"}, GlitchLog = {Path = "GlitchLog"}, DirectX = {Path = "GlitchyEngine/vendor/directx/DirectX"}, DirectXTK = {Path = "GlitchyEngine/vendor/DirectXTK/DirectXTK-beef"}, LodePng = {Path = "vendor/lodepng-beef/lodepng-beef"}, FreeType = {Path = "GlitchyEngine/vendor/freetype"}, cgltf-beef = {Path = "GlitchyEngine/vendor/gltf/cgltf-beef"}, GlitchyEditor = {Path = "GlitchyEditor"}, msdfgen-beef = {Path = "GlitchyEngine/vendor/msdfgen/msdfgen-beef"}, ImGui = {Path = "GlitchyEngine/vendor/imgui/ImGui"}, ImGuiImplDX11 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplDX11"}, ImGuiImplWin32 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplWin32"}, ImGuizmo = {Path = "GlitchyEngine/vendor/imgui/ImGuizmo"}}
Projects = {Sandbox = {Path = "Sandbox"}, GlitchyEngine = {Path = "GlitchyEngine"}, GlitchLog = {Path = "GlitchLog"}, DirectX = {Path = "GlitchyEngine/vendor/directx/DirectX"}, LodePng = {Path = "vendor/lodepng-beef/lodepng-beef"}, FreeType = {Path = "GlitchyEngine/vendor/freetype"}, cgltf-beef = {Path = "GlitchyEngine/vendor/gltf/cgltf-beef"}, GlitchyEditor = {Path = "GlitchyEditor"}, msdfgen-beef = {Path = "GlitchyEngine/vendor/msdfgen/msdfgen-beef"}, ImGui = {Path = "GlitchyEngine/vendor/imgui/ImGui"}, ImGuiImplDX11 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplDX11"}, ImGuiImplWin32 = {Path = "GlitchyEngine/vendor/imgui/ImGuiImplWin32"}, ImGuizmo = {Path = "GlitchyEngine/vendor/imgui/ImGuizmo"}, GlitchyEngineHelper = {Path = "GlitchyEngineHelper"}, bon = {Path = "GlitchyEngine/vendor/bon"}, box2d-beef = {Path = "GlitchyEngine/vendor/box2D"}, "Beef.Linq" = {Path = "GlitchyEngine/vendor/Beef.Linq/src"}, ScriptCore = {Path = "ScriptCore"}}
Unlocked = ["corlib"]
WorkspaceFolders = {GlitchyEngine = ["GlitchyEngine", "GlitchLog", "GlitchyEngineHelper", "ScriptCore"], "GlitchyEngine/Dependencies" = ["cgltf-beef", "DirectX", "FreeType", "ImGui", "ImGuiImplDX11", "ImGuiImplWin32", "ImGuizmo", "LodePng", "msdfgen-beef", "bon", "box2d-beef", "Beef.Linq"]}
[Workspace]
StartupProject = "Sandbox"
StartupProject = "GlitchyEditor"
[Configs.Debug.Win64]
AllocStackTraceDepth = 12
@@ -0,0 +1,92 @@
///
/// Loading and usage of an asset.
///
// Shows the usage of the Content Manager.
// An asset is loaded with Content.LoadAsset(AssetName)
// Loading an asset returns an AssetHandle.
// Usually you want to hold on to the AssetHandle.
// If you need the actual asset you can use Content.GetAsset<AssetType>(AssetHandle) to retrieve the actual asset.
/*
* Only hold on to AssetHandle.
* Do NOT hold actual Assets! The Asset might get invalidated
* (e.g. reloading after the source-file changed).
*/
AssetHandle _lineEffect;
void Start()
{
/*
* Loading an asset returns a handle to that asset.
*/
_lineEffect = Content.LoadAsset("Shaders\\LineEffect.hlsl");
}
void Update()
{
// Use case 1:
{
// Retrieve the actual asset. Note that this Asset is only guaranteed to persist
// for the current frame.
Effect fx = Content.GetAsset<Effect>(_lineEffect);
// Note: Assets are ref counted, however since they are not inteded to be held GetAsset
// does NOT increment the reference counter so you usually should NOT decrement it.
// The exception is when you manually hold on to an asset (see Example below)
// Use asset
fx.Variables["ViewProjection"].SetData(viewProjection * transform);
fx.Variables["Color"].SetData(color);
fx.ApplyChanges();
fx.Bind();
}
// Use case 2:
{
// Retrieve the actual asset.
Effect fx = _lineEffect.Get<Effect>();
// ...
// Same as case 1
}
}
///
/// Holding on to an actual asset.
///
// Shows the usage of the Content Manager when you hold a reference to the actual Asset instead of the handle.
// This should usually not be done. Eventhough it is technically fine, it has the implication, that if the
// content manager decides to reload the asset the changes will not be reflected in the held reference
// (which they would if you used GetAsset before every usage.)
// Also the content manager can't unload the asset because the reference counter wouldn't be zero.
// Though there currently is no way for the content manager to unload an asset unless it is specifically told to do so.
/*
* Field to hold the asset.
*/
Effect _lineEffect;
void Start()
{
// Load the Asset.
AssetHandle handle = Content.LoadAsset("Shaders\\LineEffect.hlsl");
// Get the actual asset.
_lineEffect = Content.GetAsset<Effect>(handle); // Alternative: _lineEffect = handle.Get<Effect>();
// Increment the reference counter so that the asset doesn't get unloaded.
_lineEffect.AddRef();
}
void Destroy()
{
// Make sure to release the asset once you don't need it anymore. Otherwise it will leak.
_lineEffect.Release();
}
void Update()
{
_lineEffect.Variables["ViewProjection"].SetData(viewProjection * transform);
_lineEffect.Variables["Color"].SetData(color);
_lineEffect.ApplyChanges();
_lineEffect.Bind();
}
@@ -0,0 +1,44 @@
///
/// This shows the usage of a smart/typed Asset Handle.
///
// In the basic usage-patterns the user has two options:
// Either he/she holds a handle and has to query for the actual asset every time
// or he/she hold the actual asset and loses reloading capabilities.
// The idea of the auto asset is to provide a way that can provide both.
AssetHandle<Effect> _lineEffect;
void Start()
{
/*
* Loading an asset returns a handle to that asset.
* The asset handle is implicitly converted to a smart AssetHandle.
*/
_lineEffect = Content.LoadAsset("Shaders\\LineEffect.hlsl");
}
void Update()
{
// Use case 1 (Convenience)
{
_lineEffect.Variables["ViewProjection"].SetData(viewProjection * transform);
_lineEffect.Variables["Color"].SetData(color);
_lineEffect.ApplyChanges();
_lineEffect.Bind();
}
// Use case 2 (Technically more efficient)
{
Effect fx = _lineEffect.Get();
fx.Variables["ViewProjection"].SetData(viewProjection * transform);
fx.Variables["Color"].SetData(color);
fx.ApplyChanges();
fx.Bind();
}
}
//
// Auto Assets use comp time to expose all the fields, Methods and properties of the actual asset.
// They will automatically check if the asset for the handle changed and update accordingly.
// This means it is more convenient to use than both basic patterns and has all benefits of both.
//
+3
View File
@@ -0,0 +1,3 @@
# Design Code Examples
This directory (and its subdirectories) contains non functional code snippets showing the intended usage of certain systems of the engine.
+3
View File
@@ -5,3 +5,6 @@ Dependencies = {corlib = "*", GlitchLog = "*", GlitchyEngine = "*"}
Name = "GlitchyEditor"
TargetType = "BeefGUIApplication"
StartupObject = "GlitchyEngine.Program"
[Configs.Debug.Win64]
DebugCommandArguments = "\"D:\\Development\\Projects\\Beef\\GlitchyEngine\\GlitchyEditor\\SandboxProject\""
+1
View File
@@ -0,0 +1 @@
project_user.bon
Binary file not shown.
@@ -0,0 +1,4 @@
{
AssetLoader = "ModelAssetLoader",
Config = (GlitchyEditor.Assets.ModelAssetLoaderConfig){}
}
@@ -0,0 +1,4 @@
{
AssetLoader = "ModelAssetLoader",
Config = (GlitchyEditor.Assets.ModelAssetLoaderConfig){}
}
@@ -0,0 +1,224 @@
{
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 = "Assets/Models/sphere.glb"
},
MeshRendererComponent = {
Material = "Assets/Textures/TestMaterial.mat"
}
},
{
Id = 17158420331978163131,
NameComponent = {
Name = "Light"
},
TransformComponent = {
Position = {
X = -1,
Y = 4,
Z = -4
},
Rotation = {
X = 0.614328027,
Y = 0.23977606,
Z = 0.0315669999,
W = 0.751073778
},
Scale = {
X = 0.999998808,
Y = 1,
Z = 1.00000095
},
EditorEulerRotation = {
X = 1.30899811,
Y = 0.349065989,
Z = 0.349065989
}
},
LightComponent = {
LightType = .Directional,
Illuminance = 10,
Color = {
R = 1,
G = 0.991771996,
B = 0.74086231
}
}
},
{
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 = "Assets/Models/plane.glb"
},
MeshRendererComponent = {
Material = "Assets/Textures/TestMaterial.mat"
}
},
{
Id = 3947673900993587516,
NameComponent = {
Name = "Camera"
},
TransformComponent = {
Position = {
X = 0,
Y = 2,
Z = -5
},
Rotation = {
X = 0.216440007,
Y = 0,
Z = 0,
W = 0.976296008
},
Scale = {
X = 1,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0.436332017,
Y = 0,
Z = 0
}
},
CameraComponent = {
Primary = true,
ProjectionType = .InfinitePerspective,
PerspectiveFovY = 1.30899692,
PerspectiveNearPlane = 0.100000001,
PerspectiveFarPlane = 10000,
OrthographicHeight = 10,
OrthographicNearPlane = 0,
OrthographicFarPlane = 10,
AspectRatio = 1.87453413,
FixedAspectRatio = false
}
},
{
Id = 420718992779301759,
NameComponent = {
Name = "Entity"
},
TransformComponent = {
Position = {
X = 3,
Y = 0.501076996,
Z = -0.669378757
},
Rotation = {
X = 0.18301262,
Y = -0.683013558,
Z = 0.683012187,
W = 0.183013007
},
Scale = {
X = 1,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 1.57079458,
Y = -2.61799288,
Z = 0
}
},
MeshComponent = {
Mesh = ""
},
MeshRendererComponent = {
Material = ""
}
},
{
Id = 8080288871271083510,
NameComponent = {
Name = "Rocket"
},
TransformComponent = {
Position = {
X = 2.37353563,
Y = 0.629615188,
Z = -1.34831977
},
Rotation = {
X = 0.270598024,
Y = -0.65328151,
Z = 0.65328151,
W = 0.270598054
},
Scale = {
X = 0.999999821,
Y = 0.999999762,
Z = 0.999999702
},
EditorEulerRotation = {
X = 1.57079649,
Y = -2.35619426,
Z = 8.94069601e-08
}
},
MeshComponent = {
Mesh = "Assets/Models/plane.glb"
},
MeshRendererComponent = {
Material = "Assets/Textures/RocketMaterial.mat"
}
}
]
}
@@ -0,0 +1,212 @@
{
Name = "Scene name here pls!!!",
Entities = [
{
Id = 6000868443984780499,
NameComponent = {
Name = "Child"
},
SpriterRendererComponent = {
Color = {
R = 1,
G = 0.388184,
B = 0.090109,
A = 1
},
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
ParentId = 820806682740348099,
Position = {
X = 0,
Y = 0.75,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = 0,
W = 1
},
Scale = {
X = 0.5,
Y = 0.5,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0
}
}
},
{
Id = 820806682740348099,
NameComponent = {
Name = "Quad"
},
SpriterRendererComponent = {
Color = {
R = 0,
G = 0.551178,
B = 0.328787,
A = 1
},
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = 0,
Y = 2,
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
}
},
Rigidbody2D = {
BodyType = .Dynamic,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0,
RestitutionThreshold = 0.5
}
},
{
Id = 15398726361722237419,
NameComponent = {
Name = "Floor"
},
SpriterRendererComponent = {
Color = {
R = 1,
G = 0.941886,
B = 0.401485,
A = 1
},
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = 0,
Y = -0.5,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = 0,
W = 1
},
Scale = {
X = 10,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0
}
},
Rigidbody2D = {
BodyType = .Static,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0,
RestitutionThreshold = 0.5
}
},
{
Id = 1491484622542812645,
NameComponent = {
Name = "Camera"
},
TransformComponent = {
Position = {
X = 0,
Y = 1,
Z = -5
},
Rotation = {
X = 0,
Y = 0,
Z = 0,
W = 1
},
Scale = {
X = 1,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0
}
},
CameraComponent = {
Primary = true,
ProjectionType = .InfinitePerspective,
PerspectiveFovY = 1.308997,
PerspectiveNearPlane = 0.1,
PerspectiveFarPlane = 10000,
OrthographicHeight = 10,
OrthographicNearPlane = 0,
OrthographicFarPlane = 10,
AspectRatio = 2.116827,
FixedAspectRatio = false
}
}
]
}
@@ -0,0 +1,505 @@
{
Name = "Scene name here pls!!!",
Entities = [
{
Id = 820806682740348099,
NameComponent = {
Name = "Quad"
},
SpriteRendererComponent = {
Color = {
R = 0,
G = 0.55117774,
B = 0.32878688,
A = 1
},
Sprite = "Assets/Textures/TestMat/rustediron2_albedo.png",
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = -0.72789681,
Y = 2,
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
}
},
Rigidbody2D = {
BodyType = .Dynamic,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0,
RestitutionThreshold = 0.5
}
},
{
Id = 15398726361722237419,
NameComponent = {
Name = "Floor"
},
SpriteRendererComponent = {
Color = {
R = 1,
G = 0.941887021,
B = 0.401484489,
A = 1
},
Sprite = "",
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = 0,
Y = -0.5,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = 0,
W = 1
},
Scale = {
X = 10,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0
}
},
Rigidbody2D = {
BodyType = .Static,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0,
RestitutionThreshold = 0.5
}
},
{
Id = 1491484622542812645,
NameComponent = {
Name = "Camera"
},
TransformComponent = {
Position = {
X = 0,
Y = 1,
Z = -5
},
Rotation = {
X = 0,
Y = 0,
Z = 0,
W = 1
},
Scale = {
X = 1,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0
}
},
CameraComponent = {
Primary = true,
ProjectionType = .InfinitePerspective,
PerspectiveFovY = 1.30899692,
PerspectiveNearPlane = 0.100000001,
PerspectiveFarPlane = 10000,
OrthographicHeight = 10,
OrthographicNearPlane = 0,
OrthographicFarPlane = 10,
AspectRatio = 2.05582929,
FixedAspectRatio = false
},
ScriptComponent = {
ScriptClass = "Sandbox.Camera",
Fields = [
DistanceFromPlayer = (Float)-7,
DontFollowRadius = (Float)3
] }
},
{
Id = 15710354273720487680,
NameComponent = {
Name = "Player"
},
CircleRendererComponent = {
Color = {
R = 1,
G = 0,
B = 0,
A = 1
},
InnerRadius = 0.300000012,
Sprite = "",
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = -0.121203206,
Y = 0.660161078,
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
}
},
Rigidbody2D = {
BodyType = .Dynamic,
FixedRotation = false
},
CircleCollider2D = {
Offset = {
X = 0,
Y = 0
},
Radius = 0.5,
Density = 1,
Friction = 0.5,
Restitution = 0,
RestitutionThreshold = 0.5
},
ScriptComponent = {
ScriptClass = "Sandbox.MyTestEntity",
Fields = [
_rigidBody = (Component)15710354273720487680,
TheEntity = (Entity)0,
JumpForce = (Float)200,
MoveForce = (Float)148,
MyNumber = (Int)22,
Camera = (Entity)1491484622542812645
] }
},
{
Id = 935640822766280888,
NameComponent = {
Name = "Light"
},
TransformComponent = {
Position = {
X = 3.88327599,
Y = 0,
Z = -0.808795214
},
Rotation = {
X = 0.497987002,
Y = -0.103420995,
Z = 0.155380026,
W = 0.846859217
},
Scale = {
X = 0.999997795,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 1.09089541,
Y = -0.340793997,
Z = 0.160857871
}
},
LightComponent = {
LightType = .Directional,
Illuminance = 12.8999996,
Color = {
R = 0.985467017,
G = 1,
B = 0.569977939
}
}
},
{
Id = 721949523193525565,
NameComponent = {
Name = "Sphere"
},
TransformComponent = {
Position = {
X = 0,
Y = 0,
Z = 2.56930423
},
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 = "Assets/Models/sphere.glb"
},
MeshRendererComponent = {
Material = "Assets/Textures/TestMaterial.mat"
}
},
{
Id = 2241063100006479259,
NameComponent = {
Name = "Floor 2"
},
SpriteRendererComponent = {
Color = {
R = 0.425658971,
G = 0.855207443,
B = 0.0558161177,
A = 1
},
Sprite = "",
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = 6.74610233,
Y = -2.03225946,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = -0.331792623,
W = 0.94335258
},
Scale = {
X = 5.29557419,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = -0.676406503
}
},
Rigidbody2D = {
BodyType = .Static,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0,
RestitutionThreshold = 0.5
}
},
{
Id = 5126705881069187728,
NameComponent = {
Name = "Floor 3"
},
SpriteRendererComponent = {
Color = {
R = 0.666117013,
G = 0.0600316115,
B = 1,
A = 1
},
Sprite = "",
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = 15.2321281,
Y = -1.98709273,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = 0.134986058,
W = 0.990847468
},
Scale = {
X = 13.9764528,
Y = 1,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0.270798802
}
},
Rigidbody2D = {
BodyType = .Static,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0.800000012,
RestitutionThreshold = 0.5
}
},
{
Id = 6861260438693901700,
NameComponent = {
Name = "Floor 4"
},
SpriteRendererComponent = {
Color = {
R = 0.176544309,
G = 0.666713238,
B = 0.687030852,
A = 1
},
Sprite = "",
UvTransform = {
X = 0,
Y = 0,
Z = 1,
W = 1
}
},
TransformComponent = {
Position = {
X = -6.27842855,
Y = 2.62550163,
Z = 0
},
Rotation = {
X = 0,
Y = 0,
Z = 0.187087879,
W = 0.982343197
},
Scale = {
X = 0.999999464,
Y = 6.49634314,
Z = 1
},
EditorEulerRotation = {
X = 0,
Y = 0,
Z = 0.376393616
}
},
Rigidbody2D = {
BodyType = .Static,
FixedRotation = false
},
BoxCollider2D = {
Offset = {
X = 0,
Y = 0
},
Size = {
X = 0.5,
Y = 0.5
},
Density = 1,
Friction = 0.5,
Restitution = 0.899999857,
RestitutionThreshold = 0.5
}
}
]
}
@@ -0,0 +1,398 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
@@ -0,0 +1,46 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GlitchyEngine;
using GlitchyEngine.Math;
using static GlitchyEngine.Math.Math;
namespace Sandbox;
public class Camera : Entity
{
public float DistanceFromPlayer = 5.0f;
public float DontFollowRadius = 3.0f;
void OnUpdate(float deltaTime)
{
Entity player = FindEntityWithName("Player");
if (player != null)
{
float2 playerPosition = player.Transform.Translation.XY;
float2 cameraPosition = Transform.Translation.XY;
float2 distanceVector = playerPosition - cameraPosition;
float distance = length(distanceVector);
float2 neededMovement = float2.Zero;
if (distance > DontFollowRadius)
{
neededMovement = distanceVector - (distanceVector / distance) * DontFollowRadius;
}
Transform.Translation = new float3(cameraPosition + neededMovement, DistanceFromPlayer);
}
else
{
Log.Error("Player not found!");
}
}
}
@@ -0,0 +1,155 @@
using System;
using System.Runtime.Remoting.Metadata.W3cXsd2001;
using GlitchyEngine;
using GlitchyEngine.Editor;
using GlitchyEngine.Math;
using static GlitchyEngine.Math.Math;
namespace Sandbox
{
public enum MyEnum
{
Yes = 1,
No,
Maybe = 1337
}
public struct MyStruct
{
public float TheFloat;
public float2 TheVector;
public MyEnum TheEnum;
}
class MyTestEntity : Entity
{
[ShowInEditor]
RigidBody2D _rigidBody;
//public bool Bo;
//public byte By;
//public ushort Us;
//public uint Ui;
//public ulong Ul;
//public sbyte Sb;
//public short Sh;
//public int In;
//public long Lo;
//public float Fl;
//public double Do;
//public float2 V2;
//public float3 V3;
//public float4 V4;
public Entity TheEntity;
public float JumpForce = 2000;
[ShowInEditor] float MoveForce = 1000;
[ShowInEditor] private int MyNumber = 1337;
//[ShowInEditor] public double MyDouble = 1000.0f;
public MyStruct AStruct;
public MyEnum AEnum = MyEnum.Maybe;
public Camera Camera;
/// <summary>
/// Called after the script component was created. (The entity might not be fully created yet)
/// </summary>
void OnCreate()
{
Log.Info($"Create! {UUID}");
Log.Info($"Jump Force: {JumpForce}");
//_rigidBody ??= GetComponent<RigidBody2D>() ?? AddComponent<RigidBody2D>();
if (_rigidBody == null)
{
Log.Error("_rigidBody was not set in editor.");
}
if (Camera == null)
{
Log.Warning("Camera wasn't set in editor. Searching...");
Camera = FindEntityWithName("Camera").As<Camera>();
if (Camera == null)
{
Log.Error("Camera not found.");
}
}
Log.Warning("Achtung.");
try
{
SubVoid();
}
catch (Exception e)
{
Console.WriteLine(e);
throw e;
}
}
void SubVoid()
{
throw new Exception("Ouha!", new IndexOutOfRangeException("Bist du jecke2?!", new AccessViolationException("Haleluja")));
}
/// <summary>
/// Called every frame.
/// </summary>
/// <param name="deltaTime"></param>
void OnUpdate(float deltaTime)
{
float2 force = float2.Zero;
if (Input.IsKeyPressed(Key.A))
{
force.X -= MoveForce * deltaTime;
}
if (Input.IsKeyPressed(Key.D))
{
force.X += MoveForce * deltaTime;
}
if (Input.IsKeyPressed(Key.Q))
Camera.DistanceFromPlayer -= deltaTime;
if (Input.IsKeyPressed(Key.E))
Camera.DistanceFromPlayer += deltaTime;
if (Input.IsKeyPressing(Key.Space))
{
force.Y += JumpForce;
}
if (Input.IsKeyPressing(Key.N))
SubVoid();
_rigidBody.ApplyForceToCenter(force);
if (Input.IsMouseButtonReleasing(MouseButton.MiddleButton))
{
Log.Info($"Ouha! {MyNumber}");
Physics2D.Gravity *= new float2(1, -1);
}
}
/// <summary>
/// Called before the component is being destroyed.
/// </summary>
void OnDestroy()
{
Log.Trace("Destroy");
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("SandboxProject")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SandboxProject")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("7a70819c-5317-402a-8553-95c5a001e370")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7A70819C-5317-402A-8553-95C5A001E370}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>SandboxProject</RootNamespace>
<AssemblyName>SandboxProject</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>default</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>default</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Camera.cs" />
<Compile Include="MyTestEntity.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\..\ScriptCore\ScriptCore.csproj">
<Project>{6222c226-fc78-498c-80ba-5cf10ac9123c}</Project>
<Name>ScriptCore</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SandboxProject", "SandboxProject.csproj", "{7A70819C-5317-402A-8553-95C5A001E370}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ScriptCore", "..\..\..\..\ScriptCore\ScriptCore.csproj", "{6222C226-FC78-498C-80BA-5CF10AC9123C}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ScriptCoreGenerator", "..\..\..\..\ScriptCoreGenerator\ScriptCoreGenerator.csproj", "{5D662996-1E1E-4170-A08A-B26CDB63A0DE}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A70819C-5317-402A-8553-95C5A001E370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A70819C-5317-402A-8553-95C5A001E370}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A70819C-5317-402A-8553-95C5A001E370}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A70819C-5317-402A-8553-95C5A001E370}.Release|Any CPU.Build.0 = Release|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{6222C226-FC78-498C-80BA-5CF10AC9123C}.Release|Any CPU.Build.0 = Release|Any CPU
{5D662996-1E1E-4170-A08A-B26CDB63A0DE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5D662996-1E1E-4170-A08A-B26CDB63A0DE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5D662996-1E1E-4170-A08A-B26CDB63A0DE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5D662996-1E1E-4170-A08A-B26CDB63A0DE}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B5D43D8D-D80B-41AA-BE40-1DC507D87148}
EndGlobalSection
EndGlobal
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

@@ -0,0 +1,23 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -340282346638528859811704183484516925440,
MipMaxLOD = 340282346638528859811704183484516925440,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
@@ -0,0 +1,31 @@
{
Effect = "Resources/Shaders/myEffect.hlsl",
Textures = [
"AlbedoTexture": "Assets/Textures/rocket.png",
"NormalTexture": "Assets/Textures/TestMat/rustediron2_normal.png",
"MetallicTexture": "Assets/Textures/TestMat/rustediron2_metallic.png",
"RoughnessTexture": "Assets/Textures/TestMat/rustediron2_roughness.png"
],
Variables = [
"AlbedoColor": .ColorRGBA{
Value = {
R = 1,
G = 1,
B = 1,
A = 1
}
},
"NormalScaling": .Float2{
Value = {
X = 1,
Y = 1
}
},
"MetallicFactor": .Float{
Value = 0
},
"RoughnessFactor": .Float{
Value = 1
}
]
}
@@ -0,0 +1,4 @@
{
AssetLoader = "MaterialAssetLoader",
Config = (GlitchyEditor.Assets.ModelAssetLoaderConfig){}/* No reflection data for GlitchyEditor.Assets.ModelAssetLoaderConfig. Add [BonTarget] or force it */
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

@@ -0,0 +1,23 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -340282346638528859811704183484516925440,
MipMaxLOD = 340282346638528859811704183484516925440,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 MiB

@@ -0,0 +1,27 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_generateMipMaps = true,
_isSrgb = true,
_samplerStateDescription = {
MinFilter = .Anisotropic,
MagFilter = .Anisotropic,
MipFilter = .Anisotropic,
FilterMode = .Default,
ComparisonFunction = .Never,
AddressModeU = .Wrap,
AddressModeV = .Wrap,
AddressModeW = .Wrap,
MipLODBias = 0,
MipMinLOD = 0,
MipMaxLOD = 3,
MaxAnisotropy = 16,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 MiB

@@ -0,0 +1,23 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_samplerStateDescription = {
MinFilter = .Anisotropic,
MagFilter = .Anisotropic,
MipFilter = .Anisotropic,
ComparisonFunction = .Never,
AddressModeU = .Wrap,
AddressModeV = .Wrap,
AddressModeW = .Clamp,
MipMinLOD = -Infinity,
MipMaxLOD = Infinity,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 7.4 MiB

@@ -0,0 +1,27 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_generateMipMaps = false,
_isSrgb = false,
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
FilterMode = .Default,
ComparisonFunction = .Never,
AddressModeU = .Wrap,
AddressModeV = .Wrap,
AddressModeW = .Clamp,
MipLODBias = 2.5999999,
MipMinLOD = -Infinity,
MipMaxLOD = Infinity,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

@@ -0,0 +1,27 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_generateMipMaps = false,
_isSrgb = true,
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
FilterMode = .Default,
ComparisonFunction = .Never,
AddressModeU = .Wrap,
AddressModeV = .Wrap,
AddressModeW = .Clamp,
MipLODBias = 0,
MipMinLOD = -3.40282347e+38,
MipMaxLOD = 3.40282347e+38,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
@@ -0,0 +1,39 @@
{
Effect = "Resources/Shaders/myEffect.hlsl",
Textures = [
"AlbedoTexture": "Assets/Textures/TestMat/rustediron2_albedo.png",
"NormalTexture": "Assets/Textures/TestMat/rustediron2_normal.png",
"MetallicTexture": "Assets/Textures/TestMat/rustediron2_metallic.png",
"RoughnessTexture": "Assets/Textures/TestMat/rustediron2_roughness.png",
"EmissiveTexture": "Assets/Textures/rocket.png"
],
Variables = [
"AlbedoColor": .ColorRGBA{
Value = {
R = 1,
G = 1,
B = 1,
A = 1
}
},
"NormalScaling": .Float2{
Value = {
X = 1,
Y = 1
}
},
"MetallicFactor": .Float{
Value = 1
},
"RoughnessFactor": .Float{
Value = 1
},
"EmissiveColor": .ColorRGB{
Value = {
R = 1,
G = 0,
B = 0
}
}
]
}
@@ -0,0 +1,4 @@
{
AssetLoader = "MaterialAssetLoader",
Config = (GlitchyEditor.Assets.ModelAssetLoaderConfig){}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 119 B

@@ -0,0 +1,23 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -340282346638528859811704183484516925440,
MipMaxLOD = 340282346638528859811704183484516925440,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
@@ -0,0 +1,24 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_isSrgb = true,
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -3.40282347e+38,
MipMaxLOD = 3.40282347e+38,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 258 B

@@ -0,0 +1,22 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_isSrgb = true,
_samplerStateDescription = {
MinFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -340282346638528859811704183484516925440,
MipMaxLOD = 340282346638528859811704183484516925440,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
@@ -0,0 +1,24 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_isSrgb = true,
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -Infinity,
MipMaxLOD = Infinity,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
+1
View File
@@ -0,0 +1 @@
{_projectName="SandboxProject"}
@@ -1,37 +0,0 @@
Texture2D Texture : register(t0);
SamplerState Sampler : register(s0);
struct VS_Input
{
float2 Position : POSITION;
float4x4 Tranform : TRANSFORM;
float4 Color : COLOR;
float4 UVTransform : TEXCOORD;
};
struct PS_Input
{
float4 Position : SV_Position;
float2 TexCoord : TEXCOORD0;
float4 Color : COLOR;
};
PS_Input VS(VS_Input input)
{
PS_Input output;
output.Position = mul(float4(input.Position, 0.0f, 1.0f), input.Tranform);
output.TexCoord = input.UVTransform.xy + input.UVTransform.zw * input.Position;
output.Color = input.Color;
return output;
}
float4 PS(PS_Input input) : SV_Target0
{
float4 color = input.Color * Texture.Sample(Sampler, input.TexCoord);
return color;
}
#effect[VS=VS, PS=PS]
@@ -1,84 +0,0 @@
cbuffer SceneConstants
{
float4x4 ViewProjection = float4x4(1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1);
}
cbuffer ObjectConstants
{
float4x4 Transform;
}
cbuffer Constants
{
float4 BaseColor;
float3 LightDir;
}
cbuffer SkinningMatrices
{
matrix SkinningMatrices[255];
float3x3 InvTransSkinningMatrices[255];
}
struct VS_IN
{
float3 Position : POSITION;
float3 Normal : NORMAL;
uint4 JointIndices : JOINTS_0;
float4 JointWeights : WEIGHTS_0;
};
struct PS_IN
{
float4 Position : SV_POSITION;
float3 Normal : NORMAL;
};
PS_IN VS(VS_IN input)
{
PS_IN output;
// Unanimated position in modelspace
float4 positionRaw = float4(input.Position, 1);
// Calculate animated position in modelspace
float4 position =
mul(SkinningMatrices[input.JointIndices.x], positionRaw) * input.JointWeights.x +
mul(SkinningMatrices[input.JointIndices.y], positionRaw) * input.JointWeights.y +
mul(SkinningMatrices[input.JointIndices.z], positionRaw) * input.JointWeights.z +
mul(SkinningMatrices[input.JointIndices.w], positionRaw) * input.JointWeights.w;
float3 normal =
mul(InvTransSkinningMatrices[input.JointIndices.x], input.Normal) * input.JointWeights.x +
mul(InvTransSkinningMatrices[input.JointIndices.y], input.Normal) * input.JointWeights.y +
mul(InvTransSkinningMatrices[input.JointIndices.z], input.Normal) * input.JointWeights.z +
mul(InvTransSkinningMatrices[input.JointIndices.w], input.Normal) * input.JointWeights.w;
//position = saturate(position - 1000) + positionRaw;
//float4 position = mul(SkinningMatrices[input.JointIndices.x], positionRaw);
float4 worldPosition = mul(Transform, position);
output.Position = mul(ViewProjection, worldPosition);
output.Normal = mul((float3x3)Transform, normal);
return output;
}
float4 PS(PS_IN input) : SV_TARGET
{
input.Normal = normalize(input.Normal);
float shading = dot(LightDir, input.Normal);
//float shading = dot(LightDir, LightDir) + 1;
shading = clamp(shading, 0.0f, 1.0f);
return BaseColor * shading;
}
#effect[VS=VS,PS=PS]
+1
View File
@@ -0,0 +1 @@
4.5/
+1
View File
@@ -0,0 +1 @@
Install mono and copy the folder `lib/mono/4.5` here!
Binary file not shown.
@@ -0,0 +1 @@
project_user.bon
@@ -0,0 +1,398 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Mono auto generated files
mono_crash.*
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
[Ww][Ii][Nn]32/
[Aa][Rr][Mm]/
[Aa][Rr][Mm]64/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
[Ll]ogs/
# Visual Studio 2015/2017 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# Visual Studio 2017 auto generated files
Generated\ Files/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUnit
*.VisualState.xml
TestResult.xml
nunit-*.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# Benchmark Results
BenchmarkDotNet.Artifacts/
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
# ASP.NET Scaffolding
ScaffoldingReadMe.txt
# StyleCop
StyleCopReport.xml
# Files built by Visual Studio
*_i.c
*_p.c
*_h.h
*.ilk
*.meta
*.obj
*.iobj
*.pch
*.pdb
*.ipdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*_wpftmp.csproj
*.log
*.tlog
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# Visual Studio Trace Files
*.e2e
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# AxoCover is a Code Coverage Tool
.axoCover/*
!.axoCover/settings.json
# Coverlet is a free, cross platform Code Coverage Tool
coverage*.json
coverage*.xml
coverage*.info
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# Note: Comment the next line if you want to checkin your web deploy settings,
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# NuGet Symbol Packages
*.snupkg
# The packages folder can be ignored because of Package Restore
**/[Pp]ackages/*
# except build/, which is used as an MSBuild target.
!**/[Pp]ackages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/[Pp]ackages/repositories.config
# NuGet v3's project.json files produces more ignorable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
*.appx
*.appxbundle
*.appxupload
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!?*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
orleans.codegen.cs
# Including strong name files can present a security risk
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
#*.snk
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
ServiceFabricBackup/
*.rptproj.bak
# SQL Server files
*.mdf
*.ldf
*.ndf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
*.rptproj.rsuser
*- [Bb]ackup.rdl
*- [Bb]ackup ([0-9]).rdl
*- [Bb]ackup ([0-9][0-9]).rdl
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
node_modules/
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio 6 auto-generated project file (contains which files were open etc.)
*.vbp
# Visual Studio 6 workspace and project file (working project files containing files to include in project)
*.dsw
*.dsp
# Visual Studio 6 technical files
*.ncb
*.aps
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# CodeRush personal settings
.cr/personal
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config
# Tabs Studio
*.tss
# Telerik's JustMock configuration file
*.jmconfig
# BizTalk build output
*.btp.cs
*.btm.cs
*.odx.cs
*.xsd.cs
# OpenCover UI analysis results
OpenCover/
# Azure Stream Analytics local run output
ASALocalRun/
# MSBuild Binary and Structured Log
*.binlog
# NVidia Nsight GPU debugger configuration file
*.nvuser
# MFractors (Xamarin productivity tool) working folder
.mfractor/
# Local History for Visual Studio
.localhistory/
# Visual Studio History (VSHistory) files
.vshistory/
# BeatPulse healthcheck temp database
healthchecksdb
# Backup folder for Package Reference Convert tool in Visual Studio 2017
MigrationBackup/
# Ionide (cross platform F# VS Code tools) working folder
.ionide/
# Fody - auto-generated XML schema
FodyWeavers.xsd
# VS Code files for those working on multiple tools
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
*.code-workspace
# Local History for Visual Studio Code
.history/
# Windows Installer files from build outputs
*.cab
*.msi
*.msix
*.msm
*.msp
# JetBrains Rider
*.sln.iml
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// Allgemeine Informationen über eine Assembly werden über die folgenden
// Attribute gesteuert. Ändern Sie diese Attributwerte, um die Informationen zu ändern,
// die einer Assembly zugeordnet sind.
[assembly: AssemblyTitle("[ProjectName]")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("[ProjectName]")]
[assembly: AssemblyCopyright("Copyright © 2023")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Durch Festlegen von ComVisible auf FALSE werden die Typen in dieser Assembly
// für COM-Komponenten unsichtbar. Wenn Sie auf einen Typ in dieser Assembly von
// COM aus zugreifen müssen, sollten Sie das ComVisible-Attribut für diesen Typ auf "True" festlegen.
[assembly: ComVisible(false)]
// Die folgende GUID bestimmt die ID der Typbibliothek, wenn dieses Projekt für COM verfügbar gemacht wird
[assembly: Guid("7a70819c-5317-402a-8553-95c5a001e370")]
// Versionsinformationen für eine Assembly bestehen aus den folgenden vier Werten:
//
// Hauptversion
// Nebenversion
// Buildnummer
// Revision
//
// Sie können alle Werte angeben oder Standardwerte für die Build- und Revisionsnummern verwenden,
// indem Sie "*" wie unten gezeigt eingeben:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,53 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{7A70819C-5317-402A-8553-95C5A001E370}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>[ProjectName]</RootNamespace>
<AssemblyName>[ProjectName]</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>default</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<LangVersion>default</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="ScriptCore, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>[CoreLibPath]</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
@@ -0,0 +1,25 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "[ProjectName]", "[ProjectName].csproj", "{7A70819C-5317-402A-8553-95C5A001E370}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7A70819C-5317-402A-8553-95C5A001E370}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7A70819C-5317-402A-8553-95C5A001E370}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7A70819C-5317-402A-8553-95C5A001E370}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7A70819C-5317-402A-8553-95C5A001E370}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {B5D43D8D-D80B-41AA-BE40-1DC507D87148}
EndGlobalSection
EndGlobal
+52
View File
@@ -0,0 +1,52 @@
//=================================================================================================
//
// Baking Lab
// by MJP and David Neubelt
// http://mynameismjp.wordpress.com/
//
// All code licensed under the MIT license
//
//=================================================================================================
// The code in this file was originally written by Stephen Hill (@self_shadow), who deserves all
// credit for coming up with this fit and implementing it. Buy him a beer next time you see him. :)
// Source: https://github.com/TheRealMJP/BakingLab/blob/master/BakingLab/ACES.hlsl
// sRGB => XYZ => D65_2_D60 => AP1 => RRT_SAT
static const float3x3 ACESInputMat =
{
{0.59719, 0.35458, 0.04823},
{0.07600, 0.90834, 0.01566},
{0.02840, 0.13383, 0.83777}
};
// ODT_SAT => XYZ => D60_2_D65 => sRGB
static const float3x3 ACESOutputMat =
{
{ 1.60475, -0.53108, -0.07367},
{-0.10208, 1.10813, -0.00605},
{-0.00327, -0.07276, 1.07602}
};
float3 RRTAndODTFit(float3 v)
{
float3 a = v * (v + 0.0245786f) - 0.000090537f;
float3 b = v * (0.983729f * v + 0.4329510f) + 0.238081f;
return a / b;
}
float3 ACESFitted(float3 color)
{
color = mul(ACESInputMat, color);
// Apply RRT and ODT
color = RRTAndODTFit(color);
color = mul(ACESOutputMat, color);
// Clamp to [0, 1]
color = saturate(color);
return color;
}
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,16 @@
cbuffer Constants : register(b0)
{
uint ClearValue;
}
float4 VS(float2 input : POSITION) : SV_Position
{
return float4(input, 0.0f, 1.0f);
}
uint PS(float4 input : SV_Position) : SV_Target0
{
return ClearValue;
}
#pragma Effect[VS = VS; PS = PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,33 @@
Texture2D Texture : register(t0);
SamplerState TextureSampler : register(s0);
struct VS_IN
{
float2 Position : POSITION;
float2 TexCoord : TEXCOORD0;
};
struct PS_IN
{
float4 Position : SV_POSITION;
float2 TexCoord : TEXCOORD;
};
PS_IN VS(VS_IN input)
{
PS_IN output;
output.Position = float4(input.Position, 0, 1);
output.TexCoord = input.TexCoord;
return output;
}
float4 PS(PS_IN input) : SV_TARGET
{
float4 color = Texture.Sample(TextureSampler, input.TexCoord);
return float4(pow(color.rgb, 1.0f / 2.2f), color.a);
}
#pragma Effect[VS = VS; PS = PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,59 @@
#pragma EngineBuffer[ Name = "SceneConstants"; Binding = "Scene" ]
cbuffer SceneConstants : register(b0)
{
float4x4 ViewProjection;
}
#pragma EngineBuffer[ Name = "ObjectConstants"; Binding = "Object" ]
cbuffer ObjectConstants : register(b1)
{
float4x4 Transform;
/**
* \brief Inverted and transposed transform matrix.
* \remarks This matrix is used in order to correctly transform normal vectors.
*/
float4x3 Transform_InvT;
#ifdef OutputEntityId
uint EntityId;
#endif
}
/**
* \brief Pixel Shader output for lit surfaces.
*/
struct PS_OUT_Lit
{
/** RGB: Albedo A: Transparency */
float4 Albedo : SV_TARGET0;
/** RG: TextureNormal.XY | BA: GeoNrm.XY */
float4 Normal : SV_TARGET1;
/** R: GeoNrm.Z | GBA: GeoTan.XYZ */
float4 Tangent : SV_TARGET2;
/** RGB: world position XYZ | A: 1.0 */
float4 Position : SV_TARGET3;
/** RGB: emissive light and color | A: unused */
float4 Emissive : SV_TARGET4;
/** R: Metallicity | G: Roughness | B: Ambient | A: Unused */
float4 Material : SV_TARGET5;
#ifdef OutputEntityId
/** Needed for editor picking. Simply pass through the EntityId. */
uint EntityId : SV_TARGET6;
#endif
};
/**
* \brief Pixel Shader output for unlit surfaces.
*/
struct PS_OUT_Unlit
{
/** RGB: Color A: Transparency */
float4 Color : SV_TARGET0;
/** RGB: emissive light and color | A: unused */
float4 Emissive : SV_TARGET1;
/** RGB: world position XYZ | A: 1.0 */
float4 Position : SV_TARGET2;
#ifdef OutputEntityId
uint EntityId : SV_TARGET5;
#endif
};
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}/* No reflection data for GlitchyEditor.Assets.EffectAssetLoaderConfig. Add [BonTarget] or force it */
}
@@ -0,0 +1,28 @@
#define PI 3.14159265358979323846f
/**
* Calculates the diffuse lighting of a lambertian surface
* @param diffuseColor (rho/ pi) * C_diffuse
* @param illuminanceColor The product of the "brightness" and the light color.
* @param n_dot_l The dot product of the surface normal and the light direction.
*/
float3 CalculateDiffuseReflection(float3 diffuseColor, float3 illuminanceColor, float3 n_dot_l)
{
float3 directColor = illuminanceColor * saturate(n_dot_l);
return (directColor * diffuseColor);
}
/**
* Calculates the blinn-phong-specular reflection
* @param n The normalized surface normal
* @param h The normalized half way vector (nrm(l + v))
* @param alpha The reflections alpha-value
* @param illuminanceColor The product of the "brightness" and the light color.
* @param n_dot_l The dot product of the surface normal and the light direction.
*/
float3 CalculateSpecularReflection(float3 n, float3 h, float alpha, float3 illuminanceColor, float n_dot_l)
{
float highlight = pow(saturate(dot(n, h)), alpha) * float(n_dot_l > 0.0);
return (illuminanceColor * highlight); // Todo: * SpecularColor
}
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
+78
View File
@@ -0,0 +1,78 @@
/*
* This File contains Function for PBR.
*/
#ifndef __PBR_HLSL__
#define __PBR_HLSL__
#include "ShaderHelpers.hlsl"
// #define PBR_IBL
/**
* Normal Distribution Function. (Trowbridge-Reits GGX)
* Calculates the relative surface area of microfacets exactly aligned to the halfway vector.
* @param normal The surface normal.
* @param halfway The halfway vector between the surface normal and the view direction.
* @param roughness Roughness value.
* @returns The relative surface area of microfacets exactly aligned to the halfway vector.
*/
float NormalDistributionGGX(float3 normal, float3 halfway, float roughness)
{
// Square roughness because it looks better
float a = roughness * roughness;
float aa = a * a;
float n_dot_h = max(dot(normal, halfway), 0.0f);
float denom = (n_dot_h * n_dot_h) * (aa - 1.0f) + 1.0f;
denom = PI * denom * denom;
return aa / denom;
}
/**
* Geometry Function calculating the overshadowing of microfacets based on roughness. (Schlick-Beckmann GGX).
* @param dot-product of normal vector and vector from surface to camera.
* @param k Roughness value.
*/
float GeometrySchlickGGX(float n_dot_v, float k)
{
return n_dot_v / (n_dot_v * (1 - k) + k);
}
/**
* Geometry Function calculating the overshadowing of microfacets based on roughness. (Smith)
* @param normal The surface normal.
* @param viewDir Vector from surface to viewer.
* @param lightDir Vector from surface to light source.
* @param roughness Roughness value.
*/
float GeometrySmith(float3 normal, float3 viewDir, float3 lightDir, float roughness)
{
#ifdef PBR_IBL
// IBL
float k = roughness * roughness / 2;
#else
// Direct lighting
float k = (roughness + 1.0f);
k = (k * k) / 8;
#endif
const float n_dot_v = max(dot(normal, viewDir), 0.0f);
float n_dot_l = max(dot(normal, lightDir), 0.0f);
return GeometrySchlickGGX(n_dot_v, k) * GeometrySchlickGGX(n_dot_l, k);
}
/**
* Calculates the fresnel value.
* @param n_dot_v Dot product of the normal and view direction
* @param F0 base reflectivity.
*/
float3 FresnelSchlick(float n_dot_v, float3 F0)
{
return F0 + (1.0 - F0) * pow(clamp(1.0 - n_dot_v, 0.0, 1.0), 5.0);
}
#endif // __PBR_HLSL__
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,111 @@
Texture2DArray Texture : register(t0);
SamplerState Sampler : register(s0);
Texture2DArray<int4> IntTexture : register(t1);
SamplerState IntSampler : register(s1);
Texture2DArray<uint4> UIntTexture : register(t2);
SamplerState UIntSampler : register(s2);
#define SWIZZLE_NONE 0
#define SWIZZLE_R 1
#define SWIZZLE_G 2
#define SWIZZLE_B 3
#define SWIZZLE_A 4
cbuffer Constants
{
float ColorOffset = 0.5;
float AlphaOffset = 0.0;
float ColorScale = 0.5;
float AlphaScale = 1.0;
float MipLevel = 0.0;
float ArraySlice = 0.0;
// 0: Float | 1: Int | 2: Uint
int Mode = 0;
int4 Swizzle = int4(SWIZZLE_R, SWIZZLE_G, SWIZZLE_B, SWIZZLE_A);
float2 Texels;
float4x4 WorldViewProjection;
}
struct VS_Input
{
float2 Position : POSITION;
float2 Texcoord : TEXCOORD0;
};
struct PS_Input
{
float4 Position : SV_Position;
float2 Texcoord : TEXCOORD0;
};
PS_Input VS(VS_Input input)
{
PS_Input output;
output.Position = mul(WorldViewProjection, float4(input.Position, 0.0f, 1.0f));
output.Texcoord = input.Texcoord;
return output;
}
void SwizzleColor(int swizzleMode, float4 colorToSwizzle, inout float output)
{
switch (swizzleMode)
{
case SWIZZLE_R:
output = colorToSwizzle.r;
break;
case SWIZZLE_G:
output = colorToSwizzle.g;
break;
case SWIZZLE_B:
output = colorToSwizzle.b;
break;
case SWIZZLE_A:
output = colorToSwizzle.a;
break;
default:
break;
}
}
float4 PS(PS_Input input) : SV_Target0
{
float4 outputColor;
if (Mode == 0)
{
//float4 color = Texture.SampleLevel(Sampler, float3(input.Texcoord, ArraySlice), MipLevel);
// Quasi next neighbor
float4 color = Texture.Load(int4(input.Texcoord * Texels, ArraySlice, MipLevel));
outputColor = float4(ColorOffset.xxx, AlphaOffset) + color * float4(ColorScale.xxx, AlphaScale);
}
else if (Mode == 1)
{
int4 color = IntTexture.Load(int4(input.Texcoord * Texels, ArraySlice, MipLevel));
outputColor = float4(ColorOffset.xxx, AlphaOffset) + color * float4(ColorScale.xxx, AlphaScale);
}
else if (Mode == 2)
{
uint4 color = UIntTexture.Load(int4(input.Texcoord * Texels, ArraySlice, MipLevel));
outputColor = float4(ColorOffset.xxx, AlphaOffset) + color * float4(ColorScale.xxx, AlphaScale);
}
float4 swizzledOutput = float4(0, 0, 0, 1);
SwizzleColor(Swizzle.r, outputColor, swizzledOutput.r);
SwizzleColor(Swizzle.g, outputColor, swizzledOutput.g);
SwizzleColor(Swizzle.b, outputColor, swizzledOutput.b);
SwizzleColor(Swizzle.a, outputColor, swizzledOutput.a);
return swizzledOutput;
}
#pragma Effect[VS=VS; PS=PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}/* No reflection data for GlitchyEditor.Assets.EffectAssetLoaderConfig. Add [BonTarget] or force it */
}
@@ -0,0 +1,90 @@
#ifndef __SHADER_HELPERS_HLSL__
#define __SHADER_HELPERS_HLSL__
#define PI 3.14159265358979323846f
/*
* Calculates the weighted sum of two normal vectors.
* nrm1: The first normal vector
* nrm2: The second normal vector
* a: The weight factor for nrm1
* b: The weight factor for nrm2
*/
float3 BlendNormals(float3 nrm1, float3 nrm2, float a, float b)
{
return normalize(float3(a * nrm1.x / nrm1.z + b * nrm2.x / nrm2.z,
a * nrm1.y / nrm1.z + b * nrm2.y / nrm2.z,
1.0f));
}
/*
* Scales a normal vector by a factor where 0 results in the vector (0, 0, 1)
* nrm: The normal vector
* a: The scaling factor
*/
float3 ScaleNormal(float3 nrm1, float a)
{
return normalize(float3(a * nrm1.x / nrm1.z,
a * nrm1.y / nrm1.z,
1.0f));
}
/*
* Scales a normal vector by a factor where 0 results in the vector (0, 0, 1)
* nrm: The normal vector
* a: The scaling factor
*/
float3 ScaleNormal(float3 nrm1, float2 a)
{
return normalize(float3(a.x * nrm1.x / nrm1.z,
a.y * nrm1.y / nrm1.z,
1.0f));
}
/*
* Reconstructs the z-component of a normalized normal vector from a two-component value
* cnrm: The x- and y-components of a normalized normal vector
*/
float3 DecompressNormal(float2 cnrm)
{
return float3(cnrm, sqrt(1.0 - cnrm.x * cnrm.x - cnrm.y * cnrm.y));
}
/*
* Reconstructs the tangent space from a normal and a tangent
* normal: The surface normal
* tangent: The surface tangent
* sigma: Defines the handedness of the tangent space matrix. 1.0 if it is right handend. -1.0 if it is left handed
*/
float3x3 ConstructTangentSpace(float3 normal, float3 tangent, float3 sigma)
{
float3 n = normalize(normal);
float3 t = normalize(tangent - n * dot(tangent, n));
float3 b = cross(n, t) * sigma;
return float3x3(t, b, n);
}
/**
* Calculates the luminance of an rgb-value.
* @param rgb The rgb color.
* @return The luminance of the given rgb color.
*/
float ColorToLuminance(float3 rgb)
{
return rgb.r * 0.212639 + rgb.g * 0.715169 + rgb.b * 0.072192;
}
/**
* Extrancts the handedness of the bitangent that is encoded in the z-component of the tangent.
* @param tangentz The z-component of the tangent with the handedness encoded.
* @return The handedness of the bitangent (bitangent = handedness * tangent x normal)
*/
float GetBitangentHandedness(float tangentz)
{
// handedness is in least significant bit of tangent.z
uint z = asuint(tangentz);
return (z & 1) > 0 ? 1.0 : -1.0;
}
#endif // __SHADER_HELPERS_HLSL__
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,39 @@
#include "ACES.hlsl"
Texture2D CameraTarget : register(t0);
SamplerState CameraTargetSampler : register(s0);
struct VS_IN
{
float2 Position : POSITION;
float2 TexCoord : TEXCOORD0;
};
struct PS_IN
{
float4 Position : SV_POSITION;
float2 TexCoord : TEXCOORD;
};
PS_IN VS(VS_IN input)
{
PS_IN output;
output.Position = float4(input.Position, 0, 1);
output.TexCoord = input.TexCoord;
return output;
}
float4 PS(PS_IN input) : SV_TARGET
{
float4 rawColor = CameraTarget.Sample(CameraTargetSampler, input.TexCoord);
// float3 color = rawColor.rgb / (rawColor.rgb + 1.0f);
float3 color = ACESFitted(rawColor.rgb);
return float4(color, 1);
}
#pragma Effect[VS = VS; PS = PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,88 @@
#define EDITOR
Texture2D Texture : register(t0);
SamplerState Sampler : register(s0);
cbuffer Constants : register(b0)
{
float4x4 ViewProjection;
};
struct VS_Input
{
float2 Position : POSITION;
float2 Texcoord : TEXCOORD0;
float4x4 Transform : TRANSFORM;
float4 Color : COLOR;
float4 UVTransform : TEXCOORD1;
float InnerRadius : TEXCOORD2;
#ifdef EDITOR
uint EntityId : ENTITYID;
#endif
};
struct PS_Input
{
float4 Position : SV_Position;
float2 RawPos : TEXCOORD0;
float2 Texcoord : TEXCOORD1;
float4 Color : COLOR;
#ifdef EDITOR
nointerpolation uint EntityId : ENTITYID;
#endif
float InnerRadius : TEXCOORD2;
};
PS_Input VS(VS_Input input)
{
PS_Input output;
output.Position = mul(ViewProjection, mul(input.Transform, float4(input.Position, 0.0f, 1.0f)));
output.Texcoord = input.UVTransform.xy + input.UVTransform.zw * input.Texcoord;
output.RawPos = input.Position;
output.Color = input.Color;
output.InnerRadius = input.InnerRadius;
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
struct PS_Output
{
float4 Color : SV_Target0;
#ifdef EDITOR
uint EntityId : SV_TARGET1;
#endif
};
PS_Output PS(PS_Input input)
{
PS_Output output;
float2 uv = input.RawPos * 2;
float distance = 1.0f - length(uv);
// Smoothing edges based on derivative (not sure if RawPos is the best value for this)
float f = fwidth(input.RawPos.x) + fwidth(input.RawPos.y);
float amount = smoothstep(0.0f, f, distance);
amount *= smoothstep(input.InnerRadius + f, input.InnerRadius, distance);
// Discard invisible pixels
clip(amount - 0.5f);
output.Color = Texture.Sample(Sampler, input.Texcoord) * input.Color;
output.Color.a *= amount;
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
#pragma Effect[VS=VS; PS=PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -28,4 +28,4 @@ float4 PS(PS_Input input) : SV_Target0
return Color;
}
#effect[VS=VS, PS=PS]
#pragma Effect[VS=VS; PS=PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,61 @@
#define EDITOR
cbuffer Constants : register(b0)
{
float4x4 ViewProjection;
};
struct VS_Input
{
float4 Position : POSITION;
float4 Color : COLOR;
#ifdef EDITOR
uint EntityId : ENTITYID;
#endif
};
typedef struct PS_Input
{
float4 Position : SV_Position;
float4 Color : COLOR;
#ifdef EDITOR
nointerpolation uint EntityId : ENTITYID;
#endif
} VS_Output;
VS_Output VS(VS_Input input)
{
VS_Output output;
output.Position = mul(ViewProjection, input.Position);
output.Color = input.Color;
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
struct PS_Output
{
float4 Color : SV_TARGET0;
#ifdef EDITOR
uint EntityId : SV_TARGET1;
#endif
};
PS_Output PS(PS_Input input)
{
PS_Output output;
output.Color = input.Color;
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
#pragma Effect[VS=VS; PS=PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}/* No reflection data for GlitchyEditor.Assets.EffectAssetLoaderConfig. Add [BonTarget] or force it */
}
@@ -0,0 +1,93 @@
Texture2D<float3> Texture : register(t0);
SamplerState Sampler : register(s0);
cbuffer Constants
{
float4x4 ViewProjection;
float2 UnitRange;
float screenPixelRange = 2;
}
struct VS_Input
{
float2 Position : POSITION;
float2 Texcoord : TEXCOORD0;
float4x4 Tranform : TRANSFORM;
float4 Color : COLOR;
float4 UVTransform : TEXCOORD1;
};
struct PS_Input
{
float4 Position : SV_Position;
float2 TexCoord : TEXCOORD0;
float4 Color : COLOR;
};
PS_Input VS(VS_Input input)
{
PS_Input output;
output.Position = mul(ViewProjection, mul(input.Tranform, float4(input.Position, 0.0f, 1.0f)));
output.TexCoord = input.UVTransform.xy + input.UVTransform.zw * input.Texcoord;
output.Color = input.Color;
return output;
}
/*
in vec2 texCoord;
out vec4 color;
uniform sampler2D msdf;
uniform vec4 bgColor;
uniform vec4 fgColor;
float median(float r, float g, float b) {
return max(min(r, g), min(max(r, g), b));
}
void main() {
vec3 msd = texture(msdf, texCoord).rgb;
float sd = median(msd.r, msd.g, msd.b);
float screenPxDistance = screenPxRange()*(sd - 0.5);
float opacity = clamp(screenPxDistance + 0.5, 0.0, 1.0);
color = mix(bgColor, fgColor, opacity);
}
*/
float median(float r, float g, float b)
{
return max(min(r, g), min(max(r, g), b));
}
float ScreenPxRange(float2 texcoord)
{
float2 screenTexSize = 1.0f / fwidth(texcoord);
return max(0.5f * dot(UnitRange, screenTexSize), 1.0f);
}
float4 PS(PS_Input input) : SV_Target0
{
float3 msd = Texture.Sample(Sampler, input.TexCoord);
float sd = median(msd.r, msd.g, msd.b);
float screenPxDistance = ScreenPxRange(input.TexCoord) * (sd - 0.5);
float opacity = clamp(screenPxDistance + 0.5, 0.0, 1.0);
return float4(input.Color.rgb, opacity * input.Color.a);
}
/*
// 2D
float4 PS(PS_Input input) : SV_Target0
{
float3 msd = Texture.Sample(Sampler, input.TexCoord).rgb;
float sd = median(msd.r, msd.g, msd.b);
float screenPxDistance = screenPixelRange*(sd - 0.5);
float opacity = clamp(screenPxDistance + 0.5, 0.0, 1.0);
return float4(input.Color.rgb, opacity * input.Color.a);
}
*/
#pragma Effect[VS=VS; PS=PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,152 @@
#define OutputEntityId
#include "ShaderHelpers.hlsl"
#include "GlitchyEngine.hlsl"
Texture2D AlbedoTexture : register(t0);
SamplerState AlbedoSampler : register(s0);
Texture2D<float3> NormalTexture : register(t1);
SamplerState NormalSampler : register(s1);
Texture2D<float> MetallicTexture : register(t2);
SamplerState MetallicSampler : register(s2);
Texture2D<float> RoughnessTexture : register(t3);
SamplerState RoughnessSampler : register(s3);
Texture2D<float3> EmissiveTexture : register(t4);
SamplerState EmissiveSampler : register(s4);
// Texture2D<float> AmbientTexture : register(t5);
// SamplerState AmbientSampler : register(s5);
cbuffer MaterialConstants : register(b2)
{
#pragma EditorVariable[ Name = "AlbedoColor"; Preview = "Albedo Color"; Type="Color" ]
float4 AlbedoColor = float4(1.0, 1.0, 1.0, 1.0);
#pragma EditorVariable[ Name = "NormalScaling"; Preview = "Normal Scaling" ]
float2 NormalScaling = float2(1.0, 1.0);
#pragma EditorVariable[ Name = "MetallicFactor"; Preview = "Metallic Factor"; Min = 0.0f; Max = 1.0f ]
float MetallicFactor = 0.0;
#pragma EditorVariable[ Name = "RoughnessFactor"; Preview = "Rougness Factor"; Min = 0.0f; Max = 1.0f ]
float RoughnessFactor = 0.6;
#pragma EditorVariable[ Name = "EmissiveColor"; Preview = "Emissive Factor"; Type="ColorHDR" ]
float3 EmissiveColor = float3(0.0, 0.0, 0.0);
// # pra gma Editor Variable[ Name = "AmbientFactor"; Preview = "Ambient Factor" ]
// float AmbientFactor = 1.0;
}
struct VS_IN
{
float3 Position : POSITION;
float3 Normal : NORMAL;
// Todo: Tangent.w... handedness
float3 Tangent : TANGENT;
float2 TexCoord : TEXCOORD;
};
typedef struct PS_IN
{
float4 Position : SV_POSITION;
float3 WorldPosition : WORLDPOSITION;
float3 Normal : NORMAL;
float3 Tangent : TANGENT;
float2 TexCoord : TEXCOORD;
//nointerpolation float Handedness : HANDEDNESS;
#ifdef OutputEntityId
nointerpolation uint EntityId : ENTITYID;
#endif
} VS_OUT;
VS_OUT VS(VS_IN input)
{
VS_OUT output;
float4 worldPosition = mul(Transform, float4(input.Position, 1));
output.Position = mul(ViewProjection, worldPosition);
output.WorldPosition = worldPosition.xyz / worldPosition.w;
output.Normal = mul(Transform_InvT, input.Normal);
output.Tangent = mul((float3x3)Transform, input.Tangent);
// TODO: output.Handedness = input.Tangent.w
output.TexCoord = input.TexCoord;
output.EntityId = EntityId;
return output;
}
//struct PS_OUT
//{
// float4 Albedo : SV_TARGET0;
// // RG: TextureNormal.XY BA: GeoNrm.XY
// float4 Normal : SV_TARGET1;
// // R: GeoNrm.Z GBA: GeoTan.XYZ
// float4 Tangent : SV_TARGET2;
// float4 Position : SV_TARGET3;
// // R: Metallicity G: Roughness B: Ambient
// float4 Material : SV_TARGET4;
//#ifdef OutputEntityId
// uint EntityId : SV_TARGET5;
//#endif
//};
PS_OUT_Lit PS(PS_IN input)
{
// Build tangent space
float3 normal = normalize(input.Normal);
float3 tangent = normalize(input.Tangent - dot(input.Tangent, normal) * input.Normal);
// TODO: float3 bitangent = input.Handedness * cross(normal, tangent);
float3 bitangent = -cross(normal, tangent);
//float3x3 tangentTransform = float3x3(tangent, bitangent, normal);
//tangentTransform = transpose(tangentTransform);
float4 texAlbedo = AlbedoTexture.Sample(AlbedoSampler, input.TexCoord);
float3 texNormal = NormalTexture.Sample(NormalSampler, input.TexCoord);
texNormal.xy = texNormal.xy * 2.0 - 1.0;
float texMetallic = MetallicTexture.Sample(MetallicSampler, input.TexCoord);
float texRoughness = RoughnessTexture.Sample(RoughnessSampler, input.TexCoord);
float3 texEmissive = EmissiveTexture.Sample(EmissiveSampler, input.TexCoord);
//float3 objectNormal = mul(tangentTransform, texNormal);
//float3 worldNormal = mul(objectNormal, (float3x3)Transform);
float4 finalAlbedo = texAlbedo * AlbedoColor;
float3 finalNormal = ScaleNormal(texNormal, NormalScaling);
float finalMetallic = texMetallic * MetallicFactor;
float finalRoughness = texRoughness * RoughnessFactor;
float3 finalEmissive = texEmissive * EmissiveColor;
/////////////TODO: REMOVEME
//worldNormal = max(worldNormal - 10000000, normal);
//texAlbedo = max(texAlbedo - 10000000, 1.0);
//texMetallic = max(texMetallic - 10000000, 0.0);
//texRoughness = max(texRoughness - 10000000, 0.1);
/////////////TODO: END_REMOVEME
PS_OUT_Lit output;
output.Albedo = finalAlbedo;
//output.Normal = float4(objectNormal, 1.0);
output.Normal = float4(finalNormal.xy, normal.xy);
output.Tangent = float4(normal.z, tangent.xyz);
output.Position = float4(input.WorldPosition, 1.0);
output.Emissive = float4(finalEmissive, 0.0);
output.Material = float4(finalMetallic, finalRoughness, 1.0, 0);
#ifdef OutputEntityId
output.EntityId = input.EntityId;
#endif
return output;
}
#pragma Effect[VS = VS; PS = PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,128 @@
#include "ShaderHelpers.hlsl"
#include "PBR.hlsl"
#define Render 0
#define Inspect_NormalDistribution 1
#define Inspect_GeometryFunction 2
#define Inspect_Fresnel 3
#define Inspect_Normal 4
#define OUTPUT Render
SamplerState Sampler : register(s0);
Texture2D GBuffer_Albedo : register(t0);
Texture2D GBuffer_Normal : register(t1);
Texture2D GBuffer_Tangent : register(t2);
Texture2D GBuffer_Position : register(t3);
Texture2D GBuffer_Emissive : register(t4);
Texture2D GBuffer_Material : register(t5);
cbuffer Constants
{
float3 CameraPos;
float2 Scaling;
}
cbuffer LightConstants
{
float3 LightColor;
float Illuminance;
float3 LightDir;
}
struct VS_IN
{
float2 Position : POSITION;
float2 TexCoord : TEXCOORD0;
};
struct PS_IN
{
float4 Position : SV_POSITION;
float2 TexCoord : TEXCOORD;
};
PS_IN VS(VS_IN input)
{
PS_IN output;
output.Position = float4(input.Position, 0, 1);
output.TexCoord = input.TexCoord * Scaling;
return output;
}
float4 PS(PS_IN input) : SV_TARGET
{
// Load Data from GBuffer
float4 rawAlbedo = GBuffer_Albedo.Sample(Sampler, input.TexCoord);
float4 rawNormal = GBuffer_Normal.Sample(Sampler, input.TexCoord);
float4 rawTangent = GBuffer_Tangent.Sample(Sampler, input.TexCoord);
float4 rawPosition = GBuffer_Position.Sample(Sampler, input.TexCoord);
float4 rawEmissive = GBuffer_Emissive.Sample(Sampler, input.TexCoord);
float4 rawMaterial = GBuffer_Material.Sample(Sampler, input.TexCoord);
// Extract data from GBuffer
float3 albedo = rawAlbedo.rgb;
//float3 surfaceNormal = normalize(rawNormal.xyz);
float3 worldPosition = rawPosition.xyz;
float metallic = rawMaterial.r;
float roughness = rawMaterial.g;
float3 textureNormal = DecompressNormal(rawNormal.rg);
float3 rawGeoNrm = float3(rawNormal.ba, rawTangent.r);
float3 rawGeoTan = rawTangent.gba;
// Reconstruct normal space
float3 normal = normalize(rawGeoNrm);
float3 tangent = normalize(rawGeoTan - dot(rawGeoTan, normal) * normal);
float3 bitangent = -cross(normal, tangent);
float3x3 tangentTransform = float3x3(tangent, bitangent, normal);
float3 surfaceNormal = mul(textureNormal, tangentTransform);
float3 lightDir = normalize(LightDir);
float3 viewDir = normalize(CameraPos - worldPosition.xyz);
float3 halfway = normalize(lightDir + viewDir);
float n_dot_v = max(dot(surfaceNormal, viewDir), 0.0f);
float n_dot_h = max(dot(surfaceNormal, halfway), 0.0f);
float n_dot_l = max(dot(surfaceNormal, lightDir), 0.0f);
float nrmDist = NormalDistributionGGX(surfaceNormal, halfway, roughness);
float geo = GeometrySmith(surfaceNormal, viewDir, lightDir, roughness);
float3 F0 = 0.04f;
F0 = lerp(F0, albedo, metallic);
float3 fresnel = FresnelSchlick(n_dot_h, F0);
float3 ks = fresnel;
float3 kd = 1.0f - ks;
// Metals have no diffuse light
kd *= 1.0f - metallic;
float3 diffuse = albedo / PI;
float3 specular = (nrmDist * fresnel * geo) / max(4 * n_dot_v * n_dot_l, 0.0001f);
float3 luminanceColor = LightColor * Illuminance;
float3 final = (kd * diffuse + specular) * luminanceColor * n_dot_l + rawEmissive;
#if OUTPUT == Inspect_NormalDistribution
final = max(final - 10000000, nrmDist.xxx);
#elif OUTPUT == Inspect_GeometryFunction
final = max(final - 10000000, geo.xxx);
#elif OUTPUT == Inspect_Fresnel
final = max(final - 10000000, fresnel);
#elif OUTPUT == Inspect_Normal
final = max(final - 10000000, surfaceNormal / 2 + 0.5f);
#endif
return float4(final, 1);
}
#pragma Effect[VS = VS; PS = PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,74 @@
#define EDITOR
Texture2D Texture : register(t0);
SamplerState Sampler : register(s0);
cbuffer Constants : register(b0)
{
float4x4 ViewProjection;
};
struct VS_Input
{
float2 Position : POSITION;
float2 Texcoord : TEXCOORD0;
float4x4 Transform : TRANSFORM;
float4 Color : COLOR;
float4 UVTransform : TEXCOORD1;
#ifdef EDITOR
uint EntityId : ENTITYID;
#endif
};
struct PS_Input
{
float4 Position : SV_Position;
float2 Texcoord : TEXCOORD;
float4 Color : COLOR;
#ifdef EDITOR
nointerpolation uint EntityId : ENTITYID;
#endif
};
PS_Input VS(VS_Input input)
{
PS_Input output;
output.Position = mul(ViewProjection, mul(input.Transform, float4(input.Position, 0.0f, 1.0f)));
output.Texcoord = input.UVTransform.xy + input.UVTransform.zw * input.Texcoord;
output.Color = input.Color;
// Premultiply Alpha
output.Color.rgb *= output.Color.a;
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
struct PS_Output
{
float4 Color : SV_Target0;
#ifdef EDITOR
uint EntityId : SV_TARGET1;
#endif
};
PS_Output PS(PS_Input input)
{
PS_Output output;
output.Color = Texture.Sample(Sampler, input.Texcoord) * input.Color;
clip(output.Color.a - 0.001f);
#ifdef EDITOR
output.EntityId = input.EntityId;
#endif
return output;
}
#pragma Effect[VS = VS; PS = PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
@@ -0,0 +1,52 @@
Texture2D Texture : register(t0);
SamplerState Sampler : register(s0);
cbuffer Constants
{
float4x4 ViewProjection;
float ColorOffset = 0.5f;
float AlphaOffset = 0.0f;
float ColorScale = 0.5f;
float AlphaScale = 1.0f;
float2 TextureSizeInPixels;
}
struct VS_Input
{
float2 Position : POSITION;
float2 Texcoord : TEXCOORD0;
float4x4 Transform : TRANSFORM;
float4 Color : COLOR;
float4 UVTransform : TEXCOORD1;
};
struct PS_Input
{
float4 Position : SV_Position;
float2 Texcoord : TEXCOORD0;
float4 Color : COLOR;
};
PS_Input VS(VS_Input input)
{
PS_Input output;
output.Position = mul(ViewProjection, mul(input.Transform, float4(input.Position, 0.0f, 1.0f)));
output.Texcoord = input.UVTransform.xy + input.UVTransform.zw * input.Texcoord;
output.Color = input.Color;
return output;
}
float4 PS(PS_Input input) : SV_Target0
{
float4 color = Texture.Sample(Sampler, input.Texcoord);
float4 final = float4(ColorOffset.xxx, AlphaOffset) + color * float4(ColorScale.xxx, AlphaScale);
return final;
}
#pragma Effect[VS=VS; PS=PS]
@@ -0,0 +1,4 @@
{
AssetLoader = "EffectAssetLoader",
Config = (GlitchyEditor.Assets.EffectAssetLoaderConfig){}
}
Binary file not shown.
@@ -0,0 +1,23 @@
{
AssetLoader = "EditorTextureAssetLoader",
Config = (GlitchyEditor.Assets.EditorTextureAssetLoaderConfig){
_samplerStateDescription = {
MinFilter = .Linear,
MagFilter = .Linear,
MipFilter = .Linear,
ComparisonFunction = .Never,
AddressModeU = .Clamp,
AddressModeV = .Clamp,
AddressModeW = .Clamp,
MipMinLOD = -3.40282347e+38,
MipMaxLOD = 3.40282347e+38,
MaxAnisotropy = 1,
BorderColor = {
R = 1,
G = 1,
B = 1,
A = 1
}
}
}
}
Binary file not shown.
@@ -0,0 +1,63 @@
{
"runtimeTarget": {
"name": ".NETStandard,Version=v2.0/",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETStandard,Version=v2.0": {},
".NETStandard,Version=v2.0/": {
"ScriptCore/1.0.0": {
"dependencies": {
"Half": "1.0.0",
"NETStandard.Library": "2.0.3"
},
"runtime": {
"ScriptCore.dll": {}
}
},
"Half/1.0.0": {
"runtime": {
"lib/netstandard2.0/System.Half.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Microsoft.NETCore.Platforms/1.1.0": {},
"NETStandard.Library/2.0.3": {
"dependencies": {
"Microsoft.NETCore.Platforms": "1.1.0"
}
}
}
},
"libraries": {
"ScriptCore/1.0.0": {
"type": "project",
"serviceable": false,
"sha512": ""
},
"Half/1.0.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-EPLLPQA1UjF9QM3ymNhWLhgcnBNc8e1po4qWRWTD3Hd9xiohYlkCob0QjDIbJs6Nvfd4eAbsjxIwRyh7httyXA==",
"path": "half/1.0.0",
"hashPath": "half.1.0.0.nupkg.sha512"
},
"Microsoft.NETCore.Platforms/1.1.0": {
"type": "package",
"serviceable": true,
"sha512": "sha512-kz0PEW2lhqygehI/d6XsPCQzD7ff7gUJaVGPVETX611eadGsA3A877GdSlU0LRVMCTH/+P3o2iDTak+S08V2+A==",
"path": "microsoft.netcore.platforms/1.1.0",
"hashPath": "microsoft.netcore.platforms.1.1.0.nupkg.sha512"
},
"NETStandard.Library/2.0.3": {
"type": "package",
"serviceable": true,
"sha512": "sha512-st47PosZSHrjECdjeIzZQbzivYBJFv6P2nv4cj2ypdI204DO+vZ7l5raGMiX4eXMJ53RfOIg+/s4DHVZ54Nu2A==",
"path": "netstandard.library/2.0.3",
"hashPath": "netstandard.library.2.0.3.nupkg.sha512"
}
}
}
+121
View File
@@ -0,0 +1,121 @@
using System;
using GlitchyEngine;
using System.IO;
using Bon;
using GlitchyEngine.Content;
namespace GlitchyEditor;
[BonTarget]
class AssetConfig
{
[BonIgnore]
public bool IgnoreFile = false;
[BonInclude]
public String AssetLoader ~ delete _;
[BonInclude]
public AssetLoaderConfig Config ~ delete _;
}
class AssetFile
{
private EditorContentManager _contentManager;
private String _path;
private String _identifier;
private String _assetConfigPath;
private AssetConfig _assetConfig ~ delete _;
private bool _isDirectory;
private Asset _loadedAsset;
public bool IsDirectory => _isDirectory;
public StringView FilePath => _path;
public StringView Identifier => _identifier;
public const String ConfigFileExtension = ".ass";
public AssetConfig AssetConfig => _assetConfig;
public Asset LoadedAsset => _loadedAsset;
[AllowAppend]
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);
_assetConfigPath = configPathBuffer;
_contentManager = contentManager;
_isDirectory = isDirectory;
Log.EngineLogger.AssertDebug(File.Exists(_path), "File doesn't exist.");
FindAssetConfig();
}
// Loads the asset config (.ass) file or creates it.
private void FindAssetConfig()
{
if (File.Exists(_assetConfigPath))
{
LoadAssetConfig();
}
else
{
CreateDefaultAssetLoader();
}
}
private void CreateDefaultAssetLoader()
{
String fileExtension = Path.GetExtension(_path, .. scope .());
_assetConfig = new AssetConfig();
var assetLoader = _contentManager.GetDefaultAssetLoader(fileExtension);
// We don't have a loader -> we don't need a config
if (assetLoader == null)
return;
_assetConfig.AssetLoader = new String();
assetLoader.GetType().GetName(_assetConfig.AssetLoader);
_assetConfig.Config = assetLoader?.GetDefaultConfig();
_assetConfig.Config?.[Friend]_changed = true;
SaveAssetConfig();
}
private void LoadAssetConfig()
{
if (Bon.DeserializeFromFile(ref _assetConfig, _assetConfigPath) case .Err)
{
Log.EngineLogger.Error($"Failed to load asset config {_assetConfigPath}");
// TODO: Handle failure of asset config loading
Runtime.NotImplemented();
}
}
public void SaveAssetConfig()
{
gBonEnv.serializeFlags |= .Verbose;
Bon.SerializeIntoFile(_assetConfig, _assetConfigPath);
_assetConfig.Config.[Friend]_changed = false;
}
}
+607
View File
@@ -0,0 +1,607 @@
using GlitchyEngine;
using GlitchyEngine.Collections;
using GlitchyEngine.Renderer;
using System;
using System.Collections;
using System.IO;
using System.Linq;
namespace GlitchyEditor.Assets;
public class AssetNode
{
public String Name ~ delete _;
public String Path ~ delete _;
public String Identifier ~ delete _;
public bool IsDirectory;
public AssetFile AssetFile ~ delete _;
public List<SubAsset> SubAssets ~ {
SubAssets?.ClearAndDeleteItems();
delete SubAssets;
}
public Texture2D PreviewImage ~ _?.ReleaseRef();
}
public class SubAsset
{
public AssetNode Asset;
public String Name ~ delete _;
//public String AssetInternalPath ~ delete _;
public Texture2D PreviewImage ~ _?.ReleaseRef();
}
public static class AssetIdentifier
{
public const char8 DirectorySeparatorChar = '/';
// TODO: Asset identifiers and paths have little to do with each other and already caused a bit of pain, we should consider not using String for both.
/// Removes or unifies potential platform specific or file-path related stuff in the given asset identifier
public static void Fixup(String assetIdentifier)
{
int dotIndex = 0;
assetIdentifier.Replace('\\', DirectorySeparatorChar);
// Replace /./ stuff
while ((dotIndex = assetIdentifier.IndexOf('.', dotIndex)) != -1)
{
char8 lastChar = '\0';
char8 nextChar = '\0';
int nextIndex = dotIndex + 1;
if (nextIndex < assetIdentifier.Length)
nextChar = assetIdentifier[nextIndex];
int lastIndex = dotIndex - 1;
if (lastIndex < assetIdentifier.Length)
lastChar = assetIdentifier[nextIndex];
// We either need to have a slash on both sides, or we have to be at the start or end of the string
if ((lastChar == '\0' || lastChar == DirectorySeparatorChar) &&
(lastChar == '\0' || lastChar == DirectorySeparatorChar))
{
if (lastChar != '\0')
assetIdentifier.Remove(lastIndex, 2);
else
assetIdentifier.Remove(dotIndex, 2);
}
else
{
// Skip the dot
dotIndex++;
}
}
if (assetIdentifier.StartsWith(DirectorySeparatorChar))
assetIdentifier.Remove(0, 1);
}
}
class AssetHierarchy
{
FileSystemWatcher fsw ~ {
_.StopRaisingEvents();
delete _;
};
bool _fileSystemDirty = false;
internal TreeNode<AssetNode> _assetRootNode = null ~ DeleteTreeAndChildren!(_);
internal TreeNode<AssetNode> _resourcesDirectoryNode = null;
internal TreeNode<AssetNode> _assetsDirectoryNode = null;
private append Dictionary<StringView, TreeNode<AssetNode>> _pathToAssetNode = .();
private append Dictionary<StringView, TreeNode<AssetNode>> _identifierToAssetNode = .();
private append String _resourcesDirectory = .();
private append String _assetsDirectory = .();
private EditorContentManager _contentManager;
public TreeNode<AssetNode> RootNode => _assetRootNode;
public StringView ResourcesDirectory
{
get => _resourcesDirectory;
private set
{
_resourcesDirectory.Set(value);
Path.Fixup(_resourcesDirectory);
}
}
public StringView AssetsDirectory
{
get => _assetsDirectory;
private set
{
_assetsDirectory.Set(value);
Path.Fixup(_assetsDirectory);
}
}
public this(EditorContentManager contentManager)
{
_contentManager = contentManager;
// Create a root node that will contain all Asset directory nodes.
_assetRootNode = new TreeNode<AssetNode>(new AssetNode());
_assetRootNode->Path = new String();
_assetRootNode->Name = new String();
_assetRootNode->IsDirectory = true;
Log.EngineLogger.Trace($"Created root node");
}
public void SetResourcesDirectory(StringView fileName)
{
ResourcesDirectory = fileName;
_resourcesDirectoryNode?.ForEach(scope (node) => {
_pathToAssetNode.Remove(node->Path);
_identifierToAssetNode.Remove(node->Identifier);
});
_assetRootNode.RemoveChild(_resourcesDirectoryNode);
DeleteTreeAndChildren!(_resourcesDirectoryNode);
_resourcesDirectoryNode = null;
if (!Directory.Exists(ResourcesDirectory))
{
Log.EngineLogger.Error($"Resources directory \"{ResourcesDirectory}\" doesn't exist.");
return;
}
AssetNode assetNode = new AssetNode();
assetNode.Path = new String(ResourcesDirectory);
assetNode.Name = new String();
assetNode.Identifier = new String("###resources");
assetNode.IsDirectory = true;
Path.GetFileName(assetNode.Path, assetNode.Name);
_resourcesDirectoryNode = _assetRootNode.AddChild(assetNode);
_pathToAssetNode.Add(assetNode.Path, _resourcesDirectoryNode);
_identifierToAssetNode.Add(assetNode.Identifier, _resourcesDirectoryNode);
Log.EngineLogger.Trace($"Created directory node for: \"{ResourcesDirectory}\"");
_fileSystemDirty = true;
// TODO: Watch resources folder?
//SetupResourcesFileSystemWatcher();
Update();
}
public void SetAssetsDirectory(StringView fileName)
{
AssetsDirectory = fileName;
_assetsDirectoryNode?.ForEach(scope (node) => {
_pathToAssetNode.Remove(node->Path);
_identifierToAssetNode.Remove(node->Identifier);
});
_assetRootNode.RemoveChild(_assetsDirectoryNode);
DeleteTreeAndChildren!(_assetsDirectoryNode);
_assetsDirectoryNode = null;
if (!Directory.Exists(AssetsDirectory))
{
// TODO: This is not an error, if no project is loaded
Log.EngineLogger.Warning($"Assets directory \"{AssetsDirectory}\" doesn't exist.");
return;
}
AssetNode assetNode = new AssetNode();
assetNode.Path = new String(AssetsDirectory);
assetNode.Name = new String();
assetNode.Identifier = new String("###assets");
assetNode.IsDirectory = true;
Path.GetFileName(assetNode.Path, assetNode.Name);
_assetsDirectoryNode = _assetRootNode.AddChild(assetNode);
_pathToAssetNode.Add(assetNode.Path, _assetsDirectoryNode);
_identifierToAssetNode.Add(assetNode.Identifier, _assetsDirectoryNode);
Log.EngineLogger.Trace($"Created directory node for: \"{AssetsDirectory}\"");
_fileSystemDirty = true;
SetupFileSystemWatcher();
Update();
}
/// Initializes the FSW for the current ContentDirectory and registers the events.
private void SetupFileSystemWatcher()
{
delete fsw;
fsw = new FileSystemWatcher(_assetsDirectory);
fsw.IncludeSubdirectories = true;
fsw.OnChanged.Add(new (filename) => {
// Note: Gets fired for a directory if a file inside it is created/removed
Log.EngineLogger.Trace($"File content changed (\"{filename}\")");
//_fileSystemDirty = true;
FileContentChanged(filename);
});
fsw.OnCreated.Add(new (filename) => {
Log.EngineLogger.Trace($"File created (\"{filename}\")");
_fileSystemDirty = true;
});
fsw.OnDeleted.Add(new (filename) => {
Log.EngineLogger.Trace($"File deleted (\"{filename}\")");
_fileSystemDirty = true;
});
fsw.OnRenamed.Add(new (oldName, newName) => {
Log.EngineLogger.Trace($"File renamed (From \"{oldName}\" to \"{newName}\")");
FileRenamed(oldName, newName);
});
fsw.StartRaisingEvents();
}
/// Gets the tree node for the given filePath or .Err, if the file/directory doesn't exist.
/// @param filePath the path for which to return the tree node.
/// @remarks Do not hold a reference to the TreeNode because it can become invalid when the file hierarchy changes.
public Result<TreeNode<AssetNode>> GetNodeFromPath(StringView filePath)
{
if (_pathToAssetNode.TryGetValue(filePath, let treeNode))
{
return treeNode;
}
return .Err;
}
/// Gets the tree node for the given filePath or .Err, if the file/directory doesn't exist.
/// @param filePath the path for which to return the tree node.
/// @remarks Do not hold a reference to the TreeNode because it can become invalid when the file hierarchy changes.
public Result<TreeNode<AssetNode>> GetNodeFromIdentifier(StringView identifier)
{
if (_identifierToAssetNode.TryGetValue(identifier, let treeNode))
{
return treeNode;
}
return .Err;
}
public bool FileExists(StringView filePath)
{
return _pathToAssetNode.ContainsKey(filePath);
}
public void Update()
{
// TODO: do we really need to do this in the update loop?
if (_fileSystemDirty)
{
UpdateFiles();
}
}
/// Determines and set the Identfier for the given asset node.
private void DetermineIdentifier(TreeNode<AssetNode> assetNode)
{
if (assetNode->Identifier == null)
assetNode->Identifier = new String();
assetNode->Identifier.Clear();
// Get the Identifier which is simply the path relative to the asste root (either Resources- or Assets-Folder)
if (assetNode.IsInSubtree(_resourcesDirectoryNode))
{
Path.GetRelativePath(assetNode->Path, _resourcesDirectoryNode->Path, assetNode->Identifier);
assetNode->Identifier.Insert(0, "Resources/");
}
else if (assetNode.IsInSubtree(_assetsDirectoryNode))
{
Path.GetRelativePath(assetNode->Path, _assetsDirectoryNode->Path, assetNode->Identifier);
assetNode->Identifier.Insert(0, "Assets/");
}
AssetIdentifier.Fixup(assetNode->Identifier);
}
/// Rebuilds the asset file hierarchy.
private void UpdateFiles()
{
Log.EngineLogger.Trace($"Updating asset hierarchy");
void HandleFile(AssetNode node)
{
node.AssetFile = new AssetFile(_contentManager, node.Identifier, node.Path, node.IsDirectory);
}
/// Determines the files that belong to the given directory and adds them to the tree.
void AddFilesOfDirectory(TreeNode<AssetNode> directory)
{
// Filter that accepts all files.
String filter = scope $"{directory->Path}/*";
// Buffer used to hold the path of the files iterated below.
String filepathBuffer = scope String(256);
// Buffer used to hold the file extension of the files iterated below.
String extensionBuffer = scope String(16);
for (var entry in Directory.Enumerate(filter, .Files))
{
entry.GetFilePath(filepathBuffer..Clear());
Path.GetExtension(filepathBuffer, .. extensionBuffer..Clear());
filepathBuffer.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
// Ignore meta files.
if (extensionBuffer.Equals(AssetFile.ConfigFileExtension, .OrdinalIgnoreCase))
continue;
TreeNode<AssetNode> treeNode = directory.Children.Where(scope (node) => node.Value.Path == filepathBuffer).FirstOrDefault();
if (treeNode == null)
{
AssetNode assetNode = new AssetNode();
assetNode.Name = new String();
Path.GetFileName(filepathBuffer, assetNode.Name);
assetNode.Path = new String(filepathBuffer);
assetNode.IsDirectory = false;
treeNode = directory.AddChild(assetNode);
DetermineIdentifier(treeNode);
_pathToAssetNode.Add(assetNode.Path, treeNode);
_identifierToAssetNode.Add(assetNode.Identifier, treeNode);
//GrabSubAssets(node);
HandleFile(treeNode.Value);
Log.EngineLogger.Trace($"Created file node for: \"{assetNode.Path}\"");
}
}
}
void RemoveOrphanedEntries(TreeNode<AssetNode> node)
{
for (TreeNode<AssetNode> child in node.Children)
{
if (!Directory.Exists(child->Path) && !File.Exists(child->Path))
{
Log.EngineLogger.Trace($"Removed orphaned node for: \"{child->Path}\"");
@child.Remove();
child.ForEach(scope (node) => {
_pathToAssetNode.Remove(node->Path);
_identifierToAssetNode.Remove(node->Identifier);
});
DeleteTreeAndChildren!(child);
}
}
}
/// Adds the given directory to the specified tree.
/// Recursively adds all Files and Subdirectories.
void AddDirectoryToTree(String path, TreeNode<AssetNode> parentNode)
{
path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
// Try to find the node for the specified path in the given parent
TreeNode<AssetNode> treeNode = parentNode.Children.Where(scope (node) => node.Value.Path == path).FirstOrDefault();
// Create new Node for the Directory, if no TreeNode exists.
if (treeNode == null)
{
AssetNode assetNode = new AssetNode();
assetNode.Path = new String(path);
assetNode.Name = new String();
//assetNode.Identifier = new String();
assetNode.IsDirectory = true;
Path.GetFileName(assetNode.Path, assetNode.Name);
/*// Get the Identifier which is simply the path relative to the asste root (either Resources- or Assets-Folder)
if (parentNode == _resourcesDirectoryNode || parentNode.IsChildOf(_resourcesDirectoryNode))
{
Path.GetRelativePath(assetNode.Path, _resourcesDirectoryNode->Path, assetNode.Identifier);
assetNode.Identifier.Insert(0, "Resources/");
}
else
{
Path.GetRelativePath(assetNode.Path, _assetsDirectoryNode->Path, assetNode.Identifier);
assetNode.Identifier.Insert(0, "Assets/");
}
AssetIdentifier.Fixup(assetNode.Identifier);*/
treeNode = parentNode.AddChild(assetNode);
DetermineIdentifier(treeNode);
_pathToAssetNode.Add(assetNode.Path, treeNode);
// No Identifiers for Directories, because we can't use directories as Assets anyways...
//_identifierToAssetNode.Add(assetNode.Identifier, treeNode);
Log.EngineLogger.Trace($"Created directory node for: \"{assetNode.Path}\"");
}
String directoryNameBuffer = scope String(256);
// Filter that finds all entries of a directory.
String filter = scope $"{path}/*";
for (var directory in Directory.Enumerate(filter, .Directories))
{
directory.GetFilePath(directoryNameBuffer..Clear());
AddDirectoryToTree(directoryNameBuffer, treeNode);
}
RemoveOrphanedEntries(treeNode);
AddFilesOfDirectory(treeNode);
}
if (!AssetsDirectory.IsWhiteSpace)
{
String filter = scope $"{AssetsDirectory}/*";
String directoryNameBuffer = scope String(256);
for (var directory in Directory.Enumerate(filter, .Directories))
{
directory.GetFilePath(directoryNameBuffer..Clear());
AddDirectoryToTree(directoryNameBuffer, _assetsDirectoryNode);
}
RemoveOrphanedEntries(_assetsDirectoryNode);
AddFilesOfDirectory(_assetsDirectoryNode);
}
if (!ResourcesDirectory.IsWhiteSpace)
{
String filter = scope $"{ResourcesDirectory}/*";
String directoryNameBuffer = scope String(256);
for (var directory in Directory.Enumerate(filter, .Directories))
{
directory.GetFilePath(directoryNameBuffer..Clear());
AddDirectoryToTree(directoryNameBuffer, _resourcesDirectoryNode);
}
RemoveOrphanedEntries(_resourcesDirectoryNode);
AddFilesOfDirectory(_resourcesDirectoryNode);
}
//*String filter = scope $"{AssetsDirectory}/*";
/*
String directoryNameBuffer = scope String(256);
for (var directory in Directory.Enumerate(filter, .Directories))
{
directory.GetFilePath(directoryNameBuffer..Clear());
AddDirectoryToTree(directoryNameBuffer, _assetHierarchy);
}
RemoveOrphanedEntries(_assetHierarchy);*/
_fileSystemDirty = false;
}
private void FileContentChanged(StringView fileName)
{
var fileName;
// Config files aren't really tracked but changing them effectively changes the corresponding file
// so we fire the event for them.
if (fileName.EndsWith(AssetFile.ConfigFileExtension))
fileName.RemoveFromEnd(AssetFile.ConfigFileExtension.Length);
String fileNameWithContentRoot = scope .();
Path.InternalCombine(fileNameWithContentRoot, _assetsDirectory, fileName);
var nodeResult = GetNodeFromPath(fileNameWithContentRoot);
TreeNode<AssetNode> node = null;
if (!(nodeResult case .Ok(out node)))
{
// This happens, when we create new files.
Log.EngineLogger.Trace($"Could not find node for file \"{fileNameWithContentRoot}\"");
return;
}
// Don't fire event for directories.
if (node->IsDirectory)
return;
OnFileContentChanged(node.Value);
}
private void FileRenamed(StringView oldFilePath, StringView newFilePath)
{
var oldFilePath;
// Ignore Config files.
if (oldFilePath.EndsWith(AssetFile.ConfigFileExtension))
return;
String oldFileNameWithContentRoot = scope .();
Path.InternalCombine(oldFileNameWithContentRoot, _assetsDirectory, oldFilePath);
String newFileNameWithContentRoot = scope .();
Path.InternalCombine(newFileNameWithContentRoot, _assetsDirectory, newFilePath);
// Rename config file
{
String oldConfigFileName = scope $"{oldFileNameWithContentRoot}{AssetFile.ConfigFileExtension}";
String newConfigFileName = scope $"{newFileNameWithContentRoot}{AssetFile.ConfigFileExtension}";
if (File.Exists(oldConfigFileName) && !File.Exists(newConfigFileName))
{
if (File.Move(oldConfigFileName, newConfigFileName) case .Err(let value))
{
Log.EngineLogger.Error($"Failed to move file {oldConfigFileName} to {newConfigFileName}. Code: {value}");
}
}
}
var nodeResult = GetNodeFromPath(oldFileNameWithContentRoot);
TreeNode<AssetNode> node = null;
if (!(nodeResult case .Ok(out node)))
{
// This happens, when we create new files.
Log.EngineLogger.Trace($"Could not find node for file \"{oldFileNameWithContentRoot}\"");
return;
}
_pathToAssetNode.Remove(oldFileNameWithContentRoot);
_identifierToAssetNode.Remove(node->Identifier);
node->Path.Set(newFileNameWithContentRoot);
_pathToAssetNode.Add(node->Path, node);
DetermineIdentifier(node);
_identifierToAssetNode.Add(node->Identifier, node);
node->Name.Clear();
Path.GetFileName(newFileNameWithContentRoot, node->Name);
String oldIdentifier = scope .(node->AssetFile.[Friend]_identifier);
node->AssetFile.[Friend]_path.Set(node->Path);
node->AssetFile.[Friend]_identifier.Set(newFilePath);
AssetIdentifier.Fixup(node->AssetFile.[Friend]_identifier);
node->AssetFile.[Friend]_assetConfigPath..Set(node->Path).Append(AssetFile.ConfigFileExtension);
OnFileRenamed(node.Value, oldIdentifier);
}
public delegate void FileContentChangedFunc(AssetNode node);
public Event<FileContentChangedFunc> OnFileContentChanged ~ _.Dispose();
public delegate void FileRenamedFunc(AssetNode node, StringView oldName);
public Event<FileRenamedFunc> OnFileRenamed ~ _.Dispose();
}
@@ -0,0 +1,15 @@
namespace GlitchyEditor.Assets;
abstract class AssetPropertiesEditor
{
private AssetFile _asset;
public AssetFile Asset => _asset;
public this(AssetFile asset)
{
_asset = asset;
}
public abstract void ShowEditor();
}
@@ -0,0 +1,62 @@
using Bon;
using GlitchyEngine.Content;
using System;
using System.Collections;
using System.IO;
using GlitchyEngine;
using GlitchyEngine.Renderer;
namespace GlitchyEditor.Assets;
class EffectAssetPropertiesEditor : AssetPropertiesEditor
{
public this(AssetFile asset) : base(asset)
{
}
public override void ShowEditor()
{
}
public static AssetPropertiesEditor Factory(AssetFile assetFile)
{
return new Self(assetFile);
}
}
[BonTarget, BonPolyRegister]
class EffectAssetLoaderConfig : AssetLoaderConfig
{
}
class EffectAssetLoader : IAssetLoader //, IReloadingAssetLoader
{
private static readonly List<StringView> _fileExtensions = new .(){".hlsl"} ~ delete _;
public static List<StringView> FileExtensions => _fileExtensions;
public AssetLoaderConfig GetDefaultConfig()
{
return new EffectAssetLoaderConfig();
}
public Asset LoadAsset(Stream file, AssetLoaderConfig config, StringView assetIdentifier, StringView? subAsset, IContentManager contentManager)
{
Effect effect = new Effect(file, assetIdentifier, contentManager);
return effect;
}
public Asset GetPlaceholderAsset(Type assetType)
{
return default;
}
public Asset GetErrorAsset(Type assetType)
{
return default;
}
}
+10
View File
@@ -0,0 +1,10 @@
using GlitchyEngine.Content;
using System;
using System.IO;
namespace GlitchyEditor.Assets;
interface IAssetSaver
{
Result<void> EditorSaveAsset(Stream file, Asset asset, AssetLoaderConfig config, StringView assetIdentifier, StringView? subAsset, IContentManager contentManager);
}
@@ -0,0 +1,8 @@
using System.IO;
namespace GlitchyEditor.Assets;
interface IReloadingAssetLoader
{
public void ReloadAsset(AssetFile assetFile, Stream data);
}

Some files were not shown because too many files have changed in this diff Show More