コード例 #1
0
ファイル: mesh.cpp プロジェクト: KPWhiver/DimLib
  void Mesh::updateBuffer(GLfloat const *buffer)
  {
    if(d_interleavedVBO.size() == 0)
      throw log(__FILE__, __LINE__, LogType::error, "Unable to call Mesh::updateBuffer(buffer) on an interleaved mesh");

    d_interleavedVBO.update({d_numOfVertices * numOfElements(), buffer});
  }
コード例 #2
0
ファイル: mesh.cpp プロジェクト: KPWhiver/DimLib
 Mesh::Mesh(GLfloat const *buffer, size_t numOfVertices, internal::AttributeAccessor attribute, Shader::Format format)
   :
     d_formats{{attribute, format}},
     d_instanceFormat(Shader::vec1),
     d_interleavedVBO({numOfVertices * numOfElements(), buffer}),
     d_indexVBO({}),
     d_numOfVertices(numOfVertices),
     d_numOfTriangles(0),
     d_instancingVBO({}),
     d_maxLocations(0)
 {
   // static initialize
   if(s_initialized == false)
     initialize();
 }
コード例 #3
0
ファイル: main.c プロジェクト: andyg7/CodePractice
int processInput(const char * input) {

	bool val = validInput(input);
	if(val == 1) {
		//printf("%s\n", "valid input");
	} else {
		//printf("%s\n", "invalid input");
	}

	if(val == 0) {
		return -1;
	} else {
		int elems = numOfElements(input);
		return elems;
	}
}
コード例 #4
0
ファイル: mesh.cpp プロジェクト: KPWhiver/DimLib
  void Mesh::bind() const
  {
    if(s_bound == d_interleavedVBO.id())
      return;

    s_bound = d_interleavedVBO.id();

    for(auto format : d_formats)
      format.first.enable(format.second);

    // set pointers when we're dealing with an interleaved
    if(d_additionalVBOs.size() == 0)
    {
      uint varNumOfElements = numOfElements();
      size_t offset = 0;
      d_interleavedVBO.bind(Buffer<GLfloat>::data);

      for(auto format : d_formats)
      {
        format.first.set(d_interleavedVBO, format.second, offset, varNumOfElements);
        offset += internal::formatSize(format.second);
      }
    }
    // Set pointers when we're dealing with individual buffer
    else
    {
      d_interleavedVBO.bind(Buffer<GLfloat>::data);
      d_formats[0].first.set(d_interleavedVBO, d_formats[0].second);

      for(uint idx = 0; idx != d_additionalVBOs.size(); ++idx)
      {
        d_additionalVBOs[idx].bind(Buffer<GLfloat>::data);
        d_formats[idx + 1].first.set(d_additionalVBOs[idx], d_formats[idx + 1].second);
      }
    }

    //bindElement();
  }
コード例 #5
0
void CMMCMonitorAO::BuildDriveList()
	{
	WRITELOG( "CMMCMonitorAO::BuildDriveList" ); // DEBUG INFO

	iDriveList.Zero();
    TInt numOfElements( 0 );
    TInt err = DriveInfo::GetUserVisibleDrives( 
    		iFs, iDriveList, numOfElements, 
			KDriveAttExclude | KDriveAttRemote | KDriveAttRom );

#ifdef __WINSCW__
    TFileName systemPath = PathInfo::GetPath( PathInfo::EPhoneMemoryRootPath );
    TInt systemDriveNum( -1 );
    iFs.CharToDrive( systemPath[0], systemDriveNum );
#endif
    
	if ( err != KErrNone )
		{
		WRITELOG1( "CMMCMonitorAO::BuildDriveList with error code: %d", err ); // DEBUG INFO
		
		return;
		}

	TDriveInfo driveInfo;
	for ( TInt i=0; i < KMaxDrives; i++ )
		{
	
#ifdef __WINSCW__
        if ( i == systemDriveNum )
            {
            iDriveList[i] = 0;
            continue;
            }
#endif
	
		if ( iDriveList[i] == KDriveAbsent )
			{
			continue;
			}
		err = iFs.Drive( driveInfo, i );
		if ( err != KErrNone )
			{
			WRITELOG1( "CMMCMonitorAO::BuildDriveList with error code: %d", err ); // DEBUG INFO
			}

		TUint driveStatus;
		err = DriveInfo::GetDriveStatus( iFs, i, driveStatus );
		if ( err != KErrNone )
			{
			WRITELOG1( "CMMCMonitorAO::BuildDriveList with error code2: %d", err ); // DEBUG INFO
			}

#ifdef _DEBUG
		if ( driveStatus & DriveInfo::EDriveInternal )
			{
			WRITELOG1("Drive %d is internal",i);
			}		
		
		WRITELOG2("Drive %d type %d",i,driveInfo.iType);
#endif
		
		if ( !( driveStatus & DriveInfo::EDriveRemovable ) )
			{
			WRITELOG1("Drive %d is not removable",i);
			// check if driver is internal hard disk
			if ( driveInfo.iType != EMediaHardDisk )
				{
				iDriveList[i] = 0;
				continue;
				}
			else
				{
				WRITELOG1("Drive %d is hard disk",i);
				}
			}
		
		if( driveStatus & DriveInfo::EDriveUsbMemory )
		    {
            iDriveList[i] = 0;
            continue;
		    }

		if ( driveInfo.iType == EMediaNotPresent )
			{
			WRITELOG1("Drive %d is not present",i);
			iDriveList[i] = KDriveAbsent;
			continue;
			}

		const TUint32 mediaId = FSUtil::MediaID(iFs, i);
		if ( mediaId == 0 )
			{
			WRITELOG1("Drive %d: MediaId is 0",i);
			iDriveList[i] = KDriveAbsent;
			}
		}
	}