void draw(Status *status) { Status *sptr = rewindStatus(status); while (sptr) { if (sptr->ppid == 0) { pParent(sptr); drawChildren(sptr, status, 1); } sptr = sptr->next; } }
bool CMetaData::GetFullName(char *pFullNameBuffer, unsigned int BufferSize) const { if (pFullNameBuffer == NULL) { return false; } unsigned int Char_BufferSize(BufferSize - 1 * sizeof(char)); char *pReBuffer((char*)((unsigned int)pFullNameBuffer + Char_BufferSize)); CMetaData *pParent(m_pParent); const char *pName; unsigned int total_size; unsigned int cur_len; pName = this->GetName(); if (!pName) throw new ExceptionMetaData(D_E_ID_ERR_MD, "ÔªÊý¾ÝδÃüÃû£¡"); cur_len = strlen(pName); total_size = cur_len * sizeof(char); if (total_size > Char_BufferSize) { return false; } memcpy((void*)((unsigned int)pReBuffer - total_size), pName, cur_len * sizeof(char)); while (pParent) { total_size += 2 * sizeof(char); if (total_size > Char_BufferSize) { return false; } memcpy((void*)((pReBuffer) - total_size), "::", 2 * sizeof(char)); pName = pParent->GetName(); cur_len = strlen(pName); total_size += cur_len * sizeof(char); if (total_size > Char_BufferSize) { return false; } memcpy((void*)((pReBuffer) - total_size), pName, cur_len * sizeof(char)); pParent = pParent->m_pParent; } memcpy(pFullNameBuffer, (void*)((pReBuffer) - total_size), total_size); pFullNameBuffer[total_size] = '\0'; return true; }
//////////////////////////////////////////////////////////////////////////////// // render //virtual void GaGameComponent::render( ScnCanvasComponentRef Canvas ) { BcScopedLock< BcMutex > Lock( EmoteLock_ ); Canvas->setMaterialComponent( EmoteMaterialComponent_ ); pParent()->setMaterialComponentParams( EmoteMaterialComponent_, BcMat4d() ); TEmoteList::iterator It( EmoteList_.begin() ); while( It != EmoteList_.end() ) { TEmote& Emote = (*It); Canvas->drawSpriteCenteredUp3D( Emote.Position_, BcVec2d( 64.0f, -64.0f ), Emote.Idx_, RsColour( 1.0f, 1.0f, 1.0f, Emote.Timeleft_ ), 10 ); ++It; } }
void drawChildren(Status *parent, Status *all, int level) { Status *ap = rewindStatus(all); while (ap) { if (ap->ppid == parent->pid && ap != parent) { levelPadding(level); if (hasChildren(ap)) { pParent(ap); drawChildren(ap, all, level + 1); } else { pChild(ap); } } ap = ap->next; } }
/** * Pass the sample list through the CSG node. * The sample list will contain only the relevant entry and exit points for * the resulting surface for this operation, and they will be promoted to * this node for further processing up the tree. * * @param samples Array of samples to process. */ void CqCSGTreeNode::ProcessSampleList( std::vector<SqImageSample>& samples ) { // First process any children nodes. // Process all nodes depth first. std::list<boost::weak_ptr<CqCSGTreeNode> >::const_iterator ii = lChildren().begin(), ie = lChildren().end(); for (; ii != ie; ++ii) { // If the node is a primitive, no need to process it. // In fact as the primitive, just nulls out its owned samples // this would break the CSG code. boost::shared_ptr<CqCSGTreeNode> pChild = ii->lock() ; if ( pChild.get() && pChild->NodeType() != CSGNodeType_Primitive ) pChild->ProcessSampleList( samples ); } std::vector<bool> abChildState( cChildren() ); std::vector<TqInt> aChildIndex( samples.size() ); TqInt iChild; for ( iChild = 0; iChild < cChildren(); iChild++ ) abChildState[ iChild ] = false; // Now get the initial state bool bCurrentI = false; // Find out if the camera is starting inside a solid. This is the case if you // see an odd number of walls for that solid when looking out. std::vector<SqImageSample>::iterator i; TqInt j = 0; for ( i = samples.begin(); i != samples.end(); ++i, ++j ) { if ( ( aChildIndex[j] = isChild( i->csgNode.get() ) ) >= 0 ) { if ( ((i->csgNode.get())->NodeType() == CSGNodeType_Primitive ) && ((i->csgNode.get())->NodeType() == CSGNodeType_Union ) ) { abChildState[ aChildIndex[j] ] = !abChildState[ aChildIndex[j] ]; } } } bCurrentI = EvaluateState( abChildState ); // Now go through samples, clearing any where the state doesn't change, and // promoting any where it does to this node. for ( i = samples.begin(), j = 0; i != samples.end(); ++j ) { // Find out if sample is in out children nodes, if so are we entering or leaving. if ( aChildIndex[j] >= 0 ) abChildState[ aChildIndex[j] ] = !abChildState[ aChildIndex[j] ]; else { ++i; continue; } // Work out the new state bool bNewI = EvaluateState( abChildState ); // If it hasn't changed, remove the sample. if ( bNewI == bCurrentI ) i = samples.erase( i ); else // Otherwise promote it to this node unless we are a the top. { bCurrentI = bNewI; if ( pParent() ) { i->csgNode = shared_from_this(); } else { i->csgNode = boost::shared_ptr<CqCSGTreeNode>(); } i++; } } }