当前位置: 首页>>代码示例>>C++>>正文


C++ readFile函数代码示例

本文整理汇总了C++中readFile函数的典型用法代码示例。如果您正苦于以下问题:C++ readFile函数的具体用法?C++ readFile怎么用?C++ readFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了readFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getEtcHostsContent

std::string getEtcHostsContent() {
  std::string content;
  readFile(fs::path(kTestDataPath) / "test_hosts.txt", content);
  return content;
}
开发者ID:friedbutter,项目名称:osquery,代码行数:5,代码来源:test_util.cpp

示例2: procStat

 string procStat()
 {
     string result;
     readFile("/proc/self/stat", result);
     return result;
 }
开发者ID:Redi0,项目名称:zl_reactor,代码行数:6,代码来源:ProcessUtil.cpp

示例3: file

void LogReader::readFile(int i)
{
    qint64 index = configuration.getIndex();
    QString lastLine;

    QFile file(directory.absolutePath()+fileList.at(i));
    if (!file.exists())
        return;
    if (!file.open(QIODevice::ReadOnly)){
        qDebug() << "File not found or can't be read.";
        return;
    }
    qDebug() << "File " + directory.absolutePath()+fileList.at(i) + " opened at " + QDateTime::currentDateTime().toString();

    QTextStream in(&file);
    in.seek(index);

    // O objeto recebe o conteúdo da linha na posição 'index' do arquivo texto
    lastLine = in.readLine();
    /*
     * Testa se o index não aponta para o inicio da linha.
     * Testa se o conteudo do objeto é o mesmo do conteudo do registro salvo.
     * No caso de ser diferente, ele invoca este mesmo programa \
     * para ver se o conteudo do objeto está no outro arquivo.
     * Se no final do processo ele não achar, seta o index como 0 \
     * para que o arquivo seja lido desde o inicio.
    */
    if (lastLine != configuration.getLastLine()) {
        if (i < fileList.size()-1) {
            qDebug() << "Last string readed not found, searching in a older file...";
            readFile(i+1);
        }
        index = 0;
        in.seek(index);
    }

    qDebug() << "Reading file...";
    emit(readToWrite());

    /*
     * Posiciona entrada de dados na última posição lida no arquivo;
     * Como essa linha já foi lida e processada na última vez, ele lê ela
     * e não faz nada, para que no próximo passo ele possa processar dados novos.
     * O objeto lastLine recebe os dados para que caso ele não tenha mais nada que processar,
     * não salve o lastLine em branco no procedimento de salvar.
     */
    while (!in.atEnd()) {
        lastLine = in.readLine();
        //qDebug () << lastLine;
        /*
         * Aqui processará os dados contidos no objeto lastLine
        */
        emit dataReceived(lastLine);
    }

    emit(writenDone());
    /*
     * O valor do index é igual a posição atual no arquivo, diminuido do tamanho do registro anterior,
     * e decrementado 2(duas) unidades, que é o valor do '\n'.
     *
     */
    index = in.pos()-lastLine.size()-2;

    configuration.setIndex(index);
    configuration.setLastLine(lastLine);
    configuration.doWrite();

    file.close();
    qDebug() << "File " + directory.absolutePath()+fileList.at(i) + " closed at " + QDateTime::currentDateTime().toString();
}
开发者ID:gbschenkel,项目名称:ACME,代码行数:70,代码来源:logreader.cpp

示例4: readNode

 virtual ReadResult readNode(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
 {
     return readFile(NODE,fileName,options);
 }
开发者ID:yueying,项目名称:osg,代码行数:4,代码来源:ReaderWriterGZ.cpp

示例5: analyze

/*FGROUP SSM_VME_Access ReadSSM
Analyze SSM memory - like AS python + check of serial versus TTC
*/
int analyze(){    
 int i,j,bit,word,ier;
 //int first=1;
 /*         L0 L1s L2s AE  */
 char *SIGname[]={"ORB","PP ","L0 ","L1s","L1d","L2s","L2d","sBU","lBU","1FF","2FF","ChA","ChB","TBU","PPT","SST","STA","AER"};
 int NPR=6;
 char *PRINT[]={"PP ","L0 ","L1s","L2s","AER","LBH"};
 int COUNT[18]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};  /* COUNT SSM signals */
 int COUNTe[18]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* COUNT errors */
 int COUNTl[18]={0,0,-DISTL0,-DISTL1,0,-DISTL2,0,0,0,0,0,0,0,0,0,0,0,0}; /* How close they can be ? */
 int COUNTa[18]={0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; /* Is signal active ? */
 int DIST[18]={0,0,DISTL0,DISTL1,0,DISTL2,0,0,0,0,0,0,0,0,0,0,1,0}; /* How close the signals can be ? */
 int L1DATA[NL1dat],L2DATA[NL2dat];
 int iL1d=0,iL2d=0,ivmes=0;
 int iorbi=0,ipp=0,ialls=0;
 int isdb=0,iltb=0,il1fi=0,il2fi=0,icha=0,ittcbusy=0,ippt=0;
 if(readFile()!=0) exit(9);
 dump=NULL;
 analTTCB();
 printf("analTTCB finished \n");
 ttcboffset=1;
 for(i=ttcboffset;i<Mega;i++){
   //if(i %10000 ==0)printf("%i \n",i);
   word=SSMem[i];
   // start only after first L0
   //bit= ( (word & 4) == 4);
   //if(bit) first=0;
   //if(first) continue;
   for(j=0;j<18;j++){
    bit= ( (word & (1<<j)) == (1<<j));
    switch(j){
     case  0:    /* ORBIT   */
	   lsig(0,bit,i,COUNT,COUNTa,&iorbi,"ORBIT");  
           break;
     case  1:    /* PREPULSE    */
           lsig(1,bit,i,COUNT,COUNTa,&ipp," PP");
	   break;
     case  2:  /* L0 */
	   ssig(2,bit,i,COUNT,COUNTa,COUNTl,COUNTe,DIST,"L0");
           break;
     case  3:  /* L1s */  	   
	   asig(3,bit,i,COUNT,COUNTa,COUNTl,COUNTe,DIST,"L1S");
           break;
     case  4:   /* L1data */
	   ier=data(4,bit,i,COUNTa,L1DATA,NL1dat,&iL1d,"L1DATA");
           break;
     case  5:   /* L2 strobe */
           asig(5,bit,i,COUNT,COUNTa,COUNTl,COUNTe,DIST,"L2S");
	   break;
     case  6:   /* L2 data */
	   ier=data(6,bit,i,COUNTa,L2DATA,NL2dat,&iL2d,"L2DATA");
           break;
     case  7: /* Sub Detector Busy */
	   lsig(7,bit,i,COUNT,COUNTa,&isdb,"SBUSY");
           break;
     case  8: /* LTU BUSY */
	   lsig(8,bit,i,COUNT,COUNTa,&iltb,"ALLBUSY");
           break;
     case  9: /* L1 FIFO Nearly Full */
	   lsig(9,bit,i,COUNT,COUNTa,&il1fi,"L1NF");
           break;
     case 10: /* L2 FIFO Nearly Full */
	   lsig(10,bit,i,COUNT,COUNTa,&il2fi,"L2NF");
           break;
     case 11: /* Channel A (L0) */
	   lsig(11,bit,i,COUNT,COUNTa,&icha,"ChanA");
           break;
     case 12:    /*  Channel B */
           //channelB(12,bit,i,COUNT,COUNTa,&ichb,TT,"ChanB");
           break;
     case 13:   /* TTC  BUSY */
           lsig(13,bit,i,COUNT,COUNTa,&ittcbusy,"TTCBUSY"); 
           break;
     case 14:          /* PP transmit */
           lsig(14,bit,i,COUNT,COUNTa,&ippt,"PPT"); 
           break;
     case 15:    /*  vme SLAVE strobe  */
	   lsig(15,bit,i,COUNT,COUNTa,&ivmes,"VMES");
           break;
     case 16:   /* START ALL - emulator */
	   //lsig(16,bit,i,COUNT,COUNTa,&ialls,"ALLSTART");
	   break;
     case 17: /* ANY ERROR */
	   ssig(17,bit,i,COUNT,COUNTa,COUNTl,COUNTe,DIST,"ANYERR");
           break;
    }
   }
 }
 // to take into acount signals up in all memory
 lsig(1,0,Mega,COUNT,COUNTa,&ipp," PP");
 lsig(7,0,Mega,COUNT,COUNTa,&isdb,"SBUSY");
 lsig(8,0,Mega,COUNT,COUNTa,&iltb,"ALLBUSY");
 lsig(9,0,Mega,COUNT,COUNTa,&il1fi,"L1NF");
 lsig(10,0,Mega,COUNT,COUNTa,&il2fi,"L2NF");
 lsig(11,0,Mega,COUNT,COUNTa,&icha,"LBHALT");
 //lsig(12,0,Mega,COUNT,COUNTa,&ivmem,"VMEM");
 lsig(13,0,Mega,COUNT,COUNTa,&ittcbusy,"TTCBUSY"); 
//.........这里部分代码省略.........
开发者ID:AakaFosfor,项目名称:trigger,代码行数:101,代码来源:ssmanls1.c

示例6: INFO

void TutorialLevel::setup(){
    INFO("Generating Tutorial Level...");
    readFile();
    initalizeGrid();
    createRenders();
    createLevel();
    waterSurfaceManager = WaterSurfaceManagerPtr(new WaterSurfaceManager());
    addGameObject(waterSurfaceManager);
    INFO("Removal String so less of make");
    INFO("Setting up the cameras for the Test Level...");
    CameraPtr cam3(new Camera(glm::vec3(25, 30, 0), glm::vec3(10, 20, 6),
                             glm::vec3(0, 1, 0)));
    cam3->setProjectionMatrix(
        glm::perspective(glm::radians(90.0f),
                        (float) Global::ScreenWidth/Global::ScreenHeight,
                        0.1f, 100.f));

    addCamera("CinematicCamera", cam3);
    setMainCamera("CinematicCamera");
    setCullingCamera("CinematicCamera");

    CameraPtr cam1(new Camera(glm::vec3(4, 10, -5), glm::vec3(4, 4, -10),
                              glm::vec3(0, 1, 0)));
    cam1->setProjectionMatrix(
        glm::perspective(glm::radians(90.0f),
                         (float) Global::ScreenWidth/Global::ScreenHeight,
                         0.1f, 100.f));
    addCamera("Camera1", cam1);
 
    CameraPtr cam2(new Camera(glm::vec3(0, 1, 0), glm::vec3(-6, -3, 6),
                              glm::vec3(0, 1, 0)));
    cam2->setProjectionMatrix(
        glm::perspective(glm::radians(90.0f),
                         (float) Global::ScreenWidth/Global::ScreenHeight,
                         0.1f, 100.f));
    l1 = LightPtr(new Light(glm::vec3(1), 30.0f, glm::vec3(0, 30, 0)));
    l1->setPosition(l1->getDirection());

    Uniform3DGridPtr<int> typeGrid = getTypeGrid();
    gridCenter = glm::vec3((typeGrid->getMaxX() - typeGrid->getMinX())/2.0f,
                           (typeGrid->getMaxY() - typeGrid->getMinY())/2.0f,
                           (typeGrid->getMinZ() - typeGrid->getMaxZ())/2.0f);
    l1->setViewMatrix(glm::lookAt(

        l1->getPosition(),
        gridCenter, glm::vec3(0, 1, 0)));
    l1->setProjectionMatrix(glm::ortho<float>(-30,30,-30,30,-70,70));

    addLight("Sun", l1);
    INFO("Setting up the player for the Test Level...");
    cinematicPlayer = CinematicPlayerPtr(new CinematicPlayer(cam3));
    cinematicPlayer->setup();
    addGameObject("cinematicPlayer", cinematicPlayer);

    player = PlayerPtr(new Player(cam1, 2));
    player->setup();
    addGameObject("player" , player);
    CollisionManager::addCollisionObjectToList(player);
    debugPlayer = DebugPlayerPtr(new DebugPlayer(cam2));
    debugPlayer->setup();
    addGameObject("debugPlayer" , debugPlayer);
    //Text
    addCamera("DebugCamera", cam2);

    sky = ObjectPtr(new Object(
        LoadManager::getMesh("sphere.obj"),
        MaterialManager::getMaterial("None")));

    sky->applyTexture(LoadManager::getTexture("Sky"));
    sky->enableTexture();
    sky->scale(glm::vec3(-90.0f,-90.0f,-90.0f));
    sky->translate(Director::getScene()->getCamera()->getEye());
    RenderEngine::getRenderElement("textured")->addObject(sky);

    ExclamationPtr exclamation = ExclamationPtr(new Exclamation(glm::vec3(30, 26, -48)));
    exclamation->setup();
    addGameObject("exclamation", exclamation);
}
开发者ID:Mikegrann,项目名称:flood-fill,代码行数:78,代码来源:tutorial_level.cpp

示例7: readObject

 virtual ReadResult readObject(const std::string& fileName, const osgDB::ReaderWriter::Options* options) const
 {
     return readFile(OBJECT,fileName,options);
 }
开发者ID:yueying,项目名称:osg,代码行数:4,代码来源:ReaderWriterGZ.cpp

示例8: readFile

Status readFile(const fs::path& path, bool blocking) {
  std::string blank;
  return readFile(path, blank, 0, true, false, blocking);
}
开发者ID:nemith,项目名称:osquery,代码行数:4,代码来源:filesystem.cpp

示例9: forensicReadFile

Status forensicReadFile(const fs::path& path,
                        std::string& content,
                        bool blocking) {
  return readFile(path, content, 0, false, true, blocking);
}
开发者ID:nemith,项目名称:osquery,代码行数:5,代码来源:filesystem.cpp

示例10: initialize

// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void VtkStructuredPointsReader::dataCheck()
{
  initialize();
  setErrorCondition(0);

  QFileInfo fi(getInputFile());
  if (getInputFile().isEmpty() == true)
  {
    QString ss = QObject::tr("The input file must be set");
    setErrorCondition(-61000);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }
  else if (fi.exists() == false)
  {
    QString ss = QObject::tr("The input file does not exist");
    setErrorCondition(-61001);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }

  // First shot Sanity Checks.
  if(!getReadCellData() && !getReadPointData())
  {
    QString ss = QObject::tr("At least one of Read Point Data or Read Cell Data must be checked");
    setErrorCondition(-61002);
    notifyErrorMessage(getHumanLabel(), ss, getErrorCondition());
  }

  // Last chance sanity check
  if(getErrorCondition() < 0) { return; }

  // Create a Vertex Data Container even though we may remove it later. We need it later
  // on in order to set the proper AttributeMatrix
  DataContainer::Pointer pointData_DataContainer = getDataContainerArray()->createNonPrereqDataContainer<AbstractFilter>(this, getVertexDataContainerName());
  if(getErrorCondition() < 0 && NULL == pointData_DataContainer) { return; }

  ImageGeom::Pointer pointDataGeom = ImageGeom::CreateGeometry(getVertexDataContainerName());
  pointData_DataContainer->setGeometry(pointDataGeom);

  QVector<size_t> tDims(1, 0);
  AttributeMatrix::Pointer pointAttrMat = pointData_DataContainer->createNonPrereqAttributeMatrix<AbstractFilter>(this, getVertexAttributeMatrixName(), tDims, SIMPL::AttributeMatrixType::Cell);
  if(getErrorCondition() < 0) { return; }

  // Create a Volume Data Container even though we may remove it later. We need it later
  // on in order to set the proper AttributeMatrix
  DataContainer::Pointer cellData_DataContainer = getDataContainerArray()->createNonPrereqDataContainer<AbstractFilter>(this, getVolumeDataContainerName());
  if(getErrorCondition() < 0 && NULL == cellData_DataContainer) { return; }

  ImageGeom::Pointer cellDataGeom = ImageGeom::CreateGeometry(getVolumeDataContainerName());
  cellData_DataContainer->setGeometry(cellDataGeom);

  tDims.resize(3);
  tDims[0] = 0;
  tDims[1] = 0;
  tDims[2] = 0;
  AttributeMatrix::Pointer cellAttrMat = cellData_DataContainer->createNonPrereqAttributeMatrix<AbstractFilter>(this, getCellAttributeMatrixName(), tDims, SIMPL::AttributeMatrixType::Cell);
  if(getErrorCondition() < 0) { return; }

  // Scan through the file
  readFile();

  // now check to see what the user wanted
  if (!getReadPointData())
  {
    getDataContainerArray()->removeDataContainer(getVertexDataContainerName());
  }
  if (!getReadCellData())
  {
    getDataContainerArray()->removeDataContainer(getVolumeDataContainerName());
  }

  // If there was no Cell Data, remove that dataContainer
  if (cellAttrMat->getNumAttributeArrays() == 0)
  {
    getDataContainerArray()->removeDataContainer(getVolumeDataContainerName());
  }

  // If there were no Point Arrays then remove that dataContainer
  if (pointAttrMat->getNumAttributeArrays() == 0)
  {
    getDataContainerArray()->removeDataContainer(getVertexDataContainerName());
  }
}
开发者ID:BlueQuartzSoftware,项目名称:DREAM3D,代码行数:85,代码来源:VtkStructuredPointsReader.cpp

示例11: printf

/** initialization */
bool GameControl::init(const char *configFileName, const char *logFileName, bool restart) 
{
	/** HALT */
    _lastCommand = 'H';
    _lastCommandCounter = 0;

    /** set enabled to true */
    _enabled = true;
    
    /** will be set to true if found */
    _hasSerial = false;
    
    /** default serial device */
    _serialDevice = (char *)"/dev/ttyS0";


    /** default multicast address */
    _multicastAddress = "224.5.23.1";
    
    /** default multicast port */
    _multicastPort = 10001;
  
    printf("checking file\n");
    
    if (!readFile(configFileName)) {
        printf("filename bad.\n");
        fprintf(stderr, "ERROR: Cannot read config file %s\n", configFileName);
        return (false);
    }
    
    printf("filename ok\n");
    
    /* test multicast address and multicast port number */
    printf("MulticastAddress: %s\n", _multicastAddress.c_str());
    printf("MulticastPort: %hd\n", _multicastPort);

    try {
    	
    	_broadcast.setDestination(_multicastAddress.c_str(),_multicastPort);
    	
    }
    catch (UDP_Broadcast::IOError& e)
    {
        std::cerr << "Broadcast: " << e.what() << std::endl;
    }
    
    // a little user output
    print();

    /** open the serial port */
    fprintf(stderr, "Opening Serial Connection on device %s ...\n", _serialDevice);
    if (!_serial.open(_serialDevice, COMM_BAUD_RATE)) {
        fprintf(stderr, "ERROR: Cannot open serial connection..\n");
        //return (false);  // temporarily commented out
    } else {
        _hasSerial = true;
    }
    
    /** intialize the timer */
    _gameInfo.resetTimer();
    _tLast = getCurrentTime();

    if (!_gameInfo.openLog(logFileName)) {
        fprintf(stderr, "ERROR: Cannot open log file %s..\n", logFileName);
        return (false);
    }

    /** restart from saved state */
    if (restart) {
        _gameInfo.load(_saveName);
    }

    return (true);
}
开发者ID:KN2C,项目名称:RoboJackets,代码行数:75,代码来源:GameControl.cpp

示例12: main

int main(void)
{
	Node * headNew = NULL,
			 * tailNew = headNew,
			 * headReady = NULL,            // linked list head pointer
       * tailReady = headReady,       // linked list tail pointer
       * headTerminated = NULL,
       * tailTerminated = headTerminated; 


	pthread_mutex_init(&mutexNew, NULL);
	pthread_mutex_init(&mutexReady, NULL);
	pthread_mutex_init(&mutexTerminated, NULL);

	FILE *ptr_file = NULL;              // File pointer


	// read the file
	readFile(ptr_file, &headNew, &tailNew);
	
	
	time_t startSimTime,
				 endSimTime;
				 
				 
	time(&startSimTime);
	
	pthread_t ThreadA;
	
	
	while(LinkedListgetSize(headTerminated, &mutexTerminated) != jobcount)
	{
		if (headNew)
		{			
			Args1 *args1 = (Args1 *)malloc(sizeof(Args1));
			args1 -> head1 = &headNew;
			args1 -> head2 = &headReady;
			args1 -> tail1 = &tailReady;
			args1 -> head3 = &headTerminated;
			args1 -> tail2 = &tailTerminated;
				
			pthread_create(&ThreadA, NULL, admitted, (void *)args1);
		}
		
		CPUExecution(&headReady, &tailReady, &headTerminated, &tailTerminated);
	}		
	
	
	time(&endSimTime);
	
	
	double throughPut = calcThroughPut(startSimTime, endSimTime);
	double avgWaitTime = calcAvgWaitTime(headTerminated);
	double avgTurnAroundTime = calcAvgTurnAroundTime(startSimTime, headTerminated);
	
	printf("The size of the job queue is: %i\n", LinkedListgetSize(headReady, &mutexReady));
	printf("The size of the terminated queue is: %i\n", LinkedListgetSize(headTerminated, &mutexTerminated));
	
	
	printf("\nThe throughput is: %lf\n", throughPut);
	printf("The avg wait time is: %lf\n", avgWaitTime);
	printf("The avg turn around time is: %lf\n", avgTurnAroundTime);

	pthread_mutex_destroy(&mutexNew);
	pthread_mutex_destroy(&mutexReady);
	
	return 0;
}
开发者ID:jsinoimeri,项目名称:OS-Course-Cpp,代码行数:68,代码来源:part2.c

示例13: myInit

void myInit(void)
{	
	glClearColor(0.0,0.0,0.0,0.0);
	//------------------------------------------------------------Object & Texture
	readFile("/Users/jiharu/svn/594CM/gl_obj/obj/triangular/Shatter1.obj");
	loadTextures();
	
	//DEFINE NIGTHS in some INIT function..
	glEnable(GL_LIGHTING); //enable lighting
	glShadeModel (GL_SMOOTH); //GL_SMOOTH, GL_FLAT
#pragma mark -
#pragma mark light
	//------------------------------------------------------------Light
	//define the lighting model
	float ambient[] = {0.08, 0.08, 0.01, 1.0};
	float diffuse[] = {0.7, 0.7, 0.0, 1.0};
	float specular[] = {0.3, 0.3, 0.3, 1.0};
	
	glEnable(GL_LIGHT0); //turn on one of the lights
	//	glDisable(GL_LIGHT0);
	glLightfv(GL_LIGHT0, GL_AMBIENT, ambient);
	glLightfv(GL_LIGHT0, GL_DIFFUSE, diffuse);	
	glLightfv(GL_LIGHT0, GL_SPECULAR, specular);
	
	//------------------------------------------------------------Spot Light 1, 2, & 3
	float spot_direction1[] = { 0.0, -1.0, 0.0 }; 
	float ambient1[] = {0.01, .2, 0.5, 1.0};
	float diffuse1[] = {0.01, 0.5, 0.5, 1.0};
	float specular1[] = {0.0, 0.3, 1.0, 1.0};
	
	glEnable(GL_LIGHT1); //turn on one of the lights
	//	glDisable(GL_LIGHT1);	
	glLightfv(GL_LIGHT1, GL_AMBIENT, ambient1);
	glLightfv(GL_LIGHT1, GL_DIFFUSE, diffuse1);	
	glLightfv(GL_LIGHT1, GL_SPECULAR, specular1);
	
	glLightfv(GL_LIGHT1, GL_SPOT_DIRECTION, spot_direction1);
	glLightf(GL_LIGHT1, GL_CONSTANT_ATTENUATION, 1.5); 
	glLightf(GL_LIGHT1, GL_LINEAR_ATTENUATION, 0.5); 
	glLightf(GL_LIGHT1, GL_QUADRATIC_ATTENUATION, 0.2);
	glLightf (GL_LIGHT1, GL_SPOT_CUTOFF, 30.0);	// degrees
	glLightf (GL_LIGHT1, GL_SPOT_EXPONENT, 2.0);
	
	float spot_direction2[] = { 0.0, -1.0, 0.0 }; 	
	float ambient2[] = {0.9, 0.1, 0.01, 1.0};
	float diffuse2[] = {0.9, 0.5, 0.0, 1.0};
	float specular2[] = {1.0, 0.1, 0.1, 1.0};
	
	glEnable(GL_LIGHT2); //turn on one of the lights
	//	glDisable(GL_LIGHT2);	
	glLightfv(GL_LIGHT2, GL_AMBIENT, ambient2);
	glLightfv(GL_LIGHT2, GL_DIFFUSE, diffuse2);	
	glLightfv(GL_LIGHT2, GL_SPECULAR, specular2);
	
	glLightfv(GL_LIGHT2, GL_SPOT_DIRECTION, spot_direction2);
	glLightf(GL_LIGHT2, GL_CONSTANT_ATTENUATION, 1.5); 
	glLightf(GL_LIGHT2, GL_LINEAR_ATTENUATION, 0.8); 
	glLightf(GL_LIGHT2, GL_QUADRATIC_ATTENUATION, 0.2);
	glLightf (GL_LIGHT2, GL_SPOT_CUTOFF, 45.0);	// degrees
	glLightf (GL_LIGHT2, GL_SPOT_EXPONENT, 1.0);
		
	float spot_direction3[] = { .5, -1.0, 0.0 }; 
	float ambient3[] = {0.5, 0.5, 0.5, 1.0};
	float diffuse3[] = {1.0, 1.0, 1.0, 1.0};
	float specular3[] = {1.0, 1.0, 1.0, 1.0};
	
	glEnable(GL_LIGHT3); //turn on one of the lights
	//	glDisable(GL_LIGHT2);	
	glLightfv(GL_LIGHT3, GL_AMBIENT, ambient3);
	glLightfv(GL_LIGHT3, GL_DIFFUSE, diffuse3);	
	glLightfv(GL_LIGHT3, GL_SPECULAR, specular3);
	
	glLightfv(GL_LIGHT3, GL_SPOT_DIRECTION, spot_direction3);
	glLightf(GL_LIGHT3, GL_CONSTANT_ATTENUATION, 0.5); 
	glLightf(GL_LIGHT3, GL_LINEAR_ATTENUATION, 0.8); 
	glLightf(GL_LIGHT3, GL_QUADRATIC_ATTENUATION, 0.2);
	glLightf (GL_LIGHT3, GL_SPOT_CUTOFF, 45.0);	// degrees
	glLightf (GL_LIGHT3, GL_SPOT_EXPONENT, 2.0);
	
	#pragma mark material
	//------------------------------------------------------------material
	//define the material of the object
	float mat_shininess[] = { 50. };
	float mat_ambient[] = { 0.7, 0.7, 0.7, 1.0 };
	float mat_diffuse[] = { 0.1, 0.5, 0.8, 1.0 };
	float mat_specular[] = { 1.0, 1.0, 1.0, 1.0 };
	float mat_emission[] = {1.0, 0.1, 0.1, 1.0};
	
	glMaterialfv(GL_FRONT, GL_AMBIENT, mat_ambient);
	glMaterialfv(GL_FRONT, GL_SPECULAR, mat_specular); 
	glMaterialfv(GL_FRONT, GL_SHININESS, mat_shininess); 
	glMaterialfv(GL_FRONT, GL_DIFFUSE, mat_diffuse);
	glMaterialfv(GL_FRONT, GL_EMISSION, mat_emission); 
	
	glClearColor(0.0, 0.0, 0.0, 0.0);
	glClearAccum(0.0, 0.0, 0.0, 0.0);
	
	checkForGLErrors("clearInit");
}
开发者ID:jiharu,项目名称:594CM--JiHaru-,代码行数:99,代码来源:1_4_1_blendMask.cpp

示例14: getEtcProtocolsContent

std::string getEtcProtocolsContent() {
  std::string content;
  readFile(fs::path(kTestDataPath) / "test_protocols.txt", content);
  return content;
}
开发者ID:friedbutter,项目名称:osquery,代码行数:5,代码来源:test_util.cpp

示例15: readFile

PLYPMVS_Reader::PLYPMVS_Reader(const char* fileP):IOInterface(fileP){
	readFile();
}
开发者ID:caomw,项目名称:workflow-3d,代码行数:3,代码来源:IO.cpp


注:本文中的readFile函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。