Node — Aspose.3D FOSS for .NET

Overview

Overview Node คลาสแสดงถึงองค์ประกอบที่มีชื่อใน Aspose.3D scene graph. แต่ละโหนดสามารถถือหนึ่ง Entity (เช่น a Mesh, Camera, หรือ Light) , รักษาความสัมพันธ์ parent-child กับโหนดอื่น ๆ และบรรทุก local transform โหนดเป็นวิธีหลักในการจัดระเบียบวัตถุ 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);
}

Overview

OverviewOverviewOverviewOverview
Namestringรับ/ตั้งค่าตัวระบุที่อ่านได้โดยมนุษย์สำหรับโหนด
EntityEntityรับ/ตั้งค่าเอนทิตีหลักที่แนบกับโหนดนี้
EntitiesList<Entity>รับเอนทิตีทั้งหมดที่แนบกับโหนดนี้
ChildNodesList<Node>รับโหนดลูกในลำดับชั้นของฉาก
ParentNodeNodeรับโหนดพาเรนท์ในลำดับชั้น
TransformTransformรับการแปลงโลคัล (translation, rotation, scale)
GlobalTransformGlobalTransformรับการแปลงเชิงพื้นที่โลกที่คำนวณ
PropertiesPropertyCollectionรับคุณสมบัติกำหนดเอง

Overview

Overviewประเภทการคืนค่าOverview
CreateChildNode(string name)Nodeสร้างโหนดลูกใหม่ด้วยชื่อที่กำหนด
CreateChildNode(string name, Entity entity)Nodeสร้างโหนดลูกพร้อมเอนทิตีที่แนบมาด้วย

Overview

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");

ดูเพิ่มเติม

 ภาษาไทย