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


C++ TriObject::DeleteMe方法代码示例

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


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

示例1: ExportTriGeom


//.........这里部分代码省略.........
                                        int memoffs = jpv*vIdx;
                                        memcpy(vd->weights, weights+memoffs, jpv*sizeof(awd_float64));
                                        memcpy(vd->joints, joints+memoffs, jpv*sizeof(awd_uint32));
                                    }

                                    vd->force_hard = false;

                                    // add the new vertex to the subgeo
                                    thisSubGeoGroup->append_vdata(vd);
                                }
                            }
                        }
                    }
                }
                AWDBlockList * returned_geoms =  geomUtil->build_geom(awdGeom);

                AWDBlockIterator * it=NULL;
                AWDMeshInst * block;
                int maxCount=0;
                int geomCnt=0;
                for (geomCnt=0; geomCnt<returned_geoms->get_num_blocks();geomCnt++){
                    AWDTriGeom * thisAWDGeom=(AWDTriGeom *)returned_geoms->getByIndex(geomCnt);
                    it = new AWDBlockIterator(thisAWDGeom->get_mesh_instance_list());
                    AWDSubGeom *sub;
                    sub = thisAWDGeom->get_first_sub();
                    while (sub) {
                        AWDBlockList *subGeoGroupMatList=sub->get_materials();
                        int thisIdx=0;
                        it->reset();
                        while ((block = (AWDMeshInst*)it->next()) != NULL) {
                            block->set_geom(thisAWDGeom);
                            //if (!isInSkinPoseMode){
                            //    block->set_transform(mtxData);
                            //}
                            AWDMaterial * thisMat=(AWDMaterial *)subGeoGroupMatList->getByIndex(thisIdx);
                            if (thisMat==NULL){
                                int test=0;
                                //ERROR - this should never happen
                            }
                            else{
                                AWDLightPicker * lightPicker=(AWDLightPicker *)block->get_lightPicker();
                                AWDBlock * thisAnimator=(AWDBlock *)block->get_animator();
                                if ((lightPicker!=NULL)||(thisAnimator!=NULL)){
                                    thisMat=thisMat->get_unique_material(lightPicker, thisAnimator, NULL);
                                    if(lightPicker!=NULL){
                                        if(opts->SetMultiPass()){
                                            // multipass using the number of lights, that the lightpicker uses
                                            if (lightPicker->get_lights()->get_num_blocks()>4){
                                                thisMat->set_multiPass(true);
                                            }
                                            else{
                                                thisMat->set_multiPass(false);
                                            }
                                        }
                                        if ((lightPicker->get_lights()->get_num_blocks()>4)&&(!thisMat->get_multiPass())){
                                            AWDMessageBlock * newWarning = new AWDMessageBlock(thisMat->get_name(), "AWDMaterial has more than 4 lights assigned, but is set to singlepass. this will cause problems on render.");
                                            awd->get_message_blocks()->append(newWarning);
                                        }
                                        if(opts->IncludeShadows()){
                                            if(thisMat->get_shadowMethod()!=NULL){
                                                bool shadowOK=lightPicker->check_shadowMethod((AWDShadowMethod *)(thisMat->get_shadowMethod()));
                                                if(!shadowOK){
                                                    AWDMessageBlock * newWarning = new AWDMessageBlock(thisMat->get_name(), "Could not find the ShadowMethod thats applied to the material on one of the lights that it assigned to the material.");
                                                    awd->get_message_blocks()->append(newWarning);
                                                    thisMat->set_shadowMethod(NULL);
                                                }
                                                }
                                            if(thisMat->get_shadowMethod()==NULL){
                                                thisMat->set_shadowMethod(lightPicker->get_shadowMethod());
                                            }
                                        }
                                    }
                                }
                                block->add_material((AWDMaterial*)thisMat);
                            }
                            thisIdx++;
                        }
                        sub = sub->next;
                    }
                    delete it;
                }
                delete returned_geoms;
                // If conversion created a new object, dispose it
                if (triObject != obj)
                    triObject->DeleteMe();
                delete geomUtil;
            }
            else{
            }
            //free(quadDic);
            //free(isExportedDic);
            free(mtxData);
            if (weights!=NULL)
                free(weights);
            if (joints!=NULL)
                free(joints);
        }
    }
    return;
}
开发者ID:zirancn,项目名称:AwayExtensions-3dsmax,代码行数:101,代码来源:maxawdexporter_geometry.cpp

示例2: exportMesh


//.........这里部分代码省略.........
			VertColor *vertCol = mesh->vertColArray;
			int n = mesh->getNumVertCol();
			if (n > vertColors.size())
				vertColors.assign(n, Color4(1.0f, 1.0f, 1.0f, 1.0f));
			if (vertCol) {
				for (int i=0; i<n; ++i) {
					VertColor col = vertCol[ i ];
					vertColors[i] = Color4(col.x, col.y, col.z, vertColors[i].a);
					hasvc |= (col.x != 1.0f || col.y != 1.0f || col.z != 1.0f);
				}
			}
		}
		if (!hasvc) vertColors.clear();
	}

#if VERSION_3DSMAX <= ((5000<<16)+(15<<8)+0) // Version 5
	mesh->checkNormals(TRUE);
#else
	MeshNormalSpec *specNorms = mesh->GetSpecifiedNormals ();
	if (NULL != specNorms) {
		specNorms->CheckNormals();
		if (specNorms->GetNumNormals() == 0)
			mesh->checkNormals(TRUE);
	} else {
		mesh->checkNormals(TRUE);
	}
#endif

	Result result = Ok;

	Modifier* geomMorpherMod = GetMorpherModifier(node);
	bool noSplit = FALSE;
//	bool noSplit = (NULL != geomMorpherMod);

	while (1)
	{
		FaceGroups grps;
		if (!splitMesh(node, *mesh, grps, t, vertColors, noSplit))
		{
			result = Error;
			break;
		}
		bool exportStrips = mTriStrips && (Exporter::mNifVersionInt > VER_4_2_2_0);

		Matrix44 tm = Matrix44::IDENTITY;
		if ( mExportExtraNodes || (mExportType != NIF_WO_ANIM && isNodeKeyed(node) ) ) {
			tm = TOMATRIX4(getObjectTransform(node, t, false) * Inverse(getNodeTransform(node, t, false)));
		} else {
			Matrix33 rot; Vector3 trans;
			objectTransform(rot, trans, node, t, local);
			tm = Matrix44(trans, rot, 1.0f);
		}
		tm = TOMATRIX4(Inverse(mtx)) * tm;

		TSTR basename = node->NodeName();
		TSTR format = (!basename.isNull() && grps.size() > 1) ? "%s:%d" : "%s";

		int i=1;
		FaceGroups::iterator grp;
		for (grp=grps.begin(); grp!=grps.end(); ++grp, ++i)
		{
			string name = FormatString(format, basename.data(), i);
			NiTriBasedGeomRef shape = makeMesh(ninode, getMaterial(node, grp->first), grp->second, exportStrips);
			if (shape == NULL)
			{
				result = Error;
				break;
			}

			if (node->IsHidden())
				shape->SetVisibility(false);

			shape->SetName(name);
			shape->SetLocalTransform(tm);

			if (Exporter::mZeroTransforms) {
				shape->ApplyTransforms();
			}

			makeSkin(shape, node, grp->second, t);

			if (geomMorpherMod) {
				vector<Vector3> verts = shape->GetData()->GetVertices();
				exportGeomMorpherControl(geomMorpherMod, verts, shape->GetData()->GetVertexIndices(), shape);
				shape->GetData()->SetConsistencyFlags(CT_VOLATILE);
			}

		}

		break;
	}

	if (tri != os.obj)
		tri->DeleteMe();

	if (copymesh)
		delete copymesh;

	return result;
}
开发者ID:ElliotWood,项目名称:max_nif_plugin,代码行数:101,代码来源:Mesh.cpp

示例3: SyncFromMaxMesh


//.........这里部分代码省略.........
	// get pivot TM
	MaxPivotTM.IdentityMatrix();
	MaxPivotTM.SetTrans(MaxINode->GetObjOffsetPos()); 
	PreRotateMatrix(MaxPivotTM, MaxINode->GetObjOffsetRot()); 
	ApplyScaling(MaxPivotTM, MaxINode->GetObjOffsetScale());


	
	
//	char blaat[1024];
//	sprintf(blaat,"MaxPivotTM.MaxPivotTM.GetTrans()=(%f,%f,%f)",MaxPivotTM.GetTrans().x,MaxPivotTM.GetTrans().y,MaxPivotTM.GetTrans().z);
//	MaxMsgBox(NULL, _T(blaat), _T("Error"), MB_OK);

	// GetObjectTM() = MaxPivotTM * MaxNodeTM
	MaxNodeObjectTM = MaxINode->GetObjectTM(t);
	//-----------------------------------------------------------------------------------------------
	// object might be modified by world space modifiers. We need a solution in future for this case.
	bool isWorldSpace = MaxINode->GetObjTMAfterWSM(t).IsIdentity(); 
	//-----------------------------------------------------------------------------------------------
	Matrix3 PhysicsNodeTM = ccMaxWorld::ChangeToPhysXUnit(MaxNodeObjectTM);
	// get scale TM
	// PhysicsNodeTM == PhysicsNodeScaleTM * PhysicsNodePoseTM
	Point3 maxNodeScale = ccMaxWorld::ParseScale(PhysicsNodeTM, PhysicsNodeScaleTM, PhysicsNodePoseTM);      
	//Matrix3 right;
	//ParseMatrix(PhysicsNodePoseTM, right);
	//PhysicsNodePoseTM = right;
	//PhysicsNodeScaleTM = PhysicsNodeTM * Inverse(PhysicsNodePoseTM);
	//if(IsScaled(PhysicsNodeScaleTM))
	//	objectIsScaled = true;
	// check whether the Node's mesh is scaled equally at x/y/z
	ScaledIsUnified  = (fabs((maxNodeScale.x - maxNodeScale.z)/maxNodeScale.z) < gTolerenceEpsilon) && (fabs((maxNodeScale.y - maxNodeScale.z)/maxNodeScale.z) < gTolerenceEpsilon);
	ScaledIsUnified  = (! objectIsScaled) && ScaledIsUnified;
	//if(! ScaledIsUnified) {
	//	PhysicsNodePoseTM.IdentityMatrix();
	//	PhysicsNodePoseTM.SetRow(3, NodePosInPhysics);
	//	PhysicsNodeScaleTM = PhysicsNodeTM * Inverse(PhysicsNodePoseTM);
	//}
	PhysicsNodePoseTMInv = Inverse(PhysicsNodePoseTM);

	//gCurrentstream->printf("\nNxScaleTM = ");	MxUtils::PrintMatrix3(PhysicsNodeScaleTM); 
	//gCurrentstream->printf("\nNxPoseTM = ");	MxUtils::PrintMatrix3(PhysicsNodePoseTM); 
	//gCurrentstream->printf("\n");
	//Matrix3 t1 = PhysicsNodeScaleTM * PhysicsNodePoseTM;
	//bool e1 = (t1 == MaxNodeObjectTM);
	Object* obj   = MaxINode->EvalWorldState(t).obj;
	if (obj != NULL)
	{
		SimpleObject* so = (SimpleObject*)obj;
		Class_ID id = obj->ClassID();
		if (id == Class_ID(SPHERE_CLASS_ID, 0)) {
			ShapeType = NX_SHAPE_SPHERE;
			so->pblock->GetValue(SPHERE_RADIUS, 0, PrimaryShapePara.Radius, FOREVER);
			PrimaryShapePara.Radius *= maxNodeScale.x * ccMaxWorld::GetUnitChange();         // x/y/z is scaled with a same value
		}
		else if (id == Class_ID(BOXOBJ_CLASS_ID, 0)) {
			ShapeType = NX_SHAPE_BOX;
			so->pblock->GetValue(BOXOBJ_WIDTH , 0, PrimaryShapePara.BoxDimension[0], FOREVER);
			so->pblock->GetValue(BOXOBJ_LENGTH, 0, PrimaryShapePara.BoxDimension[1], FOREVER);
			so->pblock->GetValue(BOXOBJ_HEIGHT, 0, PrimaryShapePara.BoxDimension[2], FOREVER);
			PrimaryShapePara.BoxDimension *= (0.5f * maxNodeScale.x * ccMaxWorld::GetUnitChange());          // x/y/z is scaled with a same value     // Physics box is half the size
		}
		else if (id == CAPS_CLASS_ID) {
			ShapeType = NX_SHAPE_CAPSULE;
			int centersflag = 0;
			so->pblock->GetValue(CAPS_RADIUS , 0, PrimaryShapePara.Radius, FOREVER);
			so->pblock->GetValue(CAPS_HEIGHT , 0, PrimaryShapePara.Height, FOREVER);
			so->pblock->GetValue(CAPS_CENTERS, 0, centersflag, FOREVER);
			if(!centersflag) //there are some different ways in which you can specify a capsule in 3ds max, adjust length if "center" mode is not used
				PrimaryShapePara.Height -= PrimaryShapePara.Radius * 2.0f; 
			PrimaryShapePara.Radius *= maxNodeScale.x * ccMaxWorld::GetUnitChange();         // x/y/z is scaled with a same value
			PrimaryShapePara.Height *= maxNodeScale.x * ccMaxWorld::GetUnitChange();         // x/y/z is scaled with a same value
		}
	}
	if(! ScaledIsUnified)
		ShapeType     = NX_SHAPE_MESH;
	// Disable backface culling for cloth
	//MaxINode->BackCull(FALSE);
	// get mesh
	BOOL needDel = FALSE;
	TriObject* tri = MxUtils::GetTriObjectFromNode(MaxINode, t, needDel);
	if (tri == NULL) return;

	Mesh& mesh = tri->GetMesh();
	SimpleMesh.alloc(mesh.getNumVerts(), mesh.getNumFaces());
	//Matrix3 change = PhysicsNodeTM * Inverse(PhysicsNodePoseTM);
	for(NxU32 i = 0; i < SimpleMesh.numPoints; i++) 
	{
		Point3 tmp = mesh.verts[i] * ccMaxWorld::GetUnitChange() * PhysicsNodeScaleTM;
		((Point3*)SimpleMesh.points)[i] =  tmp;  // systemTM is unit change TM.
	}
	for(NxU32 i = 0; i < SimpleMesh.numFaces; i++) 
	{
		for(NxU32 j = 0; j < 3; j++) 
		{ 
			SimpleMesh.faces[i*3+j] = mesh.faces[i].v[j];
		}
	}
	if (needDel)
		tri->DeleteMe();
}
开发者ID:ani19tha,项目名称:dynamica,代码行数:101,代码来源:MaxNode.cpp


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