# <vgl-use>

This component behaves as other components registered by the vgl-defs component.

# Example Usage

<template>
  <div>
    <p>Two canvases below shares a same scene and project it by different cameras.</p>
    <vgl-defs>
      <template #sharedScene>
        <vgl-scene>
          <vgl-mesh>
            <template #geometry>
              <vgl-box-geometry />
            </template>
            <template #material>
              <vgl-mesh-standard-material />
            </template>
          </vgl-mesh>
          <vgl-ambient-light :intensity="0.4" />
          <vgl-directional-light
            :intensity="0.5"
            :position-x="3"
            :position-y="2"
            :position-z="1"
          />
        </vgl-scene>
      </template>
    </vgl-defs>
    <vgl-renderer>
      <template #scene>
        <vgl-use href="sharedScene" />
      </template>
      <template #camera>
        <vgl-perspective-camera
          :position-x="1.5"
          :position-y="1.2"
          :position-z="1"
          rotation="lookAt"
        />
      </template>
    </vgl-renderer>
    <vgl-renderer>
      <template #scene>
        <vgl-use href="sharedScene" />
      </template>
      <template #camera>
        <vgl-orthographic-camera
          :left="-2.2"
          :right="2.2"
          :position-x="1.5"
          :position-y="1.2"
          :position-z="1"
          rotation="lookAt"
        />
      </template>
    </vgl-renderer>
  </div>
</template>

<script>
import * as components from 'vue-gl';

export default { components };
</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

# Props

  • href : string
    The reffering slot name of the vgl-defs component.