void RectangularRegion::modify(int distanceX, int distanceY) { if (getIsAllSelected()) { move(distanceX, distanceY); } else if (getIsTopSelected()) { move(0, distanceY); modifyHeight(-distanceY); } else if (getIsBottomSelected()) { modifyHeight(distanceY); } else if (getIsLeftSelected()) { move(distanceX, 0); modifyWidth(-distanceX); } else if(getIsRightSelected()) { modifyWidth(distanceX); } }
void TransformSystem::setParent(ComponentId childComp, ComponentId oldParentCompId, ComponentId newParentCompId, EntityId parentEntity) { const int childPos = _index.lookup(childComp); EntityId childEnt = *_current.getPointer(childPos); int oldParentHeight = 0; if (oldParentCompId != invalid<ComponentId>()) { int oldParentPos = _index.lookup(oldParentCompId); oldParentHeight = *_heights.getPointer(oldParentPos); } *_parents.getPointer(childPos) = parentEntity; if (parentEntity != invalid<EntityId>()) { int change = 1 - oldParentHeight; if (newParentCompId != invalid<ComponentId>()) { const int parentPos = _index.lookup(newParentCompId); const int parentHeight = *_heights.getPointer(parentPos); change += parentHeight; const glm::mat4 parentGlobalTransform = *_globalPos.getPointer(parentPos); const glm::mat4 childGlobalTransform = *_globalPos.getPointer(childPos); //const Vec4 childLocalTransform = parentGlobalTransform.transpose() * childGlobalTransform } else { //no parent //const Vec4 childLocalTransform = childGlobalTransform } *_heights.getPointer(childPos) += change; modifyHeight(childEnt, change); } else { const int change = -oldParentHeight - 1; *_heights.getPointer(childPos) += change; modifyHeight(childEnt, change); } _dirty = true; }
void EllipticalRegion::modify(int distanceX, int distanceY) { if (getIsAllSelected()) { move(distanceX, distanceY); } else if (getIsRightSelected()) { modifyWidth(distanceX); } else if (getIsBottomSelected()) { modifyHeight(distanceY); } }
void TransformSystem::modifyHeight(EntityId parentEnt, int amount) { for (int i = 0; i < _index._size; i++) { if (*_parents.getPointer(i) == parentEnt) { *_heights.getPointer(i) += amount; } } for (int i = 0; i < _index._size; i++) { if (*_parents.getPointer(i) == parentEnt) { const ComponentId childId = _index.reverseLookup(i); const EntityId parentEntId = *_current.getPointer(childId.index); modifyHeight(parentEntId, amount); } } }