/* * Registers all of the required effects subclasses for picture deserialization. * * Optional subclasses (e.g. Blur) should be registered in the ports/ version of this file, * inside the InitEffects() method. */ void SkFlattenable::PrivateInitializer::InitCore() { // Shader SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkBitmapProcShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorFilterShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkColorShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposeShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkEmptyShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkImageShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkLocalMatrixShader) SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkPictureShader) // PathEffect SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkComposePathEffect) // ImageFilter SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkMatrixImageFilter) // ColorFilter SkColorFilter::InitializeFlattenables(); // Xfermode SkXfermode::InitializeFlattenables(); // Drawable SK_DEFINE_FLATTENABLE_REGISTRAR_ENTRY(SkRecordedDrawable) // Now initialize any optional/additional effects (implemented in src/ports) InitEffects(); };
void EnergyReceiver::InitLevel() { if(IsWalking() && !EditorUtils::editor) { //Собираем точки привязки Gadgets::snapGadgets.FindSnap(GetIndex(), _shapElements); } // Под приёмниками энергии не может быть фишек или cтен. // Функция делает ячейки fake и явно задаёт нулевой уровень Game::Square *sq = GameSettings::gamefield[GetIndex()]; if(!Game::isSquare(sq) ) { sq = Game::GetValidSquare(GetIndex().x, GetIndex().y); } sq->SetFake(true); sq->SetWall(0); _timerForRunChipFall = -1.f; _crystalTimeScale = 0.6f; _uid = utils::lexical_cast(UID_NEXT++); ReleaseEffects(); InitEffects(); }
bool D3DRenderer::Init() { GameLog::GetInstance()->Log(DebugChannel::Main, DebugLevel::Normal, "[D3DRenderer] Beginning Initialisation."); GameLog::GetInstance()->Log(DebugChannel::Rendering, DebugLevel::None, "[D3DRenderer] Testing Rendering Channel! %i", 2); if (!InitDirect3D()) { return false; } InitEffects(); CreateInputLayer(); mBufferManager = new D3DBufferManager(md3dDevice); GameLog::GetInstance()->Log(DebugChannel::Main, DebugLevel::Normal, "[D3DRenderer] Initialisation Complete."); return true; }
HRESULT InitD3D( HWND hWnd ) { // Setup a DXGI swap chain descriptor DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); sd.BufferCount = 1; // number of buffer sd.BufferDesc.Width = 600; // buffer width, can we set it to the screen width? sd.BufferDesc.Height = 600; // buffer height, can we set it to the screen height? sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // buffer format, 32 bit color with alpha(RGBA) sd.BufferDesc.RefreshRate.Numerator = 60; // refresh rate? sd.BufferDesc.RefreshRate.Denominator = 1; // WHAT'S THIS? sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // use buffer as render target sd.OutputWindow = hWnd; // output window handle sd.SampleDesc.Count = 1; // WHAT'S THIS? sd.SampleDesc.Quality = 0; // WHAT'S THIS? sd.Windowed = TRUE; // full-screen mode HRESULT hr; UINT flags = D3D10_CREATE_DEVICE_BGRA_SUPPORT; #if defined( DEBUG ) || defined( _DEBUG ) flags |= D3D10_CREATE_DEVICE_DEBUG; #endif // Create device and swap chain if (FAILED (hr = D3D10CreateDeviceAndSwapChain( NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, flags, D3D10_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice))) { return hr; } // Create render target and bind the back-buffer ID3D10Texture2D* pBackBuffer; // Get a pointer to the back buffer hr = g_pSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (LPVOID* )&pBackBuffer); if (FAILED(hr)) return hr; // Create a render-target view g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_pRenderTargetView); // Bind the view g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetView, NULL); // WHAT'S OM here mean? // Setup the viewport D3D10_VIEWPORT vp; vp.Width = 640; // this should be similar with the back-buffer width, global it! vp.Height = 480; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; vp.TopLeftY = 0; g_pd3dDevice->RSSetViewports(1, &vp); InitVertexBuffer(); InitEffects(); return S_OK; }
void MainLoop(void) { int commandSock = 0; int controlSock = 0; int bridgeSock = 0; int prevFPPstatus = FPPstatus; int sleepms = 50000; fd_set active_fd_set; fd_set read_fd_set; struct timeval timeout; int selectResult; LogDebug(VB_GENERAL, "MainLoop()\n"); FD_ZERO (&active_fd_set); CheckExistanceOfDirectoriesAndFiles(); piFaceSetup(200); // PiFace inputs 1-8 == wiringPi 200-207 if (getFPPmode() == BRIDGE_MODE) { bridgeSock = Bridge_Initialize(); if (bridgeSock) FD_SET (bridgeSock, &active_fd_set); } else { InitMediaOutput(); } pluginCallbackManager.init(); InitializeChannelOutputs(); sequence->SendBlankingData(); InitEffects(); InitializeChannelDataMemoryMap(); commandSock = Command_Initialize(); if (commandSock) FD_SET (commandSock, &active_fd_set); #ifdef USEHTTPAPI APIServer apiServer; apiServer.Init(); #endif controlSock = InitControlSocket(); FD_SET (controlSock, &active_fd_set); SetupGPIOInput(); if (getFPPmode() & PLAYER_MODE) { if (getFPPmode() == MASTER_MODE) InitSyncMaster(); scheduler->CheckIfShouldBePlayingNow(); if (getAlwaysTransmit()) StartChannelOutputThread(); } LogInfo(VB_GENERAL, "Starting main processing loop\n"); while (runMainFPPDLoop) { timeout.tv_sec = 0; timeout.tv_usec = sleepms; read_fd_set = active_fd_set; selectResult = select(FD_SETSIZE, &read_fd_set, NULL, NULL, &timeout); if (selectResult < 0) { if (errno == EINTR) { // We get interrupted when media players finish continue; } else { LogErr(VB_GENERAL, "Main select() failed: %s\n", strerror(errno)); runMainFPPDLoop = 0; continue; } } if (commandSock && FD_ISSET(commandSock, &read_fd_set)) CommandProc(); if (bridgeSock && FD_ISSET(bridgeSock, &read_fd_set)) Bridge_ReceiveData(); if (controlSock && FD_ISSET(controlSock, &read_fd_set)) ProcessControlPacket(); // Check to see if we need to start up the output thread. // FIXME, possibly trigger this via a fpp command to fppd if ((!ChannelOutputThreadIsRunning()) && (getFPPmode() != BRIDGE_MODE) && ((UsingMemoryMapInput()) || (channelTester->Testing()) || (getAlwaysTransmit()))) { int E131BridgingInterval = getSettingInt("E131BridgingInterval"); if (!E131BridgingInterval) E131BridgingInterval = 50; SetChannelOutputRefreshRate(1000 / E131BridgingInterval); StartChannelOutputThread(); } if (getFPPmode() & PLAYER_MODE) { if ((FPPstatus == FPP_STATUS_PLAYLIST_PLAYING) || (FPPstatus == FPP_STATUS_STOPPING_GRACEFULLY)) { if (prevFPPstatus == FPP_STATUS_IDLE) { playlist->PlayListPlayingInit(); sleepms = 10000; } // Check again here in case PlayListPlayingInit // didn't find anything and put us back to IDLE if ((FPPstatus == FPP_STATUS_PLAYLIST_PLAYING) || (FPPstatus == FPP_STATUS_STOPPING_GRACEFULLY)) { playlist->PlayListPlayingProcess(); } } int reactivated = 0; if (FPPstatus == FPP_STATUS_IDLE) { if ((prevFPPstatus == FPP_STATUS_PLAYLIST_PLAYING) || (prevFPPstatus == FPP_STATUS_STOPPING_GRACEFULLY)) { playlist->PlayListPlayingCleanup(); if (FPPstatus != FPP_STATUS_IDLE) reactivated = 1; else sleepms = 50000; } } if (reactivated) prevFPPstatus = FPP_STATUS_IDLE; else prevFPPstatus = FPPstatus; scheduler->ScheduleProc(); } else if (getFPPmode() == REMOTE_MODE) { if(mediaOutputStatus.status == MEDIAOUTPUTSTATUS_PLAYING) { playlist->PlaylistProcessMediaData(); } } CheckGPIOInputs(); } StopChannelOutputThread(); ShutdownControlSocket(); if (getFPPmode() == BRIDGE_MODE) Bridge_Shutdown(); LogInfo(VB_GENERAL, "Main Loop complete, shutting down.\n"); }
HRESULT InitD3D( HWND hWnd ) { RECT rc; GetClientRect(hWnd, &rc); UINT width = rc.right - rc.left; UINT height = rc.bottom - rc.top; // Setup a DXGI swap chain descriptor DXGI_SWAP_CHAIN_DESC sd; ZeroMemory( &sd, sizeof( sd ) ); sd.BufferCount = 1; // number of buffer sd.BufferDesc.Width = width; // buffer width, can we set it to the screen width? sd.BufferDesc.Height = height; // buffer height, can we set it to the screen height? sd.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; // buffer format, 32 bit color with alpha(RGBA) sd.BufferDesc.RefreshRate.Numerator = 60; // refresh rate? sd.BufferDesc.RefreshRate.Denominator = 1; // WHAT'S THIS? sd.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT; // use buffer as render target sd.OutputWindow = hWnd; // output window handle sd.SampleDesc.Count = 1; // WHAT'S THIS? sd.SampleDesc.Quality = 0; // WHAT'S THIS? sd.Windowed = TRUE; // full-screen mode // Create device and swap chain HRESULT hr; if (FAILED (hr = D3D10CreateDeviceAndSwapChain( NULL, D3D10_DRIVER_TYPE_HARDWARE, NULL, 0, D3D10_SDK_VERSION, &sd, &g_pSwapChain, &g_pd3dDevice))) { return hr; } // Create render target and bind the back-buffer ID3D10Texture2D* pBackBuffer; // Get a pointer to the back buffer hr = g_pSwapChain->GetBuffer(0, __uuidof(ID3D10Texture2D), (LPVOID* )&pBackBuffer); if (FAILED(hr)) return hr; // Create a render-target view g_pd3dDevice->CreateRenderTargetView(pBackBuffer, NULL, &g_pRenderTargetView); // Bind the view g_pd3dDevice->OMSetRenderTargets(1, &g_pRenderTargetView, NULL); // WHAT'S OM here mean? // Setup the viewport D3D10_VIEWPORT vp; vp.Width = width; // this should be similar with the back-buffer width, global it! vp.Height = height; vp.MinDepth = 0.0f; vp.MaxDepth = 1.0f; vp.TopLeftX = 0; vp.TopLeftY = 0; g_pd3dDevice->RSSetViewports(1, &vp); // Create sphere DXUTCreateSphere(g_pd3dDevice, 3.0f, 20, 20, &g_pSphere); InitWorldViewProjMatrix(hWnd); InitEffects(); InitRasterState(); return S_OK; }
int main(int argc, char *argv[]) { /* Initialize Slideshow variables before the arguments are parsed..*/ InitSlideShow(); DisableScreenSaver(); strcpy((char * ) frame.album_directory,"album"); // album or test_album for debugging.. strcpy((char * ) frame.copy_directory,"Copied"); strcpy((char * ) frame.move_directory,"Moved"); strcpy((char * ) frame.resize_directory,"Resized"); strcpy((char * ) frame.link_directory,"Linked"); /* Parse Commandline arguments >>>>>>>>>>>>>>>>>> */ if (!parseArguments(argc,argv)) { fprintf(stderr,"Invalid arguments\n"); EnableScreenSaver(); return 1; } /* Turn on VSYNC to prevent tearing >>>>>>>>>>>>>>>>>> */ putenv( (char *) "__GL_SYNC_TO_VBLANK=1" ); //putenv( (char *) "__GL_SYNC_TO_VBLANK=1 __GL_YIELD=\"USLEEP\" " ); /* GLUT Initialization >>>>>>>>>>>>>>>>>> */ glutInit(&argc, argv); //Initializing Display Mode should be right after glutInit to ensure the window will get created using the correct flags..! ( double buffering etc ) glutInitDisplayMode(GLUT_RGBA | GLUT_DOUBLE | GLUT_ALPHA | GLUT_DEPTH ); // depth buffer and multisampling disabled for older systems..! |GLUT_MULTISAMPLE | GLUT_DEPTH glutSetOption (GLUT_ACTION_ON_WINDOW_CLOSE ,GLUT_ACTION_CONTINUE_EXECUTION); int width_x=glutGet(GLUT_SCREEN_WIDTH); int width_y=glutGet(GLUT_SCREEN_HEIGHT)-50; // 50 for the lxpanel bar :P fprintf(stderr,"System Resolution is %ux%u\n",width_x,width_y); if (width_x>1024) { width_x=1024; } if (width_y>600) { width_y=600; } char title[512]={0}; sprintf(title,"Flashy Slideshows v%s %s - build %u - %s/%s/%s ",AutoVersion::FULLVERSION_STRING,AutoVersion::STATUS,(unsigned int) AutoVersion::BUILDS_COUNT,AutoVersion::DATE,AutoVersion::MONTH,AutoVersion::YEAR); fprintf(stderr,"Window Resolution is %ux%u\n",width_x,width_y); glutInitWindowSize(width_x,width_y); glutInitWindowPosition(0,0); frame.windowX=0; frame.windowY=0; frame.windowWidth=width_x; frame.windowHeight=width_y; originalWindow = glutCreateWindow(title); if (frame.fullscreen) { frame.fullscreen=0; ToggleFullscreen(); } InitGlut(); /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ /* OpenGL Initialization >>>>>>>>>>>>>>>>> */ glClearColor(0,0,0,0); glEnable(GL_CULL_FACE); glCullFace(GL_BACK); //glEnable(GL_DEPTH_TEST); //glDepthFunc(GL_LESS); //glClearDepth(1.0); // Enables Clearing Of The Depth Buffer if (frame.try_for_best_render_quality) { glEnable(GL_NORMALIZE); glShadeModel(GL_SMOOTH); glHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST); glHint(GL_POINT_SMOOTH_HINT, GL_NICEST); glHint(GL_LINE_SMOOTH_HINT, GL_NICEST); glHint(GL_POLYGON_SMOOTH_HINT, GL_NICEST); } else { glShadeModel(GL_FLAT); } /* LIGHTING , ENABLED ON GOOD RENDERING QUALITY ( TO ENABLE TRANSPARENCY ETC ) */ if (frame.try_for_best_render_quality) { frame.lighting_enabled=1; glEnable(GL_COLOR_MATERIAL); glEnable(GL_LIGHT0); glEnable(GL_LIGHTING); glLightfv(GL_LIGHT0, GL_AMBIENT, light_ambient); glLightfv(GL_LIGHT0, GL_DIFFUSE, light_diffuse); //glLightfv(GL_LIGHT0, GL_SPECULAR, light_specular); //glLightfv(GL_LIGHT0, GL_POSITION, light_position); glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient); glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse); //glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); //glMaterialfv(GL_FRONT, GL_SHININESS, high_shininess); } else { frame.lighting_enabled=0; } /*>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> */ //Now that we have an OpenGL context we can query the maximum texture dimension.. QueryAndSaveGPUAndSystemCapabilities(); /* Initialize WxWidgets */ WxWidgetsContext wxlibstuff; wxlibstuff.OnInit(); fprintf(stderr,"Done with wxWidgets initialization\n"); LoadStockTexturesAndSounds(); InitEffects(); if (!LoadPicturesOfDirectory((char*)frame.album_directory,frame.sort_type,frame.sort_ascending,frame.sort_randomization,frame.recursive)) { EmmitDialogWarning( (char *) "Could not find any pictures in the directory of your selection"); return 0; } frame.total_images=GetTotalViewableFilesInDirectory(); if (!CreateSlideshowPictureStructure(GetTotalViewableFilesInDirectory())) { fprintf(stderr,"Unrecoverable error , could not allocate enough memory for %u Picture structure pointers..\nYou may try to re-run when more RAM will be availiable\n",GetTotalViewableFilesInDirectory()); return 1; } /*At this point we have initialized the picture structures and the slideshow structures so lets make sure that the camera is over an existing picture..! */ PutCameraOverExistingPictureIfItIsOff(); /* Initialize Joystick Thread (if a joystick is connected and detected )*/ StartJoystickControl(); /* Initialize Picture Loading Thread */ loadpicturesthread_id=0; pthread_create( &loadpicturesthread_id, NULL,ManageLoadingPicturesMemory_Thread,0); //This has to happen after LoadStockTexturesAndSounds in order for frame.app_clipart_dir to get populated if (frame.enable_web_interface) { if (!StartWebInterface((char*) "0.0.0.0", 8080 , (char*) frame.album_directory , ( char*) frame.app_clipart_dir)) { // EmmitDialogWarning( (char *) "Could not initialize web interface"); fprintf(stderr,"\n\nCould not initialize web interface\n\n"); } } gettimeofday(&last_frame,0x0); /* Start Rendering */ glutMainLoop(); fprintf(stderr,"Gracefully closing program\n"); if (frame.enable_web_interface) { StopWebInterface(); } EnableScreenSaver(); StopJoystickControl(); UnLoadStockTexturesAndSounds(); DestroySlideshowPictureStructure(); wxlibstuff.OnClose(); return EXIT_SUCCESS; }