テクスチャアドレスモード
■テクスチャアドレスモードの設定に関して、必要になったのでメモを残します。
テクスチャのUV値が0.0-1.0以外の数値の場合、テクスチャアドレスモードでいろんな表現が可能です。
今回使用したモデルデータは以下のように設定しています。(UV値が-3.0〜3.0の値です)
// 頂点データを作成する vertices = new VertexPositionTexture[4]; vertices[0] = new VertexPositionTexture(new Vector3(-1.0f, 0.0f, 1.0f), new Vector2(-3.0f, 3.0f)); vertices[1] = new VertexPositionTexture(new Vector3(-1.0f, 0.0f, -1.0f), new Vector2(-3.0f, -3.0f)); vertices[2] = new VertexPositionTexture(new Vector3(1.0f, 0.0f, 1.0f), new Vector2(3.0f, 3.0f)); vertices[3] = new VertexPositionTexture(new Vector3(1.0f, 0.0f, -1.0f), new Vector2(3.0f, -3.0f));
■テクスチャアドレスモードの設定
graphics.GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Border; graphics.GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Border;
graphics.GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Clamp; graphics.GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Clamp;
graphics.GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Mirror; graphics.GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Mirror;
graphics.GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.MirrorOnce; graphics.GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.MirrorOnce;
graphics.GraphicsDevice.SamplerStates[0].AddressU = TextureAddressMode.Wrap; graphics.GraphicsDevice.SamplerStates[0].AddressV = TextureAddressMode.Wrap;