Beispiel #1
0
//-----------------------------------------------------------------------
void CompositorChain::createOriginalScene()
{
    /// Create "default" compositor
    /** Compositor that is used to implicitly represent the original
        render in the chain. This is an identity compositor with only an output pass:
    compositor Ogre/Scene
    {
        technique
        {
            target_output
            {
    			pass clear
    			{
    				/// Clear frame
    			}
                pass render_scene
                {
    				visibility_mask FFFFFFFF
    				render_queues SKIES_EARLY SKIES_LATE
                }
            }
        }
    };
    */

    // If two viewports use the same scheme but differ in settings like visibility masks, shadows, etc we don't
    // want compositors to share their technique.  Otherwise both compositors will have to recompile every time they
    // render.  Thus we generate a unique compositor per viewport.
    String compName("Ogre/Scene/");
    compName += StringConverter::toString((intptr_t)mViewport);

    mOriginalSceneScheme = mViewport->getMaterialScheme();
    CompositorPtr scene = CompositorManager::getSingleton().getByName(compName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
    if (scene.isNull())
    {
        scene = CompositorManager::getSingleton().create(compName, ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);
        CompositionTechnique *t = scene->createTechnique();
        t->setSchemeName(StringUtil::BLANK);
        CompositionTargetPass *tp = t->getOutputTargetPass();
        tp->setVisibilityMask(0xFFFFFFFF);
        {
            CompositionPass *pass = tp->createPass();
            pass->setType(CompositionPass::PT_CLEAR);
        }
        {
            CompositionPass *pass = tp->createPass();
            pass->setType(CompositionPass::PT_RENDERSCENE);
            /// Render everything, including skies
            pass->setFirstRenderQueue(RENDER_QUEUE_BACKGROUND);
            pass->setLastRenderQueue(RENDER_QUEUE_SKIES_LATE);
        }


        /// Create base "original scene" compositor
        scene = CompositorManager::getSingleton().load(compName,
                ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME);



    }
    mOriginalScene = OGRE_NEW CompositorInstance(scene->getSupportedTechnique(), this);
}
int acscomponentTestServer (char *szCmdLn)
{
  int  argc;
  char *argv[100];

  argc = argUnpack(szCmdLn, argv);
  argv[0] = "acscomponentTestServer";
#else
int main(int argc, char* argv[]) 
{
#endif // defined( MAKE_VXWORKS )

 
  // creating ORB
  ACS_TEST_INIT_CORBA;


  try
    {
    ACE_OS::signal(SIGINT,  TerminationSignalHandler);  // Ctrl+C
    ACE_OS::signal(SIGTERM, TerminationSignalHandler);  // termination request

      //Get a reference to the RootPOA
      CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
      
      PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj.in());
      
   
      PortableServer::POAManager_var poa_manager = root_poa->the_POAManager();
      

      // The component will throw an exception if receives a NULL ContainerServices
      // in the constructor.
      // We pass a value only to avoid that i throws the exception. On the other 
      // hand the test doe not use the ContainerServices (remember: ContainerServices
      // does not yet exist at this point!!!!)
      ACE_CString compName("TEST");
      ACSComponentTestClassImpl mytestImpl(compName.c_str(), new TestContainerServices(compName,NULL));
      ACSCOMPONENT_TEST::ACSComponentTestClass_var mytest = mytestImpl._this ();;
      


      poa_manager->activate ();
      
      ACS_DEBUG ("acscomponentTestServer","POA Manager -> activate");

      ACS_DEBUG ("acscomponentTestServer", "Writing ior to the file: ACSCOMPONENTTEST1");
      char* ior =  orb->object_to_string (mytest.in());
      
      
      char fileName[64];
      sprintf(fileName, "%s.ior", "ACSCOMPONENTTEST1");
      FILE *output_file = ACE_OS::fopen (fileName, "w");
      if (output_file == 0) {
	ACS_SHORT_LOG((LM_ERROR, "Cannot open output files for writing IOR: ior.ior"));
	return -1;
      }

      int result = ACE_OS::fprintf (output_file, "%s", ior);
      if (result < 0) {
	ACE_ERROR_RETURN ((LM_ERROR, "ACE_OS::fprintf failed while writing %s to ior.ior", ior), -1);
      }

      ACE_OS::fclose (output_file);
      
      ACS_DEBUG ("acscomponentTestServer", "Waiting for requests ...");
      orb->run ();
      
    }

  catch( CORBA::Exception &_ex )
    {
      _ex._tao_print_exception("EXCEPTION CAUGHT");
      return -1;
    }

  //    orb->shutdown(true); //wait until all requests have completed

  return 0;


}