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


C++ NiNodeRef类代码示例

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


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

示例1: cleanTreeCollision

/*---------------------------------------------------------------------------*/
void NifCollisionUtility::cleanTreeCollision(NiNodeRef pNode)
{
	vector<NiAVObjectRef>	srcChildList(pNode->GetChildren());		//  children of node

	//  remove collision object (new style [>= Oblivion])
	pNode->SetCollisionObject(NULL);

	//  iterate over source nodes and remove possible old-style [Morrowind] collision node
	for (auto  ppIter=srcChildList.begin(), pEnd=srcChildList.end(); ppIter != pEnd; ppIter++)
	{
		//  RootCollisionNode
		if (DynamicCast<RootCollisionNode>(*ppIter) != NULL)
		{
			pNode->RemoveChild(*ppIter);
		}
		//  NiNode
		else if (DynamicCast<NiNode>(*ppIter) != NULL)
		{
			cleanTreeCollision(DynamicCast<NiNode>(*ppIter));
		}
		//  other children
		else
		{
			(*ppIter)->SetCollisionObject(NULL);
		}
	}  //  for (vector<NiAVObjectRef>::iterator  ppIter = srcChildList.begin(); ....
}
开发者ID:Hashmi1,项目名称:NifConvert,代码行数:28,代码来源:NifCollisionUtility.cpp

示例2: strmatch

NiNodeRef Exporter::createNode(INode* maxNode, const string& name)
{
	USES_CONVERSION;
	bool ismatch = strmatch(T2A(maxNode->GetName()), name);
	if (ismatch) {
		NodeToNodeMap::iterator itr = mNodeMap.find(maxNode);
		if (itr != mNodeMap.end())
			return (*itr).second;
	}

	NiNodeRef node;
	if (!findNode(name, node))
	{
		node = createNode();
		BOOL noname = FALSE;
		if (!maxNode->GetUserPropBool(NP_NONAME, noname) || !noname)
			node->SetName(name);
	}
	if (wildmatch("noname*", name))
	{
		maxNode->SetUserPropBool(NP_NONAME, TRUE);
	}
	mNodeMap[maxNode] = node;
	return node;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:25,代码来源:Util.cpp

示例3: NiSkinInstance

NiSkinInstance::NiSkinInstance( NiNode * skeleton_root, vector< Ref<NiNode> > bone_nodes ) {
	//Call normal constructor
	NiSkinInstance();

	//Ensure that all bones are below the skeleton root node on the scene graph
	for ( unsigned int i = 0; i < bone_nodes.size(); ++i ) {
		bool is_decended = false;
		NiNodeRef node = bone_nodes[i];
		while ( node != NULL ) {
			if ( node == skeleton_root ) {
				is_decended = true;
				break;
			}
			node = node->GetParent();
		}
		if ( is_decended == false ) {
			throw runtime_error( "All bones must be lower than the skeleton root in the scene graph." );
		}
	}

	//Add the bones to the internal list
	bones.resize( bone_nodes.size() );
	for ( unsigned int i = 0; i < bone_nodes.size(); ++i ) {
		bones[i] = bone_nodes[i];
	}

	//Flag any bones that are part of this skin instance
	for ( unsigned int i = 0; i < bones.size(); ++i ) {
		bones[i]->SetSkinFlag(true);
	}

	//Store skeleton root and inform it of this attachment
	skeletonRoot = skeleton_root;
	skeletonRoot->AddSkin( this );
}
开发者ID:przemyslaw-szymanski,项目名称:x-source-engine,代码行数:35,代码来源:NiSkinInstance.cpp

示例4: ImportMesh

bool NifImporter::ImportMeshes(NiNodeRef node)
{
   bool ok = true;
   try 
   {
#if 1
      vector<NiTriShapeRef> trinodes = DynamicCast<NiTriShape>(node->GetChildren());
      for (vector<NiTriShapeRef>::iterator itr = trinodes.begin(), end = trinodes.end(); itr != end; ++itr){
         ok |= ImportMesh(*itr);
      }
      vector<NiTriStripsRef> tristrips = DynamicCast<NiTriStrips>(node->GetChildren());
      for (vector<NiTriStripsRef>::iterator itr = tristrips.begin(), end = tristrips.end(); itr != end; ++itr){
         ok |= ImportMesh(*itr);
      }
#else
      // Only do multiples on object that have same name and use XXX:# notation
      vector<NiTriBasedGeomRef> trigeom = DynamicCast<NiTriBasedGeom>(node->GetChildren());
      ok |= ImportMultipleGeometry(node, trigeom);
#endif
      vector<NiNodeRef> nodes = DynamicCast<NiNode>(node->GetChildren());
      for (vector<NiNodeRef>::iterator itr = nodes.begin(), end = nodes.end(); itr != end; ++itr){
         ok |= ImportMeshes(*itr);
      }
   }
   catch( exception & e ) 
   {
      e=e;
      ok = false;
   }
   catch( ... ) 
   {
	   ok = false;
   }
   return ok;
}
开发者ID:blabbatheorange,项目名称:Nif-Plugin,代码行数:35,代码来源:ImportMeshAndSkin.cpp

示例5: createNode

NiNodeRef Exporter::createNode()
{
	NiNodeRef node = CreateNiObject<NiNode>();
	if (IsFallout3() || IsSkyrim()) {
		node->SetFlags(14);
	}
	return node;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:8,代码来源:Util.cpp

示例6: sortNodes

void Exporter::sortNodes(NiNodeRef node)
{
   node->SortChildren(SortNodeEquivalence());

   vector<NiNodeRef> children = DynamicCast<NiNode>(node->GetChildren());
   for (vector<NiNodeRef>::iterator itr = children.begin(); itr != children.end(); ++itr)
      sortNodes(*itr);
}
开发者ID:Anchoys1,项目名称:max_nif_plugin,代码行数:8,代码来源:Util.cpp

示例7: GoToSkeletonBindPosition

void GoToSkeletonBindPosition(vector<NiNodeRef>& blocks)
{
   //Send all skeleton roots to bind position
   for (unsigned int i = 0; i < blocks.size(); ++i) {
      NiNodeRef node = blocks[i];
      if ( node != NULL && node->IsSkeletonRoot() ) {
         node->GoToSkeletonBindPosition();
      }
   }
}
开发者ID:CruxAnsata,项目名称:max_nif_plugin,代码行数:10,代码来源:ImportSkeleton.cpp

示例8: return

NiNodeRef Exporter::getNode(const string& name)
{
   NodeMap::iterator itr = mNameMap.find(name);
   if (itr != mNameMap.end())
      return (*itr).second;
   NiNodeRef node = CreateNiObject<NiNode>();
   if ( IsFallout3() || IsSkyrim() ) {
      node->SetFlags( 14 );
   }
   node->SetName(name);
   mNameMap[name] = node;
   return node;
}
开发者ID:Anchoys1,项目名称:max_nif_plugin,代码行数:13,代码来源:Util.cpp

示例9: dumpNif

/**
* @brief writes the given nif to the given file.
*/
void dumpNif(const std::string& n, CellMeshList& l){
	using namespace Niflib;
	NiNodeRef node = new NiNode;

	for ( std::list<NiAVObjectRef>::iterator iter = l.begin(); l.end() != iter; ++iter)
		if ( *iter )
			node->AddChild(*iter);


	NiObjectRef obj = DynamicCast<NiObject>( node );
	unsigned ver = 67108866;
	WriteNifTree(n, obj, NifInfo(ver));
}
开发者ID:Yacoby,项目名称:CellToNif,代码行数:16,代码来源:main.cpp

示例10: getGeometryFromNode

/*---------------------------------------------------------------------------*/
unsigned int NifCollisionUtility::getGeometryFromNode(NiNodeRef pNode, vector<hkGeometry>& geometryMap, vector<hkGeometry>& geometryMapColl, vector<Matrix44>& transformAry)
{
	bhkCollisionObjectRef	pCollObject(DynamicCast<bhkCollisionObject>(pNode->GetCollisionObject()));
	vector<NiAVObjectRef>	childList  (pNode->GetChildren());

	//  add own translation to list
	transformAry.push_back(pNode->GetLocalTransform());

	//  get geometry from collision object
	if (pCollObject != NULL)
	{
		//  search for embedded shape
		bhkRigidBodyRef		pRBody(DynamicCast<bhkRigidBody>(pCollObject->GetBody()));

		if (pRBody != NULL)
		{
			getGeometryFromCollShape(pRBody->GetShape(), geometryMapColl, transformAry);
		}
	}  //  if (pCollObject != NULL)

	//  iterate over children
	for (vector<NiAVObjectRef>::iterator ppIter = childList.begin(); ppIter != childList.end(); ppIter++)
	{
		//  NiTriShape
		if (DynamicCast<NiTriShape>(*ppIter) != NULL)
		{
			getGeometryFromTriShape(DynamicCast<NiTriShape>(*ppIter), geometryMap, transformAry);
		}
		//  NiTriStrips
		else if (DynamicCast<NiTriStrips>(*ppIter) != NULL)
		{
			getGeometryFromTriStrips(DynamicCast<NiTriStrips>(*ppIter), geometryMap, transformAry);
		}
		//  RootCollisionNode
		else if (DynamicCast<RootCollisionNode>(*ppIter) != NULL)
		{
			getGeometryFromNode(&(*DynamicCast<RootCollisionNode>(*ppIter)), geometryMapColl, geometryMapColl, transformAry);
		}
		//  NiNode (and derived classes?)
		else if (DynamicCast<NiNode>(*ppIter) != NULL)
		{
			getGeometryFromNode(DynamicCast<NiNode>(*ppIter), geometryMap, geometryMapColl, transformAry);
		}
	}  //  for (vector<NiAVObjectRef>::iterator ppIter = childList.begin(); ppIter != childList.end(); ppIter++)

	//  remove own translation from list
	transformAry.pop_back();

	return geometryMap.size();
}
开发者ID:Hashmi1,项目名称:NifConvert,代码行数:51,代码来源:NifCollisionUtility.cpp

示例11: IsBiped

bool NifImporter::IsBiped()
{
   if (HasSkeleton()){
      NiNodeRef rootNode = root;
      if (rootNode){
         list<NiExtraDataRef> extraData = rootNode->GetExtraData();
         if (!extraData.empty()) {
			 if ( BSXFlagsRef flags = SelectFirstObjectOfType<BSXFlags>(extraData) ) {
				 return (flags->GetData() & 0x4);
			 }
         }
      }
   }
   return false;
}
开发者ID:CruxAnsata,项目名称:max_nif_plugin,代码行数:15,代码来源:ImportSkeleton.cpp

示例12: CalcScale

static float CalcScale(INode *bone, NiNodeRef node, vector<NiNodeRef>& children)
{
   int n = bone->NumberOfChildren();
   if (n > 0) 
   {
      float len1 = 0.0f;
      float len2 = 0.0f;
      Matrix3 m = bone->GetNodeTM(0);
      Matrix3 m2 = TOMATRIX3(node->GetWorldTransform());
      for (int i = 0; i<n; i++)
      {
         INode *child = bone->GetChildNode(i);
         LPCTSTR name = child->GetName();
         if (HasBipedPosDOF(name))
            continue;

         Matrix3 cm = child->GetObjectTM(0);
         len1 += Length(m.GetTrans()-cm.GetTrans());

         if (NiNodeRef child2 = FindNodeByName(children, string(child->GetName()))){
            Matrix3 cm2 = TOMATRIX3(child2->GetWorldTransform());
            len2 += Length(m2.GetTrans()-cm2.GetTrans());
         }
      }
      return (len2 != 0.0f && len1 != 0.0f) ? (len2/len1) : 1.0f;
   }
   return 1.0f;
}
开发者ID:CruxAnsata,项目名称:max_nif_plugin,代码行数:28,代码来源:ImportSkeleton.cpp

示例13: setName

void Exporter::setName(NiNodeRef node, const string& name)
{
	USES_CONVERSION;
	tstring tname = A2TString(name);
	node->SetName(name);
	mNameMap[tname] = node;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:7,代码来源:Util.cpp

示例14: exportUPB

bool Exporter::exportUPB(NiNodeRef &root, INode *node)
{
   bool ok = false;
   if (!mUserPropBuffer)
      return ok;

   // Write the actual UPB sans any np_ prefixed strings
   TSTR upb;
   node->GetUserPropBuffer(upb);
   if (!upb.isNull())
   {
      string line;
      istringstream istr(string(upb), ios_base::out);
      ostringstream ostr;
      while (!istr.eof()) {
         std::getline(istr, line);
         if (!line.empty() && 0 != line.compare(0, 3, "np_"))
            ostr << line << endl;
      }
      if (!ostr.str().empty())
      {
         NiStringExtraDataRef strings = CreateNiObject<NiStringExtraData>();	
         strings->SetName("UPB");
         strings->SetData(ostr.str());
         root->AddExtraData(DynamicCast<NiExtraData>(strings));
         ok = true;
      }
   }
   return ok;
}
开发者ID:Anchoys1,项目名称:max_nif_plugin,代码行数:30,代码来源:Util.cpp

示例15: ApplyAllSkinOffsets

void Exporter::ApplyAllSkinOffsets( NiAVObjectRef & root ) {
   NiGeometryRef niGeom = DynamicCast<NiGeometry>(root);
   if ( niGeom != NULL && niGeom->IsSkin() == true ) {
      niGeom->ApplySkinOffset();
   }

   NiNodeRef niNode = DynamicCast<NiNode>(root);
   if ( niNode != NULL ) {
      //Call this function on all children
      vector<NiAVObjectRef> children = niNode->GetChildren();

      for ( unsigned i = 0; i < children.size(); ++i ) {
         ApplyAllSkinOffsets( children[i] );
      }
   }
} 
开发者ID:Anchoys1,项目名称:max_nif_plugin,代码行数:16,代码来源:Util.cpp


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