Example #1
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="triangleCount">三角形の個数</param>
 /// <param name="vertices">頂点配列</param>
 /// <param name="vertMap">モデルの頂点とMMDの頂点対応</param>
 /// <param name="indexBuffer">インデックスバッファ</param>
 public MMDGPUModelPartPNmVc(int triangleCount, MMDVertexNmVc[] vertices, Dictionary<long, int[]> vertMap, IndexBuffer indexBuffer)
     : base(triangleCount, vertices.Length, vertMap, indexBuffer)
 {
     this.vertices = vertices;
     //GPUリソース作成
     gpuVertices = new VertexPositionNormalColor[vertices.Length];
     vertexBuffer = new WritableVertexBuffer(indexBuffer.GraphicsDevice, vertices.Length * 4, typeof(VertexPositionNormalColor));
     //初期値代入
     for (int i = 0; i < vertices.Length; i++)
     {
         gpuVertices[i].Position = vertices[i].Position;
         gpuVertices[i].Normal = vertices[i].Normal;
         gpuVertices[i].Color = new Color(vertices[i].VertexColor);
     }
     // put the vertices into our vertex buffer
     vertexOffset = vertexBuffer.SetData(gpuVertices);
 }
Example #2
0
 /// <summary>
 /// コンストラクタ
 /// </summary>
 /// <param name="triangleCount">三角形の個数</param>
 /// <param name="vertices">頂点配列</param>
 /// <param name="indexBuffer">インデックスバッファ</param>
 public MMDCPUModelPartPNmVc(int triangleCount, MMDVertexNmVc[] vertices, int[] vertMap, IndexBuffer indexBuffer)
     : base(triangleCount, vertices.Length, vertMap, indexBuffer)
 {
     this.vertices = vertices;
     //GPUリソース作成
     gpuVertices = new VertexPositionNormalColor[vertices.Length];
     vertexBuffer = new DynamicVertexBuffer(indexBuffer.GraphicsDevice, typeof(VertexPositionNormalColor), vertices.Length, BufferUsage.WriteOnly);
     //初期値代入
     for (int i = 0; i < vertices.Length; i++)
     {
         gpuVertices[i].Position = vertices[i].Position;
         gpuVertices[i].Normal = vertices[i].Normal;
         gpuVertices[i].Color = new Color(vertices[i].VertexColor);
     }
     // put the vertices into our vertex buffer
     vertexBuffer.SetData(gpuVertices, 0, vertexCount, SetDataOptions.Discard);
 }