<commit_before>require('debug').enable('*')
const createCube = require('primitive-cube')
const bunny = require('bunny')
// const bunny = require('primitive-cube')()
const normals = require('normals')
const centerAndNormalize = require('geom-center-and-normalize')
const Vec3 = require('pex-math/Vec3')
const Mat4 = require('pex-math/Mat4')
const Quat = require('pex-math/Quat')
const SimplexNoise = require('simplex-noise')
const R = require('ramda')
const random = require('pex-random')

const createContext = require('../../pex-context')
const raf = require('raf')
const createCamera = require('pex-cam/perspective')
const createOrbiter = require('pex-cam/orbiter')
const glsl = require('glslify')

const ctx = createContext()

let elapsedSeconds = 0
let prevTime = Date.now()
const noise = new SimplexNoise()

const camera = createCamera({
  fov: 45, // TODO: change fov to radians
  aspect: ctx.gl.canvas.width / ctx.gl.canvas.height,
  position: [3, 0.5, 3],
  target: [0, 2, 0]
})

const lightCamera = createCamera({
  fov: 45, // TODO: change fov to radians,
  aspect: 1,
  near: 5,
  far: 20,
  position: [1, 14, 1],
  target: [0, 0, 0]
})

const depthMapSize = 1024
const depthMap = ctx.texture2D({
  width: depthMapSize,
  height: depthMapSize,
  format: ctx.PixelFormat.Depth,
  min: ctx.Filter.Linear,
  mag: ctx.Filter.Linear
})
const colorMap = ctx.texture2D({ width: depthMapSize, height: depthMapSize })

const depthPassCmd = {
  name: 'depthPass',
  pass: ctx.pass({
    color: [ colorMap ],
    depth: depthMap,
    clearColor: [1, 0, 0, 1],
    clearDepth: 1
  })
}

const drawPassCmd = {
  name: 'drawPass',
  pass: ctx.pass({
    clearColor: [1, 0, 0, 1],
    clearDepth: 1
  })
}

const showNormalsVert = `
attribute vec3 aPosition;
attribute vec3 aNormal;
uniform mat4 uProjectionMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uModelMatrix;
varying vec4 vColor;

void main() {
  gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aPosition, 1.0);<commit_msg>Add texture formats to instancing example<commit_after>require('debug').enable('*')
const createCube = require('primitive-cube')
const bunny = require('bunny')
// const bunny = require('primitive-cube')()
const normals = require('normals')
const centerAndNormalize = require('geom-center-and-normalize')
const Vec3 = require('pex-math/Vec3')
const Mat4 = require('pex-math/Mat4')
const Quat = require('pex-math/Quat')
const SimplexNoise = require('simplex-noise')
const R = require('ramda')
const random = require('pex-random')

const createContext = require('../../pex-context')
const raf = require('raf')
const createCamera = require('pex-cam/perspective')
const createOrbiter = require('pex-cam/orbiter')
const glsl = require('glslify')

const ctx = createContext()

let elapsedSeconds = 0
let prevTime = Date.now()
const noise = new SimplexNoise()

const camera = createCamera({
  fov: 45, // TODO: change fov to radians
  aspect: ctx.gl.canvas.width / ctx.gl.canvas.height,
  position: [3, 0.5, 3],
  target: [0, 2, 0]
})

const lightCamera = createCamera({
  fov: 45, // TODO: change fov to radians,
  aspect: 1,
  near: 5,
  far: 20,
  position: [1, 14, 1],
  target: [0, 0, 0]
})

const depthMapSize = 1024
const depthMap = ctx.texture2D({
  width: depthMapSize,
  height: depthMapSize,
  pixelFormat: ctx.PixelFormat.Depth,
  encoding: ctx.Encoding.Linear,
  min: ctx.Filter.Linear,
  mag: ctx.Filter.Linear
})
const colorMap = ctx.texture2D({ width: depthMapSize, height: depthMapSize, pixelFormat: ctx.PixelFormat.RGBA8, encoding: ctx.Encoding.SRGB })

const depthPassCmd = {
  name: 'depthPass',
  pass: ctx.pass({
    color: [ colorMap ],
    depth: depthMap,
    clearColor: [1, 0, 0, 1],
    clearDepth: 1
  })
}

const drawPassCmd = {
  name: 'drawPass',
  pass: ctx.pass({
    clearColor: [1, 0, 0, 1],
    clearDepth: 1
  })
}

const showNormalsVert = `
attribute vec3 aPosition;
attribute vec3 aNormal;
uniform mat4 uProjectionMatrix;
uniform mat4 uViewMatrix;
uniform mat4 uModelMatrix;
varying vec4 vColor;

void main() {
  gl_Position = uProjectionMatrix * uViewMatrix * uModelMatrix * vec4(aPosition, 1.0);
{'fraction_non_alphanumeric': 0.14344560213229948, 'fraction_numerical': 0.02544220983765447, 'mean_word_length': 4.48936170212766, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1642688', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1418, 'n_words': 386}