Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
dataPos[i] = x;
dataPos[i + 1] = y;
dataPos[i + 2] = z;
dataPos[i + 3] = Math.random();
pos[count * 3 + 0] = dataPos[i];
pos[count * 3 + 1] = dataPos[i + 1];
pos[count * 3 + 2] = dataPos[i + 2];
uvs[count * 2 + 0] = (count % width) / width;
uvs[count * 2 + 1] = Math.floor(count / width) / height;
size[count] = G.utils.random(0.5, 1);
}
const prim = G.Primitive.cube(1, 1, 1);
const geom = new G.Geometry(prim);
const uvvv = new Float32Array(prim.uvs.length);
for (let i = 0; i < prim.uvs.length * 2; i += 2)
{
uvvv[count * 2 + 0] = (count % width) / width;
uvvv[count * 2 + 1] = Math.floor(count / width) / height;
count++;
}
console.log(uvvv.length);
geom.addAttribute('cuvss', uvvv);
// console.log(this.sphere.geometry.positions._data.length);
// console.log(144/2);
// console.log(Math.pow(Math.floor(Math.log2(this.sphere.geometry.positions._data.length)),2));
this.gpu = new PingPong({
data: dataText,
width,
height,
timeAdd: 0.001,
renderer: scene.webgl,
camera: new G.OrthographicCamera(-1, 1, -1, 1, 0.1, 100),
vs: glslify('./shaders/basic.vert'),
fs: glslify('./shaders/sim.frag'),
uniforms: {
uMouse: [0, 0, 0],
},
});
const geometry = new G.Geometry();
geometry.addAttribute('positions', pos, true);
geometry.addAttribute('colors', colors, true);
geometry.addAttribute('twouvs', uvs, true);
geometry.addAttribute('sizes', size, true);
const normal = this.normal = new G.Texture(gl);
normal.format = gl.RGBA;
normal.upload(window.getAsset('img/normal.png'));
this.mesh = new G.Mesh(
geometry,
new G.Shader(
glslify('./shaders/instancing.vert'),
for (var i = 0; i < width/6; i++) {
path.push([0,0,0]);
uvs.push([i / width, 1./height]);
uvs.push([i / width, 1./height]);
}
for (var i = 0; i < height; i++) {
uvsy.push(i/width);
uvsy.push(i/width);
}
const position = duplicate(path)
const directions = duplicate(path.map(x => 1), true)
const indexBuffer = createIndices(path.length);
const geometry = this.geometry = new G.Geometry();
geometry.addAttribute('positions', position)
geometry.addAttribute('directions', directions)
geometry.addIndices(indexBuffer, true);
geometry.addInstancedAttribute('uvys', uvsy, 1);
geometry.addAttribute('uvs', uvs)
geometry.addCount(uvsy.length)
this.lines = new G.Mesh(geometry,shader);
this.lines.position.y = 2;
this.scene.addChild(this.lines);
let dataPos = new Float32Array(width * height * 4);
let count = 0;
let row = 0;
let lifes = [];
for (var i = 0; i < height; i++) {