It is possible to get rid of bitwise implementation and use a struct to hold all necessary data that describes the node. In this case we can extend the struct to hold any type of data. Also we add an array to hold each node' data.
That may look like:
Code: Select all
// Holds all necessary info to describe the node.
// Note: unlike to bitwise implementation (the original) this struct can be extended to hold any type of data (not only flags).
struct NodeInfo
{
bool IsPickable;
bool IsHighlightable;
NodeInfo(bool pickable, bool highlightable)
{
IsPickable = pickable;
IsHighlightable = highlightable;
}
};
// Array of all node' descriptions.
// Note: node' ID is an index in this array.
core::array<NodeInfo> NodeInfoArray;
Code: Select all
NodeInfoArray.push_back(NodeInfo(true, false));
q3node = smgr->addOctreeSceneNode(q3levelmesh->getMesh(0), 0, NodeInfoArray.size() - 1);
Code: Select all
if (selectedSceneNode &&
NodeInfoArray[selectedSceneNode->getID()].IsPickable)
{
...