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


C++ GraphicsWindow::getHitDistance方法代码示例

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


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

示例1: DrawAxisLock

void SnapPivot_Mode::DrawAxisLock(ViewExp *vpt, int axis, float size, bool hightLight, bool hitTest, float& dist)
{
	GraphicsWindow *gw = vpt->getGW();

	if (hitTest)
	{
		gw->setRndLimits(gw->getRndLimits() | GW_PICK);
		gw->clearHitCode();		
	}

	
	Point3 p(0, 0, 0);
	p[axis] = size+ size*0.1f;

	if (axis == mLockedAxis)
		gw->setColor(ColorType::LINE_COLOR, mLockedColor);
	else
		gw->setColor(ColorType::LINE_COLOR, mLockColor);
	gw->startMarkers();
	gw->marker(&p, MarkerType::CIRCLE_MRKR);
	gw->endMarkers();


	dist = -1.0f;
	if (hitTest)
	{
		if (gw->checkHitCode())
		{
			if (gw->getHitDistance())
				dist = gw->getHitDistance();
		}
	}


}
开发者ID:watjepeter,项目名称:Plugins,代码行数:35,代码来源:SnapPivot_ViewportDisplay.cpp

示例2: DrawCenter

void SnapPivot_Mode::DrawCenter(ViewExp *vpt, float size, bool hightLight, bool hitTest, float& dist)
{
	GraphicsWindow *gw = vpt->getGW();
	if (hitTest)
	{
		gw->setRndLimits(gw->getRndLimits() | GW_PICK);
		gw->clearHitCode();		
	}

	
	Point3 p(0, 0, 0);
	gw->setColor(ColorType::LINE_COLOR, mCenterColor);
	gw->startMarkers();
	gw->marker(&p, MarkerType::BIG_BOX_MRKR);
	gw->endMarkers();

	dist = -1.0f;
	if (hitTest)
	{
		if (gw->checkHitCode()) 
		{
			if (gw->getHitDistance() )
				dist = gw->getHitDistance();
		}		
	}

}
开发者ID:watjepeter,项目名称:Plugins,代码行数:27,代码来源:SnapPivot_ViewportDisplay.cpp

示例3: HitTest

int FExtrudeMod::HitTest(
		TimeValue t, INode* inode, int type, int crossing, 
		int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc)
	{	

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}

	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);

	gw->clearHitCode();
	base->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
	gw->marker(&pt,HOLLOW_BOX_MRKR);
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		res = 1;
		}			

	gw->setRndLimits(savedLimits);
	return res;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:34,代码来源:fextrude.cpp

示例4: HitTest

int SymmetryMod::HitTest (TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) {

	if ( ! vpt || ! vpt->IsAlive() )
	{
		// why are we here
		DbgAssert(!_T("Invalid viewport!"));
		return FALSE;
	}


	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);
	gw->clearHitCode();
	DrawLineProc lp(gw);
	DrawGizmo(
		vpt->GetScreenScaleFactor(tm.GetTrans())*SCREEN_SCALE,lp);
	gw->setRndLimits(savedLimits);
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		return 1;
		}
	return 0;
}
开发者ID:innovatelogic,项目名称:ilogic-vm,代码行数:31,代码来源:Symmetry.cpp

示例5: HitTest

int AFRMod::HitTest(
		TimeValue t, INode* inode, 
		int type, int crossing, int flags, 
		IPoint2 *p, ViewExp *vpt, ModContext* mc)
	{
	GraphicsWindow *gw = vpt->getGW();
	Point3 pt;
	HitRegion hr;
	int savedLimits, res = 0;
	Matrix3 tm = CompMatrix(t,inode,mc);

	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);	
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);	
	gw->setTransform(tm);

	// Hit test start point
	if ((flags&HIT_SELONLY   &&  sel[0]) ||
		(flags&HIT_UNSELONLY && !sel[0]) ||
		!(flags&(HIT_UNSELONLY|HIT_SELONLY)) ) {
	
		gw->clearHitCode();
		p1->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
		gw->marker(&pt,HOLLOW_BOX_MRKR);
		if (gw->checkHitCode()) {
			vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
			res = 1;
			}
		}

	// Hit test end point
	if ((flags&HIT_SELONLY   &&  sel[1]) ||
		(flags&HIT_UNSELONLY && !sel[1]) ||
		!(flags&(HIT_UNSELONLY|HIT_SELONLY)) ) {
	
		gw->clearHitCode();
		p2->GetValue(t,&pt,FOREVER,CTRL_ABSOLUTE);
		gw->marker(&pt,HOLLOW_BOX_MRKR);
		if (gw->checkHitCode()) {
			vpt->LogHit(inode, mc, gw->getHitDistance(), 1, NULL); 
			res = 1;
			}
		}

	gw->setRndLimits(savedLimits);
	return res;
	}
开发者ID:2asoft,项目名称:xray,代码行数:47,代码来源:afregion.cpp

示例6: HitTest

int BendManip::HitTest(TimeValue t, INode* pNode, int type, int crossing,
			int flags, IPoint2 *p, ViewExp *pVpt)
{
	ModContext* mc = FindModContext( pNode, modifier );
	if( mc==NULL ) return 0;

// From SimpleMod - Removed the centre drawing section
	Interval valid;
	int savedLimits;	
	GraphicsWindow *gw = pVpt->getGW();
	HitRegion hr;
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	Matrix3 modmat, ntm = pNode->GetObjTMBeforeWSM(t);

	if (mc->box->IsEmpty()) return 0;

	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();

	//Lets get the Modifier do all the work here

	Matrix3 off, invoff;
	modmat = modifier->CompMatrix(t,*mc,ntm,valid,FALSE);
	modifier->CompOffset(t,off,invoff);
	gw->setTransform(modmat);		
	DoModifiedBox(*mc->box,modifier->GetDeformer(t,*mc,invoff,off),DrawLineProc(gw));
	

	gw->setRndLimits(savedLimits);	

	if (gw->checkHitCode()) {
		pVpt->LogHit(pNode, mc, gw->getHitDistance(), 0, NULL); 

	}

// Setup the Hit data from the Manipulator system into the HitRecord
	if(  pVpt->NumSubObjHits() ) {
		ManipHitData* pHitData = new ManipHitData(this);
		HitRecord* hit = pVpt->GetSubObjHitList().First();

		hit->hitData = pHitData; //Add the manip hit data
		return TRUE;
	}

	else 
	{
		return FALSE;
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:50,代码来源:bendmanip.cpp

示例7: HitTest

int ClustMod::HitTest(
		TimeValue t, INode* inode, int type, int crossing, 
		int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc)
	{	
	int savedLimits;
	Matrix3 obtm = inode->GetObjectTM(t);
	GraphicsWindow *gw = vpt->getGW();
	HitRegion hr;
	MakeHitRegion(hr,type, crossing,4,p);
	gw->setHitRegion(&hr);
	gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
	gw->clearHitCode();	
	gw->setTransform(obtm);

	Matrix3 ptm(1), ctm(1);
	if (posControl) posControl->GetValue(t,&ptm,FOREVER,CTRL_RELATIVE);
	if (tmControl) tmControl->GetValue(t,&ctm,FOREVER,CTRL_RELATIVE);	

	if (ip && ip->GetSubObjectLevel() == 1) {		
		//Matrix3 tm = DEFORMER_TM;
		Matrix3 tm = CompTM(ptm,ctm,mc->tm,1);

		ClustDeformer deformer(tm);
		if (mc->box->pmin==mc->box->pmax) {
			Point3 pt = mc->box->pmin * tm;
			gw->marker(&pt,ASTERISK_MRKR);
		} else {
			DoModifiedBox(MakeBoxNotEmpty(*mc->box),deformer,DrawLineProc(gw));
			}
		}

	if (ip && (ip->GetSubObjectLevel() == 1 ||
	           ip->GetSubObjectLevel() == 2)) {		
		//obtm = ctm * obtm;
		if (mc->tm) obtm = ctm * Inverse(*mc->tm) * obtm;
		else obtm = ctm * obtm;

		gw->setTransform(obtm);
		DrawCenterMark(DrawLineProc(gw),MakeBoxNotEmpty(*mc->box));
		}

	gw->setRndLimits(savedLimits);	
	if (gw->checkHitCode()) {
		vpt->LogHit(inode, mc, gw->getHitDistance(), 0, NULL); 
		return 1;
		}
	return 0;
	}
开发者ID:artemeliy,项目名称:inf4715,代码行数:48,代码来源:clustmod.cpp


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