• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ TriObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: assert

Mesh* SGP_MaxInterface::GetMesh( INode* pNode )
{
	if( !IsMesh( pNode ) )
		return NULL;

	TimeValue time = 0;

	// get max mesh instance
	ObjectState os;
	os = pNode->EvalWorldState(time);

	Object* obj = os.obj;
	if( !os.obj )
	{
		assert( false );
		return NULL;
	}
	TriObject* triObj = (TriObject *)obj->ConvertToType( time, triObjectClassID );
	if( !triObj )
	{
		assert( false );
		return NULL;
	}

	Mesh* pMesh = &triObj->GetMesh();

	return pMesh;
}
开发者ID:phoenixzz,项目名称:SGPEngine,代码行数:28,代码来源:SGP_MAX9Interface.cpp


示例2: CreateNewTriObject

bool CollisionImport::ImportTriStripsShape(INode *rbody, bhkRigidBodyRef body, bhkNiTriStripsShapeRef shape, INode *parent, Matrix3& tm)
{
	if (shape->GetNumStripsData() != 1)
		return NULL;

	if ( ImpNode *node = ni.i->CreateNode() )
	{
		TriObject *triObject = CreateNewTriObject();
		node->Reference(triObject);

		INode *inode = node->GetINode();

		// Texture
		Mesh& mesh = triObject->GetMesh();
		NiTriStripsDataRef triShapeData = shape->GetStripsData(0);
		if (triShapeData == NULL)
			return false;

		// Temporary shape
		NiTriStripsRef triShape = new NiTriStrips();
		vector<Triangle> tris = triShapeData->GetTriangles();
		ni.ImportMesh(node, triObject, triShape, triShapeData, tris);
		CreatebhkCollisionModifier(inode, bv_type_shapes, shape->GetMaterial(), OL_UNIDENTIFIED, 0);
		ImportBase(body, shape, parent, inode, tm);
		AddShape(rbody, inode);
		return true;
	}
	return false;
}
开发者ID:ElliotWood,项目名称:max_nif_plugin,代码行数:29,代码来源:ImportCollision.cpp


示例3: DoMaterialSet

void MatMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
   {
   Interval valid = FOREVER;
   int id;
   pblock->GetValue(PB_MATID,t,id,valid); 
   id--;
   if (id<0) id = 0;
   if (id>0xffff) id = 0xffff;

   // For version 4 and later, we process patch meshes as they are and pass them on.  Earlier
   // versions converted to TriMeshes (done below).  For adding other new types of objects, add
   // them here!
#ifndef NO_PATCHES
   if(version >= MATMOD_VER4 && os->obj->IsSubClassOf(patchObjectClassID)) {
      PatchObject *patchOb = (PatchObject *)os->obj;
      PatchMesh &pmesh = patchOb->GetPatchMesh(t);
      BOOL useSel = pmesh.selLevel >= PO_PATCH;

      for (int i=0; i<pmesh.getNumPatches(); i++) {
         if (!useSel || pmesh.patchSel[i]) {
            pmesh.setPatchMtlIndex(i,(MtlID)id);
            }
         }
      pmesh.InvalidateGeomCache();  // Do this because there isn't a topo cache in PatchMesh
                  
      patchOb->UpdateValidity(TOPO_CHAN_NUM,valid);      
      }
   else
#endif // NO_PATCHES
   // Process PolyObjects
   if(os->obj->IsSubClassOf(polyObjectClassID)) {
      PolyObject *polyOb = (PolyObject *)os->obj;
      MNMesh &mesh = polyOb->GetMesh();
      BOOL useSel = mesh.selLevel == MNM_SL_FACE;

      for (int i=0; i<mesh.numf; i++) {
         if (!useSel || mesh.f[i].GetFlag(MN_SEL)) {
            mesh.f[i].material = (MtlID)id;
         }
      }
      polyOb->UpdateValidity(TOPO_CHAN_NUM,valid);    
   }
   else  // If it's a TriObject, process it
   if(os->obj->IsSubClassOf(triObjectClassID)) {
      TriObject *triOb = (TriObject *)os->obj;
      DoMaterialSet(triOb, id);
      triOb->UpdateValidity(TOPO_CHAN_NUM,valid);     
      }
   else  // Fallback position: If it can convert to a TriObject, do it!
   if(os->obj->CanConvertToType(triObjectClassID)) {
      TriObject  *triOb = (TriObject *)os->obj->ConvertToType(t, triObjectClassID);
      // Now stuff this into the pipeline!
      os->obj = triOb;

      DoMaterialSet(triOb, id);
      triOb->UpdateValidity(TOPO_CHAN_NUM,valid);     
      }
   else
      return;     // Do nothing if it can't convert to triObject
   }
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:60,代码来源:surfmod.cpp


示例4: ModifyObject

void CVDModifier::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
{
	if (!os->obj->IsSubClassOf(triObjectClassID)) return;

	// Get a mesh from input object
	TriObject *tobj = (TriObject*)os->obj;
	Mesh* mesh = &tobj->GetMesh();
	int numVert = mesh->getNumVerts();

	// Get parameters from pblock
	float sparam = 0.0f; 
	Interval valid = FOREVER;
	pblock->GetValue(cvd_codev, t, sparam, valid);

		// Take over the channel, realloc with size == number of verts
		mesh->setVDataSupport(MY_CHANNEL,TRUE);

		// Get a pointer back to the floating point array
		float *vdata = mesh->vertexFloat(MY_CHANNEL);
		if(vdata)
		{
			// loop through all verticies
			// Ask the random number generator for a value bound to the
			//	paramblock value
			// and encode it into the vertex.
			for(int i=0;i<numVert;i++)
			{
				vdata[i] = randomGen.getf(sparam);
			}
		}

}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:32,代码来源:applycustom.cpp


示例5: md

void bhkProxyObject::BuildColCapsule()
{
	proxyMesh.FreeAll();
	MeshDelta md(proxyMesh);
	for (int i = 0;i < pblock2->Count(PB_MESHLIST); i++) {
		INode *tnode = NULL;
		pblock2->GetValue(PB_MESHLIST,0,tnode,FOREVER,i);	
		if (tnode)
		{
			ObjectState os = tnode->EvalWorldState(0);
			Matrix3 wm = tnode->GetNodeTM(0);
			TriObject *tri = (TriObject *)os.obj->ConvertToType(0, Class_ID(TRIOBJ_CLASS_ID, 0));
			if (tri)
			{
				Mesh& mesh = tri->GetMesh();
				MeshDelta tmd (mesh);
				md.AttachMesh(proxyMesh, mesh, wm, 0);
				md.Apply(proxyMesh);
			}
		}
	}
	Point3 pt1 = Point3::Origin;
	Point3 pt2 = Point3::Origin;
	float r1 = 0.0;
	float r2 = 0.0;

	if (proxyMesh.getNumVerts() > 3) // Doesn't guarantee that the mesh is not a plane.
	{
		CalcCapsule(proxyMesh, pt1, pt2, r1, r2);
		BuildCapsule(proxyMesh, pt1, pt2, r1, r2);
	}

	proxyPos = Point3::Origin;
	forceRedraw = true;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:35,代码来源:bhkProxyObj.cpp


示例6: Class_ID

void bhkProxyObject::BuildColBox()
{
	Box3 box; box.Init();
	for (int i = 0;i < pblock2->Count(PB_MESHLIST); i++) {
		INode *tnode = NULL;
		pblock2->GetValue(PB_MESHLIST,0,tnode,FOREVER,i);	
		if (tnode)
		{
			ObjectState os = tnode->EvalWorldState(0);
			Matrix3 wm = tnode->GetNodeTM(0);
			TriObject *tri = (TriObject *)os.obj->ConvertToType(0, Class_ID(TRIOBJ_CLASS_ID, 0));
			if (tri)
			{
				Box3 box2; box2.Init();
				Mesh& mesh = tri->GetMesh();
				CalcAxisAlignedBox(mesh, box2, &wm);
				box += box2;
			}
		}
	}
	BuildBox(proxyMesh, box.Max().y-box.Min().y, box.Max().x-box.Min().x, box.Max().z-box.Min().z);

	MNMesh mn(proxyMesh);
	Matrix3 tm(true);
	tm.SetTranslate(box.Center());
	mn.Transform(tm);
	mn.OutToTri(proxyMesh);

	//proxyPos = box.Center();
	proxyPos = Point3::Origin;
	forceRedraw = true;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:32,代码来源:bhkProxyObj.cpp


示例7: IReadyRepNodes

BOOL plDistributor::IReadyRepNodes(plMeshCacheTab& cache) const
{
    int i;
    for( i = 0; i < fRepNodes.Count(); i++ )
    {
        Mesh* mesh = nil;
        TriObject* obj = nil;
        if( IGetMesh(fRepNodes[i], obj, mesh) )
        {
            plMaxNode* repNode = (plMaxNode*)fRepNodes[i];

            int iCache = cache.Count();
            cache.SetCount(iCache + 1);

            cache[iCache].fMesh = new Mesh(*mesh);
            cache[iCache].fFlex = repNode->GetFlexibility();
            
            if( obj )
                obj->DeleteThis();

            BOOL hasXImp = nil != repNode->GetXImposterComp();

            ISetupNormals(repNode, cache[iCache].fMesh, hasXImp);

            ISetupSkinWeights(repNode, cache[iCache].fMesh, cache[iCache].fFlex);
        }
        else
        {
            fRepNodes.Delete(i, 1);
            i--;
        }
    }

    return fRepNodes.Count() > 0;
}
开发者ID:Asteral,项目名称:Plasma,代码行数:35,代码来源:plDistributor.cpp


示例8: DbgAssert

int XTCSample::Display(TimeValue t, INode* inode, ViewExp *vpt, int flags, Object *pObj)
{
	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Doing Display() on invalid viewport!"));
		return FALSE;
	}

	if(pObj->ClassID() == XGSPHERE_CLASS_ID || pObj->IsSubClassOf(triObjectClassID))
	{
		return DisplayMesh(t, inode, vpt, flags, GetMesh(pObj));
	}
#ifndef NO_PATCHES
	else if( pObj->IsSubClassOf(patchObjectClassID) )
	{
		return DisplayPatch(t, inode, vpt, flags, (PatchObject *) pObj);
	}
#endif
	else if(pObj->CanConvertToType(triObjectClassID))
	{
		TriObject *pTri = (TriObject *) pObj->ConvertToType(t,triObjectClassID);
		DisplayMesh(t, inode, vpt, flags, &pTri->mesh);
		if(pTri != pObj)
			pTri->DeleteThis();
		
	}
	
	return 0;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:30,代码来源:xmodifier.cpp


示例9: EvalWorldState

float plMaxNodeBase::RegionPriority()
{
    TimeValue currTime = 0;//hsConverterUtils::Instance().GetTime(GetInterface());
    Object *obj = EvalWorldState(currTime).obj;
    if( !obj )
        return 0;

    Matrix3 l2w = GetObjectTM(currTime);

    if( obj->ClassID() == Class_ID(DUMMY_CLASS_ID,0) )
    {
        DummyObject* dummy = (DummyObject*)obj;
        Box3 bnd = dummy->GetBox();

        return BoxVolume(bnd, l2w);
    }

    if( obj->CanConvertToType(triObjectClassID) )
    {
        TriObject   *meshObj = (TriObject *)obj->ConvertToType(currTime, triObjectClassID);
        if( !meshObj )
            return 0;

        Mesh& mesh = meshObj->mesh;
        Box3 bnd = mesh.getBoundingBox();
        
        if( meshObj != obj )
            meshObj->DeleteThis();

        return BoxVolume(bnd, l2w);
    }

    // Don't know how to interpret other, it's not contained.
    return 0;
}
开发者ID:cwalther,项目名称:Plasma-nobink-test,代码行数:35,代码来源:plMaxNodeBase.cpp


示例10: DebugPrint

bool BakeRadiosity::CreateNewMesh (INode *orgNode, 
                                    Mesh *orgMesh, 
                                    Matrix3 orgMtx)
{
   if((orgNode == NULL)||(orgMesh == NULL)){
	   DebugPrint(_T("Mesh error\n"));
      return false;
   }
   // Creates an instance of a registered class.
   Object *newObj = (Object*)(ip->CreateInstance(
                                       GEOMOBJECT_CLASS_ID,
                                       Class_ID(TRIOBJ_CLASS_ID, 0)));
   if(newObj == NULL){
	   DebugPrint(_T("CreateInstance error\n"));
      return false;
   }
   // Creates a new node in the scene with the given object. 
   INode *newNode = ip->CreateObjectNode(newObj);
   if(newNode == NULL){
	   DebugPrint(_T("CreateObjectNode error\n"));
      return false;
   }
   // Sets the name of the node. 
   if(keepOrgFlag != true){
      newNode->SetName(orgNode->GetName());
   } else {
      TSTR newName;
      newName.printf(_T("%s_BAKED"), orgNode->GetName());
      newNode->SetName(newName);
   }
   // Sets the renderer material used by the node.
   newNode->SetMtl(orgNode->GetMtl());
   // Returns a reference to the mesh data member of new TriObject.
   TriObject *newTriObj = (TriObject *)newObj;
   Mesh &newMesh = newTriObj->GetMesh();
   // Returns the number of vertices from original mesh. 
   int nbVert = orgMesh->getNumVerts();
   // Sets the number of geometric vertices in the new mesh.
   newMesh.setNumVerts(nbVert);
   // The loop will continue until handling all vertices...
   for(int i=0; i<nbVert; i++) { 
      newMesh.verts[i] = orgMtx * orgMesh->verts[i];//Set new vertices
   }
   // Returns the number of faces in the original mesh.
   int nbFace = orgMesh->getNumFaces();
   // Sets the number of faces in the new mesh 
   // and previous faces are discarded.
   newMesh.setNumFaces(nbFace, FALSE);
   // The loop will continue until handling all faces...
   for(int i=0; i<nbFace; i++){ // Set new faces and Material id
      newMesh.faces[i] = orgMesh->faces[i];
      newMesh.faces[i].setMatID(orgMesh->faces[i].getMatID());
   }
   // Makes a complete copy of the specified channels 
   // of the original Mesh object into new Mesh.
   newMesh.DeepCopy(orgMesh, CNVERT_CHANNELS);

   return true;
}
开发者ID:ADN-DevTech,项目名称:3dsMax-Bake-Radiosity,代码行数:59,代码来源:BakeRadiosity.cpp


示例11: GetFaceSelectionFromMesh

void UnwrapMod::GetFaceSelectionFromMesh(ObjectState *os, ModContext &mc, TimeValue t)
	{
	TriObject *tobj = (TriObject*)os->obj;
	MeshTopoData *d  = (MeshTopoData*)mc.localData;
	if (d)
		{
		d->SetFaceSel(tobj->GetMesh().faceSel, this, t);
		UpdateFaceSelection(d->faceSel);
		}
	}
开发者ID:2asoft,项目名称:xray,代码行数:10,代码来源:mesh.cpp


示例12: ModifyObject

void AFRMod::ModifyObject (TimeValue t, ModContext &mc, ObjectState *os, INode *node) {
	Interval iv = FOREVER;
	float f, p, b;
	int backface;
	Point3 pt1, pt2;
	pblock->GetValue(PB_FALLOFF,t,f,iv);
	pblock->GetValue(PB_PINCH,t,p,iv);
	pblock->GetValue(PB_BUBBLE,t,b,iv);
	pblock->GetValue(PB_BACKFACE,t,backface,iv);
	p1->GetValue(t,&pt1,iv,CTRL_ABSOLUTE);
	p2->GetValue(t,&pt2,iv,CTRL_ABSOLUTE);
	if (f==0.0) {
		os->obj->UpdateValidity(GEOM_CHAN_NUM,iv);	
		return;
	}
	Tab<Point3> normals;
	if (backface) {
		// Need to get vertex normals.
		if (os->obj->IsSubClassOf(triObjectClassID)) {
			TriObject *tobj = (TriObject*)os->obj;
			AverageVertexNormals (tobj->GetMesh(), normals);
		} else if (os->obj->IsSubClassOf (polyObjectClassID)) {
			PolyObject *pobj = (PolyObject *) os->obj;
			MNMesh &mesh = pobj->GetMesh();
			normals.SetCount (mesh.numv);
			Point3 *vn = normals.Addr(0);
			for (int i=0; i<mesh.numv; i++) {
				if (mesh.v[i].GetFlag (MN_DEAD)) vn[i]=Point3(0,0,0);
				else vn[i] = mesh.GetVertexNormal (i);
			}
#ifndef NO_PATCHES
		} else if (os->obj->IsSubClassOf (patchObjectClassID)) {
			PatchObject *pobj = (PatchObject *) os->obj;
			normals.SetCount (pobj->NumPoints ());
			Point3 *vn = normals.Addr(0);
			for (int i=0; i<pobj->NumPoints(); i++) vn[i] = pobj->VertexNormal (i);
#endif
		}
	}
	if (normals.Count()) {
		AFRDeformer deformer(mc,f,p,b,pt1,pt2,&normals);
		os->obj->Deform(&deformer, TRUE);
	} else {
		AFRDeformer deformer(mc,f,p,b,pt1,pt2);
		os->obj->Deform(&deformer, TRUE);
	}	
	os->obj->UpdateValidity(GEOM_CHAN_NUM,iv);	
	}
开发者ID:2asoft,项目名称:xray,代码行数:48,代码来源:afregion.cpp


示例13: CreateNewTriObject

Object *TriObject::MakeShallowCopy(ChannelMask channels) {
	TriObject* newob = CreateNewTriObject();
#ifdef TRIPIPE_DEBUG
	DebugPrint ("TriObject(%08x)::MakeShallowCopy (%08x): %08x\n", this, channels, newob);
#endif
	newob->ShallowCopy(this,channels);
	
	/* Redundant code NS:03-15-00
	newob->mesh.ShallowCopy(&mesh,channels);
	newob->CopyValidity(this,channels);
	newob->mDispApprox = mDispApprox;
	newob->mSubDivideDisplacement = mSubDivideDisplacement;
	newob->mSplitMesh = mSplitMesh;
	newob->mDisableDisplacement = mDisableDisplacement;
	*/
	return newob;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:17,代码来源:triobj.cpp


示例14: CreateNewTriObject

Object* bhkProxyObject::ConvertToType(TimeValue t, Class_ID obtype)
{
	if (obtype == triObjectClassID)
	{
		int bvType = 0;
		pblock2->GetValue(PB_BOUND_TYPE, 0, bvType, FOREVER, 0);
		if (bvType != 0) 
		{
			TriObject *ob = CreateNewTriObject();
#if VERSION_3DSMAX >= ((5000<<16)+(15<<8)+0) // Version 5+
			ob->GetMesh().CopyBasics(proxyMesh);
#else
			ob->GetMesh() = proxyMesh;
#endif
			ob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
			ob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));
			return ob;
		}
	}
	return 0;
}
开发者ID:Doommarine23,项目名称:max_nif_plugin,代码行数:21,代码来源:bhkProxyObj.cpp


示例15: CreateNewTriObject

int
OBJImport::DoImport(const TCHAR *filename,ImpInterface *i,Interface *gi, BOOL suppressPrompts) {
	TriObject *object = CreateNewTriObject();
	if(!object)
		return 0;
	if(objFileRead(filename, &object->GetMesh())) {
		ImpNode *node = i->CreateNode();
		if(!node) {
			delete object;
			return 0;
			}
		Matrix3 tm;
		tm.IdentityMatrix();
		node->Reference(object);
		node->SetTransform(0,tm);
		i->AddNodeToScene(node);
		node->SetName(GetString(IDS_TH_WAVE_OBJ_NAME));
		i->RedrawViews();
		return 1;
		}
	return 0;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:22,代码来源:objimp.cpp


示例16: nodeEnum

BOOL FaceDataExport::nodeEnum(INode* node,Interface *ip) {	
	if(!exportSelected || node->Selected()) {
		ObjectState os = node->EvalWorldState(ip->GetTime());

		IFaceDataMgr *pFDMgr = NULL;
		if (os.obj->IsSubClassOf(triObjectClassID)) {
			TriObject *tobj = (TriObject *)os.obj;
			Mesh* mesh = &tobj->GetMesh();
			pFDMgr = static_cast<IFaceDataMgr*>(mesh->GetInterface( FACEDATAMGR_INTERFACE ));
		} else if (os.obj->IsSubClassOf (polyObjectClassID)) {
			PolyObject *pobj = (PolyObject *)os.obj;
			MNMesh *mesh = &pobj->GetMesh();
			pFDMgr = static_cast<IFaceDataMgr*>(mesh->GetInterface( FACEDATAMGR_INTERFACE ));
		}
		if (pFDMgr == NULL) return FALSE;

		SampleFaceData* SampleDataChan = NULL; 
		IFaceDataChannel* fdc = pFDMgr->GetFaceDataChan( FACE_MAXSAMPLEUSE_CLSID );
		if ( fdc != NULL ) SampleDataChan = dynamic_cast<SampleFaceData*>(fdc);
		if ( SampleDataChan == NULL) {
			fileStream.Printf(_T("Node %s does not have our Face Data\n"),node->GetName());
			return false;
		}

		//OK so We have Face data lets dump it out..
		fileStream.Printf(_T("\nNode %s has %d faces with FaceFloats\n"),node->GetName(), SampleDataChan->Count());
		for(ULONG i=0;i<SampleDataChan->Count();i++) {
			float data = SampleDataChan->data[i];
			fileStream.Printf(_T("Face %d, float %f\n"),i,data);
		}
	}

	// Recurse through this node's children, if any
	for (int c = 0; c < node->NumberOfChildren(); c++) {
		if (!nodeEnum(node->GetChildNode(c), ip)) return FALSE;
	}

	return TRUE;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:39,代码来源:ExportFaceData.cpp


示例17: UpdateMesh

Object* SimpleObject::ConvertToType(TimeValue t, Class_ID obtype) 
	{
	if (obtype==defObjectClassID||obtype==triObjectClassID||obtype==mapObjectClassID) {
		TriObject *triob;
		UpdateMesh(t);
		triob = CreateNewTriObject();
		triob->GetMesh() = mesh;
		triob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
		triob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));		
		return triob;
		}
	else
	if (obtype == patchObjectClassID) {
		UpdateMesh(t);
		PatchObject *patchob = new PatchObject();
		patchob->patch = mesh;		// Handy Mesh->PatchMesh conversion
		patchob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
		patchob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));		
		return patchob;
		}
	return Object::ConvertToType(t,obtype);
	}
开发者ID:2asoft,项目名称:xray,代码行数:22,代码来源:simpobj.cpp


示例18: ModifyObject

void EditFaceDataMod::ModifyObject (TimeValue t, ModContext &mc, ObjectState *os, INode *node) {
	if (mDisabled) return;

	EditFaceDataModData *d  = (EditFaceDataModData*)mc.localData;
	if (!d) mc.localData = d = new EditFaceDataModData();

	if (os->obj->IsSubClassOf(triObjectClassID)) {
		// Access the Mesh:
		TriObject *tobj = (TriObject*)os->obj;
		Mesh & mesh = tobj->GetMesh();

		// Apply our modifier's changes:
		d->ApplyChanges (mesh);

		// Update the cache used for display and hit testing:
		if (!d->GetCacheMesh()) d->SetCacheMesh(mesh);

		// Set display flags according to SO level:
		mesh.dispFlags = 0;
		mesh.SetDispFlag (levelDispFlags[selLevel]);

	} else if (os->obj->IsSubClassOf(polyObjectClassID)) {

		// Access the Mesh:
		PolyObject *pobj = (PolyObject*)os->obj;
		MNMesh & mesh = pobj->GetMesh();

		// Apply our modifier's changes:
		d->ApplyChanges (mesh);

		// Update the cache used for display and hit testing:
		if (!d->GetCacheMNMesh()) d->SetCacheMNMesh(mesh);

		// Set display flags according to SO level:
		mesh.dispFlags = 0;
		mesh.SetDispFlag (mnlevelDispFlags[selLevel]);
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:38,代码来源:EditFaceData.cpp


示例19: CreateNewTriObject

bool NifImporter::ImportMesh(NiTriStripsRef triStrips)
{
   bool ok = true;

   ImpNode *node = i->CreateNode();
   if(!node)
	   return false;
   INode *inode = node->GetINode();
   TriObject *triObject = CreateNewTriObject();
   node->Reference(triObject);
   wstring name = wide(triStrips->GetName());
   node->SetName(name.c_str());

   // Texture
   Mesh& mesh = triObject->GetMesh();
   NiTriStripsDataRef triStripsData = DynamicCast<NiTriStripsData>(triStrips->GetData());
   if (triStripsData == NULL)
      return false;

   vector<Triangle> tris = triStripsData->GetTriangles();
   ok |= ImportMesh(node, triObject, triStrips, triStripsData, tris);
   return ok;
}
开发者ID:blabbatheorange,项目名称:Nif-Plugin,代码行数:23,代码来源:ImportMeshAndSkin.cpp


示例20: UpdateMesh

Object* SimpleObject::ConvertToType(TimeValue t, Class_ID obtype) 
	{
	if (obtype==defObjectClassID||obtype==triObjectClassID||obtype==mapObjectClassID) {
		TriObject *triob;
		UpdateMesh(t);
		triob = CreateNewTriObject();
		triob->GetMesh() = mesh;
		triob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
		triob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));		
		return triob;
		}
#ifndef NO_PATCHES
	if (obtype == patchObjectClassID) {
		UpdateMesh(t);
		PatchObject *patchob = new PatchObject();
		patchob->patch = mesh;		// Handy Mesh->PatchMesh conversion
		patchob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
		patchob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));		
		return patchob;
		}
#endif
	if (Object::CanConvertToType (obtype)) {
		UpdateMesh (t);
	return Object::ConvertToType(t,obtype);
	}
	if (CanConvertTriObject(obtype)) {
		UpdateMesh (t);
		TriObject *triob = CreateNewTriObject ();
		triob->GetMesh() = mesh;
		triob->SetChannelValidity(TOPO_CHAN_NUM,ObjectValidity(t));
		triob->SetChannelValidity(GEOM_CHAN_NUM,ObjectValidity(t));		
		Object *ob = triob->ConvertToType (t, obtype);
		if (ob != triob) triob->DeleteThis ();	// (ob should never = tob.)
		return ob;
	}
	return NULL;
}
开发者ID:artemeliy,项目名称:inf4715,代码行数:37,代码来源:simpobj.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ Triangle类代码示例发布时间:2022-05-31
下一篇:
C++ TriMesh类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap