그리드 만들기
jjuiddong
- GitHub 소스코드 경로
// 격자무늬 버텍스를 만든다. // width = 격자 하나의 폭 크기 (정 사각형이므로 인자값은 하나만 받는다) // count = 격자 가로 세로 갯수 void cRenderer::MakeGrid( const float width, const int count, DWORD color, vector<sVertexDiffuse> &out ) { if (out.empty()) { out.reserve(count * 4); const Vector3 start(count/2 * -width, 0, count/2 * width); for (int i=0; i < count+1; ++i) { sVertexDiffuse vtx; vtx.p = start; vtx.p.x += (i * width); vtx.c = color; out.push_back(vtx); vtx.p += Vector3(0,0,-width*count); out.push_back(vtx); } for (int i=0; i < count+1; ++i) { sVertexDiffuse vtx; vtx.p = start; vtx.p.z -= (i * width); vtx.c = color; out.push_back(vtx); vtx.p += Vector3(width*count,0,0); out.push_back(vtx); } } }