source: liacs/mms/assignment2/TalkShadowFun.diff@ 144

Last change on this file since 144 was 2, checked in by Rick van der Zwet, 15 years ago

Initial import of data of old repository ('data') worth keeping (e.g. tracking
means of URL access statistics)

File size: 3.0 KB
  • cmdmode.xml

    diff -ur ../SRWorkshop/TalkShadowFun/cmdmode.xml ./cmdmode.xml
    old new  
    55        <ID NAME="PID_CmdRight" VAL="2"/>
    66        <ID NAME="PID_CmdUp" VAL="3"/>
    77        <ID NAME="PID_CmdDown" VAL="4"/>
     8        <ID NAME="PID_CmdForward" VAL="5"/>
     9        <ID NAME="PID_CmdBackward" VAL="6"/>
     10
    811                <ID NAME="PID_CmdNavigation" VAL="1000"/>
    912                        <ID NAME="PID_Moving" VAL="1001"/>
    1013    </DEFINE>
     
    1922            <P VAL="PID_CmdUp">higher</P>
    2023            <P VAL="PID_CmdDown">down</P>
    2124            <P VAL="PID_CmdDown">lower</P>
     25            <P VAL="PID_CmdForward">forward</P>
     26            <P VAL="PID_CmdBackward">backward</P>
     27
    2228                </L>
    2329    </RULE>
    2430
  • shadowfun.cpp

    diff -ur ../SRWorkshop/TalkShadowFun/shadowfun.cpp ./shadowfun.cpp
    old new  
    102102//SR Workshop
    103103// Commands
    104104enum {
    105         C_NONE, C_LEFT, C_RIGHT, C_UP, C_DOWN, C_HOME, C_STOP
     105        C_NONE, C_LEFT, C_RIGHT, C_UP, C_DOWN, C_HOME, C_STOP, C_FORWARD, C_BACKWARD
    106106};
    107107
    108108int listening = 0;  // boolean use: 0 = false, 1= true
     
    326326                         if (recogstr.Find("down") != -1) { command = C_DOWN; }
    327327                         if (recogstr.Find("home") != -1) { command = C_HOME; }
    328328                         if (recogstr.Find("stop") != -1) { command = C_STOP; }
     329                         if (recogstr.Find("forward") != -1) { command = C_FORWARD; }
     330                         if (recogstr.Find("backward") != -1) { command = C_BACKWARD; }
    329331
    330332             if (fUseTTS)
    331333             {
     
    10801082  glutSwapBuffers();
    10811083}
    10821084
     1085#define MOVE_FACTOR 0.5
     1086
    10831087//SR Workshop
    10841088void MoveLeft(int value)
    10851089{
    10861090        // value should be in range M_TORUS, M_CUBE, M_SPHERE
    1087         animPos[value][X] -= 1.0;
     1091        animPos[value][X] -= MOVE_FACTOR;
    10881092}
    10891093
    10901094//SR Workshop
    10911095void MoveRight(int value)
    10921096{
    10931097        // value should be in range M_TORUS, M_CUBE, M_SPHERE
    1094         animPos[value][X] += 1.0;
     1098        animPos[value][X] += MOVE_FACTOR;
    10951099}
    10961100
    10971101//SR Workshop
    10981102void MoveUp(int value)
    10991103{
    11001104        // value should be in range M_TORUS, M_CUBE, M_SPHERE
    1101         animPos[value][Y] += 1.0;
     1105        animPos[value][Y] += MOVE_FACTOR;
    11021106}
    11031107
    11041108//SR Workshop
    11051109void MoveDown(int value)
    11061110{
    11071111        // value should be in range M_TORUS, M_CUBE, M_SPHERE
    1108         animPos[value][Y] -= 1.0;
     1112        animPos[value][Y] -= MOVE_FACTOR;
     1113}
     1114
     1115//SR Workshop
     1116void MoveForward(int value)
     1117{
     1118        // value should be in range M_TORUS, M_CUBE, M_SPHERE
     1119        animPos[value][Z] += MOVE_FACTOR;
     1120}
     1121
     1122//SR Workshop
     1123void MoveBackward(int value)
     1124{
     1125        // value should be in range M_TORUS, M_CUBE, M_SPHERE
     1126        animPos[value][Z] -= MOVE_FACTOR;
    11091127}
    11101128
    11111129//SR Workshop
     
    11441162          case C_DOWN:
    11451163                  MoveDown(M_SPHERE);
    11461164                  break;
     1165      case C_FORWARD:
     1166                  MoveForward(M_SPHERE);
     1167                  break;
     1168          case C_BACKWARD:
     1169                  MoveBackward(M_SPHERE);
     1170                  break;
    11471171          case C_HOME:
    11481172                  MoveHome(M_SPHERE);
    11491173                  break;
Note: See TracBrowser for help on using the repository browser.