コード例 #1
0
ファイル: MWMeshLoader.cpp プロジェクト: ak4hige/myway3d
void MeshLoader_v0::ReadSkeleton(MeshPtr mesh, DataStreamPtr & stream)
{
    String sSkeletonName;
    stream->ReadString(sSkeletonName);
	
	TString128 Source = mesh->GetSourceName();
	Source = File::GetFileDir(Source);

	if (Source == "")
	{
		Source = sSkeletonName.c_str();
	}
	else
	{
		Source += "\\";
		Source += sSkeletonName.c_str();
	}

	SkeletonLoader::Load(mesh->GetSkeleton(), Source);
    //mesh->SetSkeletonName(sSkeletonName.c_str());
}
コード例 #2
0
ファイル: MWMeshLoader.cpp プロジェクト: ak4hige/myway3d
void MeshLoader_v0::Load(MeshPtr mesh, DataStreamPtr stream)
{
	bool hasBound = false;

	chunk ck;
	while (ReadChunk(ck, stream) &&
		(ck.id == MC_SUBMESH ||
		ck.id == MC_BOUNDS ||
		ck.id == MC_SKELETON))
	{
		switch (ck.id)
		{
		case MC_SUBMESH:
			ReadSubMesh(mesh->CreateSubMesh(), stream);
			break;

		case MC_BOUNDS:
			ReadBounds(mesh, stream);
			hasBound = TRUE;
			break;

		case MC_SKELETON:
			ReadSkeleton(mesh, stream);
			break;
		}
	}

	if (!hasBound)
		mesh->CalcuBounds();

	TString128 mtlSource = File::RemoveExternName(mesh->GetSourceName()) + ".material";

	DataStreamPtr mtlStream = ResourceManager::Instance()->OpenResource(mtlSource.c_str());

	if (mtlStream.NotNull())
	{
		MaterialLoader loader;
		loader.Load(mesh.c_ptr(), mtlStream);
	}
}