当前位置: 首页>>代码示例>>C++>>正文


C++ Model::GetName方法代码示例

本文整理汇总了C++中Model::GetName方法的典型用法代码示例。如果您正苦于以下问题:C++ Model::GetName方法的具体用法?C++ Model::GetName怎么用?C++ Model::GetName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Model的用法示例。


在下文中一共展示了Model::GetName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetModelOfValue

af::Model OutValue::GetModelOfValue()
{
	if(Root.IsNull())
	{
		throw NoLabelInicialisationException("OutValue: label do not inicialised.");
	}

	TIterator TITER;

	Model vallr;
	TITER.Init(Root, false);
	while (TITER.More())
	{
		Model val = (Model)TITER.Value();
		QString name = val.GetName();

		if(name == "Model")
		{
			return val;
		}
		TITER.Next();
	}

	TElement e(Root);
	throw NoExistException("OutValue: Model Of Value do not exists.", e);

	return vallr;
}
开发者ID:laduga,项目名称:pradis,代码行数:28,代码来源:OutValue.cpp

示例2: OnContextMenuImport

void ModelListTree::OnContextMenuImport(wxCommandEvent& event)
{
	wxFileDialog dialog(this, L"Import", wxEmptyString, wxEmptyString, _T("OBJ files (*.obj*)|*.obj*"), wxFD_MULTIPLE);
	if (dialog.ShowModal() == wxID_OK)
	{
		Model* model = NULL;
		OBJParser::Parse(dialog.GetPath().wchar_str(), &model);

		_Assert(NULL != model);
		AppendItem(GetRootItem(), model->GetName(), 0, 0, New ModelTreeItemData(model));
	}
}
开发者ID:SinYocto,项目名称:Zee,代码行数:12,代码来源:ModelPanel.cpp

示例3: InitInstance

void FBXSceneInstance::InitInstance()
{
	// Bounding Box
	m_BoundingBox = mScene->m_BoundingBox;

	// Models
	for(unsigned int i = 0; i < mScene->GetModelCount(); i++)
	{
		Model* srcModel = mScene->GetModel(i);
		m_Models.Add(srcModel->GetName(), new Model(srcModel));
	}

	// Copy Skeleton
	if ( mScene->GetSkeleton() )
	{
		Skeleton* newSkeleton = new Skeleton();
		
		for( unsigned int x = 0; x < mScene->GetSkeleton()->GetBoneCount(); ++x )
		{
			SkeletonBone* sourceBone = mScene->GetSkeleton()->GetSkeletonBone(x);

			SkeletonBone* targetBone = new SkeletonBone(
				sourceBone->GetName(), 
				sourceBone->GetParentBoneIndex(), 
				newSkeleton);

			newSkeleton->AddSkeletonBone( targetBone );
		}

		newSkeleton->BuildBoneHierarchy();

		for( unsigned int x = 0; x < newSkeleton->GetBoneCount(); ++x )
		{
			SkeletonBone* sourceBone = mScene->GetSkeleton()->GetSkeletonBone(x);
			SkeletonBone* targetBone = newSkeleton->GetSkeletonBone(x);
			targetBone->SetBindPoseTransform2(sourceBone->GetBindPoseTransform2());
			targetBone->SetBoneReferenceTransform2(sourceBone->GetBoneReferenceTransform2());
			targetBone->m_AnimationKeyFrames = sourceBone->m_AnimationKeyFrames;
			targetBone->SetBoundingBoxData(sourceBone->m_AABB);
		}

		// Update My Skeleton
		m_pSkeleton = newSkeleton;

		// Update My Animation
		m_pAnimationController = new AnimationController(mScene->m_pAnimationController);
	}

	// Curves
	m_Curves = &mScene->m_Curves;
}
开发者ID:Malow,项目名称:NDYGFX,代码行数:51,代码来源:FBXSceneInstance.cpp

示例4: ProcessMesh

void FBXScene::ProcessMesh(FbxNode* pNode)
{
	FbxMesh* pFBXMesh = pNode->GetMesh();
	if( !pFBXMesh )
		return;

	if ( pFBXMesh->GetPolygonVertexCount() != pFBXMesh->GetPolygonCount() * 3 )
	{
		FbxGeometryConverter GeometryConverter(pNode->GetFbxManager());
		if( !GeometryConverter.TriangulateInPlace( pNode ) )
		{
			return;
		}
		pFBXMesh = pNode->GetMesh();
	}

	pFBXMesh->InitNormals();
	pFBXMesh->ComputeVertexNormals(true); 
	pFBXMesh->GenerateTangentsDataForAllUVSets();

	int nVertexCount = pFBXMesh->GetControlPointsCount();
	if( nVertexCount <= 0 )
		return;

	std::vector<BoneWeights> boneWeights(nVertexCount);

	ProcessBoneWeights(pFBXMesh, boneWeights);
	
	Model* pModel = new Model(pNode->GetName(), m_Models.GetCount(), false);
	FbxVector4* aControlPoints = pFBXMesh->GetControlPoints();
	for( int pi = 0; pi < pFBXMesh->GetPolygonCount(); ++pi )	// Whole for-loop takes some time too, investigate further.
	{
		// Material
		Material* pMaterial = NULL;

		for( unsigned int pvi = 0; pvi < 3; ++pvi )
		{
			int nVertexIndex = pFBXMesh->GetPolygonVertex(pi, pvi);

			if( nVertexIndex < 0 || nVertexIndex >= nVertexCount )
				continue;

			// Material
			if( pMaterial == NULL )
				pMaterial = GetMaterialLinkedWithPolygon(pFBXMesh, 0, pi, 0, nVertexIndex);

			// Position
			FbxVector4 fbxPosition = aControlPoints[nVertexIndex];

			// Normals And Tangents
			FbxVector4 fbxNormal, fbxTangent;
			fbxNormal = GetNormal(pFBXMesh, 0, pi, pvi, nVertexIndex);
			fbxTangent = GetTangent(pFBXMesh, 0, pi, pvi, nVertexIndex);

			// Add Vertex
			pModel->AddVertex(pMaterial, FbxVector4ToBTHFBX_VEC3(fbxPosition),
										 FbxVector4ToBTHFBX_VEC3(fbxNormal),
										 FbxVector4ToBTHFBX_VEC3(fbxTangent),
										 GetTexCoord(pFBXMesh, 0, pi, pvi, nVertexIndex),
										 boneWeights[nVertexIndex]);

			// Update Bounding Box
			UpdateBoundingBoxDataFromVertex(FbxVector4ToBTHFBX_VEC3(fbxPosition));
		}
	}

	// Geometric Offset
	pModel->SetGeometricOffset2(GetGeometricOffset2(pNode));

	// Insert Model
	m_Models.Add(pModel->GetName(), pModel);
}
开发者ID:Malow,项目名称:NDYGFX,代码行数:72,代码来源:FBXScene.cpp

示例5: SetOutputs


//.........这里部分代码省略.........

            for (auto model = models.begin(); model != models.end(); ++model)
            {
                if ((*model)->GetProtocol() == *protocol && (*model)->GetPort() == i)
                {
                    int modelstart = (*model)->GetNumberFromChannelString((*model)->ModelStartChannel);
                    int modelend = modelstart + (*model)->GetChanCount() - 1;
                    if (modelstart < loweststart)
                    {
                        loweststart = modelstart;
                        first = *model;
                    }
                    if (modelend > highestend)
                    {
                        highestend = modelend;
                        last = *model;
                    }
                }
            }

            if (first != nullptr)
            {
                int portstart = first->GetNumberFromChannelString(first->ModelStartChannel);
                int portend = last->GetNumberFromChannelString(last->ModelStartChannel) + last->GetChanCount() - 1;
                int numstrings = first->GetNumStrings();
                bool multistringelement = (first->GetDisplayAs() == "Matrix" || 
                    first->GetDisplayAs() == "Tree" ||
                    first->GetDisplayAs() == "Circle" ||
                    first->GetDisplayAs() == "Star" ||
                    first->GetDisplayAs() == "Wreath" ||
                    first->GetDisplayAs() == "Icicles");
                int channelsperstring = first->NodesPerString() * first->GetChanCountPerNode();
                // upload it
                if (DecodeStringPortProtocol(*protocol) >= 0)
                {
                    if (first == last && numstrings > 1 && multistringelement)
                    {
                        for (int j = 0; j < numstrings; j++)
                        {
                            if (portdone[i+j])
                            {
                                logger_base.warn("Falcon Outputs Upload: Attempt to upload model %s to string port %d but this string port already has a model on it.", (const char *)first->GetName().c_str(), i +j);
                                wxMessageBox(wxString::Format("Attempt to upload model %s to string port %d but this string port already has a model on it.", (const char *)first->GetName().c_str(), i + j));
                            }
                            else
                            {
                                portdone[i + j] = true;
                                count++;
                                if (sendmessage != "") sendmessage = sendmessage + "&";
                                sendmessage = sendmessage + BuildStringPort(strings, i + j, DecodeStringPortProtocol(*protocol), portstart + j * channelsperstring, channelsperstring / 3, first->GetName(), parent);
                                if (count == 40)
                                {
                                    UploadStringPort(sendmessage, false);
                                    sendmessage = "";
                                    count = 0;
                                }
                            }
                        }
                    }
                    else
                    {
                        if (portdone[i])
                        {
                            logger_base.warn("Falcon Outputs Upload: Attempt to upload model %s to string port %d but this string port already has a model on it.", (const char *)first->GetName().c_str() , i);
                            wxMessageBox(wxString::Format("Attempt to upload model %s to string port %d but this string port already has a model on it.", (const char *)first->GetName().c_str(), i));
                        }
                        else
                        {
                            portdone[i] = true;
                            count++;
                            if (sendmessage != "") sendmessage = sendmessage + "&";
                            sendmessage = sendmessage + BuildStringPort(strings, i, DecodeStringPortProtocol(*protocol), portstart, (portend - portstart + 1) / 3, first->GetName(), parent);
                            if (count == 40)
                            {
                                UploadStringPort(sendmessage, false);
                                sendmessage = "";
                                count = 0;
                            }
                        }
                    }                    
                }
                else if (DecodeSerialOutputProtocol(*protocol) >= 0)
                {
                    UploadSerialOutput(i, DecodeSerialOutputProtocol(*protocol), portstart, parent);
                }
                else
                {
                    logger_base.warn("Falcon Outputs Upload: Controller %s protocol %s not supported by this controller.",
                        (const char *)_ip.c_str(), (const char *)protocol->c_str());
                    wxMessageBox("Controller " + _ip + " protocol " + (*protocol) + " not supported by this controller.", "Protocol Ignored");
                }
            }
            else
            {
                // nothing on this port ... ignore it
            }
        }
        UploadStringPort(sendmessage, true);
    }
}
开发者ID:,项目名称:,代码行数:101,代码来源:

示例6: EX_DETAILS

void Grafkit::SceneLoader::SceneLoaderHelper::Load(Archive &ar, IResourceManager * const & resman)
{
	Persist(ar, resman);

	LOGGER(Log::Logger().Info("-- ASSIGN --"));

	// 5. material -> mesh relation
	LOGGER(Log::Logger().Info("Materials: %d", m_materials_to_meshes.size()));
	for (auto it = m_materials_to_meshes.begin(); it != m_materials_to_meshes.end(); ++it)
	{
		USHORT key = it->first;
		USHORT val = it->second;

		Material * material = m_materials[key];
		Model *model = dynamic_cast<Model *>(m_entities[val]);

		if (model && material) {
			model->SetMaterial(material);

			LOGGER(Log::Logger().Info("%hu (\"%s\") -> %hu (\"%s\")", key, material->GetName().c_str(), val, model->GetName().c_str()));
		}
	}
	// ... 

	// 6. entitiy -> actor relation
	LOGGER(Log::Logger().Info("Entities: %d", m_entities_to_actors.size()));
	for (auto it = m_entities_to_actors.begin(); it != m_entities_to_actors.end(); ++it)
	{
		USHORT key = it->first;
		USHORT val = it->second;

		Entity3D *entity = m_entities[key];
		Actor *actor = m_actors[val];

		if (actor && entity) {
			actor->AddEntity(entity);

			LOGGER(Log::Logger().Info("%hu (\"%s\") -> %hu (\"%s\")", key, entity->GetName().c_str()), val, actor->GetName().c_str());
		}
	}

	// ...

	// 7. actor -> actor relation - scenegraph
	LOGGER(Log::Logger().Info("Actors: %d", m_actor_to_actor.size()));
	for (auto it = m_actor_to_actor.begin(); it != m_actor_to_actor.end(); ++it)
	{
		USHORT key = it->first;
		USHORT val = it->second;

		Actor *child = m_actors[val];
		Actor *parent = m_actors[key];

		if (parent && child) {
			parent->AddChild(child);

			LOGGER(Log::Logger().Info("%hu (\"%s\") -> %hu (\"%s\")", key, parent->GetName().c_str(), val, child->GetName().c_str()));
		}
	}

	//8, 9 animation -> actor, entity
	LOGGER(Log::Logger().Info("Animations: %d", m_animation_to_actor.size() + m_animation_to_entity.size()));
	for (auto it = m_animation_to_actor.cbegin(); it != m_animation_to_actor.cend(); ++it)
	{
		USHORT key = it->first;
		USHORT value = it->second;
		ActorAnimation *actor_animation = dynamic_cast<ActorAnimation *>(m_Animations[key]);
		if (actor_animation) {
			Actor* actor = m_actors[value];
			if (actor) {
				actor_animation->SetActor(ActorRef(actor));
				m_scene->AddAnimation(actor_animation);
				LOGGER(Log::Logger().Info("Actor %hu (\"%s\") -> %hu (\"%s\")", key, actor->GetName().c_str(), value, actor_animation->GetName().c_str()));
			}
		}

	}

	for (auto it = m_animation_to_entity.cbegin(); it != m_animation_to_entity.cend(); ++it)
	{
		USHORT key = it->first;
		USHORT value = it->second;

		EntityAnimation *entity_animation = dynamic_cast<EntityAnimation*>(m_Animations[key]);
		if (entity_animation) {
			Entity3D* entity = m_entities[value];
			if (entity) {
				entity_animation->SetEntity(Ref<Entity3D>(entity));
				m_scene->AddAnimation(entity_animation);
				LOGGER(Log::Logger().Info("Entity %hu -> %hu", key, value));
			}
		}

	}

	if (m_actors.empty())
		throw new EX_DETAILS(SceneLoadException, "Actors are empty for some reason");

	Actor * root = m_actors[0];
	m_scene->Initialize(root);
//.........这里部分代码省略.........
开发者ID:caiwan,项目名称:Grafkit2,代码行数:101,代码来源:SceneLoader.cpp


注:本文中的Model::GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。