全言語ドキュメントのカーネル対象構文を改定

このコミットが含まれているのは:
routersys committed 2026-07-04 17:28:13 +09:00
1 親 bc69ec5681
コミット db8017a8ce
8ファイル変更
+164 -48

検索条件に一致するファイルはありません

+20 -6
ファイルの表示
@@ -58,14 +58,28 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
الشكل التالي الذي يستخدم getpixeldata يتحول إلى نواة أيضاً.
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
· يجوز في الجسم استخدام العمليات الحسابية و math.* والمقارنات
وصيغة العتبة "cond and value1 or value2" ومتغيرات local فقط.
· يجوز الإشارة فقط إلى البكسل الجاري معالجته (getpixel(x, y))
وقيم مثل obj/scene/time.
وصيغة العتبة "cond and value1 or value2" والإسناد الشرطي إلى
متغيرات local عبر if/elseif/else ومتغيرات local فقط.
· يجوز أيضاً استخدام أسماء بديلة لحدود الحلقة مثل local w = obj.w.
· يجوز الإشارة فقط إلى البكسل الجاري معالجته وقيم مثل
obj/scene/time.
· أي استخدام لأخذ عينات الجوار (التمويه، إلخ) أو الكتابة إلى
إحداثيات أخرى أو getpixeldata أو getobject أو عمليات
الجداول/السلاسل أو جُمَل if لا يتحول إلى نواة ويُنفَّذ تلقائياً
على المحرك التقليدي.
إحداثيات أخرى أو استدعاء setpixel أو set داخل جملة if أو
getobject أو عمليات الجداول/السلاسل لا يتحول إلى نواة
ويُنفَّذ تلقائياً على المحرك التقليدي.
مثال (يجعل شكلاً أبيض أحمر):
--!gpu
+20 -6
ファイルの表示
@@ -60,15 +60,29 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
The following form using getpixeldata becomes a kernel as well.
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
- The body may use only arithmetic, math.*, comparisons, the
threshold idiom "cond and value1 or value2", and local
threshold idiom "cond and value1 or value2", conditional
assignment to local variables via if/elseif/else, and local
variables.
- It may reference only the current pixel being processed
(getpixel(x, y)) and values such as obj/scene/time.
- Loop bounds may also use aliases such as local w = obj.w.
- It may reference only the current pixel being processed and
values such as obj/scene/time.
- Anything using neighbor sampling (blur, etc.), writes to other
coordinates, getpixeldata, getobject, table/string operations,
or if statements is not turned into a kernel and automatically
runs on the classic engine.
coordinates, setpixel or set calls inside an if statement,
getobject, or table/string operations is not turned into a
kernel and automatically runs on the classic engine.
Example (turns a white figure red):
--!gpu
+23 -6
ファイルの表示
@@ -61,14 +61,31 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
La siguiente forma con getpixeldata también se convierte en núcleo.
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
- El cuerpo solo puede usar aritmética, math.*, comparaciones, el
modismo de umbral "cond and valor1 or valor2" y variables local.
- Solo puede referenciar el píxel actual en proceso
(getpixel(x, y)) y valores como obj/scene/time.
modismo de umbral "cond and valor1 or valor2", la asignación
condicional a variables local mediante if/elseif/else y
variables local.
- Los límites del bucle también pueden usar alias como
local w = obj.w.
- Solo puede referenciar el píxel actual en proceso y valores
como obj/scene/time.
- Todo lo que use muestreo de vecinos (desenfoque, etc.),
escrituras en otras coordenadas, getpixeldata, getobject,
operaciones de tabla/cadena o sentencias if no se convierte en
núcleo y se ejecuta automáticamente en el motor clásico.
escrituras en otras coordenadas, llamadas a setpixel o set
dentro de una sentencia if, getobject u operaciones de
tabla/cadena no se convierte en núcleo y se ejecuta
automáticamente en el motor clásico.
Ejemplo (vuelve roja una figura blanca):
--!gpu
+21 -6
ファイルの表示
@@ -62,14 +62,29 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
Bentuk berikut yang memakai getpixeldata juga menjadi kernel.
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
- Badan hanya boleh memakai aritmetika, math.*, perbandingan,
idiom ambang "cond and nilai1 or nilai2", dan variabel local.
- Hanya boleh mereferensikan piksel yang sedang diproses
(getpixel(x, y)) dan nilai seperti obj/scene/time.
idiom ambang "cond and nilai1 or nilai2", penugasan bersyarat
ke variabel local melalui if/elseif/else, dan variabel local.
- Batas perulangan juga boleh memakai alias seperti
local w = obj.w.
- Hanya boleh mereferensikan piksel yang sedang diproses dan
nilai seperti obj/scene/time.
- Apa pun yang memakai sampling tetangga (blur, dll.), penulisan
ke koordinat lain, getpixeldata, getobject, operasi
tabel/string, atau pernyataan if tidak diubah menjadi kernel dan
otomatis berjalan di mesin klasik.
ke koordinat lain, pemanggilan setpixel atau set di dalam
pernyataan if, getobject, atau operasi tabel/string tidak
diubah menjadi kernel dan otomatis berjalan di mesin klasik.
Contoh (membuat figur putih menjadi merah):
--!gpu
+21 -6
ファイルの表示
@@ -57,13 +57,28 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
getpixeldata を使う次の形も同様にカーネル化されます。
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
・本体で使えるのは四則演算・math.*・比較・しきい値の
「条件 and 値1 or 値2」・local 変数のみです。
・参照できるのは処理中の自ピクセル(getpixel(x, y))と
obj/scene/time 等の値だけです。
・近傍参照(ぼかし等)、別座標への書き込み、getpixeldata、
getobject、テーブル/文字列操作、if 文などを含む場合は
カーネル化されず、自動的に従来エンジンで実行されます。
「条件 and 値1 or 値2」・if/elseif/else による local 変数への
条件代入・local 変数のみです。
・ループの上限には local w = obj.w のような別名も使えます。
・参照できるのは処理中の自ピクセルと obj/scene/time 等の
値だけです。
・近傍参照(ぼかし等)、別座標への書き込み、if 文の中での
setpixel や set の呼び出し、getobject、テーブル/文字列操作
などを含む場合はカーネル化されず、自動的に従来エンジンで
実行されます。
例(白い図形が赤くなる):
--!gpu
+21 -6
ファイルの表示
@@ -57,13 +57,28 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
getpixeldata를 사용하는 다음 형태도 마찬가지로 커널화됩니다.
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
· 본문에서 사용할 수 있는 것은 사칙연산・math.*・비교・임계값
「조건 and 값1 or 값2」・local 변수뿐입니다.
· 참조할 수 있는 것은 처리 중인 자기 픽셀(getpixel(x, y))과
obj/scene/time 등의 값뿐입니다.
· 이웃 참조(블러 등), 다른 좌표로의 쓰기, getpixeldata,
getobject, 테이블/문자열 조작, if 문 등을 포함하는 경우에는
커널화되지 않고 자동으로 기존 엔진에서 실행됩니다.
「조건 and 값1 or 값2」・if/elseif/else에 의한 local 변수에
대한 조건 대입・local 변수뿐입니다.
· 루프의 상한에는 local w = obj.w 같은 별칭도 사용할 수 있습니다.
· 참조할 수 있는 것은 처리 중인 자기 픽셀과 obj/scene/time
등의 값뿐입니다.
· 이웃 참조(블러 등), 다른 좌표로의 쓰기, if 문 안에서의
setpixel이나 set 호출, getobject, 테이블/문자열 조작 등을
포함하는 경우에는 커널화되지 않고 자동으로 기존 엔진에서
실행됩니다.
예(흰색 도형이 빨갛게 됨):
--!gpu
+19 -6
ファイルの表示
@@ -57,13 +57,26 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
使用 getpixeldata 的下列形式同样会被内核化。
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
· 主体中仅可使用四则运算、math.*、比较、阈值写法
“条件 and 值1 or 值2”以及 local 变量。
· 仅可引用正在处理的自像素(getpixel(x, y))
以及 obj/scene/time 等值。
· 含有邻域参照(模糊等)、写入其他坐标、getpixeldata、
getobject、表/字符串操作、if 语句等的脚本不会被内核化,
会自动由传统引擎执行。
“条件 and 值1 or 值2”、通过 if/elseif/else 对 local 变量的
条件赋值以及 local 变量。
· 循环上限也可以使用 local w = obj.w 这样的别名。
· 仅可引用正在处理的自像素以及 obj/scene/time 等值。
· 含有邻域参照(模糊等)、写入其他坐标、在 if 语句中调用
setpixel 或 set、getobject、表/字符串操作等的脚本不会被
内核化,会自动由传统引擎执行。
示例(让白色图形变红):
--!gpu
+19 -6
ファイルの表示
@@ -57,13 +57,26 @@
obj.setpixel(x, y, r2, g2, b2 [, a2])
end
end
使用 getpixeldata 的下列形式同樣會被核心化。
local data = obj.getpixeldata()
for y = 0, data.height - 1 do
for x = 0, data.width - 1 do
local i = (y * data.width + x) * 4
local r = data:get(i + 1)
data:set(i + 1, r2)
data:set(i + 2, g2)
data:set(i + 3, b2)
end
end
obj.putpixeldata(data)
· 主體中僅可使用四則運算、math.*、比較、閾值寫法
「條件 and 值1 or 值2」以及 local 變數。
· 僅可參照正在處理的自像素(getpixel(x, y))
以及 obj/scene/time 等值。
· 含有鄰域參照(模糊等)、寫入其他座標、getpixeldata、
getobject、表/字串操作、if 陳述式等的腳本不會被核心化,
會自動由傳統引擎執行。
「條件 and 值1 or 值2」、透過 if/elseif/else 對 local 變數的
條件賦值以及 local 變數。
· 迴圈上限也可以使用 local w = obj.w 這樣的別名。
· 僅可參照正在處理的自像素以及 obj/scene/time 等值。
· 含有鄰域參照(模糊等)、寫入其他座標、在 if 陳述式中呼叫
setpixel 或 set、getobject、表/字串操作等的腳本不會被
核心化,會自動由傳統引擎執行。
範例(讓白色圖形變紅):
--!gpu