Mercurial > hg > ccmieditor
comparison native/PhantomOmni/HapticManager.cpp @ 8:ea7885bd9bff tip
fixed bug : render solid line as dotted/dashed when moving the stylus from dotted/dashed to solid
author | ccmi-guest |
---|---|
date | Thu, 03 Jul 2014 16:12:20 +0100 |
parents | d66dd5880081 |
children |
comparison
equal
deleted
inserted
replaced
7:075ae9eb2a40 | 8:ea7885bd9bff |
---|---|
54 HLcache *cache, void *userdata) | 54 HLcache *cache, void *userdata) |
55 { | 55 { |
56 HapticManager *pThis = static_cast<HapticManager*>(userdata); | 56 HapticManager *pThis = static_cast<HapticManager*>(userdata); |
57 if(object == pThis->wall1Id||object == pThis->wall2Id) // no event is associated to the wall | 57 if(object == pThis->wall1Id||object == pThis->wall2Id) // no event is associated to the wall |
58 return; | 58 return; |
59 | |
59 if(pThis->lastMovedElement == object){ | 60 if(pThis->lastMovedElement == object){ |
60 pThis->stillTouchingLastMovedElement = true; | 61 pThis->stillTouchingLastMovedElement = true; |
61 } | 62 } |
62 | 63 |
63 try{ | 64 try{ |
64 // check if the touched object is an edge | 65 // check if the touched object is an edge |
65 if(pThis->collectionsManager->isEdge(object)){ | 66 if(pThis->collectionsManager->isEdge(object)){ |
66 CollectionsManager::EdgeData & ed = pThis->collectionsManager->getEdgeDataFromID(object); | 67 CollectionsManager::EdgeData & ed = pThis->collectionsManager->getEdgeDataFromID(object); |
67 pThis->lastTouchedEdgeID = object; | 68 pThis->lastTouchedEdgeID = object; |
68 pThis->lastTouchedEdgeIsUntouched = false; | 69 pThis->lastTouchedEdgeIsUntouched = false; |
70 | |
69 pThis->lastTouchedEdgeStipplePattern = ed.stipplePattern; | 71 pThis->lastTouchedEdgeStipplePattern = ed.stipplePattern; |
70 // check if the proxy is still touching the edge's node, in that case only play the sound | 72 // check if the proxy is still touching the edge's node, in that case only play the sound |
71 HLboolean isTouching = HL_FALSE; | 73 HLboolean isTouching = HL_FALSE; |
72 if(pThis->lastTouchedNodeID != HL_OBJECT_ANY){ | 74 if(pThis->lastTouchedNodeID != HL_OBJECT_ANY){ |
73 hlGetShapeBooleanv(pThis->lastTouchedNodeID,HL_PROXY_IS_TOUCHING,&isTouching); | 75 hlGetShapeBooleanv(pThis->lastTouchedNodeID,HL_PROXY_IS_TOUCHING,&isTouching); |
101 HLcache *cache, void *userdata) | 103 HLcache *cache, void *userdata) |
102 { | 104 { |
103 HapticManager *pThis = static_cast<HapticManager*>(userdata); | 105 HapticManager *pThis = static_cast<HapticManager*>(userdata); |
104 if(object == pThis->wall1Id||object == pThis->wall2Id) // no event is associated to the wall | 106 if(object == pThis->wall1Id||object == pThis->wall2Id) // no event is associated to the wall |
105 return; | 107 return; |
106 | 108 |
107 if(object == pThis->lastMovedElement){ | 109 if(object == pThis->lastMovedElement){ |
108 pThis->lastMovedElement = HL_OBJECT_ANY; | 110 pThis->lastMovedElement = HL_OBJECT_ANY; |
109 pThis->stillTouchingLastMovedElement = false; | 111 pThis->stillTouchingLastMovedElement = false; |
110 } | 112 } |
111 if(pThis->lastHighlightElementID == object){ | 113 if(pThis->lastHighlightElementID == object){ |
112 pThis->lastHighlightElementID = HL_OBJECT_ANY; | 114 pThis->lastHighlightElementID = HL_OBJECT_ANY; |
113 pThis->executeCommand('u',0,0,0,0,0); | 115 pThis->executeCommand('u',0,0,0,0,0); |
114 } | 116 } |
117 | |
115 if(pThis->lastTouchedEdgeID == object){ | 118 if(pThis->lastTouchedEdgeID == object){ |
116 pThis->lastTouchedEdgeIsUntouched = true; | 119 pThis->lastTouchedEdgeIsUntouched = true; |
117 } | 120 } |
118 } | 121 } |
119 | 122 |
514 /* --- FORCES --- */ | 517 /* --- FORCES --- */ |
515 /* friction */ | 518 /* friction */ |
516 if(lastTouchedEdgeID != HL_OBJECT_ANY){ | 519 if(lastTouchedEdgeID != HL_OBJECT_ANY){ |
517 /* check if the edge is still there, it might not as the tab could be changed */ | 520 /* check if the edge is still there, it might not as the tab could be changed */ |
518 if(collectionsManager->isEdge(lastTouchedEdgeID)){ | 521 if(collectionsManager->isEdge(lastTouchedEdgeID)){ |
519 //hlGetShapeBooleanv(lastTouchedEdgeID,HL_PROXY_IS_TOUCHING,&isTouching); FIXME to remove | 522 if(frictionDisabled||lastTouchedEdgeIsUntouched){ |
520 if(frictionDisabled||lastTouchedEdgeIsUntouched/*(isTouching == HL_FALSE)*/){ | 523 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0); // none |
521 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0); | |
522 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 0); | 524 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 0); |
523 }else{ | 525 }else{ |
524 if(lastTouchedEdgeStipplePattern == 0xAAAA){ // dotted | 526 if(lastTouchedEdgeStipplePattern == 0xAAAA){ // dotted |
525 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0.4f); | 527 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0.4f); |
526 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 1); | 528 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 1); |
527 }else if(lastTouchedEdgeStipplePattern == 0xF0F0){ // dashed | 529 }else if(lastTouchedEdgeStipplePattern == 0xF0F0){ // dashed |
528 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0.6); | 530 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0.6); |
529 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 0.6); | 531 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 0.6); |
532 }else{ | |
533 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0); // solid | |
534 hlEffectd(HL_EFFECT_PROPERTY_GAIN, 0); | |
530 } | 535 } |
531 } | 536 } |
532 }else{ | 537 }else{ |
533 lastTouchedEdgeID = HL_OBJECT_ANY; | 538 lastTouchedEdgeID = HL_OBJECT_ANY; |
534 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0); | 539 hlEffectd(HL_EFFECT_PROPERTY_MAGNITUDE, 0); |