bool KinectPlugin::activate() { InputPlugin::activate(); loadSettings(); if (_enabled) { // register with userInputMapper auto userInputMapper = DependencyManager::get<controller::UserInputMapper>(); userInputMapper->registerDevice(_inputDevice); return initializeDefaultSensor(); } else { return false; } }
int TextureManager::init(char *errorString) { // Free everything if there was something before. releaseAll(); int retVal = initializeDefaultSensor(errorString); if (retVal != 0) return retVal; // create small and large rendertarget texture createRenderTargetTexture(errorString, X_OFFSCREEN, Y_OFFSCREEN, TM_OFFSCREEN_NAME); createRenderTargetTexture(errorString, X_HIGHLIGHT, Y_HIGHLIGHT, TM_HIGHLIGHT_NAME); createNoiseTexture(errorString, TM_NOISE_NAME); createNoiseTexture3D(errorString, TM_NOISE3D_NAME); // Create texture for depth sensor (kinect) CreateSensorTexture(errorString, TM_DEPTH_SENSOR_NAME); // Go throught the textures directory and load all textures. HANDLE hFind = INVALID_HANDLE_VALUE; WIN32_FIND_DATA ffd; // Go to first file in textures directory char *dirname = TM_DIRECTORY TM_SHADER_WILDCARD; hFind = FindFirstFile(TM_DIRECTORY TM_SHADER_WILDCARD, &ffd); if (hFind == INVALID_HANDLE_VALUE) { sprintf_s(errorString, MAX_ERROR_LENGTH, "IO Error\nThere are no textures in " TM_DIRECTORY); return -1; } // Load all the textures in the directory do { // Note that the number of textures is increased automatically int retVal = loadTGA(ffd.cFileName, errorString); if (retVal) return retVal; } while (FindNextFile(hFind, &ffd)); return 0; }