# <vgl-texture>

# Example Usage

<template>
  <div>
    <vgl-renderer antialias>
      <template #scene>
        <vgl-scene>
          <vgl-mesh>
            <template #geometry>
              <vgl-plane-geometry
                :width="512"
                :height="512"
              />
            </template>
            <template #material>
              <vgl-mesh-standard-material>
                <template #map>
                  <vgl-texture
                    :rotation="rotation"
                    :center-u="0.5"
                    :center-v="0.5"
                  >
                    <template #image>
                      <vgl-image :src="shimoguri" />
                    </template>
                  </vgl-texture>
                </template>
              </vgl-mesh-standard-material>
            </template>
          </vgl-mesh>
          <vgl-ambient-light color="#ffeecc" />
          <vgl-directional-light
            :position-y="1"
            :position-z="2"
          />
        </vgl-scene>
      </template>
      <template #camera>
        <vgl-perspective-camera
          position="spherical"
          :position-radius="700"
          :position-phi="1"
          :position-theta="0.5"
          rotation="lookAt"
        />
      </template>
    </vgl-renderer>

    <aside class="control-panel">
      <label>Rotation<input
        v-model.number="rotation"
        type="range"
        max="3.14"
        min="-3.14"
        step="0.01"
      ></label>
    </aside>
  </div>
</template>

<script>
import * as components from 'vue-gl';
import shimoguri from './shimoguri.jpg';

export default {
  components,
  data: () => ({ rotation: 0, shimoguri }),
};
</script>

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68

# Props

  • name : string
    An arbitrary name of the instance.
    Defaults to [object Object]
  • mapping : uv | cubeReflection | cubeRefraction | equirectangularReflection | cubeUVReflection | equirectangularRefraction | cubeUVRefraction
    The image mapping mode.
    Defaults to [object Object]
  • wrapS : repeat | clampToEdge | mirroredRepeat
    The horizontal wrapping mode.
    Defaults to [object Object]
  • wrapT : repeat | clampToEdge | mirroredRepeat
    The vertical wrapping mode.
    Defaults to [object Object]
  • magFilter : linear | nearest
    The texture magnification method.
    Defaults to [object Object]
  • minFilter : linear | nearest | nearestMipMapNearest | nearestMipMapLinear | linearMipMapNearest | linearMipMapLinear
    The texture minification method.
    Defaults to [object Object]
  • anisotropy : number
    undefined
    Defaults to [object Object]
  • format : alpha | rgb | rgba | luminance | luminanceAlpha | rgbe | depth | depthStencil
    undefined
    Defaults to [object Object]
  • type : unsignedByte | byte | short | unsignedShort | int | unsignedInt | float | halfFloat | unsignedShort4444 | unsignedShort5551 | unsignedShort565 | unsignedInt248
    undefined
    Defaults to [object Object]
  • offsetU : number
    The offset along the U axis.
    Defaults to [object Object]
  • offsetV : number
    The offset along the V axis.
    Defaults to [object Object]
  • repeatU : number
    The repeating times along the U axis.
    Defaults to [object Object]
  • repeatV : number
    The repeating times along the V axis.
    Defaults to [object Object]
  • rotation : number
    The rotation angle around the center in radians.
    Defaults to [object Object]
  • centerU : number
    The coodinate of the rotating center point on the U axis.
    Defaults to [object Object]
  • centerV : number
    The coodinate of the rotating center point on the V axis.
    Defaults to [object Object]
  • premultiplyAlpha : boolean
    Wether premultiplying the alpha channel to the colors when uploading to GPU or not.
  • noFlipY : boolean
    Wether flipping the texture along the vertical axis in GPU or not.
  • unpackAlignment : 1 | 2 | 4 | 8
    undefined
    Defaults to [object Object]
  • encoding : linear | sRgb | gamma | rgbe | logLuv | rgbm7 | rgbm16 | rgbde | basicDepth | rgbaDepth
    undefined
    Defaults to [object Object]

# Slots

  • image
    A <vgl-image> component to be used as the texture image.