Compare commits

...

1 Commits

Author SHA1 Message Date
478e30b24b Begin mesh and more advanced node stuff 2025-01-16 22:27:21 -06:00
6 changed files with 34 additions and 25 deletions

View File

@ -4,6 +4,7 @@
<option name="projectPerEditor"> <option name="projectPerEditor">
<map> <map>
<entry key="GLTFViewer/BaseOpenTKControl.axaml" value="GLTFViewer/GLTFViewer.csproj" /> <entry key="GLTFViewer/BaseOpenTKControl.axaml" value="GLTFViewer/GLTFViewer.csproj" />
<entry key="GLTFViewer/Engine/Ui/Controls/BaseOpenTKControl.axaml" value="GLTFViewer/GLTFViewer.csproj" />
<entry key="GLTFViewer/Engine/Ui/Controls/BasePropertyViewerControl.axaml" value="GLTFViewer/GLTFViewer.csproj" /> <entry key="GLTFViewer/Engine/Ui/Controls/BasePropertyViewerControl.axaml" value="GLTFViewer/GLTFViewer.csproj" />
<entry key="GLTFViewer/Engine/Ui/Controls/BaseSceneTreeControl.axaml" value="GLTFViewer/GLTFViewer.csproj" /> <entry key="GLTFViewer/Engine/Ui/Controls/BaseSceneTreeControl.axaml" value="GLTFViewer/GLTFViewer.csproj" />
<entry key="GLTFViewer/Engine/Ui/Controls/MainUI.axaml" value="GLTFViewer/GLTFViewer.csproj" /> <entry key="GLTFViewer/Engine/Ui/Controls/MainUI.axaml" value="GLTFViewer/GLTFViewer.csproj" />

View File

@ -15,6 +15,7 @@ A simple application to load GLTF scenes and render the model(s) in a lit scene
## Development Status ## Development Status
- 01/15/2025 Update 1: Successfully have Avalonia project set up with a BaseOpenTK control rendering the OpenTK context. Also have a Renerer class to seperate out the rendering code from the control, but it's empty for now. There is also some boilerplate UI for the inspector, but its only visual and will need to be filled out. - 01/15/2025 Update 1: Successfully have Avalonia project set up with a BaseOpenTK control rendering the OpenTK context. Also have a Renerer class to seperate out the rendering code from the control, but it's empty for now. There is also some boilerplate UI for the inspector, but its only visual and will need to be filled out.
- 01/15/2025 Update 2: Have some basic UI and Node structure. Now deciding how best to load models, render them, and handling scenes.
## Development Environment ## Development Environment
- OS: Linux (NixOS) - OS: Linux (NixOS)

View File

@ -0,0 +1,8 @@
using System.Collections.ObjectModel;
namespace GLTFViewer.Engine;
public class Mesh : Node
{
}

View File

@ -6,22 +6,32 @@ namespace GLTFViewer.Engine;
public class Node public class Node
{ {
public string Name { get; } public string Name { get; set; } = "Node";
public ObservableCollection<Node> Children { get; } public ObservableCollection<Node> Children { get; } = [];
public ObservableCollection<NodeProperty> Properties { get; } public ObservableCollection<NodeProperty> Properties { get; } = [];
public Node(string name) public virtual void Update()
{ {
Name = name; foreach (var node in Children)
Children = new ObservableCollection<Node>(); {
Properties = new ObservableCollection<NodeProperty>(); node.Update();
}
} }
public Node(string name, ObservableCollection<Node> children) public virtual void EnterScene()
{ {
Name = name; foreach (var node in Children)
Children = children; {
Properties = new ObservableCollection<NodeProperty>(); node.EnterScene();
}
}
public virtual void ExitScene()
{
foreach (var node in Children)
{
node.ExitScene();
}
} }
public void AddChild(Node child) public void AddChild(Node child)

View File

@ -6,10 +6,8 @@ namespace GLTFViewer.Engine.Ui;
public class SceneTree public class SceneTree
{ {
public Node Root { get; } = new Node("root");
private TreeView _sceneTreeView; private TreeView _sceneTreeView;
private ObservableCollection<Node> _nodes; private ObservableCollection<Node> _nodes = [];
public SceneTree(TreeView sceneTreeView) public SceneTree(TreeView sceneTreeView)
{ {
@ -20,15 +18,6 @@ public class SceneTree
public void Initialize() public void Initialize()
{ {
Root.AddProperty(new NodeProperty<string>("TestPropertyString", "TestValue"));
Root.AddProperty(new NodeProperty<int>("TestPropertyInt", 42));
_nodes = new ObservableCollection<Node>()
{
Root
};
_sceneTreeView.ItemsSource = _nodes; _sceneTreeView.ItemsSource = _nodes;
_sceneTreeView.ItemTemplate = new FuncTreeDataTemplate<Node>( _sceneTreeView.ItemTemplate = new FuncTreeDataTemplate<Node>(
(node, _) => (node, _) =>