<commit_before>const reglM = require('regl')
// use this one for server side render
// const regl = require('regl')(require('gl')(256, 256))
// use this one for rendering inside a specific canvas/element
// var regl = require('regl')(canvasOrElement)
import { bunnyData, bunnyData2, bunnyData3, sceneData } from '../common/data'
import { drawModel as _drawModel, draw as _draw, makeDrawCalls } from './draw'
import { params as cameraDefaults } from '../common/controls/orbitControls'
import camera from '../common/camera'

import normals from 'angle-normals'


const regl = reglM({extensions: 'oes_texture_float'})//FIXME: for shadows, is it widely supported
/*canvas: container,
  drawingBufferWidth: container.offsetWidth,
  drawingBufferHeight: container.offsetHeight})*/ //for editor

const {frame, clear} = regl
//const drawModel = _drawModel.bind(null, regl)
const draw = _draw.bind(null, regl)

import {controlsLoop as controlsLoop} from '../common/controls/controlsLoop'
import pickLoop from '../common/picking/pickLoop'

import computeBounds from '../common/bounds/computeBounds'// from 'vertices-bounding-box'
import computeTMatrixFromTransforms from '../common/utils/computeTMatrixFromTransforms'

import most from 'most'

import { interactionsFromEvents, pointerGestures } from '../common/interactions/pointerGestures'

/* --------------------- */

const container = document.querySelector('canvas')
//const container = document.querySelector('#drawHere')


import makeGrid from './grid'
import makeShadowPlane from './shadowPlane'
import makeTransformGizmo from './transformsGizmo'

const grid = makeGrid(160, 1)
const gizmo = makeTransformGizmo()
const shadowPlane = makeShadowPlane(160)


/* --------------------- */

function flatten (arr) {
  return arr.reduce(function (a, b) {
    return a.concat(b)
  }, [])
}

let fullData = {
  scene: sceneData,
  entities: flatten([bunnyData, bunnyData2, bunnyData3, grid, shadowPlane, gizmo])
}

// inject bounding box data
fullData.entities = fullData.entities.map(function (entity) {
  const bounds = computeBounds(entity)
  const result = Object.assign({}, entity, {bounds})
  console.log('data with bounds', result)<commit_msg>chore(proto1): added extra notes about overall pipeline<commit_after>const reglM = require('regl')
// use this one for server side render
// const regl = require('regl')(require('gl')(256, 256))
// use this one for rendering inside a specific canvas/element
// var regl = require('regl')(canvasOrElement)
import { bunnyData, bunnyData2, bunnyData3, sceneData } from '../common/data'
import { drawModel as _drawModel, draw as _draw, makeDrawCalls } from './draw'
import { params as cameraDefaults } from '../common/controls/orbitControls'
import camera from '../common/camera'
import normals from 'angle-normals'


const regl = reglM({extensions: 'oes_texture_float'})//FIXME: for shadows, is it widely supported
/*canvas: container,
  drawingBufferWidth: container.offsetWidth,
  drawingBufferHeight: container.offsetHeight})*/ //for editor

const {frame, clear} = regl
//const drawModel = _drawModel.bind(null, regl)
const draw = _draw.bind(null, regl)

import {controlsLoop as controlsLoop} from '../common/controls/controlsLoop'
import pickLoop from '../common/picking/pickLoop'

import computeBounds from '../common/bounds/computeBounds'// from 'vertices-bounding-box'
import computeTMatrixFromTransforms from '../common/utils/computeTMatrixFromTransforms'

import most from 'most'

import { interactionsFromEvents, pointerGestures } from '../common/interactions/pointerGestures'

/* --------------------- */

const container = document.querySelector('canvas')
//const container = document.querySelector('#drawHere')


import makeGrid from './grid'
import makeShadowPlane from './shadowPlane'
import makeTransformGizmo from './transformsGizmo'

const grid = makeGrid(160, 1)
const gizmo = makeTransformGizmo()
const shadowPlane = makeShadowPlane(160)


/* --------------------- */


/* Pipeline:
  - data => process (normals computation, color format conversion) => (drawCall generation) => drawCall

  - every object with a fundamentall different 'look' (beyond what can be done with shader parameters) => different (VS) & PS
  - even if regl can 'combine' various uniforms, attributes, props etc, the rule above still applies
*/

function flatten (arr) {
  return arr.reduce(function (a, b) {
    return a.concat(b)
  }, [])
}

let fullData = {
  scene: sceneData,
  entities: flatten([bunnyData, bunnyData2, bunnyData3, grid, shadowPlane, ])//gizmo])
}

// inject bounding box data
fullData.entities = fullData.entities.map(function (entity) {
  const bounds = computeBounds(entity)
  const result = Object.assign({}, entity, {bounds})
  console.log('data with bounds', result)
{'fraction_non_alphanumeric': 0.1403729310706055, 'fraction_numerical': 0.007332914309658495, 'mean_word_length': 4.5, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '6244369', 'n_tokens_mistral': 1422, 'n_tokens_neox': 1381, 'n_words': 415}