---
title: "MapboxTextureBuilding"
description: "纹理建筑，用户贴图作 fill-extrusion-pattern。"
seo_title: "MapboxTextureBuilding Component"
seo_description: "Textured 3D buildings using a user image as fill-extrusion-pattern over the composite/building source."
canonical_url: "https://mapbox.mhaibaraai.cn/docs/effects/texture-building"
---
# MapboxTextureBuilding

> 纹理建筑，用户贴图作 fill-extrusion-pattern。

## 简介

`MapboxTextureBuilding` 基于官方样式的 `composite/building` 渲染 3D 建筑，并以 `url` 贴图作 `fill-extrusion-pattern`；`opacity` / `minzoom` 控制透明度与起始缩放。需倾斜视角且缩放 ≥ `minzoom`（默认 15）。

## 用法

以可平铺砖墙贴图覆盖楼体表面：

```vue [TextureBuildingExample.vue]
<template>
  <div class="h-115 w-full overflow-hidden rounded-(--ui-radius) border border-default">
    <MapboxMap
      :options="{ style: 'mapbox://styles/mapbox/light-v11', center: [116.461, 39.909], zoom: 15.5, pitch: 60, bearing: -20 }"
    >
      <!-- three.js 公开的可平铺砖墙贴图 -->
      <MapboxTextureBuilding url="https://threejs.org/examples/textures/brick_diffuse.jpg" />
    </MapboxMap>
  </div>
</template>
```

## API

### Props

```ts
/**
 * Props for the MapboxTextureBuilding component
 */
interface MapboxTextureBuildingProps {
  /**
   * 贴图地址
   */
  url: string;
  /**
   * 图层 id；省略时自动生成
   */
  layerId?: string | undefined;
  /**
   * 整体透明度
   */
  opacity?: number | undefined;
  /**
   * 最小缩放级别
   * @default "15"
   */
  minzoom?: number | undefined;
  /**
   * 插入到该图层之前
   */
  beforeId?: string | undefined;
}
```

## Changelog

See commit history for [src/runtime/components/effects/TextureBuilding.vue](https://github.com/mhaibaraai/movk-mapbox/commits/main/src/runtime/components/effects/TextureBuilding.vue).


## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
