
前田稔(Maeda Minoru)の超初心者のプログラム入門
![]()
![]()
float[,] vt = new float[14, 3]
{ { -10.0f, 7.0f, 5.0f }, { 10.0f, -7.0f, 5.0f }, { 10.0f, 7.0f, 5.0f}, { 10.0f, 7.0f, -5.0f },
{ -10.0f, 7.0f, 5.0f }, { -10.0f, 7.0f, -5.0f }, { -10.0f, -7.0f, -5.0f }, { 10.0f, 7.0f, -5.0f },
{ 10.0f, -7.0f, -5.0f }, { 10.0f, -7.0f, 5.0f }, { -10.0f, -7.0f, -5.0f }, { -10.0f, -7.0f, 5.0f },
{ -10.0f, 7.0f, 5.0f }, { 10.0f, -7.0f, 5.0f } };
|
int[] cor = new int[14]
{ (int)0xff8080, (int)0xff8080, (int)0xff8080, (int)0xffff80, (int)0xffff80, (int)0xffff80, (int)0x80ff80,
(int)0x80ff80, (int)0x80ff80, (int)0x80ffff, (int)0x80ffff, (int)0x80ffff, (int)0x8080ff, (int)0x8080ff };
|
![]()

//前面赤, 右側面青, 裏面黄, 左側面緑, 上面白, 下面紫
float[, ,] vt = new float[6, 4, 3]
{ { { -10, -10, 10 }, { 10, -10, 10 }, { -10, 10, 10 }, { 10, 10, 10 } },
{ { 10, -10, 10 }, { 10, -10, -10 }, { 10, 10, 10 }, { 10, 10, -10 } },
{ { -10, 10, 10 }, { -10, 10, -10 }, { -10, -10, 10 }, { -10, -10, -10 } },
{ { -10, 10, -10 }, { 10, 10, -10 }, { -10, -10, -10 }, { 10, -10, -10 } },
{ { 10, 10, -10 }, { -10, 10, -10 }, { 10, 10, 10 }, { -10, 10, 10 } },
{ { -10, -10, -10 }, { 10, -10, -10 }, { -10, -10, 10 }, { 10, -10, 10 } },
};
|
int[] cor = new int[6]
{ (int)0xff0000, (int)0x00ff00, (int)0x0000ff, (int)0xffff00, (int)0xffffff, (int)0xff00ff };
|
public void OnCreateDevice(object sender, EventArgs e)
{
Device dev = (Device)sender;
// VertexBuffer を生成
vertexBuffer = new VertexBuffer(typeof(CustomVertex.PositionColored), 4, dev, 0,
CustomVertex.PositionColored.Format, Pool.Default);
}
|
for (int i = 0; i <6; i++)
{
SetBuffer(vertexBuffer, i);
device.SetStreamSource(0, vertexBuffer, 0);
device.DrawPrimitives(PrimitiveType.TriangleStrip, 0, 2);
}
|
![]()