Вверх ↑
Ответов: 1429
Рейтинг: 50
#1: 2012-03-13 15:06:30 ЛС | профиль | цитата
Хочется привести пример когда код проигрывает схеме

Вот схема:
ftcg_shema1.png

А это код который она генерирует:

#pas
for i882 := 1 to result2883 do
begin
result3883:= Length(ArrayItem[0,0]) - 1;
for i884 := 1 to result3883 do
begin
if ArrayItem[name_x152,i882,i884,4] = 1 then
begin
if ArrayItem[name_x152,i882,i884,15] = 0 then
begin
if ArrayItem[name_x152,i882,i884,3] = 1 then
begin
tmp1891 := ArrayItem[name_x152,i882,i884,7] + ArrayItem[name_x152,i882,i884,5];
tmp2891 := ArrayItem[name_x152,i882,i884,8] + ArrayItem[name_x152,i882,i884,6];
sk891 := 3;
if ArrayItem[name_x152,i882,i884,8] < 25 then
begin
sk891 := 1;
end;
glBegin (GL_QUAD_STRIP);
glColor3f(ArrayColors[ArrayItem[name_x152,i882,i884,9],6], ArrayColors[ArrayItem[name_x152,i882,i884,9],7], ArrayColors[ArrayItem[name_x152,i882,i884,9],8]);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + 0 ,tmp2891 - sk891 - 0 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + 0 ,ArrayItem[name_x152,i882,i884,6] + sk891 + 0, 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk891 + 0 ,tmp2891 - 0, 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk891 + 0,ArrayItem[name_x152,i882,i884,6] + 0, 0);
glVertex3f(tmp1891 - sk891 - 0,tmp2891 - 0, 0);
glVertex3f(tmp1891 - sk891 - 0,ArrayItem[name_x152,i882,i884,6] + 0, 0);
glVertex3f(tmp1891 - 0,tmp2891 - sk891 - 0, 0);
glVertex3f(tmp1891 - 0,ArrayItem[name_x152,i882,i884,6] + sk891 + 0, 0);
glEnd;
tmp1896 := ArrayItem[name_x152,i882,i884,7] + ArrayItem[name_x152,i882,i884,5];
tmp2896 := ArrayItem[name_x152,i882,i884,8] + ArrayItem[name_x152,i882,i884,6];
sk896 := 3;
if ArrayItem[name_x152,i882,i884,8] < 25 then
begin
sk896 := 1;
end;
glBegin (GL_LINE_LOOP);
glColor3f(ArrayColors[ArrayItem[name_x152,i882,i884,9],9], ArrayColors[ArrayItem[name_x152,i882,i884,9],10], ArrayColors[ArrayItem[name_x152,i882,i884,9],11]);
glVertex3f(ArrayItem[name_x152,i882,i884,5] ,tmp2896 - sk896 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] ,ArrayItem[name_x152,i882,i884,6] + sk896 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk896 ,ArrayItem[name_x152,i882,i884,6] , 0);
glVertex3f(tmp1896 - sk896 ,ArrayItem[name_x152,i882,i884,6] , 0);
glVertex3f(tmp1896 ,ArrayItem[name_x152,i882,i884,6] + sk896 , 0);
glVertex3f(tmp1896 ,tmp2896 - sk896 , 0);
glVertex3f(tmp1896 - sk896 - 1 ,tmp2896 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk896 ,tmp2896 , 0);
glEnd;
end
else
begin
tmp1899 := ArrayItem[name_x152,i882,i884,7] + ArrayItem[name_x152,i882,i884,5];
tmp2899 := ArrayItem[name_x152,i882,i884,8] + ArrayItem[name_x152,i882,i884,6];
sk899 := 3;
if ArrayItem[name_x152,i882,i884,8] < 25 then
begin
sk899 := 1;
end;
glBegin (GL_QUAD_STRIP);
glColor3f(ArrayColors[ArrayItem[name_x152,i882,i884,9],0], ArrayColors[ArrayItem[name_x152,i882,i884,9],1], ArrayColors[ArrayItem[name_x152,i882,i884,9],2]);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + 0 ,tmp2899 - sk899 - 0 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + 0 ,ArrayItem[name_x152,i882,i884,6] + sk899 + 0, 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk899 + 0 ,tmp2899 - 0, 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk899 + 0,ArrayItem[name_x152,i882,i884,6] + 0, 0);
glVertex3f(tmp1899 - sk899 - 0,tmp2899 - 0, 0);
glVertex3f(tmp1899 - sk899 - 0,ArrayItem[name_x152,i882,i884,6] + 0, 0);
glVertex3f(tmp1899 - 0,tmp2899 - sk899 - 0, 0);
glVertex3f(tmp1899 - 0,ArrayItem[name_x152,i882,i884,6] + sk899 + 0, 0);
glEnd;
tmp1901 := ArrayItem[name_x152,i882,i884,7] + ArrayItem[name_x152,i882,i884,5];
tmp2901 := ArrayItem[name_x152,i882,i884,8] + ArrayItem[name_x152,i882,i884,6];
sk901 := 3;
if ArrayItem[name_x152,i882,i884,8] < 25 then
begin
sk901 := 1;
end;
glBegin (GL_LINE_LOOP);
glColor3f(ArrayColors[ArrayItem[name_x152,i882,i884,9],3], ArrayColors[ArrayItem[name_x152,i882,i884,9],4], ArrayColors[ArrayItem[name_x152,i882,i884,9],5]);
glVertex3f(ArrayItem[name_x152,i882,i884,5] ,tmp2901 - sk901 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] ,ArrayItem[name_x152,i882,i884,6] + sk901 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk901 ,ArrayItem[name_x152,i882,i884,6] , 0);
glVertex3f(tmp1901 - sk901 ,ArrayItem[name_x152,i882,i884,6] , 0);
glVertex3f(tmp1901 ,ArrayItem[name_x152,i882,i884,6] + sk901 , 0);
glVertex3f(tmp1901 ,tmp2901 - sk901 , 0);
glVertex3f(tmp1901 - sk901 - 1 ,tmp2901 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk901 ,tmp2901 , 0);
glEnd;
end;
end
else
begin
tmp1904 := ArrayItem[name_x152,i882,i884,7] + ArrayItem[name_x152,i882,i884,5];
tmp2904 := ArrayItem[name_x152,i882,i884,8] + ArrayItem[name_x152,i882,i884,6];
sk904 := 3;
if ArrayItem[name_x152,i882,i884,8] < 25 then
begin
sk904 := 1;
end;
glBegin (GL_QUAD_STRIP);
glColor3f(ArrayColors[ArrayItem[name_x152,i882,i884,9],12], ArrayColors[ArrayItem[name_x152,i882,i884,9],13], ArrayColors[ArrayItem[name_x152,i882,i884,9],14]);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + 0 ,tmp2904 - sk904 - 0 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + 0 ,ArrayItem[name_x152,i882,i884,6] + sk904 + 0, 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk904 + 0 ,tmp2904 - 0, 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk904 + 0,ArrayItem[name_x152,i882,i884,6] + 0, 0);
glVertex3f(tmp1904 - sk904 - 0,tmp2904 - 0, 0);
glVertex3f(tmp1904 - sk904 - 0,ArrayItem[name_x152,i882,i884,6] + 0, 0);
glVertex3f(tmp1904 - 0,tmp2904 - sk904 - 0, 0);
glVertex3f(tmp1904 - 0,ArrayItem[name_x152,i882,i884,6] + sk904 + 0, 0);
glEnd;
tmp1906 := ArrayItem[name_x152,i882,i884,7] + ArrayItem[name_x152,i882,i884,5];
tmp2906 := ArrayItem[name_x152,i882,i884,8] + ArrayItem[name_x152,i882,i884,6];
sk906 := 3;
if ArrayItem[name_x152,i882,i884,8] < 25 then
begin
sk906 := 1;
end;
glBegin (GL_LINE_LOOP);
glColor3f(ArrayColors[ArrayItem[name_x152,i882,i884,9],15], ArrayColors[ArrayItem[name_x152,i882,i884,9],16], ArrayColors[ArrayItem[name_x152,i882,i884,9],17]);
glVertex3f(ArrayItem[name_x152,i882,i884,5] ,tmp2906 - sk906 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] ,ArrayItem[name_x152,i882,i884,6] + sk906 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk906 ,ArrayItem[name_x152,i882,i884,6] , 0);
glVertex3f(tmp1906 - sk906 ,ArrayItem[name_x152,i882,i884,6] , 0);
glVertex3f(tmp1906 ,ArrayItem[name_x152,i882,i884,6] + sk906 , 0);
glVertex3f(tmp1906 ,tmp2906 - sk906 , 0);
glVertex3f(tmp1906 - sk906 - 1 ,tmp2906 , 0);
glVertex3f(ArrayItem[name_x152,i882,i884,5] + sk906 ,tmp2906 , 0);
glEnd;
end;
end;
end;
end;

Всё так упаковано, человек бы рехнулся. И размер и сложность кода против схемы - несопоставимы.
(особенно доставляет еще и то, что все нижние точки массивов имеют простые понятные имена)
карма: 0

0
файлы: 1ftcg_shema1.png [33.6KB] [403]