
jit.gl.gridshapeで出力される難解なmatrixの仕様が見つからない日々が続きましたが(過去にもjit.genでなんとか頑張ろうとしたのですが、)仕様を見つけました。さらにjit.unpackで綺麗に書く方法を見つけたので書いておきます。
[jit.unpack 4 @jump 3 2 3 4 @offset 0 3 5 8]
jumpってなんなんplanesとかplanenumとかでいいじゃん。jitterは行列演算なので数式さえわかればmax以外の環境とそこまで遜色ない事ができるとは思うんですがhelpパッチも含めて仕様把握するのがむず過ぎると思います。
outputmatrix 1 で出力されるmatrixの仕様
やっと見つけたよ・・・
- plane 0: x coordinate of vertex
- plane 1: y coordinate of vertex
- plane 2: z coordinate of vertex
- plane 3: s coordinate of texture at vertex, if textured
- plane 4: t coordinate of texture at vertex, if textured
- plane 5: x component of lighting normal at vertex
- plane 6: y component of lighting normal at vertex
- plane 7: z component of lighting normal at vertex
- plane 8: red component of vertex color
- plane 9: green component of vertex color
- plane 10: blue component of vertex color
- plane 11: alpha component of vertex color
- plane 12: edge flag for connection to next vertex: if = 0, no line is drawn.
出典:https://docs.cycling74.com/max8/tutorials/jitterchapter99_appendixb
これを適切にjit.gl.meshに入れればモデルが表示されますし、jit.genで任意のmatrixを変形させればインタラクティブにモデルがいじれます。