void AssimpParser::ParseModel(aiNode* node, std::shared_ptr<SceneNode> sceneNode)
{
	std::shared_ptr<SceneNode> newNode = std::shared_ptr<SceneNode>(new SceneNode(std::string(node->mName.C_Str())));

	for(int i=0; i<node->mNumMeshes; i++)
	{
		int meshIndex = node->mMeshes[i];
		aiMesh* mesh = scene->mMeshes[meshIndex];

		std::shared_ptr<SceneMesh> newMesh = std::shared_ptr<SceneMesh>(new SceneMesh());
		newNode->AddMesh(newMesh);

		ParseMesh(newMesh, mesh);
	}

	if(sceneNode != nullptr)
	{
		sceneNode->AddChild(newNode);
	}

	for(int i=0; i<node->mNumChildren; i++)
	{
		aiNode* child = node->mChildren[i];		
		ParseModel(child, newNode);
	}
}
void TAstNodeForSentence::AddToNode(TLexer* const lexer, std::shared_ptr<TToken> token, std::shared_ptr<TAstNode> result)
{
	if (lexer->GetToken()->Type() != TOKEN_TYPE::STRUCTURE_TO)
	{
		throw TInterpreterException(TInterpreterException::WRONG_GRAMMAR, token->LineNumber());
	}

	result->AddChild(TAstNodeOperator::GetAstNode(lexer));
}
void _DeepCopy(std::shared_ptr<touchmind::model::node::NodeModel> srcParent,
               std::shared_ptr<touchmind::model::node::NodeModel> destParent) {
  for (size_t i = 0; i < srcParent->GetActualChildrenCount(); ++i) {
    auto srcChild = srcParent->GetChild(i);
    auto destChild = touchmind::model::node::NodeModel::Create(*srcChild.get());
    destChild->RemoveAllChildren();
    destParent->AddChild(destChild);
    _DeepCopy(srcChild, destChild);
  }
}
Beispiel #4
0
/** \brief Save this item to an XML node
 * \param node The node we are going to be a child of
 * \returns Created XML node
 */
std::shared_ptr<xmlnode::CXmlNode> CTile::XmlSave(const std::shared_ptr<xmlnode::CXmlNode> &node)
{
    auto itemNode = node->AddChild(L"tile");

    itemNode->SetAttribute(L"x", mX);
    itemNode->SetAttribute(L"y", mY);
    itemNode->SetAttribute(L"zoning", (int)mZoning);

    return itemNode;
}
Beispiel #5
0
/** \brief Save this item to an XML node
* \param node The node we are going to be a child of
* \returns A pointer to our fish node
*/
std::shared_ptr<xmlnode::CXmlNode> CFish::XmlSave(const std::shared_ptr<xmlnode::CXmlNode> &node)
{
	auto itemNode = node->AddChild(L"item");

	itemNode->SetAttribute(L"x", GetX());
	itemNode->SetAttribute(L"y", GetY());

	itemNode->SetAttribute(L"speedx", mSpeedX);
	itemNode->SetAttribute(L"speedy", mSpeedY);

	itemNode->SetAttribute(L"canBreed", mCanBreed);
	itemNode->SetAttribute(L"isInterested", mIsInterested);
	itemNode->SetAttribute(L"isMale", mIsMale);
	itemNode->SetAttribute(L"isGestating", mIsGestating);
	itemNode->SetAttribute(L"interestTime", mInterestTime);
	itemNode->SetAttribute(L"gestatingTime", mGestatingTime);

	itemNode->SetAttribute(L"feedingTime", mTimeFeeding);
	itemNode->SetAttribute(L"isHungry", mIsHungry);
	itemNode->SetAttribute(L"age", mAge);

	return itemNode;
}