Exemple #1
0
void PolyOpExtrudeFace::Do(MNMesh & mesh)
{
	MNChamferData chamData;
	if (mType<2) {
		MNFaceClusters fclust(mesh, MN_USER);
		if (!mesh.ExtrudeFaceClusters (fclust)) return;
		if (mType == 0) {
			// Get fresh face clusters:
			MNFaceClusters fclustAfter(mesh, MN_USER);
			Tab<Point3> clusterNormals, clusterCenters;
			fclustAfter.GetNormalsCenters (mesh, clusterNormals, clusterCenters);
			mesh.GetExtrudeDirection (&chamData, &fclustAfter, clusterNormals.Addr(0));
		} else {
			mesh.GetExtrudeDirection (&chamData, MN_USER);
		}
	} else {
		// Polygon-by-polygon extrusion.
		if (!mesh.ExtrudeFaces (MN_USER)) return;
		MNFaceClusters fclustAfter(mesh, MN_USER);
		Tab<Point3> clusterNormals, clusterCenters;
		fclustAfter.GetNormalsCenters (mesh, clusterNormals, clusterCenters);
		mesh.GetExtrudeDirection (&chamData, &fclustAfter, clusterNormals.Addr(0));
	}

	// Move vertices
	for (int i=0; i<mesh.numv; i++) {
		if (mesh.v[i].GetFlag (MN_DEAD)) continue;
		mesh.v[i].p += chamData.vdir[i]*mHeight;
	}
}
Exemple #2
0
void PolyOpBevelFace::Do (MNMesh & mesh)
{
	// Topological extrusion first:
	MNChamferData chamData;
	if (mType<2) {
		MNFaceClusters fclust(mesh, MN_USER);
		if (!mesh.ExtrudeFaceClusters (fclust)) return;
		if (mType == 0) {
			// Get fresh face clusters:
			MNFaceClusters fclustAfter(mesh, MN_USER);
			Tab<Point3> clusterNormals, clusterCenters;
			fclustAfter.GetNormalsCenters (mesh, clusterNormals, clusterCenters);
			mesh.GetExtrudeDirection (&chamData, &fclustAfter, clusterNormals.Addr(0));
		} else {
			mesh.GetExtrudeDirection (&chamData, MN_USER);
		}
	} else {
		// Polygon-by-polygon extrusion.
		if (!mesh.ExtrudeFaces (MN_USER)) return;
		MNFaceClusters fclustAfter(mesh, MN_USER);
		Tab<Point3> clusterNormals, clusterCenters;
		fclustAfter.GetNormalsCenters (mesh, clusterNormals, clusterCenters);
		mesh.GetExtrudeDirection (&chamData, &fclustAfter, clusterNormals.Addr(0));
	}

	int i;
	if (mHeight) {
		for (i=0; i<mesh.numv; i++) mesh.v[i].p += chamData.vdir[i]*mHeight;
	}

	if (mOutline) {
		MNTempData temp(&mesh);
		Tab<Point3> *outDir;
		if (mType == 0) outDir = temp.OutlineDir (MESH_EXTRUDE_CLUSTER, MN_USER);
		else outDir = temp.OutlineDir (MESH_EXTRUDE_LOCAL, MN_USER);
		if (outDir && outDir->Count()) {
			Point3 *od = outDir->Addr(0);
			for (i=0; i<mesh.numv; i++) mesh.v[i].p += od[i]*mOutline;
		}
	}
}