DirectX 11 3d

230602 지형 만들기, Height Map (다시)

슬뷔 2023. 6. 4. 23:17

1. 지형만들기 (수업 25분가량 못들음) - 기초 (4 by 4)

vector<UINT> vecIdx;

	for (int i = 0; i < m_iFaceZ; ++i)
	{
		for (int j = 0; j < m_iFaceX; ++j)
		{
			// 0
			// | \
			// 2--1  
			vecIdx.push_back((m_iFaceX + 1) * (i + 1) + (j)    );
			vecIdx.push_back((m_iFaceX + 1) * (i)     + (j + 1));
			vecIdx.push_back((m_iFaceX + 1) * (i)     + (j)    );

			// 0--1
			//  \ |
			//    2
			vecIdx.push_back((m_iFaceX + 1) * (i + 1) + (j)    );
			vecIdx.push_back((m_iFaceX + 1) * (i + 1) + (j + 1));
			vecIdx.push_back((m_iFaceX + 1) * (i)     + (j + 1));
		}
	}

	Ptr<CMesh> pMesh = new CMesh;
	pMesh->Create(vecVtx.data(), (UINT)vecVtx.size(), vecIdx.data(), (UINT)vecIdx.size());
	SetMesh(pMesh);

2. Height Map