VertexElement — Aspose.3D TypeScript API Reference

पैकेज : एलईडी / 3D (अनुच्छेद 12.0)

VertexElement यह एक प्रति-vertex अनुकूलित चैनलों के लिए अब्दुल आधार वर्ग है। Geometry.प्रत्येक चैनल में एक टाइप डेटा रेंज होता है और mappingMode / referenceMode मेटाडेटा जो नियंत्रित करता है कि डेटा कैसे भूमध्यसागरीय प्राचीनताओं से संबंधित है. उप-क्लास हैं: VertexElementNormal, VertexElementUV,और VertexElementVertexColor.

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

VertexElement (अब्स्ट्राट आधार)

export abstract class VertexElement implements IIndexedVertexElement { }

Constructor

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

Default mappingMode है MappingMode.CONTROL_POINT;· अभाव referenceMode है ReferenceMode.DIRECT.

Properties

PropertyTypeAccessDescription
vertexElementTypeVertexElementTypeReadइस परत के सेमंटिक प्रकार।.
namestringपढ़ना / लिखनाइस परत के लिए वैकल्पिक लेबल।.
mappingModeMappingModeपढ़ना / लिखनानियंत्रण जिस भूमध्यसागरीय प्राचीन प्रत्येक मूल्य से जुड़ा हुआ है।.
referenceModeReferenceModeपढ़ना / लिखनायह जांचता है कि क्या मूल्यों को सीधे या एक सूचकांक रेंज के माध्यम से संबोधित किया जाता है।.
indicesnumber[]Readआंकड़े के लिए आउट IndexToDirect संदर्भ मोड।.

Methods

setIndices(data)

NOT IMPLEMENTED. आधार पर VertexElement इस विधि को फेंकना, यह विधियों को Error('set_indices is not implemented') सब्जी में - Subclasses VertexElementFVector और VertexElementIntsTemplate कार्यों को लागू करने के लिए।.

इंडेक्स एरे को बदलें।.

setIndices(data: number[]): void

clear()

NOT IMPLEMENTED. आधार पर VertexElement इस विधि को फेंकना, यह विधियों को Error('clear is not implemented') सब्जी में - Subclasses VertexElementFVector और VertexElementIntsTemplate कार्यों को लागू करने के लिए।.

लेयर से सभी डेटा और इंडेक्स हटाएँ।.

clear(): void

VertexElementNormal

सतह के नॉर्मल वेक्टर संग्रहीत करता है। सही लाइटिंग के लिए अधिकांश रेंडरर्स को नॉर्मल डेटा की आवश्यकता होती है।.

export class VertexElementNormal extends VertexElementFVector { }

Inheritance

VertexElementVertexElementFVectorVertexElementNormal

Constructor

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

vertexElementType निश्चित रूप से तय किया गया है VertexElementType.NORMAL.


VertexElementUV

2D संरचना कोडों का भंडारण. एक मशीन विभिन्न संरक्षण चैनलों के लिए कई यूवी परतों ले जा सकती है. textureMapping संपत्ति चैनल के उद्देश्य की पहचान करती है।.

export class VertexElementUV extends VertexElementFVector { }

Inheritance

VertexElementVertexElementFVectorVertexElementUV

Constructor

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

दोषों के लिए TextureMapping.DIFFUSE जब textureMapping है null.

अतिरिक्त गुण

PropertyTypeAccessDescription
textureMappingTextureMappingReadइस यूवी परत के साथ संरचना चैनल जुड़ा हुआ है।.
dataFVector4[]ReadUV के रूप में प्रदर्शित किया गया है FVector4 इनमें से (Z और W) 0).
uvDataFVector2[]Readयूवी के रूप में FVector2 इनमें से एक (एक्स, और केवल) है।.

addData(data)

यूवी के आकार को जोड़ें. स्वीकार करें FVector2[], FVector3[],या FVector4[].

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

VertexElementVertexColor

प्रति-शिखर RGBA रंग मान संग्रहीत करता है। घटक 0–1 की सीमा में होते हैं।.

export class VertexElementVertexColor extends VertexElementFVector { }

Inheritance

VertexElementVertexElementFVectorVertexElementVertexColor

Constructor

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

vertexElementType निश्चित रूप से तय किया गया है VertexElementType.VERTEX_COLOR.


Examples

त्रिभुज मेष में नॉर्मल जोड़ें:

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

UV निर्देशांक जोड़ें:

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

See Also

 हिन्दी