Beispiel #1
0
void ChCylinderObject::BuildMesh(TimeValue t)
	{	
	int segs, smooth, hsegs, capsegs,fsegs;
	float radius,height,pie1, pie2,fillet;
	int doPie, genUVs;	

	FixFillet(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL),increate);
	// Start the validity interval at forever and widdle it down.
	ivalid = FOREVER;
	
	pblock->GetValue(PB_FSEGS,t,fsegs,ivalid);
	pblock->GetValue(PB_SIDES,t,segs,ivalid);
	pblock->GetValue(PB_HSEGS,t,hsegs,ivalid);
	pblock->GetValue(PB_CSEGS,t,capsegs,ivalid);
	pblock->GetValue(PB_RADIUS,t,radius,ivalid);
	pblock->GetValue(PB_HEIGHT,t,height,ivalid);
	pblock->GetValue(PB_FILLET,t,fillet,ivalid);
	pblock->GetValue(PB_SMOOTHON,t,smooth,ivalid);	
	pblock->GetValue(PB_SLICEFROM,t,pie1,ivalid);
	pblock->GetValue(PB_SLICETO,t,pie2,ivalid);	
	pblock->GetValue(PB_SLICEON,t,doPie,ivalid);	
	pblock->GetValue(PB_GENUVS,t,genUVs,ivalid);	
	LimitValue(radius, MIN_RADIUS, MAX_RADIUS);
	LimitValue(height, MIN_HEIGHT, MAX_HEIGHT);
	LimitValue(fsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(hsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(capsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(segs, MIN_SIDES, MAX_SIDES);
	LimitValue(smooth, 0, 1);	
	
	BuildChCylinderMesh(mesh,
		segs, smooth, hsegs, capsegs, fsegs,doPie,
		radius, fillet, height, pie1, pie2, genUVs);
	}
Beispiel #2
0
void ScubaObject::BuildMesh(TimeValue t)
	{	
	int segs, smooth, hsegs;
	float radius,height,pie1, pie2,r2;
	int doPie, genUVs,con;	

	// Start the validity interval at forever and widdle it down.
    FixHeight(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL),increate);
	ivalid = FOREVER;
	
	pblock->GetValue(PB_RADIUS,t,radius,ivalid);
	pblock->GetValue(PB_CENTERS,t,con,ivalid);
	pblock->GetValue(PB_HEIGHT,t,height,ivalid);
	r2=2.0f*radius;
	if (con) height+=(height<0.0f?-r2:r2);
	pblock->GetValue(PB_SIDES,t,segs,ivalid);
	pblock->GetValue(PB_HSEGS,t,hsegs,ivalid);
	pblock->GetValue(PB_SMOOTHON,t,smooth,ivalid);	
	pblock->GetValue(PB_SLICEFROM,t,pie1,ivalid);
	pblock->GetValue(PB_SLICETO,t,pie2,ivalid);	
	pblock->GetValue(PB_SLICEON,t,doPie,ivalid);	
	pblock->GetValue(PB_GENUVS,t,genUVs,ivalid);	
	LimitValue(radius, MIN_RADIUS, MAX_RADIUS);
	LimitValue(height, MIN_HEIGHT, MAX_HEIGHT);
	LimitValue(hsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(segs, MIN_SIDES, MAX_SIDES);
	LimitValue(smooth, 0, 1);	
				//        sides, smooth, 			  cylrad  
	BuildScubaMesh(mesh, segs, smooth, hsegs, doPie,radius, height, pie1, pie2, genUVs, GetUsePhysicalScaleUVs());
	}
Beispiel #3
0
void CExtObject::BuildMesh(TimeValue t)
	{	
	int hsegs,tsegs,ssegs,bsegs,wsegs;
	float height,toplen,sidelen,botlen,topwidth,sidewidth,botwidth;
	int genUVs;	

	// Start the validity interval at forever and widdle it down.
	FixTopWidth(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL),increate);
	FixBotWidth(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL),increate);
	FixSideWidth(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL),increate);
	ivalid = FOREVER;
	
	pblock->GetValue(PB_HSEGS,t,hsegs,ivalid);
	pblock->GetValue(PB_TSEGS,t,tsegs,ivalid);
	pblock->GetValue(PB_SSEGS,t,ssegs,ivalid);
	pblock->GetValue(PB_BSEGS,t,bsegs,ivalid);
	pblock->GetValue(PB_WSEGS,t,wsegs,ivalid);
	pblock->GetValue(PB_TOPLENGTH,t,toplen,ivalid);
	pblock->GetValue(PB_SIDELENGTH,t,sidelen,ivalid);
	pblock->GetValue(PB_BOTLENGTH,t,botlen,ivalid);
	pblock->GetValue(PB_TOPWIDTH,t,topwidth,ivalid);
	pblock->GetValue(PB_SIDEWIDTH,t,sidewidth,ivalid);
	pblock->GetValue(PB_BOTWIDTH,t,botwidth,ivalid);
	pblock->GetValue(PB_HEIGHT,t,height,ivalid);
	pblock->GetValue(PB_GENUVS,t,genUVs,ivalid);
	LimitValue(height, MIN_HEIGHT, BMAX_HEIGHT);
	LimitValue(toplen, MIN_HEIGHT, BMAX_LENGTH);
	LimitValue(sidelen, MIN_HEIGHT,BMAX_WIDTH);
	LimitValue(botlen, MIN_HEIGHT, BMAX_HEIGHT);
	LimitValue(topwidth, BMIN_LENGTH,BMAX_LENGTH);
	LimitValue(sidewidth, BMIN_WIDTH,BMAX_WIDTH);
	LimitValue(botwidth, BMIN_HEIGHT,BMAX_HEIGHT);
	LimitValue(hsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(tsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(ssegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(bsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(wsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	
	BuildCExtMesh(mesh,hsegs,tsegs,ssegs,bsegs,wsegs,height,
		toplen,sidelen,botlen,topwidth,sidewidth,botwidth, genUVs,createmeth,GetUsePhysicalScaleUVs());
	}
Beispiel #4
0
void PrismObject::BuildMesh(TimeValue t)
	{	
	int hsegs,s1segs,s2segs,s3segs;
	float height,s1len,s2len,s3len;
	int genUVs;	

	if (isdone)
	{  FixSide1(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL));
	   FixSide2(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL));
	   FixSide3(pblock,t,(pmapParam?pmapParam->GetHWnd():NULL));
	}

	// Start the validity interval at forever and widdle it down.
	ivalid = FOREVER;
	
	pblock->GetValue(PB_HSEGS,t,hsegs,ivalid);
	pblock->GetValue(PB_S1SEGS,t,s1segs,ivalid);
	pblock->GetValue(PB_S2SEGS,t,s2segs,ivalid);
	pblock->GetValue(PB_S3SEGS,t,s3segs,ivalid);
	pblock->GetValue(PB_HEIGHT,t,height,ivalid);
	pblock->GetValue(PB_SIDE1,t,s1len,ivalid);
	pblock->GetValue(PB_SIDE2,t,s2len,ivalid);
	pblock->GetValue(PB_SIDE3,t,s3len,ivalid);
	pblock->GetValue(PB_GENUVS,t,genUVs,ivalid);	
	LimitValue(height, MIN_HEIGHT, MAX_HEIGHT);
	LimitValue(s1len, BMIN_HEIGHT, MAX_HEIGHT);
	LimitValue(s2len, BMIN_HEIGHT, MAX_HEIGHT);
	LimitValue(s3len, BMIN_HEIGHT, MAX_HEIGHT);
	LimitValue(hsegs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(s1segs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(s2segs, MIN_SEGMENTS, MAX_SEGMENTS);
	LimitValue(s3segs, MIN_SEGMENTS, MAX_SEGMENTS);
	
	BuildPrismMesh(mesh, s1segs, s2segs, s3segs, hsegs, 
		s1len, s2len, s3len, height, genUVs);
	}
Beispiel #5
0
void OptMod::ModifyObject(TimeValue t, ModContext &mc, ObjectState *os, INode *node)
	{
	float faceThresh, edgeThresh, bias, maxEdge;
	int preserveMat, preserveSmooth, which, render=0, autoEdge;
	DWORD flags = 0;
	Interval valid = FOREVER;
	int nv,nf;

	int man;
	pblock->GetValue(PB_MANUPDATE,t,man,valid);
	if (man && !forceUpdate && !TestAFlag(A_RENDER)) return;
	forceUpdate = FALSE;

	if (TestAFlag(A_RENDER)) {
		pblock->GetValue(PB_RENDER,t,which,valid);
	} else {
		pblock->GetValue(PB_VIEWS,t,which,valid);
		}	
	
	pblock->GetValue(PB_AUTOEDGE,t,autoEdge,valid);

	if (which==0) {
		pblock->GetValue(PB_FACETHRESH1,t,faceThresh,valid);
		pblock->GetValue(PB_EDGETHRESH1,t,edgeThresh,valid);	
		pblock->GetValue(PB_BIAS1,t,bias,valid);
		pblock->GetValue(PB_PRESERVEMAT1,t,preserveMat,valid);
		pblock->GetValue(PB_PRESERVESMOOTH1,t,preserveSmooth,valid);
		pblock->GetValue(PB_MAXEDGE1,t,maxEdge,valid);
	} else {
		pblock->GetValue(PB_FACETHRESH2,t,faceThresh,valid);
		pblock->GetValue(PB_EDGETHRESH2,t,edgeThresh,valid);	
		pblock->GetValue(PB_BIAS2,t,bias,valid);
		pblock->GetValue(PB_PRESERVEMAT2,t,preserveMat,valid);
		pblock->GetValue(PB_PRESERVESMOOTH2,t,preserveSmooth,valid);
		pblock->GetValue(PB_MAXEDGE2,t,maxEdge,valid);
		}
	
	assert(os->obj->IsSubClassOf(triObjectClassID));
	TriObject *triOb = (TriObject *)os->obj;
	nv = triOb->GetMesh().getNumVerts();
	nf = triOb->GetMesh().getNumFaces();

	if (preserveMat) flags |= OPTIMIZE_SAVEMATBOUNDRIES;
	if (preserveSmooth) flags |= OPTIMIZE_SAVESMOOTHBOUNDRIES;
	if (autoEdge) flags |= OPTIMIZE_AUTOEDGE;

	if (faceThresh!=0.0f) {
		GetAsyncKeyState(VK_ESCAPE); // clear the state
		HCURSOR hCur;
		if (nf > 2000) hCur = SetCursor(LoadCursor(NULL,IDC_WAIT));

		triOb->GetMesh().Optimize(
			faceThresh,edgeThresh, bias*0.5f, maxEdge, flags,this);

		if (nf > 200) SetCursor(hCur);
		}

	triOb->GetMesh().InvalidateTopologyCache ();
	triOb->PointsWereChanged();
	triOb->UpdateValidity(GEOM_CHAN_NUM,valid);
	triOb->UpdateValidity(TOPO_CHAN_NUM,valid);
	triOb->UpdateValidity (TEXMAP_CHAN_NUM, valid);
	triOb->UpdateValidity (VERT_COLOR_CHAN_NUM, valid);

	if (pmapParam && pmapParam->GetParamBlock()==pblock && !TestAFlag(A_RENDER)) {
		TSTR buf;
		buf.printf("%d / %d",nv,triOb->GetMesh().getNumVerts());
		SetWindowText(GetDlgItem(pmapParam->GetHWnd(),IDC_OPT_VERTCOUNT),buf);
		buf.printf("%d / %d",nf,triOb->GetMesh().getNumFaces());
		SetWindowText(GetDlgItem(pmapParam->GetHWnd(),IDC_OPT_FACECOUNT),buf);
		}
	}