VglRenderer
This component creates a canvas that have WebGL context. Options are corresponding THREE.WebGLRenderer.
Properties of VglNamespace are also available as mixin.
props
-  
cameraname (required)Name of the using camera.
 -  
scenename (required)Name of the target scene.
 -  
alphaboolean (optional)Whether the canvas contains an alpha (transparency) buffer or not.
 -  
disable-premultiplied-alphaboolean (optional)Whether the renderer will assume that colors have premultiplied alpha.
 -  
antialiasboolean (optional)Whether to perform antialiasing.
 -  
disable-stencilboolean (optional)Whether the drawing buffer has a stencil buffer of at least 8 bits.
 -  
preserve-drawing-bufferboolean (optional)Whether to preserve the buffers until manually cleared or overwritten.
 -  
disable-depthboolean (optional)Whether the drawing buffer has a depth buffer of at least 16 bits.
 -  
logarithmic-depth-bufferboolean (optional)Whether to use a logarithmic depth buffer.
 -  
shadow-map-enabledboolean (optional)If set, use shadow maps in the scene.
 -  
precisionstring (optional)Shader precision. Can be “highp”, “mediump” or “lowp”.
 -  
power-preferencestring (optional)A hint to the user agent indicating what configuration of GPU is suitable for this WebGL context. Can be “high-performance”, “low-power” or “default”.
 
computed properties
-  
instThe THREE.WebGLRenderer instance.
dependencies:
precision,alpha,disablePremultipliedAlpha,antialias,disableStencil,preserveDrawingBuffer,disableDepth,logarithmicDepthBuffer,powerPreference,shadowMapEnabled 
methods
-  
setCameraRef(camera)Set camera for rendering the scene. If canvas is already mounted, also calculates view size or aspect ratio.
 -  
setSceneRef(scene)Set scene to be rendered.
 -  
setFallbackCamera(cameras)Set camera for rendering the scene when
cameraprop is undefined. -  
setFallbackScene(scenes)Set scene to be rendered when
sceneprop is undefined. -  
requestRender()Call render function at next tick. Even if this method was called multiple times, it will be render just once.
 
Example
<template>
  <div>
    <vgl-renderer
      :antialias="antialias"
      :alpha="alpha"
      :disable-premultiplied-alpha="!premultipliedAlpha"
      :disable-depth="!depth"
      :precision="precision"
      :disable-stencil="!stencil"
      :preserve-drawing-buffer="preserveDrawingBuffer"
      :shadow-map-enabled="shadowMapEnabled"
      :logarithmic-depth-buffer="logarithmicDepthBuffer"
      camera="camera"
      scene="scene"
    >
      <vgl-scene name="scene">
        <vgl-sphere-geometry name="sphere" />
        <vgl-box-geometry name="box" />
        <vgl-mesh-standard-material name="std" />
        <vgl-mesh
          geometry="box"
          material="std"
          position="0 -1.5 0"
          receive-shadow
        />
        <vgl-mesh
          geometry="sphere"
          material="std"
          cast-shadow
          receive-shadow
        />
        <vgl-ambient-light color="#ffeecc" />
        <vgl-directional-light
          position="0 1 1"
          cast-shadow
        />
      </vgl-scene>
      <vgl-perspective-camera
        orbit-position="5 1 1"
        name="camera"
      />
    </vgl-renderer>
    <aside class="control-panel">
      <label><input
        v-model="antialias"
        type="checkbox"
      >Antialias</label>
      <label><input
        v-model="alpha"
        type="checkbox"
      >Alpha</label>
      <label><input
        v-model="premultipliedAlpha"
        type="checkbox"
      >Premultiplied alpha</label>
      <label><input
        v-model="depth"
        type="checkbox"
      >Depth buffer</label>
      <label><input
        v-model="stencil"
        type="checkbox"
      >Stencil buffer</label>
      <label><input
        v-model="preserveDrawingBuffer"
        type="checkbox"
      >Preserve drawing buffer</label>
      <label><input
        v-model="logarithmicDepthBuffer"
        type="checkbox"
      >Logarithmic depth buffer</label>
      <label><input
        v-model="shadowMapEnabled"
        type="checkbox"
      >Shadow map</label>
      <label>Precision
        <select v-model="precision">
          <option value="highp">High</option>
          <option value="mediump">Medium</option>
          <option value="lowp">Low</option>
        </select>
      </label>
    </aside>
  </div>
</template>
<script>
export default {
  data: () => ({
    antialias: true,
    alpha: false,
    premultipliedAlpha: true,
    depth: true,
    precision: 'highp',
    stencil: true,
    preserveDrawingBuffer: false,
    shadowMapEnabled: false,
    logarithmicDepthBuffer: false,
  }),
};
</script>