static void RenderPickAndCheckForHits(
void)
{
register unsigned long i;
register char *a, *b;
unsigned long count;
unsigned long numPicked;
unsigned long numPicked2;
TQ3HitData hitData;
TQ3HitData hitData2;
TQ3Vector3D scaleVec;
TQ3Status whatHappened;
TQ3Vector3D translate;
TQ3Vector3D tmp;
Q3Vector3D_Set(&scaleVec, gZoom, gZoom, gZoom);
Q3Vector3D_Scale(&scaleVec, gGlobalScale, &scaleVec);
Q3Vector3D_Set(&tmp, gXTranslate, gYTranslate, gZTranslate);
translate = gGlobalTranslate;
Q3Vector3D_Add(&translate, &tmp, &translate);
Q3View_StartPicking(gTransformationsView);
Q3ScaleTransform_Submit(&scaleVec, gTransformationsView);
Q3TranslateTransform_Submit(&translate, gTransformationsView);
Q3Style_Submit(gSubdivControl, gTransformationsView);
Q3PickIDStyle_Submit(32, gTransformationsView);
whatHappened = ErDisplayGroup_Pick(gGroup, pickObject, gTransformationsView);
Q3View_EndPicking(gTransformationsView);
if (!Q3Pick_GetNumHits(pickObject, &numPicked) || (numPicked == 0)) {
Q3Object_Dispose(pickObject);
return;
}
#if 0
count = 0;
for ( whatHappened = ErPick_GetFirstHit(pickObject, &hitData);
whatHappened == kQ3Success;
whatHappened = ErPick_GetNextHit(pickObject, &hitData)) {
if (whatHappened != kQ3Success)
break;
SysBeep(10);
Q3Hit_EmptyData(&hitData);
count++;
}
if (count != numPicked)
DebugStr("\pSOMETHING SUCKS IN PICKING");
#else
/*
This code highlights the objects that were picked.
However, the code can't be enabled until geometries
stop returning the decomp as the object picked, which produces
a crash.
*/
count = 0;
for ( whatHappened = ErPick_GetFirstHit(pickObject, &hitData);
whatHappened == kQ3Success;
whatHappened = ErPick_GetNextHit(pickObject, &hitData)) {
if (whatHappened != kQ3Success)
break;
SysBeep(10);
count++;
if( Q3Object_IsType(hitData.object, kQ3ShapeTypeGeometry)) {
TQ3Switch highlightSwitch = kQ3On;
TQ3AttributeSet attribSet;
Q3Geometry_GetAttributeSet(hitData.object, &attribSet);
if( !attribSet ) {
attribSet = Q3AttributeSet_New();
Q3Geometry_SetAttributeSet(hitData.object, attribSet);
Q3Object_Dispose(attribSet);
}
Q3AttributeSet_Add(attribSet,
kQ3AttributeTypeHighlightState,
&highlightSwitch);
}
Q3Hit_EmptyData(&hitData);
}
if (count != numPicked)
DebugStr("\pSOMETHING SUCKS IN PICKING");
UpdateScreen();
for ( whatHappened = ErPick_GetFirstHit(pickObject, &hitData);
whatHappened == kQ3Success;
whatHappened = ErPick_GetNextHit(pickObject, &hitData)) {
if (whatHappened != kQ3Success)
break;
if( Q3Object_IsType(hitData.object, kQ3ShapeTypeGeometry)) {
TQ3Switch highlightSwitch = kQ3Off;
TQ3AttributeSet attribSet;
Q3Geometry_GetAttributeSet(hitData.object, &attribSet);
if( attribSet )
Q3AttributeSet_Add(attribSet, kQ3AttributeTypeHighlightState,
&highlightSwitch);
}
Q3Hit_EmptyData(&hitData);
}
#endif
Q3Object_Dispose(pickObject);
}
#endif
|