<commit_before><template>
  <canvas title="VScene">
    <slot v-if="ready"></slot>
  </canvas>
</template>

<script>
  const THREE = require('three');
  export default {
    name: "v-scene",
    props: {
      width: {type: Number, default: 50},
      height: {type: Number, default: 50},
      backgroundColor: {type: String, default: 'rgb(0,0,0)'},
      backgroundAlpha: {type: Number, default: 1},
    },
    data() {
      return {
        dom: null,
        scene: null,
        renderer: null,
        rendererDelegation: [],
        rendererTick: null,
        camera: null,
        ready: false,

      }
    },
    mounted() {
      this.dom = this.$el;
      this.scene = new THREE.Scene();
      this.renderer = new THREE.WebGLRenderer({
        //preserveDrawingBuffer: true,
        antialias: true, // 抗锯齿
        alpha: true,
        canvas: this.dom
      });
      this.rendererDelegationAdd(this.updateRenderer);
      this.ready = true;
    },
    update() {
      this.render();
    },
    methods: {
      render() {
        if (this.rendererDelegation.length < 1) return;
        if (this.rendererTick) return;
        this.rendererTick = requestAnimationFrame(() => {
          this.rendererTick = null;
          this.rendererDelegation.forEach((func) => {
            func();
          });
          this.renderer.render(this.scene, this.camera);
        })
      },
      updateRenderer() {
        this.renderer.setSize(this.width, this.height);
        this.renderer.setPixelRatio(window.devicePixelRatio || 1);
        this.renderer.setClearColor(new THREE.Color(this.backgroundColor).getHex());
        this.renderer.setClearAlpha(this.backgroundAlpha);
      },
      rendererDelegationAdd(func) {
        if (typeof func === 'function') {<commit_msg>0.3.4 修改scene的参数为可配置props<commit_after><template>
  <canvas title="VScene">
    <slot v-if="ready"></slot>
  </canvas>
</template>

<script>
  const THREE = require('three');
  export default {
    name: "v-scene",
    props: {
      width: {type: Number, default: 50},
      height: {type: Number, default: 50},
      backgroundColor: {type: String, default: 'rgb(0,0,0)'},
      backgroundAlpha: {type: Number, default: 1},
      buffer: {type: Boolean, default: true},
      antialias: {type: Boolean, default: true},
      alpha: {type: Boolean, default: true},
    },
    data() {
      return {
        dom: null,
        scene: null,
        renderer: null,
        rendererDelegation: [],
        rendererTick: null,
        camera: null,
        ready: false,
      }
    },
    mounted() {
      this.dom = this.$el;
      this.scene = new THREE.Scene();
      this.renderer = new THREE.WebGLRenderer({
        preserveDrawingBuffer: this.buffer, //绘图缓冲
        antialias: this.antialias, // 抗锯齿
        alpha: this.alpha,
        canvas: this.dom
      });
      this.rendererDelegationAdd(this.updateRenderer);
      this.ready = true;
    },
    update() {
      this.render();
    },
    methods: {
      render() {
        if (this.rendererDelegation.length < 1) return;
        if (this.rendererTick) return;
        this.rendererTick = requestAnimationFrame(() => {
          this.rendererTick = null;
          this.rendererDelegation.forEach((func) => {
            func();
          });
          this.renderer.render(this.scene, this.camera);
        })
      },
      updateRenderer() {
        this.renderer.setSize(this.width, this.height);
        this.renderer.setPixelRatio(window.devicePixelRatio || 1);
        this.renderer.setClearColor(new THREE.Color(this.backgroundColor).getHex());
        this.renderer.setClearAlpha(this.backgroundAlpha);
      },
      rendererDelegationAdd(func) {
        if (typeof func === 'function') {
{'fraction_non_alphanumeric': 0.1431241655540721, 'fraction_numerical': 0.006141522029372497, 'mean_word_length': 2.2293103448275864, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 21, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5373290', 'n_tokens_mistral': 1160, 'n_tokens_neox': 1159, 'n_words': 225}