namechange CollisionFlags --> CollisionGroups

This commit is contained in:
Andrew Meadows 2014-04-24 11:07:49 -07:00
parent 10265a4a3e
commit f07a418a27
4 changed files with 22 additions and 26 deletions

View file

@ -505,7 +505,7 @@ void Menu::loadSettings(QSettings* settings) {
// MyAvatar caches some menu options, so we have to update them whenever we load settings. // MyAvatar caches some menu options, so we have to update them whenever we load settings.
// TODO: cache more settings in MyAvatar that are checked with very high frequency. // TODO: cache more settings in MyAvatar that are checked with very high frequency.
MyAvatar* myAvatar = Application::getInstance()->getAvatar(); MyAvatar* myAvatar = Application::getInstance()->getAvatar();
myAvatar->updateCollisionFlags(); myAvatar->updateCollisionGroups();
if (lockedSettings) { if (lockedSettings) {
Application::getInstance()->unlockSettings(); Application::getInstance()->unlockSettings();
@ -1368,13 +1368,13 @@ void Menu::addAvatarCollisionSubMenu(QMenu* overMenu) {
Application* appInstance = Application::getInstance(); Application* appInstance = Application::getInstance();
QObject* avatar = appInstance->getAvatar(); QObject* avatar = appInstance->getAvatar();
addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithEnvironment, addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithEnvironment,
0, false, avatar, SLOT(updateCollisionFlags())); 0, false, avatar, SLOT(updateCollisionGroups()));
addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithAvatars, addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithAvatars,
0, true, avatar, SLOT(updateCollisionFlags())); 0, true, avatar, SLOT(updateCollisionGroups()));
addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithVoxels, addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithVoxels,
0, false, avatar, SLOT(updateCollisionFlags())); 0, false, avatar, SLOT(updateCollisionGroups()));
addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithParticles, addCheckableActionToQMenuAndActionHash(subMenu, MenuOption::CollideWithParticles,
0, true, avatar, SLOT(updateCollisionFlags())); 0, true, avatar, SLOT(updateCollisionGroups()));
} }
QAction* Menu::getActionFromName(const QString& menuName, QMenu* menu) { QAction* Menu::getActionFromName(const QString& menuName, QMenu* menu) {

View file

@ -54,7 +54,7 @@ Avatar::Avatar() :
_mouseRayOrigin(0.0f, 0.0f, 0.0f), _mouseRayOrigin(0.0f, 0.0f, 0.0f),
_mouseRayDirection(0.0f, 0.0f, 0.0f), _mouseRayDirection(0.0f, 0.0f, 0.0f),
_moving(false), _moving(false),
_collisionFlags(0), _collisionGroups(0),
_initialized(false), _initialized(false),
_shouldRenderBillboard(true) _shouldRenderBillboard(true)
{ {
@ -550,7 +550,7 @@ bool Avatar::findCollisions(const QVector<const Shape*>& shapes, CollisionList&
} }
bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float particleRadius, CollisionList& collisions) { bool Avatar::findParticleCollisions(const glm::vec3& particleCenter, float particleRadius, CollisionList& collisions) {
if (_collisionFlags & COLLISION_GROUP_PARTICLES) { if (_collisionGroups & COLLISION_GROUP_PARTICLES) {
return false; return false;
} }
bool collided = false; bool collided = false;
@ -740,19 +740,19 @@ void Avatar::renderJointConnectingCone(glm::vec3 position1, glm::vec3 position2,
glEnd(); glEnd();
} }
void Avatar::updateCollisionFlags() { void Avatar::updateCollisionGroups() {
_collisionFlags = 0; _collisionGroups = 0;
if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithEnvironment)) { if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithEnvironment)) {
_collisionFlags |= COLLISION_GROUP_ENVIRONMENT; _collisionGroups |= COLLISION_GROUP_ENVIRONMENT;
} }
if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithAvatars)) { if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithAvatars)) {
_collisionFlags |= COLLISION_GROUP_AVATARS; _collisionGroups |= COLLISION_GROUP_AVATARS;
} }
if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithVoxels)) { if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithVoxels)) {
_collisionFlags |= COLLISION_GROUP_VOXELS; _collisionGroups |= COLLISION_GROUP_VOXELS;
} }
if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithParticles)) { if (Menu::getInstance()->isOptionChecked(MenuOption::CollideWithParticles)) {
_collisionFlags |= COLLISION_GROUP_PARTICLES; _collisionGroups |= COLLISION_GROUP_PARTICLES;
} }
} }

View file

@ -149,7 +149,7 @@ public:
void updateShapePositions(); void updateShapePositions();
public slots: public slots:
void updateCollisionFlags(); void updateCollisionGroups();
signals: signals:
void collisionWithAvatar(const QUuid& myUUID, const QUuid& theirUUID, const CollisionInfo& collision); void collisionWithAvatar(const QUuid& myUUID, const QUuid& theirUUID, const CollisionInfo& collision);
@ -166,7 +166,7 @@ protected:
float _stringLength; float _stringLength;
bool _moving; ///< set when position is changing bool _moving; ///< set when position is changing
uint32_t _collisionFlags; uint32_t _collisionGroups;
// protected methods... // protected methods...
glm::vec3 getBodyRightDirection() const { return getOrientation() * IDENTITY_RIGHT; } glm::vec3 getBodyRightDirection() const { return getOrientation() * IDENTITY_RIGHT; }

View file

@ -284,7 +284,7 @@ void MyAvatar::simulate(float deltaTime) {
_thrust *= glm::vec3(0.0f); _thrust *= glm::vec3(0.0f);
// now that we're done stepping the avatar forward in time, compute new collisions // now that we're done stepping the avatar forward in time, compute new collisions
if (_collisionFlags != 0) { if (_collisionGroups != 0) {
Camera* myCamera = Application::getInstance()->getCamera(); Camera* myCamera = Application::getInstance()->getCamera();
float radius = getSkeletonHeight() * COLLISION_RADIUS_SCALE; float radius = getSkeletonHeight() * COLLISION_RADIUS_SCALE;
@ -292,15 +292,15 @@ void MyAvatar::simulate(float deltaTime) {
radius = myCamera->getAspectRatio() * (myCamera->getNearClip() / cos(myCamera->getFieldOfView() / 2.0f)); radius = myCamera->getAspectRatio() * (myCamera->getNearClip() / cos(myCamera->getFieldOfView() / 2.0f));
radius *= COLLISION_RADIUS_SCALAR; radius *= COLLISION_RADIUS_SCALAR;
} }
if (_collisionFlags) { if (_collisionGroups) {
updateShapePositions(); updateShapePositions();
if (_collisionFlags & COLLISION_GROUP_ENVIRONMENT) { if (_collisionGroups & COLLISION_GROUP_ENVIRONMENT) {
updateCollisionWithEnvironment(deltaTime, radius); updateCollisionWithEnvironment(deltaTime, radius);
} }
if (_collisionFlags & COLLISION_GROUP_VOXELS) { if (_collisionGroups & COLLISION_GROUP_VOXELS) {
updateCollisionWithVoxels(deltaTime, radius); updateCollisionWithVoxels(deltaTime, radius);
} }
if (_collisionFlags & COLLISION_GROUP_AVATARS) { if (_collisionGroups & COLLISION_GROUP_AVATARS) {
updateCollisionWithAvatars(deltaTime); updateCollisionWithAvatars(deltaTime);
} }
} }
@ -408,17 +408,13 @@ void MyAvatar::renderDebugBodyPoints() {
glTranslatef(position.x, position.y, position.z); glTranslatef(position.x, position.y, position.z);
glutSolidSphere(0.15, 10, 10); glutSolidSphere(0.15, 10, 10);
glPopMatrix(); glPopMatrix();
} }
// virtual // virtual
void MyAvatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) { void MyAvatar::render(const glm::vec3& cameraPosition, RenderMode renderMode) {
// don't render if we've been asked to disable local rendering if (_shouldRender) {
if (!_shouldRender) { Avatar::render(cameraPosition, renderMode);
return; // exit early
} }
Avatar::render(cameraPosition, renderMode);
} }
void MyAvatar::renderHeadMouse() const { void MyAvatar::renderHeadMouse() const {