# <vgl-geometry>

A mesh, line, or point geometry representation.

# Example Usage

<template>
  <div>
    <vgl-renderer antialias>
      <template #scene>
        <vgl-scene>
          <vgl-line-loop>
            <template #geometry>
              <vgl-geometry
                :draw-range-start="drawRangeStart"
                :draw-range-count="drawRangeCount"
              >
                <template #position>
                  <vgl-float32-attribute
                    :array="position"
                    :item-size="3"
                  />
                </template>
                <template #color>
                  <vgl-float32-attribute
                    :array="color"
                    :item-size="3"
                  />
                </template>
              </vgl-geometry>
            </template>
            <template #material>
              <vgl-line-basic-material
                :linewidth="2"
                vertex-colors
              />
            </template>
          </vgl-line-loop>
          <vgl-line-loop
            :position-y="5"
            :rotation-y="-1.5708"
            :rotation-x="3.1416"
          >
            <template #geometry>
              <vgl-geometry>
                <template #position>
                  <vgl-float32-attribute
                    :array="position"
                    :item-size="3"
                  />
                </template>
                <template #color>
                  <vgl-float32-attribute
                    :array="color"
                    :item-size="3"
                  />
                </template>
              </vgl-geometry>
            </template>
            <template #material>
              <vgl-line-basic-material
                :linewidth="2"
                vertex-colors
              />
            </template>
          </vgl-line-loop>
        </vgl-scene>
      </template>
      <template #camera>
        <vgl-perspective-camera
          position="spherical"
          rotation="lookAt"
          :look-at-y="1.5"
          :position-radius="13"
          :position-phi="0.8"
          :position-theta="0.4"
        />
      </template>
    </vgl-renderer>
    <aside>
      <p>
        Draw range
        <label>Start<input
          v-model.number="drawRangeStart"
          type="range"
          max="6"
        ></label>
        <label>
          Count
          <input
            v-model.number="drawRangeCount"
            type="range"
            :max="8 - drawRangeStart"
            min="2"
          >
        </label>
      </p>
      <p>
        Position attribute
        <label>
          Line distance
          <input
            v-model.number="distance"
            min="0.5"
            max="1.5"
            step="0.1"
            type="range"
          >
        </label>
      </p>
      <p>
        Color attribute
        <label>
          Intensity
          <input
            v-model.number="intensity"
            min="0.5"
            max="1"
            step="0.01"
            type="range"
          >
        </label>
      </p>
    </aside>
  </div>
</template>

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

export default {
  components,
  data: () => ({
    drawRangeStart: 0, drawRangeCount: 8, intensity: 1, distance: 1,
  }),
  computed: {
    color() {
      return [
        1, 1, 1, 0.5, 0.5, 0.5, 1, 0.5, 0.5, 1, 1, 1,
        0.5, 1, 0.5, 0.5, 0.5, 0.5, 0.5, 0.5, 1, 1, 1, 1,
      ].map((value) => value * this.intensity);
    },
    position() {
      return [
        -5, 0, 0, 5, 0, 0, 5, 5, 0, -5, 5, 0,
        -5, 5 - this.distance, 0, 5 - this.distance, 5 - this.distance, 0,
        5 - this.distance, this.distance, 0, -5, this.distance, 0,
      ];
    },
  },
};
</script>

<style scoped>
  label {
    display: flex;
  }
  input {
    margin-left: 1ex;
  }
  p:first-line {
    font-weight: bold;
  }
</style>

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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159

# Props

  • name : string
    An arbitrary name of the instance.
    Defaults to [object Object]
  • drawRangeStart : number
    The start index of drawn part in the geometry.
    Defaults to [object Object]
  • drawRangeCount : number
    The number of indices to be drawn.
    Defaults to [object Object]
  • groups : array
    An array of objects those represent index groups to be rendered in separate draw calls.
    Defaults to [object Object]

# Slots

  • Any
    Each attribute in a named slot will be added to the geometry with the same name as the slot.