本文整理汇总了C++中GraphicsWindow::clearHitCode方法的典型用法代码示例。如果您正苦于以下问题:C++ GraphicsWindow::clearHitCode方法的具体用法?C++ GraphicsWindow::clearHitCode怎么用?C++ GraphicsWindow::clearHitCode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicsWindow
的用法示例。
在下文中一共展示了GraphicsWindow::clearHitCode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HitTest
int ProtHelpObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
HitRegion hitRegion;
DWORD savedLimits;
int res;
Matrix3 m;
GraphicsWindow *gw = vpt->getGW();
Material *mtl = gw->getMaterial();
MakeHitRegion(hitRegion,type,crossing,4,p);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
GetMat(t,inode,*vpt,m);
gw->setTransform(m);
// if we get a hit on the mesh, we're done
gw->clearHitCode();
if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
return TRUE;
// if not, check the target line, and set the pair flag if it's hit
gw->clearHitCode();
res = DrawLines(t, inode, gw, 1);
gw->setRndLimits(savedLimits);
return res;
}
示例2: HitTest
int
FogObject::HitTest(TimeValue t, INode *inode, int type, int crossing,
int flags, IPoint2 *p, ViewExp *vpt)
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here?
DbgAssert(!"Doing HitTest() on invalid view port!");
return FALSE;
}
HitRegion hitRegion;
DWORD savedLimits;
int res = FALSE;
Matrix3 m;
GraphicsWindow *gw = vpt->getGW();
Material *mtl = gw->getMaterial();
MakeHitRegion(hitRegion,type,crossing,4,p);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
GetMat(t,inode,*vpt,m);
gw->setTransform(m);
gw->clearHitCode();
if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
return TRUE;
gw->setRndLimits(savedLimits);
return res;
}
示例3: 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;
}
示例4: 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;
}
示例5: HitTest
int EditFaceDataMod::HitTest (TimeValue t, INode* inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt, ModContext* mc) {
Interval valid;
int savedLimits, res = 0;
GraphicsWindow *gw = vpt->getGW();
HitRegion hr;
// Setup GW
MakeHitRegion(hr,type, crossing,4,p);
gw->setHitRegion(&hr);
Matrix3 mat = inode->GetObjectTM(t);
gw->setTransform(mat);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
gw->clearHitCode();
if (!mc->localData) return 0;
EditFaceDataModData *md = (EditFaceDataModData*)mc->localData;
Mesh *mesh = md->GetCacheMesh ();
MNMesh *mnmesh = md->GetCacheMNMesh ();
SubObjHitList hitList;
if (mesh) {
res = mesh->SubObjectHitTest(gw, gw->getMaterial(), &hr, flags|hitLevel[selLevel], hitList);
} else if (mnmesh) {
res = mnmesh->SubObjectHitTest (gw, gw->getMaterial(), &hr, flags|mnhitLevel[selLevel], hitList);
}
MeshSubHitRec *rec = hitList.First();
while (rec) {
vpt->LogHit(inode,mc,rec->dist,rec->index,NULL);
rec = rec->Next();
}
gw->setRndLimits(savedLimits);
return res;
}
示例6: 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();
}
}
}
示例7: 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();
}
}
}
示例8: HitTest
// From BaseObject
int TargetObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt) {
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
HitRegion hitRegion;
DWORD savedLimits;
Matrix3 m;
GraphicsWindow *gw = vpt->getGW();
MakeHitRegion(hitRegion,type,crossing,4,p);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
GetMat(t,inode,*vpt,m);
gw->setTransform(m);
if(mesh.select( gw, gw->getMaterial(), &hitRegion, flags & HIT_ABORTONHIT ))
return TRUE;
gw->setRndLimits( savedLimits );
return FALSE;
#if 0
gw->setHitRegion(&hitRegion);
gw->clearHitCode();
gw->fWinMarker(&pt, HOLLOW_BOX_MRKR);
return gw->checkHitCode();
#endif
}
示例9: 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;
}
示例10: HitTest
int SplineData::HitTest(ViewExp *vpt,INode *node, ModContext *mc, Matrix3 tm, HitRegion hr, int flags, SplineMapProjectionTypes projType, BOOL selectCrossSection )
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here?
DbgAssert(!_T("Doing HitTest() on invalid viewport!"));
return FALSE;
}
int res = 0;
GraphicsWindow *gw = vpt->getGW();
DWORD limit = gw->getRndLimits();
gw->setRndLimits(( limit | GW_PICK) & ~GW_ILLUM);
if (selectCrossSection)
{
Tab<int> hitSplines;
Tab<int> hitCrossSections;
if (HitTestCrossSection(gw, hr, projType, hitSplines,hitCrossSections))
{
for (int i = 0; i < hitSplines.Count(); i++)
{
int splineIndex = hitSplines[i];
int crossSectionIndex = hitCrossSections[i];
if ( (mSplineElementData[splineIndex]->CrossSectionIsSelected(crossSectionIndex) && (flags&HIT_SELONLY)) ||
!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
vpt->LogHit(node,mc,crossSectionIndex,splineIndex,NULL);
else if ( (!mSplineElementData[splineIndex]->CrossSectionIsSelected(crossSectionIndex) && (flags&HIT_UNSELONLY)) ||
!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
vpt->LogHit(node,mc,crossSectionIndex,splineIndex,NULL);
}
}
}
else
{
for (int splineIndex = 0; splineIndex < mSplineElementData.Count();splineIndex++)
{
gw->clearHitCode();
mSplineElementData[splineIndex]->Display(gw,Matrix3(1),projType );
if (gw->checkHitCode())
{
if ( (mSplineElementData[splineIndex]->IsSelected() && (flags&HIT_SELONLY)) ||
!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
vpt->LogHit(node,mc,0,splineIndex,NULL);
else if ( (!mSplineElementData[splineIndex]->IsSelected() && (flags&HIT_UNSELONLY)) ||
!(flags&(HIT_UNSELONLY|HIT_SELONLY)))
vpt->LogHit(node,mc,0,splineIndex,NULL);
}
}
}
gw->setRndLimits(limit);
return res;
}
示例11: HitTest
int TapeHelpObject::HitTest(TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
HitRegion hitRegion;
DWORD savedLimits;
int res = 0;
Matrix3 m;
if (!enable) return 0;
GraphicsWindow *gw = vpt->getGW();
Material *mtl = gw->getMaterial();
MakeHitRegion(hitRegion,type,crossing,4,p);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
GetMat(t,inode,*vpt,m);
gw->setTransform(m);
// if we get a hit on the mesh, we're done
gw->clearHitCode();
if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
return TRUE;
// if not, check the target line, and set the pair flag if it's hit
// this special case only works with point selection
if(type != HITTYPE_POINT)
return 0;
// don't let line be active if only looking at selected stuff and target isn't selected
if((flags & HIT_SELONLY) && (inode->GetTarget()) && !inode->GetTarget()->Selected() )
return 0;
gw->clearHitCode();
res = DrawLine(t,inode,gw,-1);
if(res != 0)
inode->SetTargetNodePair(1);
gw->setRndLimits(savedLimits);
return res;
}
示例12: 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;
}
}
示例13: 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;
}
示例14: HitTest
int PointHelpObject::HitTest(
TimeValue t, INode *inode, int type, int crossing, int flags, IPoint2 *p, ViewExp *vpt)
{
if ( ! vpt || ! vpt->IsAlive() )
{
// why are we here
DbgAssert(!_T("Invalid viewport!"));
return FALSE;
}
Matrix3 tm(1);
HitRegion hitRegion;
DWORD savedLimits;
Point3 pt(0,0,0);
GraphicsWindow *gw = vpt->getGW();
gw->setTransform(tm);
Material *mtl = gw->getMaterial();
tm = inode->GetObjectTM(t);
MakeHitRegion(hitRegion, type, crossing, 4, p);
gw->setRndLimits(((savedLimits = gw->getRndLimits())|GW_PICK)&~GW_ILLUM);
gw->setHitRegion(&hitRegion);
gw->clearHitCode();
DrawAndHit(t, inode, vpt);
/*
if (showAxis) {
DrawAxis(vpt,tm,axisLength,screenSize);
}
gw->setTransform(tm);
gw->marker(&pt,X_MRKR);
*/
gw->setRndLimits(savedLimits);
// CAL-08/27/03: This doesn't make sense. It shouldn't do this. (Defect #468271)
// This will always select this helper when there's an intersection on the bounding box and the selection window.
// TODO: There's still a problem with window selection. We need to check if it hits all components in DrawAndHit.
/*
if((hitRegion.type != POINT_RGN) && !hitRegion.crossing)
return TRUE;
*/
return gw->checkHitCode();
}
示例15: MakeHitRegion
int
BackgroundObject::HitTest(TimeValue t, INode *inode, int type, int crossing,
int flags, IPoint2 *p, ViewExp *vpt)
{
HitRegion hitRegion;
DWORD savedLimits;
int res = FALSE;
Matrix3 m;
GraphicsWindow *gw = vpt->getGW();
Material *mtl = gw->getMaterial();
MakeHitRegion(hitRegion,type,crossing,4,p);
gw->setRndLimits(((savedLimits = gw->getRndLimits()) | GW_PICK) & ~GW_ILLUM);
GetMat(t,inode,vpt,m);
gw->setTransform(m);
gw->clearHitCode();
if (mesh.select( gw, mtl, &hitRegion, flags & HIT_ABORTONHIT ))
return TRUE;
gw->setRndLimits(savedLimits);
return res;
}