本文整理汇总了C++中Compound类的典型用法代码示例。如果您正苦于以下问题:C++ Compound类的具体用法?C++ Compound怎么用?C++ Compound使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Compound类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: postNeedsFinish
void Config::updateCanvas( Canvas* canvas )
{
postNeedsFinish();
activateCanvas( canvas );
// Create compounds for all new output channels
const Segments& segments = canvas->getSegments();
Compound* group = new Compound( this );
for( Segments::const_iterator i=segments.begin(); i != segments.end(); ++i )
{
const Segment* segment = *i;
const Channels& channels = segment->getDestinationChannels();
if( channels.empty( ))
EQWARN << "New segment without destination channels will be ignored"
<< std::endl;
for( Channels::const_iterator j = channels.begin();
j != channels.end(); ++j )
{
Channel* channel = *j;
EQASSERT( !channel->isActive( ));
Compound* compound = new Compound( group );
compound->setIAttribute( Compound::IATTR_STEREO_MODE, fabric::AUTO);
compound->setChannel( channel );
}
}
group->init();
canvas->init();
EQINFO << *this << std::endl;
}
示例2: _modeDB
/** Pure DB rendering when each node compose result from its pipes and transmit
only one set of images to the destination node. */
static void _modeDB( Config* config,
const unsigned nChannels,
const unsigned nPipes )
{
Compound* compound = config->getCompounds()[0];
vector<float> ranges( nChannels + 1, 0 );
ranges[ nChannels ] = 1.0;
for( unsigned i = 1; i < nChannels; ++i )
ranges[ i ] = ranges[ i-1 ] + 1.0/nChannels;
unsigned i = 0;
// for each node
for( unsigned n = 0 ; n < nChannels/nPipes; ++n )
{
Compound* childNode = compound;
if( n != 0 ) // don't create separate compound for dst channel
{
childNode = new Compound( compound );
std::ostringstream channelName;
channelName << "channel" << n*nPipes;
Channel* childChannel = config->find< Channel >( channelName.str());
childNode->setChannel( childChannel );
}
// for each gpu on the node
for( unsigned p = 0; p < nPipes; ++p )
{
Compound* childPipe = new Compound( childNode );
childPipe->setRange( eq::Range( ranges[ i ], ranges[ i+1 ] ));
if( i != n*nPipes )
{
std::ostringstream channelName;
channelName << "channel" << i;
Channel* childChannel =
config->find< Channel >( channelName.str( ));
childPipe->setChannel( childChannel );
std::ostringstream frameName;
frameName << "frame.channel" << i;
childPipe->addOutputFrame( ::Frame::create( frameName ));
childNode->addInputFrame( ::Frame::create( frameName ));
}
i++;
}
if( n != 0 ) // dst channel has no output
{
std::ostringstream frameName;
frameName << "frame.channel" << n*nPipes;
childNode->addOutputFrame( ::Frame::create( frameName ));
compound->addInputFrame( ::Frame::create( frameName ));
}
}
}
示例3: getCompound
void FramerateEqualizer::_init()
{
const Compound* compound = getCompound();
if( _nSamples > 0 || !compound )
return;
_nSamples = 1;
// Subscribe to child channel load events
const Compounds& children = compound->getChildren();
EQASSERT( _loadListeners.empty( ));
_loadListeners.resize( children.size( ));
for( size_t i = 0; i < children.size(); ++i )
{
Compound* child = children[i];
const uint32_t period = child->getInheritPeriod();
LoadListener& loadListener = _loadListeners[i];
loadListener.parent = this;
loadListener.period = period;
LoadSubscriber subscriber( &loadListener );
child->accept( subscriber );
_nSamples = EQ_MAX( _nSamples, period );
}
_nSamples = EQ_MIN( _nSamples, 100 );
}
示例4: pose
Compound* Actor::createCompoundFromChunk(const destructible::DestructibleActorImpl& actor, uint32_t partIndex)
{
Mesh RTmesh;
RTmesh.loadFromRenderMesh(*actor.getDestructibleAsset()->getRenderMeshAsset(),partIndex);
// Fix texture v's (different between right hand and left hand)
RTmesh.flipV();
PxTransform pose(actor.getChunkPose(partIndex));
pose.p = actor.getStructure()->getChunkWorldCentroid(actor.getChunk(partIndex));
Compound* c = createCompound();
c->createFromMesh(&RTmesh,pose,actor.getChunkLinearVelocity(partIndex),actor.getChunkAngularVelocity(partIndex),-1,actor.getScale());
const DestructibleActorParamNS::BehaviorGroup_Type& behaviorGroup = actor.getBehaviorGroup(partIndex);
mMinRadius = behaviorGroup.damageSpread.minimumRadius;
mRadiusMultiplier = behaviorGroup.damageSpread.radiusMultiplier;
// attachment
//const DestructibleActorParamNS::RuntimeFracture_Type& params = mActor->getParams()->destructibleParameters.runtimeFracture;
DestructibleParameters& params = mActor->getDestructibleParameters();
mAttachmentFlags.posX |= params.rtFractureParameters.attachment.posX;
mAttachmentFlags.negX |= params.rtFractureParameters.attachment.negX;
mAttachmentFlags.posY |= params.rtFractureParameters.attachment.posY;
mAttachmentFlags.negY |= params.rtFractureParameters.attachment.negY;
mAttachmentFlags.posZ |= params.rtFractureParameters.attachment.posZ;
mAttachmentFlags.negZ |= params.rtFractureParameters.attachment.negZ;
attachBasedOnFlags(c);
mRenderResourcesDirty = true;
return c;
}
示例5: EQASSERT
//---------------------------------------------------------------------------
// exit
//---------------------------------------------------------------------------
bool Config::exit()
{
if( _state != STATE_RUNNING )
EQWARN << "Exiting non-initialized config" << std::endl;
EQASSERT( _state == STATE_RUNNING || _state == STATE_INITIALIZING );
_state = STATE_EXITING;
const Canvases& canvases = getCanvases();
for( Canvases::const_iterator i = canvases.begin();
i != canvases.end(); ++i )
{
Canvas* canvas = *i;
canvas->exit();
}
for( Compounds::const_iterator i = _compounds.begin();
i != _compounds.end(); ++i )
{
Compound* compound = *i;
compound->exit();
}
const bool success = _updateRunning();
ConfigEvent exitEvent;
exitEvent.data.type = Event::EXIT;
send( findApplicationNetNode(), exitEvent );
_needsFinish = false;
_state = STATE_STOPPED;
return success;
}
示例6: getMode
void View::trigger( const Canvas* canvas, const bool active )
{
const Mode mode = getMode();
Config* config = getConfig();
// (De)activate destination compounds for canvas/eye(s)
for( Channels::const_iterator i = _channels.begin();
i != _channels.end(); ++i )
{
Channel* channel = *i;
const Canvas* channelCanvas = channel->getCanvas();
const Layout* canvasLayout = channelCanvas->getActiveLayout();
if(( canvas && channelCanvas != canvas ) ||
( !canvas && canvasLayout != getLayout( )))
{
continue;
}
const Segment* segment = channel->getSegment();
const uint32_t segmentEyes = segment->getEyes();
const uint32_t eyes = ( mode == MODE_MONO ) ?
EYE_CYCLOP & segmentEyes : EYES_STEREO & segmentEyes;
if( eyes == 0 )
continue;
ConfigDestCompoundVisitor visitor( channel, true /*activeOnly*/ );
config->accept( visitor );
const Compounds& compounds = visitor.getResult();
for( Compounds::const_iterator j = compounds.begin();
j != compounds.end(); ++j )
{
Compound* compound = *j;
if( active )
{
compound->activate( eyes );
LBLOG( LOG_VIEW ) << "Activate " << compound->getName()
<< std::endl;
}
else
{
compound->deactivate( eyes );
LBLOG( LOG_VIEW ) << "Deactivate " << compound->getName()
<< std::endl;
}
}
}
}
示例7: _mode2D
/** 2D decomposition based on precalculated grid */
static void _mode2D( Config* config,
const vector<float>& xMarks,
const vector<float>& yMarks )
{
Compound* compound = config->getCompounds()[0];
const size_t rows = yMarks.size() - 1;
const size_t columns = xMarks.size() - 1;
size_t i = 0;
for( size_t y = 0; y < rows; ++y )
for( size_t x = 0; x < columns; ++x )
{
Compound* child = new Compound( compound );
std::ostringstream channelName;
channelName << "channel" << i;
Channel* childChannel = config->find< Channel >( channelName.str( ));
child->setChannel( childChannel );
child->setViewport(
eq::Viewport( xMarks[x ], yMarks[y ],
xMarks[x+1]-xMarks[x], yMarks[y+1]-yMarks[y] ));
if( i != 0 )
{
std::ostringstream frameName;
frameName << "frame.channel" << i;
child->addOutputFrame( ::Frame::create( frameName ));
compound->addInputFrame( ::Frame::create( frameName ));
}
i++;
}
}
示例8: getCompound
void MonitorEqualizer::_updateViewports()
{
if( !_outputFrames.empty( ))
return;
Compound* compound = getCompound();
if( !compound )
return;
const Frames& inputFrames = compound->getInputFrames();
for( Frames::const_iterator i = inputFrames.begin();
i != inputFrames.end(); ++i )
{
const Frame* frame = *i;
const Compound* root = compound->getRoot();
// find the output frame
OutputFrameFinder frameFinder( frame->getName() );
root->accept( frameFinder );
Frame* outputFrame = frameFinder.getResult();
_outputFrames.push_back( outputFrame );
_viewports.push_back( eq::Viewport::FULL );
if( outputFrame )
{
const Channel* channel = outputFrame->getChannel();
const Segment* segment = channel->getSegment();
const View* view = channel->getView();
if( view )
{
Viewport viewport( segment->getViewport( ));
viewport.intersect( view->getViewport( ));
_viewports.back() = viewport;
}
}
}
}
示例9: LBASSERT
//---------------------------------------------------------------------------
// exit
//---------------------------------------------------------------------------
bool Config::exit()
{
if( _state != STATE_RUNNING )
LBWARN << "Exiting non-initialized config" << std::endl;
LBASSERT( _state == STATE_RUNNING || _state == STATE_INITIALIZING );
_state = STATE_EXITING;
const Canvases& canvases = getCanvases();
for( Canvases::const_iterator i = canvases.begin();
i != canvases.end(); ++i )
{
Canvas* canvas = *i;
canvas->exit();
}
for( Compounds::const_iterator i = _compounds.begin();
i != _compounds.end(); ++i )
{
Compound* compound = *i;
compound->exit();
}
const bool success = _updateRunning( true );
// send exit event to app, needed if this is called from init()
EventOCommand cmd( send( findApplicationNetNode(),
fabric::CMD_CONFIG_EVENT ));
Event event;
event.serial = getSerial();
event.time = getServer()->getTime();
event.originator = getID();
cmd << EVENT_EXIT << event;
_needsFinish = false;
_state = STATE_STOPPED;
return success;
}
示例10: postNeedsFinish
void Config::updateCanvas( Canvas* canvas )
{
postNeedsFinish();
activateCanvas( canvas );
// Create one compound group for all new output channels of each layout
const Layouts& layouts = canvas->getLayouts();
for( LayoutsCIter i = layouts.begin(); i != layouts.end(); ++i )
{
Compound* group = new Compound( this );
const Layout* layout = *i;
const Views& views = layout->getViews();
for( ViewsCIter j = views.begin(); j != views.end(); ++j )
{
const View* view = *j;
const Channels& channels = view->getChannels();
if( channels.empty( ))
LBWARN << "View without destination channels will be ignored"
<< std::endl;
for( ChannelsCIter k = channels.begin(); k != channels.end(); ++k )
{
Channel* channel = *k;
LBASSERT( !channel->isActive( ));
Compound* compound = new Compound( group );
compound->setIAttribute( Compound::IATTR_STEREO_MODE,
fabric::AUTO );
compound->setChannel( channel );
}
}
group->init();
}
canvas->init();
LBDEBUG << *this << std::endl;
}
示例11: main
int main() {
Compound *unknown = new Compound("Unknown");
unknown->Display();
Compound *water = new RitchCompound("Water");
water->Display();
Compound *benzene = new RitchCompound("Benzene");
benzene->Display();
Compound *ethanol = new RitchCompound("Ethanol");
ethanol->Display();
return 0;
}
示例12: Compound
void Loader::addOutputCompounds( ServerPtr server )
{
const Configs& configs = server->getConfigs();
for( Configs::const_iterator i = configs.begin(); i != configs.end(); ++i )
{
UnusedOutputChannelFinder finder;
Config* config = *i;
config->accept( finder );
const Channels& channels = finder.getResult();
if( channels.empty( ))
continue;
Compound* group = new Compound( config );
for( Channels::const_iterator j = channels.begin();
j != channels.end(); ++j )
{
Compound* compound = new Compound( group );
Channel* channel = *j;
compound->setChannel( channel );
}
}
}
示例13: LBASSERT
//---------------------------------------------------------------------------
// exit
//---------------------------------------------------------------------------
bool Config::exit()
{
if( _state != STATE_RUNNING )
LBWARN << "Exiting non-initialized config" << std::endl;
LBASSERT( _state == STATE_RUNNING || _state == STATE_INITIALIZING );
_state = STATE_EXITING;
const Canvases& canvases = getCanvases();
for( Canvases::const_iterator i = canvases.begin();
i != canvases.end(); ++i )
{
Canvas* canvas = *i;
canvas->exit();
}
for( Compounds::const_iterator i = _compounds.begin();
i != _compounds.end(); ++i )
{
Compound* compound = *i;
compound->exit();
}
const bool success = _updateRunning( true );
// TODO: is this needed? sender of CMD_CONFIG_EXIT is the appNode itself
// which sets the running state to false anyway. Besides, this event is
// not handled by the appNode because it is already in exiting procedure
// and does not call handleEvents anymore
// eile: May be needed for reliability?
send( findApplicationNetNode(), fabric::CMD_CONFIG_EVENT ) << Event::EXIT;
_needsFinish = false;
_state = STATE_STOPPED;
return success;
}
示例14: _modeDS
/** DB_ds rendering when each node compose result from its pipes on to first
pipe, then result is used in DB_ds compositing between nodes */
static void _modeDS( Config* config,
const unsigned nChannels,
const unsigned nPipes,
const vector< vector<int> >& descr,
const vector<float>& xMarks,
const vector<float>& yMarks )
{
Compound* compound = config->getCompounds()[0];
vector<float> ranges( nChannels + 1, 0 );
ranges[ nChannels ] = 1.0;
for( unsigned i = 1; i < nChannels; ++i )
ranges[ i ] = ranges[ i-1 ] + 1.0/nChannels;
const unsigned nNodes = nChannels/nPipes;
if( descr.size() < nNodes )
{
cerr << "Description file is incomplete" << std::endl;
return;
}
const int rows = int( yMarks.size( )) - 1;
const int columns = int( xMarks.size( )) - 1;
const int cells = rows*columns;
// check that all specified viewports are within a grid
for( size_t i = 0; i < nNodes; ++i )
{
const vector< int >& vals = descr[i];
for( size_t j = 0; j < vals.size(); ++j )
if( vals[j] >= cells || vals[j] < 0 )
{
cerr << "description of region is invalid: "
<< vals[j] << " no such cell" << std::endl;
return;
}
}
// fill all viewports for grid
vector< eq::Viewport > tmpVP;
for( int y = 0; y < rows; ++y )
for( int x = 0; x < columns; ++x )
tmpVP.push_back( eq::Viewport( xMarks[x],
yMarks[y],
xMarks[x+1]-xMarks[x],
yMarks[y+1]-yMarks[y] ));
// build per-node viewports
vector< eq::Viewport > vp( nNodes );
for( size_t i = 0; i < nNodes; ++i )
{
const vector< int >& vals = descr[i];
vp[i] = tmpVP[vals[0]];
for( size_t j = 1; j < vals.size(); ++j )
vp[i].unite( tmpVP[vals[j]] );
}
unsigned i = 0;
// for each node
for( unsigned n = 0 ; n < nNodes; ++n )
{
Compound* child = compound;
if( n != 0 ) // don't create separate compound for dst channel
{
child = new Compound( compound );
std::ostringstream channelName;
channelName << "channel" << n*nPipes;
Channel* childChannel = config->find< Channel >( channelName.str());
child->setChannel( childChannel );
}
Compound* childNode = new Compound( child );
// for each gpu on the node
for( unsigned p = 0; p < nPipes; ++p )
{
Compound* childPipe = new Compound( childNode );
childPipe->setRange( eq::Range( ranges[ i ], ranges[ i+1 ] ));
if( i != n*nPipes )
{
std::ostringstream channelName;
channelName << "channel" << i;
Channel* childChannel =
config->find< Channel >( channelName.str( ));
childPipe->setChannel( childChannel );
std::ostringstream frameName;
frameName << "frame.channel" << i;
childPipe->addOutputFrame( ::Frame::create( frameName ));
childNode->addInputFrame( ::Frame::create( frameName ));
}
i++;
//.........这里部分代码省略.........
示例15: Compound
bool SceneLoader::loadObjects(){ //Falta condicao para nao se repetirem ID's <--
TiXmlElement* objectElement = root->FirstChildElement("objects");
if(objectElement == NULL)
{
cout << "> Error: objects tag not found!" << endl;
return false;
}
TiXmlElement* objectChild = objectElement->FirstChildElement();
int i=1;
for( ; objectChild != NULL; objectChild = objectChild->NextSiblingElement()){
if(i <= maxObjects){
if(!objectChild->Attribute("type")){
cout << " > Error: Could not load type of an Object!" << endl; //Sair imediatamente
return NULL;
}
string type = objectChild->Attribute("type");
if(type == "compound"){ //Tipo composto
Compound* compound = new Compound();
if((compound->loadAttributes(objectChild)) == NULL)
return false;
if(sceneManager->getObjectbyID(objectChild->Attribute("id")) != NULL){ //Objecto já existente no sistema
cout << " > Warning: object with ID " << objectChild->Attribute("id") << " is already in the system!!" << endl;
continue;
}
string material;
if((material = compound->loadMaterial(objectChild)).empty()) return NULL;
if(material != "null"){
Material* mat = this->sceneManager->getMaterialbyID(material);
if(mat == NULL){
cout << " > Error: Material with ID: " << material << " not found for Object: " << compound->id << endl;
return false;
}
compound->material = mat;
} else{
Material* mat = new Material();
mat->id = "null";
compound->material = mat;
}
string texture;
if((texture = compound->loadTexture(objectChild)).empty()) return NULL;
if(texture == "clear"){
Texture* text = new Texture();
text->id = "clear";
compound->texture = text;
} else if(texture != "null"){
Texture* text = this->sceneManager->getTexturebyID(texture);
if(text == NULL){
cout << " > Error: Texture with ID: " << texture << " not found for Object: " << compound->id << endl;
return false;
}
compound->texture = text;
} else{
Texture* text = new Texture();
text->id = "null";
compound->texture = text;
}
if(objectChild->Attribute("id") == sceneManager->globals->root){
sceneManager->root = compound;
}
sceneManager->addObject(compound);
} else if(type == "simple"){ //Tipo simples
Simple* simple = new Simple();
if((simple->loadAttributes(objectChild)) == NULL)
return false;
if(sceneManager->getObjectbyID(objectChild->Attribute("id")) != NULL) //Objecto já existente no sistema
{
cout << " > Warning: object with ID " << objectChild->Attribute("id") << " is already in the system!!" << endl;
continue;
}
string material;
if((material = simple->loadMaterial(objectChild)).empty()) return NULL;
if(material != "null"){
Material* mat = this->sceneManager->getMaterialbyID(material);
if(mat == NULL){
cout << " > Error: Material with ID: " << material << " not found for Object: " << simple->id << endl;
return false;
}
simple->material = mat;
} else{
Material* mat = new Material();
mat->id = "null";
simple->material = mat;
}
string texture;
if((texture = simple->loadTexture(objectChild)).empty()) return NULL;
if(texture == "clear"){
Texture* text = new Texture();
text->id = "clear";
simple->texture = text;
} else if(texture != "null"){
Texture* text = this->sceneManager->getTexturebyID(texture);
if(text == NULL){
//.........这里部分代码省略.........