基本信息
以下是所在类或对象的基本信息。
AMD:
require(["esri/geometry/support/MeshTexture"], (MeshTexture) => { /* code goes here */ });
ESM:
import MeshTexture from "@arcgis/core/geometry/support/MeshTexture";
类:
esri/geometry/support/MeshTexture
继承: MeshTexture > Accessor
自从:用于 JavaScript 4.11 的 ArcGIS API
用法说明
MeshTexture 表示要用于 MeshMaterial 或 MeshMaterialMetallicRoughness 的图像数据。它通过其 uv 顶点属性映射到网格。 MeshTexture 实例可以与 MeshComponent.material 属性一起使用,它们可以设置为 MeshMaterial.colorTexture 或 MeshMaterial.normalTexture 。可以通过 url 或直接通过数据(HTMLImageElement、HTMLCanvasElement、HTMLVideoElement 或 ImageData)引用图像。
const meshColorByUrl = new MeshTexture({
url: "./image.png"
});
const mesh = Mesh.createBox(location, {
material: {
colorTexture: meshColorByUrl
}
});
const meshColorByCanvas = new MeshTexture({
data: canvasElement
});
const meshWithCanvasMaterial = Mesh.createBox(location, {
material: {
colorTexture: meshColorByCanvas
}
});
// Support for autocasting within a mesh material constructor
const meshWithAutocastMaterial = Mesh.createSphere(location, {
material: {
colorTexture: {
url: "./image.png"
}
}
});
// Mesh materials also support additional advanced autocasting types
// such as a Canvas element. In this case the canvas element will be
// available in the MeshTexture.data property.
const meshWithCanvasAutocastMaterial = Mesh.createSphere(location, {
material: {
colorTexture: canvasElement
}
});
// When using a video as a texture, you need to create a Video element
// and pass it in the MeshTexture.data property.
const video = document.createElement("video");
video.src = "./my-video.mp4";
video.crossOrigin = "anonymous";
video.autoplay = true;
video.muted = true;
// The video needs to be added to the DOM and be located in
// the viewport in order for it to play
document.body.appendChild(video);
video.style.position = "absolute";
video.style.top = 0;
// Hide the video element
video.style.height = 0;
video.style.visibility = "hidden";
const meshWithVideoMaterial = Mesh.createPlane(location, {
material: {
colorTexture: { data: video }
}
});
相关用法
- JavaScript ArcGIS MeshTexture.wrap用法及代码示例
- JavaScript ArcGIS MeshComponent.faces用法及代码示例
- JavaScript ArcGIS MeshSymbol3D用法及代码示例
- JavaScript ArcGIS Mesh.rotate用法及代码示例
- JavaScript ArcGIS MeshSymbol3D.clone用法及代码示例
- JavaScript ArcGIS MeshComponent用法及代码示例
- JavaScript ArcGIS Mesh.vertexAttributes用法及代码示例
- JavaScript ArcGIS Mesh.createBox用法及代码示例
- JavaScript ArcGIS Mesh用法及代码示例
- JavaScript ArcGIS MeshMaterial用法及代码示例
- JavaScript Measurement.areaUnit用法及代码示例
- JavaScript ArcGIS MediaContent用法及代码示例
- JavaScript Measurement.on用法及代码示例
- JavaScript Measurement.activeWidget用法及代码示例
- JavaScript Measurement.activeTool用法及代码示例
- JavaScript Measurement.container用法及代码示例
- JavaScript Measurement.startMeasurement用法及代码示例
- JavaScript Measurement用法及代码示例
- JavaScript Measurement.visible用法及代码示例
- JavaScript Measurement.linearUnit用法及代码示例
- JavaScript Measurement.classes用法及代码示例
- JavaScript Measurement.view用法及代码示例
- JavaScript Measurement.viewModel用法及代码示例
- JavaScript Measurement.when用法及代码示例
- JavaScript ArcGIS MultipointDrawAction vertex-add事件用法及代码示例
注:本文由纯净天空筛选整理自arcgis.com大神的英文原创作品 MeshTexture。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。