본문으로 건너뛰기

AddMultiPrimitiveMesh

public List<Node> AddMultiPrimitiveMesh(Node parentNode, string nodeName, List<PrimitiveMesh> primitives, bool IsCreateAssembly)

Primitive Mesh 생성
위치와, 법선 방향이 동일한 정점은 공유해서 사용
삼각형의 인덱스는 3의 배수로 구성되어야 하며, 각 3개는 하나의 삼각형을 나타냄
삼각형의 인덱스 순서는 외부에서 면을 바라볼 때 반시계 방향으로 설정되어야 함

Parameters​

NameTypeDescription
parentNodeNodePrimitive 부모 노드
nodeNamestring노드 이름
primitivesList<PrimitiveMesh>Primitive 정보 리스트
IsCreateAssemblyboolAssembly 노드 생성 여부(선택된 노드가 Assembly 일 경우 생성 또는 미생성, Part 인 경우에는 Assembly 생성 안됨)

Returns​

TypeDescription
List<Node>생성된 Node 정보

Examples​

// VIZCore3DX.NET Control
private VIZCore3DX.NET.VIZCore3DXControl vizcore3dx;

private void Example()
{
List<Data.Node> nodes = vizcore3dx.Object3D.FromFilter(Object3dFilter.SELECTED_TOP);
if (nodes.Count <= 0) return;

var vertices = new List<Data.ColorMeshVertex> // 메시 정점 정보
{
new ColorMeshVertex(new Data.Vector3D(0, 0, 0), Data.Axis.Z, Color.Red),
new ColorMeshVertex(new Data.Vector3D(1000, 0, 0), Data.Axis.Z, Color.Green),
new ColorMeshVertex(new Data.Vector3D(1000, 1000, 0), Data.Axis.Z, Color.Blue),
new ColorMeshVertex(new Data.Vector3D(0, 1000, 0), Data.Axis.Z, Color.Yellow),
new ColorMeshVertex(new Data.Vector3D(500, 1500, 0), Data.Axis.Z, Color.Magenta),
};

var indices = new List<ushort> // 메시 인덱스 정보 (3개 단위로 삼각형을 정의)
{
0, 1, 2,
0, 2, 3,
3, 2, 4,
};

// 파트 Mesh 생성
List<Data.PrimitiveMesh> Mesh = new List<Data.PrimitiveMesh>();

Mesh.Add(new Data.PrimitiveMesh(
"Part",
vertices,
indices,
new Data.Vector3D(6000.0f, 1000.0f, 1000.0f)
));

List<Data.Node> part = vizcore3dx.Object3D.Primitive.AddMultiPrimitiveMesh(nodes[0], "Part_Mesh", Mesh, false);


// 파트 Mesh 하위에 바디 Mesh 생성
List<Data.PrimitiveMesh> bodyMesh = new List<Data.PrimitiveMesh>();

bodyMesh.Add(new Data.PrimitiveMesh(
"Body1",
vertices,
indices,
new Data.Vector3D(0.0f, 1000.0f, 1000.0f)
));

bodyMesh.Add(new Data.PrimitiveMesh(
"Body2",
vertices,
indices,
new Data.Vector3D(3000.0f, 1000.0f, 1000.0f)
));

bodyMesh.Add(new Data.PrimitiveMesh(
"Body3",
vertices,
indices,
new Data.Vector3D(9000.0f, 1000.0f, 1000.0f)
));

bodyMesh.Add(new Data.PrimitiveMesh(
"Body4",
vertices,
indices,
new Data.Vector3D(12000.0f, 1000.0f, 1000.0f)
));

vizcore3dx.Object3D.Primitive.AddMultiPrimitiveMesh(part[0], "Node", bodyMesh);
}