Esempio n. 1
0
//----------------------------------------------------------------------------
//
//  Test:           test_tuner
//
//  Description:    Iterates through each of the known local channels,
//                  and attempts to save an image from each of them.
//
//  Setup:          - Source is TV tuner
//                  - Tunes to each local channel sequentially
//                  - Uses standard window sizing
//                  - Saves in RGB24 format
//
//----------------------------------------------------------------------------
int test_tuner( FRAMEGRABBER* fg )
{
    FRAME* frame = NULL;
    char fname[32];
    int i;

    _T( fg_set_format( fg, VIDEO_PALETTE_RGB32 ) );
    _T( fg_set_capture_window( fg, 0, 0, 320, 240 ) );
    _N( frame = fg_new_compatible_frame( fg ) );

    for ( i = 0; i < sizeof(local)/sizeof(CHANNEL); i++ )
    {
        printf( "%u. Saving %s @ %fMHz\n", i, local[i].name, local[i].freq );

        _T( fg_set_channel( fg, local[i].freq ) );

        // Catch up to the new tuning
        _N( fg_grab_frame( fg, frame ) );
        _N( fg_grab_frame( fg, frame ) );

        snprintf( fname, sizeof(fname), "test_%s.ppm", local[i].name );

        _T( frame_save( frame, fname ) );
    }
    frame_release( frame );

    return 0;
}
Esempio n. 2
0
void StartupEngine(HINSTANCE anAppInstanceHandle)
{
  Fancy::Init(anAppInstanceHandle);

  Fancy::RenderWindow* window = Fancy::GetCurrentRenderWindow();

  std::function<void(uint, uint)> onResizeCallback = &OnWindowResized;
  window->myOnResize.Connect(onResizeCallback);
  
  Fancy::Scene::ScenePtr pScene = std::make_shared<Fancy::Scene::Scene>();
  Fancy::SetCurrentScene(pScene);

  pRenderProcessFwd = new Fancy::Rendering::RenderingProcessForward;
  Fancy::SetRenderingProcess(pRenderProcessFwd);

  Fancy::Scene::SceneNode* pCameraNode = pScene->getRootNode()->createChildNode(_N(CameraNode));
  pCameraComponent = static_cast<Fancy::Scene::CameraComponent*>(pCameraNode->addOrRetrieveComponent(_N(CameraComponent)));
  pCameraComponent->setProjectionPersp(45.0f, window->GetWidth(), window->GetHeight(), 1.0f, 1000.0f);
  pScene->setActiveCamera(pCameraComponent);

  pModelNode = pScene->getRootNode()->createChildNode(_N(ModelNode));
  Fancy::IO::SceneImporter::importToSceneGraph("Models/cube.obj", pModelNode);
  pModelNode->getTransform().setPositionLocal(glm::vec3(0.0f, 0.0f, 10.0f));

  Fancy::Scene::SceneNode* pLightNode = pScene->getRootNode()->createChildNode(_N(LightNode));
  Fancy::Scene::LightComponent* pLight = static_cast<Fancy::Scene::LightComponent*>(pLightNode->addOrRetrieveComponent(_N(LightComponent)));

  Fancy::Startup();
}
   /*Construtor da camera*/
   mCamera(float px, float py, float pz,
      float centerx,float centery, float centerz,
      float upx, float upy, float upz) 
   {
      Matriz<4,1> _mp;
      _mp.setZero();
      _mp(0,0) = px;
      _mp(1,0) = py;
      _mp(2,0) = pz;
      _mp(3,0) = 1;
      _p = _mp;

      _V.setZero();
      _V(0,0) = upx;
      _V(1,0) = upy;
      _V(2,0) = upz;
      _V(3,0) = 1;
      _V = mat.normalizeVector3D(_V);

      _N.setZero();
      _N(0,0) = centerx - px;
      _N(1,0) = centery - py;
      _N(2,0) = centerz - pz;
      _N = mat.normalizeVector3D(_N);
      _U = mat.normalizeVector3D(mat.crossProduct3D(_V,_N));
      _V = mat.normalizeVector3D(mat.crossProduct3D(_U,_N));
      tipo_de_projecao = 1;
      graus = 0.02f;
   }
void NodeManager::init()
{
  _INTR_LOG_INFO("Inititializing Node Component Manager...");

  Dod::Components::ComponentManagerBase<
      NodeData, _INTR_MAX_NODE_COMPONENT_COUNT>::_initComponentManager();

  _sortedNodes.reserve(_INTR_MAX_NODE_COMPONENT_COUNT);
  _rootNodes.reserve(_INTR_MAX_NODE_COMPONENT_COUNT);

  Dod::Components::ComponentManagerEntry nodeEntry;
  {
    nodeEntry.createFunction = Components::NodeManager::createNode;
    nodeEntry.destroyFunction = Components::NodeManager::destroyNode;
    nodeEntry.getComponentForEntityFunction =
        Components::NodeManager::getComponentForEntity;
    nodeEntry.onPropertyUpdateFinishedFunction =
        Components::NodeManager::updateTransforms;
    nodeEntry.onInsertionDeletionFinishedAction =
        Components::NodeManager::rebuildTreeAndUpdateTransforms;

    Application::_componentManagerMapping[_N(Node)] = nodeEntry;
    Application::_orderedComponentManagers.push_back(nodeEntry);
  }

  Dod::PropertyCompilerEntry propCompilerNode;
  {
    propCompilerNode.compileFunction =
        Components::NodeManager::compileDescriptor;
    propCompilerNode.initFunction = Components::NodeManager::initFromDescriptor;
    propCompilerNode.ref = Dod::Ref();

    Application::_componentPropertyCompilerMapping[_N(Node)] = propCompilerNode;
  }
}
Esempio n. 5
0
    std::string str(void) {
	std::ostringstream os; 	
	os << v << " v[" << _N(v, 0); 
	for (int i = 1; i < 16; i++) {
	    os << "," << _N(v, i);
	}
	os << "]";
	return os.str();
    }
Esempio n. 6
0
//---------------------------------------------------------------------------//
  void Scene::onComponentRemoved(const SceneNodeComponent* _pComponent)
  {
    const ObjectName& typeName = _pComponent->getTypeName();
    if (typeName == _N(LightComponent))
    {
      myLights.erase(static_cast<const LightComponent*>(_pComponent));
    }
    else if (typeName == _N(ModelComponent))
    {
      myModels.erase(static_cast<const ModelComponent*>(_pComponent));
    }
  }
Esempio n. 7
0
//----------------------------------------------------------------------------
//
//  Test:           test_timing
//
//  Description:    Grabs a series of frames, and times how long each takes
//                  in a tight loop that also pretends to do some "processing"
//                  (by sleeping).
//
//  Setup:          - Source is default
//                  - Tuned to default
//                  - Uses standard window sizing and format
//
//----------------------------------------------------------------------------
int test_timing( FRAMEGRABBER* fg )
{
    FRAME* frame = NULL;
    struct timeval start_time, end_time;
    int i;

    printf( "Capture timings...\n" );

    _T( fg_set_channel( fg, local[0].freq ) );
    _T( fg_set_format( fg, VIDEO_PALETTE_RGB32 ) );
    _T( fg_set_capture_window( fg, 0, 0, 768, 576 ) );

    _N( frame = frame_new( 768, 576, VIDEO_PALETTE_RGB32 ) );

    for ( i = 0; i < 20; i++ )
    {
        gettimeofday( &start_time, NULL );

        fg_grab_frame( fg, frame );

        // Image crunching step would be here
        usleep(35);

        gettimeofday( &end_time, NULL );

        // This subtraction doesn't handle wrapping
        printf( "Elapsed time = %lu secs %lu usecs\n",
                ( end_time.tv_sec  - start_time.tv_sec  ),
                ( end_time.tv_usec - start_time.tv_usec ) );
    }

    return 0;
}
static void set_phase(TyonXceleratorCalibrationAssistant *cal_assistant, guint phase) {
	TyonXceleratorCalibrationAssistantPrivate *priv = cal_assistant->priv;
	priv->phase = phase;
	priv->count = 0;
	priv->phase_start = time(NULL);
	gtk_label_set_text(priv->progress_label, _N(phase_strings[phase_string_indices[phase]]));
}
Esempio n. 9
0
//----------------------------------------------------------------------------
//
//  Test:           test_simple_grab
//
//  Description:    Grabs a single frame and saves it to a file.
//
//  Setup:          - Source is TV tuner
//                  - Uses standard window sizing
//                  - Tunes to first local channel
//
//----------------------------------------------------------------------------
int test_simple_grab( FRAMEGRABBER* fg )
{
    FRAME* frame = NULL;

    _T( fg_set_source( fg, FG_SOURCE_TV ) );

    _T( fg_set_capture_window( fg, 0, 0,
                               fg->caps.maxwidth,
                               fg->caps.maxheight ) );

    _T( fg_set_channel( fg, local[0].freq ) );

    _T( fg_set_brightness( fg, 75 ) );

    _T( fg_set_colour( fg, 80 ) );

    _N( frame = fg_grab( fg ) );

    printf( "Saving test frame...\n" );

    _T( frame_save( frame, "test_frame.ppm" ) );

    frame_release( frame );

    return 0;
}
IntrinsicEdManagerWindowMaterial::IntrinsicEdManagerWindowMaterial(
    QWidget* parent)
    : IntrinsicEdManagerWindowBase(parent)
{
  setWindowTitle("Materials");
  _propertyCompilerEntry =
      Application::_resourcePropertyCompilerMapping[_N(Material)];
  _resourceManagerEntry = Application::_resourceManagerMapping[_N(Material)];
  _managerPath = "managers/materials/";
  _managerExtension = ".material.json";
  _resourceName = "Material";

  QObject::connect(this, SIGNAL(resourceTreePopulated()), this,
                   SLOT(onResourceTreePopulated()));

  onPopulateResourceTree();
}
Esempio n. 11
0
void reader() {
    gx_mfd                 *mfd_r;
    gx_eventloop_init (mfd_events);
    gx_sleep(0,500);  // Give the writer enough time to get the file set up.
    _N( mfd_r = acquire_gx_mfd(mfd_pool)               ) _abort();
    _ ( gx_mfd_create_r(mfd_r,10,"tmp/writer-file.dat")) _abort();
    _ ( mfd_events_add_misc(mfd_r->notify_fd, mfd_r)   ) _abort();
    _ ( mfd_events_wait(-1, on_readfile_changed)       ) _abort();
}
void GpuProgramManager::init()
{
  _INTR_LOG_INFO("Inititializing GPU Program Manager...");

  Dod::Resources::ResourceManagerBase<
      GpuProgramData, _INTR_MAX_GPU_PROGRAM_COUNT>::_initResourceManager();

  {
    Dod::Resources::ResourceManagerEntry managerEntry;
    managerEntry.createFunction =
        Resources::GpuProgramManager::createGpuProgram;
    managerEntry.destroyFunction =
        Resources::GpuProgramManager::destroyGpuProgram;
    managerEntry.createResourcesFunction =
        Resources::GpuProgramManager::createResources;
    managerEntry.destroyResourcesFunction =
        Resources::GpuProgramManager::destroyResources;
    managerEntry.getActiveResourceAtIndexFunction =
        Resources::GpuProgramManager::getActiveResourceAtIndex;
    managerEntry.getActiveResourceCountFunction =
        Resources::GpuProgramManager::getActiveResourceCount;
    managerEntry.loadFromMultipleFilesFunction =
        Resources::GpuProgramManager::loadFromMultipleFiles;
    managerEntry.saveToMultipleFilesFunction =
        Resources::GpuProgramManager::saveToMultipleFiles;
    managerEntry.getResourceFlagsFunction = GpuProgramManager::_resourceFlags;
    Application::_resourceManagerMapping[_N(GpuProgram)] = managerEntry;
  }

  {
    Dod::PropertyCompilerEntry compilerEntry;
    compilerEntry.compileFunction =
        Resources::GpuProgramManager::compileDescriptor;
    compilerEntry.initFunction =
        Resources::GpuProgramManager::initFromDescriptor;
    compilerEntry.ref = Dod::Ref();
    Application::_resourcePropertyCompilerMapping[_N(GpuProgram)] =
        compilerEntry;
  }

  glslang::InitializeProcess();
  Helper::initResource(_defaultResource);
  loadShaderCache();
}
int show_student_window()
{
		GladeXML *StudentWinXML;
		GtkWidget *student_window, *exit_button;
		GtkWidget *treeview;      /*树视图*/
		GtkTreeIter iter;           /*迭代器*/
		GtkCellRenderer* renderer;  /*渲染器*/
		GtkTreeModel *store;      /*树模式*/
		char *sqlresult;
		MYSQL_ROW row;
		unsigned int i=0;
		
		gtk_init(&argc,&argv);
		StudentWinXML = glade_xml_new("ui/student_win.glade", NULL, NULL);
		student_window = glade_xml_get_widget(StudentWinXML, "window1");
		glade_xml_signal_autoconnect(StudentWinXML);
		treeview = glade_xml_get_widget(StudentWinXML, "treeview");
		/*定义渲染器,定义视图中的列,设置各列的数据均为text*/
		renderer = gtk_cell_renderer_text_new();
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 课程编号 "), renderer, "text", CRS_ID, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 课程名称 "), renderer, "text", CRS_NAME, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 学  分 "), renderer, "text", CRS_CREDIT, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 学  时 "), renderer, "text", CRS_HOUR, NULL);
		gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(treeview), -1, _N(" 成  绩 "), renderer, "text", MARK, NULL);
		/*设置树模式中各列的数据类型*/
		store = GTK_TREE_MODEL(gtk_list_store_new(STU_COLUM_NUM,G_TYPE_STRING,G_TYPE_STRING,G_TYPE_UINT,G_TYPE_UINT,G_TYPE_FLOAT));
		gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), store);
		/*向模式中插入数据*/
		for(i=0; i<stu_res_tab.row; i++)
		{
			row = mysql_fetch_row(stu_res_tab.res)
			gtk_list_store_append(GTK_LIST_STORE(store), &iter);  /*获取插入的位置*/
			gtk_list_store_set(GTK_LIST_STORE(store),&iter,CRS_ID,row[CRS_ID],CRS_NAME,row[CRS_NAME],CRS_CREDIT,row[CRS_CREDIT],CRS_HOUR,row[CRS_HOUR],MARK,row[MARK],-1);
		}
		g_object_unref(store);
		/*为界面添加信号*/
		exit_button = glade_xml_get_widget(StudentWinXML, "exit_button");
		g_signal_connect(G_OBJECT(exit_button), "clicked", G_CALLBACK(gtk_main_quit),student_window);
		g_signal_connect(G_OBJECT(student_window),"destroy",G_CALLBACK(gtk_main_quit),student_window);
		gtk_widget_show_all(student_window);
		gtk_main();
		return 0;
}
Esempio n. 14
0
int main(int argc, char **argv) {
    pid_t pid;
    int   status=0;

    _N( mfd_pool = new_gx_mfd_pool(2) ) _abort();
    _ (pid = fork()                   ) _abort();
    if(pid) /* child  */ writer();
    else    /* parent */ {reader(); waitpid(pid, &status, 0);}
    return status;
}
void Main::activate()
{
  Entity::EntityRef entityRef =
      Entity::EntityManager::getEntityByName(_N(GameCamera));
  _INTR_ASSERT(entityRef.isValid());
  Components::CameraRef cameraRef =
      Components::CameraManager::getComponentForEntity(entityRef);
  _INTR_ASSERT(cameraRef.isValid());

  World::setActiveCamera(cameraRef);
}
Esempio n. 16
0
//---------------------------------------------------------------------------//
  SharedPtr<void> ObjectFactory::Create(const ObjectName& aTypeName, const DescriptionBase& aDesc)
  {
    if (aTypeName == _N(Texture))
    {
      const Rendering::TextureDesc& desc = static_cast<const Rendering::TextureDesc&>(aDesc);
      return Rendering::RenderCore::CreateTexture(desc);
    }
    else if (aTypeName == _N(GpuProgram))
    {
      const Rendering::GpuProgramDesc& desc = static_cast<const Rendering::GpuProgramDesc&>(aDesc);
      return Rendering::RenderCore::CreateGpuProgram(desc);
    }
    else if (aTypeName == _N(GpuProgramPipeline))
    {
      const Rendering::GpuProgramPipelineDesc& desc = static_cast<const Rendering::GpuProgramPipelineDesc&>(aDesc);
      return Rendering::RenderCore::CreateGpuProgramPipeline(desc);
    }
    
    ASSERT(false, "Unknown typename");
    return nullptr;
  }
Esempio n. 17
0
void writer() {
    int     i;
    gx_mfd *mfd_w;
    char    msg[] = "something blah blah";

    _N( mfd_w = acquire_gx_mfd(mfd_pool)               ) _abort();
    _ ( gx_mfd_create_w(mfd_w,10,"tmp/writer-file.dat")) _abort();
    gx_sleep(1);
    for(i=0; i < 5; i++) {
        gx_sleep(0,500);
        log_info("CHILD:    Writing some stuff");
        mfd_write(mfd_w, msg, sizeof(msg));
    }
    //printf("writer: %llX\n", (unsigned long long int)(mfd_w->head->sig));
    gx_sleep(1);
}
Esempio n. 18
0
bool VdaMixer::upload(const VideoFrame &frame, bool /*deint*/) {
	Q_ASSERT(frame.format().imgfmt() == IMGFMT_VDA);
	CGLError error = kCGLNoError;
	for (auto &texture : m_textures) {
		const auto cgl = CGLGetCurrentContext();
		const auto surface = CVPixelBufferGetIOSurface((CVPixelBufferRef)frame.data(3));
		texture.bind();
		const auto w = IOSurfaceGetWidthOfPlane(surface, texture.plane());
		const auto h = IOSurfaceGetHeightOfPlane(surface, texture.plane());
		if (_Change(error, CGLTexImageIOSurface2D(cgl, texture.target(), texture.format(), w, h, texture.transfer().format, texture.transfer().type, surface, texture.plane()))) {
			_Error("CGLError: %%(0x%%)", CGLErrorString(error), _N(error, 16));
			return false;
		}
	}
	return true;
}
FE_TMPL void FE_NODE::calcFarFieldSeries(unsigned int p){
	if(_left != 0){
		_left->calcFarFieldSeries(p);
		_right->calcFarFieldSeries(p);

		//TODO calc from children, see section 6
	}else{
		_farSeries.clear();
		for(int k = 0;k<=v;k++)for(int n = 0;n<=p-2*k;n++)for(int m = -n;m<=n;m++){
			std::complex<float> N = _N(n,m,k);
			/*if(N.real() == 0 && N.imag() == 0){
				continue;
			}*/
			_farSeries.push_back(N);
		}
		std::cout << _farSeries.size() << std::endl;
	}
}
    bool GL4RenderSystem::Shutdown() noexcept
    {
        GRAPHYTE_TRACE_WRITELINE(GL4RenderSystemChannel, Debug, _N("GL4: Shutdown"));
/*
        ::wglMakeCurrent(nullptr, nullptr);

        if (_render_context != nullptr)
        {
            ::wglDeleteContext(_render_context);
        }

        if (_device_context != nullptr)
        {
            ::ReleaseDC()
        }

*/
        return true;
    }
Esempio n. 21
0
//----------------------------------------------------------------------------
//
//  Test:           test_formats
//
//  Description:    Iterates through each of the supported frame formats,
//                  and attempts to save an image in each of them.
//
//  Setup:          - Source is default
//                  - Channel tuning is default 
//                  - Window sizing is default
//
//----------------------------------------------------------------------------
int test_formats( FRAMEGRABBER* fg )
{
    FRAME* frame = NULL;
    char fname[32];
    int i;

    for ( i = 0; i < sizeof(fmts)/sizeof(FMT); i++ )
    {
        printf( "Saving in %s...\n", fmts[i].name );

        _T( fg_set_format( fg, fmts[i].format ) );
        _N( frame = fg_grab( fg ) );

        snprintf( fname, sizeof(fname), "test_%s.ppm", fmts[i].name );

        _T( frame_save( frame, fname ) );
        frame_release( frame );
    }

    return 0;
}
Esempio n. 22
0
static void nyth_dcu_frame_init(NythDcuFrame *frame) {
	NythDcuFramePrivate *priv = NYTH_DCU_FRAME_GET_PRIVATE(frame);
	GtkWidget *box;
	GtkWidget *radio;
	int i;

	frame->priv = priv;

	box = gtk_vbox_new(FALSE, 0);

	gtk_container_add(GTK_CONTAINER(frame), box);

	struct {
		NythControlUnitDcu state;
		gchar const *title;
	} radios[4] = {
		{NYTH_DISTANCE_CONTROL_UNIT_OFF, N_("Off")},
		{NYTH_DISTANCE_CONTROL_UNIT_EXTRA_LOW, N_("Extra low")},
		{NYTH_DISTANCE_CONTROL_UNIT_LOW, N_("Low")},
		{NYTH_DISTANCE_CONTROL_UNIT_NORMAL, N_("Normal")},
	};

	priv->radios = NULL;

	for (i = 3; i >= 0; --i) {
		radio = gtk_radio_button_new_with_label(priv->radios, _N(radios[i].title));
		g_object_set_data(G_OBJECT(radio), state_key, GUINT_TO_POINTER(radios[i].state));
		priv->radios = gtk_radio_button_get_group(GTK_RADIO_BUTTON(radio));
		g_signal_connect(G_OBJECT(radio), "toggled", G_CALLBACK(radio_toggled_cb), frame);
	}

	g_slist_foreach(priv->radios, pack_radio_button, box);

	gtk_frame_set_label(GTK_FRAME(frame), _("Distance control unit"));

	gtk_widget_show_all(box);
}
Esempio n. 23
0
CPeopleNeeds CPeopleNeeds::countSetNewNeeds(double _lifeSatisfaction)
{
    CPeopleNeeds _N(countNewNeeds(_lifeSatisfaction));
    (*this) = _N;
    return _N;
}
    bool GL4RenderSystem::Initialize() noexcept
    {
        GRAPHYTE_TRACE_WRITELINE(GL4RenderSystemChannel, Debug, _N("GL4: Initialize"));

        return true;
    }
 /*Imprimi os 3 vetores*/
 void print()
 {
    std::cout << "Forward:" <<  _N(0,0) << " " << _N(1,0) << " " << _N(2,0) << std::endl;
    std::cout << "Up:" <<_V(0,0) << " " << _V(1,0) << " " << _V(2,0) << std::endl;
    std::cout << "Right:" << _U(0,0) << " " << _U(1,0) << " " << _U(2,0) << std::endl;
 }
 void move_forward(float forward)
 {
    _p = mat.Translate3D(_N(0,0)*getSpeed()*forward,_N(1,0)*getSpeed()*forward,_N(2,0)*getSpeed()*forward)*_p;
 }
Esempio n. 27
0
namespace Fancy { namespace IO {

//---------------------------------------------------------------------------//
  template<class T, MemoryCategory eMemoryCategory>
  void* locCreateManaged(uint64 aHash, bool& aWasCreated)
  {
    T* object = T::Find(aHash);

    if (object)
    {
      aWasCreated = false;
      return object;
    }
     
    aWasCreated = true;
    object = FANCY_NEW(T, eMemoryCategory);
    
    // TODO: This is bad design... we should set the whole description here. 
    // We need to do this during a refactoring of the serialization-system...
    T::Register(object, aHash);  
    
    return object;
  }
//---------------------------------------------------------------------------//
  template<>
  void* locCreateManaged<Geometry::Mesh, MemoryCategory::GEOMETRY>
    (uint64 aHash, bool& aWasCreated)
  {
    Geometry::Mesh* object = Geometry::Mesh::Find(aHash);

    if (object)
    {
      aWasCreated = false;
      return object;
    }

    aWasCreated = true;
    BinaryCache::read(&object, aHash, 0u);

    return object;
  }
//---------------------------------------------------------------------------//
  template<class T, MemoryCategory eMemoryCategory>
  void* locCreate(uint64, bool& aWasCreated)
  {
    aWasCreated = true;
    return FANCY_NEW(T, eMemoryCategory);
  }
//---------------------------------------------------------------------------//
  typedef void* (*CreateFunc)(uint64, bool&);
  std::pair<ObjectName, CreateFunc> locResourceCreateFunctions[] =
  {
    // Managed:
    { _N(MaterialPass), &locCreateManaged<Rendering::MaterialPass, MemoryCategory::MATERIALS> },
    { _N(Material), &locCreateManaged<Rendering::Material, MemoryCategory::MATERIALS> },
    { _N(Mesh), &locCreateManaged<Geometry::Mesh, MemoryCategory::GEOMETRY> },
    { _N(SubModel), &locCreateManaged<Geometry::SubModel, MemoryCategory::GEOMETRY> },
    { _N(Model), &locCreateManaged<Geometry::Model, MemoryCategory::GEOMETRY> },

    // Non-managed
    { _N(MaterialPassInstance), &locCreate<Rendering::MaterialPassInstance, MemoryCategory::MATERIALS> },
    { _N(SceneNode), &locCreate<Scene::SceneNode, MemoryCategory::GENERAL> },
  };
//---------------------------------------------------------------------------//
  void* ObjectFactory::create(const ObjectName& aTypeName, bool& aWasCreated, uint64 aHash)
  {
    Scene::SceneNodeComponentFactory::CreateFunction createFunc = 
      Scene::SceneNodeComponentFactory::getFactoryMethod(aTypeName);

    if (createFunc != nullptr)
    {
      aWasCreated = true;
      return createFunc(nullptr);
    }
    
    for (std::pair<ObjectName, CreateFunc>& createFuncEntry : locResourceCreateFunctions)
      if (createFuncEntry.first == aTypeName)
        return createFuncEntry.second(aHash, aWasCreated);

    ASSERT(false, "Unknown typename");
    return nullptr;
  }
//---------------------------------------------------------------------------//
  SharedPtr<void> ObjectFactory::Create(const ObjectName& aTypeName, const DescriptionBase& aDesc)
  {
    if (aTypeName == _N(Texture))
    {
      const Rendering::TextureDesc& desc = static_cast<const Rendering::TextureDesc&>(aDesc);
      return Rendering::RenderCore::CreateTexture(desc);
    }
    else if (aTypeName == _N(GpuProgram))
    {
      const Rendering::GpuProgramDesc& desc = static_cast<const Rendering::GpuProgramDesc&>(aDesc);
      return Rendering::RenderCore::CreateGpuProgram(desc);
    }
    else if (aTypeName == _N(GpuProgramPipeline))
    {
      const Rendering::GpuProgramPipelineDesc& desc = static_cast<const Rendering::GpuProgramPipelineDesc&>(aDesc);
      return Rendering::RenderCore::CreateGpuProgramPipeline(desc);
    }
    
    ASSERT(false, "Unknown typename");
    return nullptr;
  }
//---------------------------------------------------------------------------//
} }
Esempio n. 28
0
void DNA::AddCell(ColorType _C, PointTotal _P, int _N1, int _N2, int _N3)
{
    Nucleotide _N(_C, _P, _N1, _N2, _N3);
    nChain.push_back(_N);
}