Node — Aspose.3D FOSS for .NET
Example
Example Node 클래스는 Aspose.3D 씬 그래프에서 이름이 지정된 요소를 나타냅니다. 각 노드는 하나를 보유할 수 있습니다 Entity (예를 들어 Mesh, Camera, 또는 Light), 다른 노드와 부모‑자식 관계를 유지하고 로컬 변환을 보유합니다. 노드는 씬 계층 구조에서 3D 객체를 조직하는 주요 방법입니다.
using Aspose.ThreeD;
var scene = new Scene();
// Access the root node
Node root = scene.RootNode;
// Create a child node
Node child = root.CreateChildNode("my_node");
// Iterate child nodes
foreach (var node in root.ChildNodes)
{
Console.WriteLine(node.Name);
}Example
| Example | Example | Example | Example |
|---|---|---|---|
Name | string | 읽기/쓰기 | 노드에 대한 사람이 읽을 수 있는 식별자 |
Entity | Entity | 읽기/쓰기 | 이 노드에 연결된 주요 엔터티 |
Entities | List<Entity> | 읽기 | 이 노드에 연결된 모든 엔터티 |
ChildNodes | List<Node> | 읽기 | 씬 계층 구조의 자식 노드 |
ParentNode | Node | 읽기 | 계층 구조의 부모 노드 |
Transform | Transform | 읽기 | 로컬 변환(이동, 회전, 스케일) |
GlobalTransform | GlobalTransform | 가져오기 | 계산된 월드 공간 변환 |
Properties | PropertyCollection | 가져오기 | 사용자 정의 속성 |
Example
| Example | 반환 유형 | Example |
|---|---|---|
CreateChildNode(string name) | Node | 주어진 이름으로 새로운 자식 노드를 생성합니다 |
CreateChildNode(string name, Entity entity) | Node | 첨부된 엔터티와 함께 자식 노드를 생성합니다 |
Example
using Aspose.ThreeD;
using Aspose.ThreeD.Entities;
var scene = new Scene();
// Build a hierarchy with entities
var parent = scene.RootNode.CreateChildNode("Parent");
parent.Transform.Translation = new FVector3(10, 0, 0);
var box = new Box(2, 2, 2);
var child = parent.CreateChildNode("BoxChild", box);
child.Transform.Translation = new FVector3(5, 0, 0);
scene.Save("hierarchy.gltf");