08.01.2015 Views

Computer Graphics

Computer Graphics

Computer Graphics

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

void Render::mouseMove(int x, int y){ <br />

if (mBuVon == LEFT) <br />

{ <br />

rot[0] -­‐= ((mOldY -­‐ y) * 180.0f) / 1000.0f; <br />

rot[1] -­‐= ((mOldX -­‐ x) * 180.0f) / 1000.0f; <br />

clamp(rot[0], rot[1], rot[2]); <br />

} <br />

else if (mBuVon == MIDDLE) <br />

{ <br />

eye[2] -­‐= ((mOldY -­‐ y) * 180.0f) / 500.0f; <br />

clamp(rot[0], rot[1], rot[2]); <br />

} <br />

else if (mBuVon == RIGHT) <br />

{ <br />

eye[0] += ((mOldX -­‐ x) * 180.0f) / 1000.0f; <br />

eye[1] -­‐= ((mOldY -­‐ y) * 180.0f) / 1000.0f; <br />

clamp(rot[0], rot[1], rot[2]); <br />

} <br />

mOldX = x; <br />

mOldY = y; <br />

// I changed values to be used in the modelview matrix. <br />

// Update my display and the objects on the screen <br />

glutPostRedisplay();}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!