JSFiddle - React, Tailwind, and code Playground

HTML

<canvas id="main" style="border:1px #eee solid;background:black;" width="600" height="600"></canvas>
<!-- модель -->
<script type="text/objmodel" id="model">v -0.000581696 -0.734665 -0.623267
v 0.000283538 -1 0.286843
v -0.117277 -0.973564 0.306907
v -0.382144 -0.890788 0.221243
v -0.247144 -0.942602 0.276051
v -0.656078 -0.718512 -0.109025
v -0.609847 -0.786562 0.0198068
v -0.66248 -0.632053 -0.244271
v -0.511812 -0.845392 0.127809
v -0.609326 -0.569868 -0.41571
v -0.426949 -0.649767 -0.567143
v -0.201076 -0.720822 -0.633205
v 0.117382 -0.973645 0.306766
v 0.382454 -0.890869 0.221097
v 0.247512 -0.942667 0.275986
v 0.656371 -0.718624 -0.109224
v 0.610273 -0.786562 0.0197893
v 0.66248 -0.631463 -0.244119
v 0.511631 -0.845357 0.127832
v 0.608654 -0.568839 -0.416318
v 0.424663 -0.649937 -0.567418
v 0.198972 -0.720968 -0.633141
v 0.153371 -0.140519 0.477416
v 0.134781 -0.14723 0.48805
v 0.131261 -0.132153 0.49872
v 0.14749 -0.135105 0.489565
v 0.000686924 -0.0534984 0.505694
v 0.075062 -0.0473306 0.49955
v 0.0695841 -0.0997942 0.550277
v 0.0302569 -0.0971868 0.55389
v 0.0745124 -0.135953 0.523215
v 0.0354892 -0.12785 0.535159
v 0.0389268 -0.109557 0.550558
v 0.0734835 -0.11538 0.538029
v 0.106386 -0.125623 0.51513
v 0.107415 -0.144295 0.5047
v 0.15968 -0.130861 0.484794
v 0.156224 -0.123705 0.486735
v 0.15792 -0.107798 0.4677
v 0.163784 -0.126996 0.470144
v 0.154687 -0.134655 0.486373
v 0.160668 -0.135649 0.476189
v 0.143433 -0.119034 0.499854
v 0.131606 -0.0726738 0.476148
v -0.000260156 -0.124553 0.539058
v -0.000646004 -0.110651 0.55444
v 0.100423 -0.10574 0.537643
v 0.126128 -0.115784 0.515598
v 0.250944 -0.275583 0.380381
v 0.221602 -0.335752 0.330174
v 0.275434 -0.301318 0.24751
v 0.307699 -0.239869 0.292356
v 0.332124 -0.0415605 0.412962
v 0.319444 0.00732526 0.451091
v 0.28667 -0.025805 0.481549
v 0.297006 -0.0758717 0.454242
v 0.357953 -0.159928 -0.223225
v 0.303981 -0.144611 -0.343644
v 0.296386 -0.0547553 -0.357792
v 0.357339 -0.0633433 -0.24278
v 0.45086...

JavaScript

// CanvasGL, Model and Vector3 class
(function(window, undefined){
	var CanvasGL = function(canvas){
		this.canvas = canvas;
		this.context = canvas.getContext('2d');
		this.width = canvas.width;
		this.height = canvas.height;
		this.buffer = this.context.createImageData(this.width, this.height);
		this.zbuffer = new Float64Array(this.width * this.height);
	};

	CanvasGL.prototype = {
		put : function(){
			this.context.putImageData(this.buffer, 0, 0);
		},
		// draws a point !!! from right bottom corner !!!
		set : function(x, y, z, color){
			// rotate the image
			var data = this.buffer.data,
				width = this.buffer.width,
				height = this.buffer.height,
				index   = ((height - y|0) * width + (width - x|0));
			if(this.zbuffer[index] > z+1)
				return;
			this.zbuffer[index] = z+1;

			index *= 4;
			data[index]   = color[0];
			data[index+1] = color[1];
			data[index+2] = color[2];
			data[index+3] = 255;
		},
		line : function(x1, y1, x2, y2, color){
			var steep = false, temp;
			if(Math.abs(x1 - x2) < Math.abs(y1 - y2)){
				x1 = [y1, y1 = x1][0];
				x2 = [y2, y2 = x2][0];
				steep = true;
			}

			if(x1 > x2){
				x1 = [x2, x2 = x1][0];
				y1 = [y2, y2 = y1][0];
			}

			var dx = x2 - x1,
				dy = y2 - y1,
				derror = Math.abs(dy / dx),
				error = 0,
				y = y1;

			for(var x = x1; x <= x2; x++){
				if(steep)
					this.set(y, x, 0, color);
				else
					this.set(x, y, 0, color);

				error += derror;
				if(error > 0.5){
					y += (y2 > y1) ? 1 : -1;
					error -= 1;
				}
			}
		},
		triangleSolid : function(ax, ay, az, bx, by, bz, cx, cy, cz, color){
			if(ay == by && ay == cy) return;
			// sort the vertices, a, b, c lower-to-upper 
			var temp;
			if(ay > by){
				// swapping ax & bx; ay & by
				ax = [bx, bx = ax][0];
				ay = [by, by = ay][0];
			}
			if(ay > cy){
				ax = [cx, cx = ax][0];
				ay = [cy, cy = ay][0];
			}
			if(by > cy){
				bx = [cx, cx = bx][0];
				by = [cy, cy = by][0];
			}

			var ab_delta = by - ay,
				ac_delta = cy...