PropertyCollection - Я не могу.

VertexElement Цель.3D TypeScript Ссылка на API

Пакет: @aspose/3d (v24.12.0)

VertexElement является абстрактным базовым классом для канала с атрибутом в верхушке, присоединенного к Geometry.Каждый канал содержит массив данных , встроенный по типографии . mappingMode / referenceMode метаданные, которые контролируют отношение данных к примитивным геометриям. Подклассы: VertexElementNormal, VertexElementUV, и VertexElementVertexColor.

import { VertexElement, VertexElementNormal, VertexElementUV, VertexElementVertexColor } from '@aspose/3d';

VertexElement (абстрактная база)

export abstract class VertexElement implements IIndexedVertexElement

Строитель

constructor(
  elementType: VertexElementType,
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

По умолчанию mappingMode - это … MappingMode.CONTROL_POINT; по умолчанию referenceMode - это … ReferenceMode.DIRECT.

Свойства

СобственностьТип:Доступ к информацииОписание:
vertexElementTypeVertexElementTypeЧитайте .Семантический тип этого слоя.
namestringЧитать/писатьФакультативная этикетка для этого слоя.
mappingModeMappingModeЧитать/писатьКонтролирует, с какой первичной геометрии связано каждое значение.
referenceModeReferenceModeЧитать/писатьКонтролирует, адресуются ли значения непосредственно или через массив индекса.
indicesnumber[]Читайте .Индексный массив для: IndexToDirect эталонный режим.

Методы

setIndices(data)

NOT IMPLEMENTED. На базе . VertexElement класс, этот метод бросает Error('set_indices is not implemented') Подклассы VertexElementFVector и в том числе: VertexElementIntsTemplate обеспечивать рабочие реализации.

Замените индексный массив.

setIndices(data: number[]): void

clear()

NOT IMPLEMENTED. На базе . VertexElement класс, этот метод бросает Error('clear is not implemented') Подклассы VertexElementFVector и в том числе: VertexElementIntsTemplate обеспечивать рабочие реализации.

Удалите все данные и индексы из слоя.

clear(): void

VertexElementNormal

Большинство рендеров требуют нормальных данных для правильного освещения.

export class VertexElementNormal extends VertexElementFVector

Наследство

VertexElementVertexElementFVectorVertexElementNormal

Строитель

new VertexElementNormal(
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

vertexElementType закреплено на: VertexElementType.NORMAL.


VertexElementUV (Вертексэлемент)

Сохраняет координаты 2D-текстуры. Сеть может нести несколько УФ-слоев для различных каналов текстуры . textureMapping свойство определяет цель канала.

export class VertexElementUV extends VertexElementFVector

Наследство

VertexElementVertexElementFVectorVertexElementUV

Строитель

new VertexElementUV(
  textureMapping: TextureMapping | null = null,
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

Недостаточность в TextureMapping.DIFFUSE когда? textureMapping - это … null.

Дополнительное имущество

СобственностьТип:Доступ к нимОписание:
textureMappingTextureMappingЧитайте .Канал текстуры, с которым связано это УФ-слой.
dataFVector4[]Читайте .Ультрафиолетовые значения, подвергаемые воздействию: FVector4 вложения (z и w - это 0).
uvDataFVector2[]Читайте .Ультрафиолетовые значения как: FVector2 записи (только x, y).

addData(data)

Присоединяйте значения УФ. FVector2[], FVector3[], или FVector4[].

addData(data: FVector2[] | FVector3[] | FVector4[]): void

VertexElementVertexColor

Сохраняет цветные значения RGBA на вертикаль. Компоненты в диапазоне 01.

export class VertexElementVertexColor extends VertexElementFVector

Наследство

VertexElementVertexElementFVectorVertexElementVertexColor

Строитель

new VertexElementVertexColor(
  name: string = '',
  mappingMode: MappingMode | null = null,
  referenceMode: ReferenceMode | null = null,
)

vertexElementType закреплено на: VertexElementType.VERTEX_COLOR.


Примеры:

Добавить нормалы в треугольную сетку:

import { Scene, Mesh, Vector4, VertexElementType, MappingMode, ReferenceMode, FVector4 } from '@aspose/3d';

const mesh = new Mesh();
mesh.controlPoints.push(new Vector4(0, 0, 0, 1));
mesh.controlPoints.push(new Vector4(1, 0, 0, 1));
mesh.controlPoints.push(new Vector4(0.5, 1, 0, 1));
mesh.createPolygon(0, 1, 2);

const normals = mesh.createElement(
  VertexElementType.NORMAL,
  MappingMode.CONTROL_POINT,
  ReferenceMode.DIRECT,
);
normals.setData([
  new FVector4(0, 0, 1, 0),
  new FVector4(0, 0, 1, 0),
  new FVector4(0, 0, 1, 0),
]);

const scene = new Scene();
scene.rootNode.createChildNode('tri', mesh);
scene.save('triangle_normals.glb');

Добавить УФ-координаты:

import { Scene, Mesh, Vector4, TextureMapping, MappingMode, ReferenceMode, FVector2 } from '@aspose/3d';

const mesh = new Mesh();
for (const [x, z] of [[0,0],[1,0],[1,1],[0,1]]) {
  mesh.controlPoints.push(new Vector4(x, 0, z, 1));
}
mesh.createPolygon(0, 1, 2, 3);

const uv = mesh.createElementUV(TextureMapping.DIFFUSE, MappingMode.CONTROL_POINT, ReferenceMode.DIRECT);
uv.addData([
  new FVector2(0, 0),
  new FVector2(1, 0),
  new FVector2(1, 1),
  new FVector2(0, 1),
]);

const scene = new Scene();
scene.rootNode.createChildNode('quad', mesh);
scene.save('quad_uv.glb');

См. также:

 Русский