Game Development Reference
In-Depth Information
(ADvalue - Admin)
(ADmax - ADmin)
rot =
* (max - min) + min
In the following function, we calculate this value for each channel for an
object:
void CToonObject::ADRotate()
{
CADConvert adcon;
short s,c,m;
if (mcChannelH > -1){
c = mcChannelH & 0xF;
m = (mcChannelH & 0xF0)>>4;
adcon.SetMultiplexer(m);
s = adcon.GetChannel(c);
if (ADminH<ADmaxH){
if (s<ADminH) s=ADminH;
if (s>ADmaxH) s=ADmaxH;
rot.x=((double)(s-ADminH)/(double)(ADmaxH-
ADminH))*(maxH-minH) + minH;
}else{
if (s>ADminH) s=ADminH;
if (s<ADmaxH) s=ADmaxH;
rot.x=((double)(ADminH-s)/(double)(ADminH-
ADmaxH))*(maxH-minH) + minH;
}
}
if (mcChannelP>-1){
c=mcChannelP & 0xF;
m=(mcChannelP & 0xF0)>>4;
adcon.SetMultiplexer(m);
s=adcon.GetChannel(c);
if (ADminP<ADmaxP){
if (s<ADminP) s=ADminP;
if (s>ADmaxP) s=ADmaxP;
rot.y=((double)(s-ADminP)/(double)(ADmaxP-
ADminP))*(maxP-minP) + minP;
}else{
if (s>ADminP) s=ADminP;
Search Nedrilad ::




Custom Search