Link Search Menu Expand Document

You are browsing the documentation for v0.x.
Visit here for the newest version.

VglAmbientLight

A light component globally illuminates all objects in the scene equally, corresponding THREE.AmbientLight. This light cannot be used to cast shadows as it does not have a direction.

Properties of VglLight are also available as mixin.

computed properties

  • inst

    The THREE.AmbientLight instance.

Example

<template>
  <div>
    <vgl-renderer
      antialias
      shadow-map-enabled
      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="`rgb(${r}, ${g}, ${b})`"
          :intensity="intensity"
        />
        <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">
      <section>
        <h3>Intensity</h3>
        <input
          v-model="intensity"
          type="range"
          max="1"
          step="0.01"
        >
      </section>
      <section>
        <h3>Color</h3>
        <label>R<input
          v-model="r"
          type="range"
          max="255"
        ></label>
        <label>G<input
          v-model="g"
          type="range"
          max="255"
        ></label>
        <label>B<input
          v-model="b"
          type="range"
          max="255"
        ></label>
      </section>
    </aside>
  </div>
</template>

<script>
export default {
  data: () => ({
    intensity: 0.5,
    r: 255,
    b: 255,
    g: 255,
  }),
};
</script>