「MonoGameでHLSLにMatrixを渡す」の版間の差分
Administrator (トーク | 投稿記録) 編集の要約なし |
Administrator (トーク | 投稿記録) 編集の要約なし |
||
| (同じ利用者による、間の2版が非表示) | |||
| 15行目: | 15行目: | ||
// 仕方がないので「Vector4が4個」と指定する。 | // 仕方がないので「Vector4が4個」と指定する。 | ||
var vertexDeclaration = new VertexDeclaration( | var vertexDeclaration = new VertexDeclaration( | ||
new VertexElement( 0, VertexElementFormat.Vector4, VertexElementUsage.BlendWeight, 0), | |||
new VertexElement(16, VertexElementFormat.Vector4, VertexElementUsage.BlendWeight, 1), | |||
new VertexElement(32, VertexElementFormat.Vector4, VertexElementUsage.BlendWeight, 2), | |||
new VertexElement(48, VertexElementFormat.Vector4, VertexElementUsage.BlendWeight, 3)); | |||
// ダイナミックバーテックスバッファーを生成する | // ダイナミックバーテックスバッファーを生成する | ||
| 34行目: | 34行目: | ||
<syntaxhighlight lang="hlsl"> | <syntaxhighlight lang="hlsl"> | ||
// 「float4が4個」として受け取る。 | // 「float4が4個」として受け取る。 | ||
struct | struct VSInstance | ||
{ | { | ||
float4 w1 : BLENDWEIGHT0; | float4 w1 : BLENDWEIGHT0; | ||
| 42行目: | 42行目: | ||
}; | }; | ||
VSOutput VSMain(VSInput input, VSInstance instance) | |||
{ | { | ||
VSOutput output = (VSOutput)0; | |||
// 「float4が4個」をmatrixに合成する。 | // 「float4が4個」をmatrixに合成する。 | ||
| 50行目: | 50行目: | ||
// 〜以下略〜 | // 〜以下略〜 | ||
return output; | return output; | ||
} | } | ||