Crafty.init(500,1000, document.getElementById('game'));
//ArrayA=F2 row=i column=F7
//ArrayB=F7 row=a column=F6
//ArrayC=F6 row=LU column=F3 result
//ArrayD=F3 row=NU column=LU
//ArrayE=F9 row=1024 column=512
//ArrayF=F1 [A]=13bit [B]=9bit
Crafty.c("Pixel",{ init: function(){ var FA=0; var FB=0; var FC=0;this.lum=128; this.i=50; this.a=50;this.NU=256; this.LU=256; this.j=0; this.b=0; this.requires("2D,Color");},
qqq: function(){
FC=myArrayD[this.LU][this.NU];
FB=myArrayC[this.LU][FC];
FA=myArrayB[this.a][FB];
this.b=myArrayA[this.i][FA];
this.j=myArrayE[this.y][this.x];
this.color("#0000FF",check.lastIndexOf(myArrayF[this.j][this.b]));
}
});
Crafty.e('2D, Canvas, Color, Pixel')
.attr({x: 0, y: 0, w:100, h: 100})
.color('#F00')
//assign variables
//The arrays are random
这是光线追踪的代码,但是如果有人为HTML5加速它我感兴趣我不想使用不同的算法进行光线追踪。只是想要正确实现大型数组并使用其他东西对单个像素进行着色,因为它太慢了。