NmtReader::NmtReader() { addReader(FragShader, [](const char *data, uint offset, MaterialData *mat, void *) { logMsg("shader"); uint length = 0; memcpy(&length, data + offset, sizeof(uint)); if(length) { core::String shader(data + offset + sizeof(uint), length); mat->prog = ShaderProgram(new Shader<FragmentShader>(shader)); } }); addReader(RenderData, [](const char *data, uint offset, MaterialData *mat, void *) { logMsg("data"); memcpy(&mat->render, data + offset, sizeof(mat->render)); }); addReader(TextureName, [](const char *data, uint offset, MaterialData *mat, void *) { logMsg("texture"); uint length = 0; memcpy(&length, data + offset, sizeof(uint)); if(length) { uint id = 0; memcpy(&id, data + offset + sizeof(uint), sizeof(uint)); core::String texName(data + offset + 2 * sizeof(uint), length); mat->surface.textures[id] = Texture(ImageLoader::load<core::String>(texName), true); } }); }
Stage& PipelineManager::makeReader(StageCreationOptions& o) { if (o.m_driver.empty()) { o.m_driver = StageFactory::inferReaderDriver(o.m_filename); if (o.m_driver.empty()) throw pdal_error("Cannot determine reader for input file: " + o.m_filename); } if (!o.m_filename.empty()) o.m_options.replace("filename", o.m_filename); Stage& reader = addReader(o.m_driver); reader.setTag(o.m_tag); setOptions(reader, o.m_options); return reader; }
Stage& PipelineManager::makeReader(const std::string& inputFile, std::string driver) { if (driver.empty()) { driver = StageFactory::inferReaderDriver(inputFile); if (driver.empty()) throw pdal_error("Cannot determine reader for input file: " + inputFile); } Options options; if (!inputFile.empty()) options.add("filename", inputFile); Stage& reader = addReader(driver); setOptions(reader, options); return reader; }
sageBlockQueue::sageBlockQueue(int len) : full(false), curLen(0), active(true), pointerNum(0), maxPointerID(0), listLock(NULL), notEmpty(NULL), pixelPassed(false) { queueLock = (pthread_mutex_t*)malloc(sizeof(pthread_mutex_t)); pthread_mutex_init(queueLock, NULL); pthread_mutex_unlock(queueLock); notFull = (pthread_cond_t*)malloc(sizeof(pthread_cond_t)); pthread_cond_init(notFull, NULL); maxLen = len; head = tail = NULL; for (int i=0; i<MAX_ENDPOINT_NUM; i++) { pointerList[i] = &invalid; skipFrame[i] = -1; lastFrame[i] = 0; lastPixelFrame[i] = 1; } addReader(); }