예제 #1
0
		// returns the name of a profiling entry that includes
		// its scope information
		PooledString BuildCompleteName(const char* name) {
			PooledString completeName(GetCurrentName());
			// appends the new name to the current scope name
			completeName+="::";
			completeName+=name;
			return completeName;
		}
예제 #2
0
파일: Mesh.cpp 프로젝트: pipmix/Game
Mesh::Mesh(ID3D11Device* d, wstring fn) : fileName(fn){


	wstring completePathAndName = gPath + gMeshPath + fileName + L".mesh";
	string completeName(completePathAndName.begin(), completePathAndName.end());




	ifstream file(completePathAndName);




	if (file) {

		file >> materialName >> textureName >> numOfIndices >> numOfVertices;

		unsigned short* indices = new unsigned short[numOfIndices];

		for (int i = 0; i < numOfIndices; i++) file >> indices[i];
		

		VERTEXPNU* vertices = new VERTEXPNU[numOfVertices];

		for (int i = 0; i < numOfVertices; i++) {

			file >> vertices[i].pos.x
				>> vertices[i].pos.y
				>> vertices[i].pos.z
				>> vertices[i].normal.x
				>> vertices[i].normal.y
				>> vertices[i].normal.z
				>> vertices[i].uv.x
				>> vertices[i].uv.y;
		}
		file.close();



		D3D11_SUBRESOURCE_DATA vertexBufferData = { 0 };
		vertexBufferData.pSysMem = vertices;
		vertexBufferData.SysMemPitch = 0;
		vertexBufferData.SysMemSlicePitch = 0;

		CD3D11_BUFFER_DESC vertexBufferDesc(sizeof(vertices), D3D11_BIND_VERTEX_BUFFER);
		

		D3D11_SUBRESOURCE_DATA indexBufferData = { 0 };
		indexBufferData.pSysMem = indices;
		indexBufferData.SysMemPitch = 0;
		indexBufferData.SysMemSlicePitch = 0;
		CD3D11_BUFFER_DESC indexBufferDesc(sizeof(indices), D3D11_BIND_INDEX_BUFFER);

		d->CreateBuffer(&vertexBufferDesc, &vertexBufferData, &mVertexBuffer);
		d->CreateBuffer(&indexBufferDesc, &indexBufferData, &mIndexBuffer);

		delete[] vertices;
		delete[] indices;



	}





}