Explorar el Código

support generating plane geometry.

maybe such objects should be optimized? it's quite expensive to draw
such simple things. or maybe buffering the draw calls would help. not
sure.
Lucas Stadler %!s(int64=12) %!d(string=hace) años
padre
commit
e5c91a0881
Se han modificado 1 ficheros con 16 adiciones y 0 borrados
  1. 16 0
      js/pixl/public/trixl.html

+ 16 - 0
js/pixl/public/trixl.html

@ -372,6 +372,22 @@
372 372
			}
373 373
		}
374 374
375
		trixl.geometry.plane = function(pos, v, w, width, height, color) {
376
			var v = vec3.normalize([], v), w = vec3.normalize([], w);
377
378
			for (var i = 0; i < width; i++) {
379
				for (var j = 0; j < height; j++) {
380
					var pos = vec3.create();
381
					vec3.scaleAndAdd(pos, pos, v, i);
382
					vec3.scaleAndAdd(pos, pos, w, j);
383
384
					trixl.world.set([
385
						Math.round(pos[0]), Math.round(pos[1]), Math.round(pos[2])
386
					], {color: color || trixl.color});
387
				}
388
			}
389
		}
390
375 391
		var angle = {x: 0, y: 0, z: 0};
376 392
		var offset = {x: 0, y: 0, z: 0};
377 393
		program.transform = gl.getUniformLocation(program, 'transform');