本文整理汇总了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();
}
}
}
示例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();
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
示例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;
}