Add NO_DEPTH_SORT ItemKey flag

This commit is contained in:
Ryan Huffman 2015-05-29 08:52:37 -07:00
parent 874f722504
commit b2c503af0e

View file

@ -32,15 +32,16 @@ class Context;
class ItemKey {
public:
enum FlagBit {
TYPE_SHAPE = 0, // Item is a Shape
TYPE_LIGHT, // Item is a Light
TRANSLUCENT, // Transparent and not opaque, for some odd reason TRANSPARENCY doesn't work...
VIEW_SPACE, // Transformed in view space, and not in world space
DYNAMIC, // Dynamic and bound will change unlike static item
DEFORMED, // Deformed within bound, not solid
INVISIBLE, // Visible or not? could be just here to cast shadow
SHADOW_CASTER, // Item cast shadows
PICKABLE, // Item can be picked/selected
TYPE_SHAPE = 0, // Item is a Shape
TYPE_LIGHT, // Item is a Light
TRANSLUCENT, // Transparent and not opaque, for some odd reason TRANSPARENCY doesn't work...
VIEW_SPACE, // Transformed in view space, and not in world space
DYNAMIC, // Dynamic and bound will change unlike static item
DEFORMED, // Deformed within bound, not solid
INVISIBLE, // Visible or not? could be just here to cast shadow
SHADOW_CASTER, // Item cast shadows
PICKABLE, // Item can be picked/selected
NO_DEPTH_SORT, // Item should not be depth sorted
NUM_FLAGS, // Not a valid flag
};
@ -68,6 +69,7 @@ public:
Builder& withInvisible() { _flags.set(INVISIBLE); return (*this); }
Builder& withShadowCaster() { _flags.set(SHADOW_CASTER); return (*this); }
Builder& withPickable() { _flags.set(PICKABLE); return (*this); }
Builder& withNoDepthSort() { _flags.set(NO_DEPTH_SORT); return (*this); }
// Convenient standard keys that we will keep on using all over the place
static ItemKey opaqueShape() { return Builder().withTypeShape().build(); }
@ -79,7 +81,7 @@ public:
bool isWorldSpace() const { return !_flags[VIEW_SPACE]; }
bool isViewSpace() const { return _flags[VIEW_SPACE]; }
bool isStatic() const { return !_flags[DYNAMIC]; }
bool isDynamic() const { return _flags[DYNAMIC]; }
@ -87,11 +89,14 @@ public:
bool isDeformed() const { return _flags[DEFORMED]; }
bool isVisible() const { return !_flags[INVISIBLE]; }
bool isUnvisible() const { return _flags[INVISIBLE]; }
bool isInvisible() const { return _flags[INVISIBLE]; }
bool isShadowCaster() const { return _flags[SHADOW_CASTER]; }
bool isPickable() const { return _flags[PICKABLE]; }
bool isDepthSort() const { return !_flags[NO_DEPTH_SORT]; }
bool isNoDepthSort() const { return _flags[NO_DEPTH_SORT]; }
};
inline QDebug operator<<(QDebug debug, const ItemKey& itemKey) {
@ -141,6 +146,9 @@ public:
Builder& withPickable() { _value.set(ItemKey::PICKABLE); _mask.set(ItemKey::PICKABLE); return (*this); }
Builder& withDepthSort() { _value.reset(ItemKey::NO_DEPTH_SORT); _mask.set(ItemKey::NO_DEPTH_SORT); return (*this); }
Builder& withNotDepthSort() { _value.set(ItemKey::NO_DEPTH_SORT); _mask.set(ItemKey::NO_DEPTH_SORT); return (*this); }
// Convenient standard keys that we will keep on using all over the place
static ItemFilter opaqueShape() { return Builder().withTypeShape().withOpaque().build(); }
static ItemFilter transparentShape() { return Builder().withTypeShape().withTransparent().build(); }