Пример #1
0
/* WriteMTL: write a wavefront material library file
*
* mesh   - properly initialized OBJMesh structure
* meshpath  - pathname of the mesh being written
* mtllibname - name of the material library to be written
*/
static void WriteMTL( OBJMesh* mesh, const Path& meshPath, const tstring& materialLibraryName )
{
    FILE* file;
    Material* material;
    uint32_t i;

    Path materialLibraryPath( meshPath.Directory() + materialLibraryName );
    /* open the file */
    file = _tfopen( materialLibraryPath.c_str(), TXT( "w" ) );
    if (!file)
    {
        Log::Error( TXT( "WriteMTL() failed: can't open file \"%s\"." ), materialLibraryPath.c_str() );
    }

    /* spit out a header */
    fprintf(file, "#  \n");
    fprintf(file, "#  Wavefront MTL generated by Core library\n");
    fprintf(file, "#  \n");
    fprintf(file, "#  Core library\n");
    fprintf(file, "#  Nate Robins\n");
    fprintf(file, "#  [email protected]\n");
    fprintf(file, "#  http://www.pobox.com/~ndr\n");
    fprintf(file, "#  \n\n");

    for (i = 0; i < mesh->m_MaterialCount; i++)
    {
        material = &mesh->m_Materials[i];
        fprintf(file, "newmtl %s\n", material->m_Name);
        fprintf(file, "Ka %f %f %f\n", 
            material->m_Ambient[0], material->m_Ambient[1], material->m_Ambient[2]);
        fprintf(file, "Kd %f %f %f\n", 
            material->m_Diffuse[0], material->m_Diffuse[1], material->m_Diffuse[2]);
        fprintf(file, "Ks %f %f %f\n", 
            material->m_Specular[0],material->m_Specular[1],material->m_Specular[2]);
        fprintf(file, "Ns %f\n", material->m_Shininess / 128.0 * MAX_SHININESS);
        fprintf(file, "\n");
    }
}
Пример #2
0
void Tracker::SetProject( Project* project )
{
    bool restartThread = false;
    if ( IsThreadRunning() )
    {
        restartThread = true;
        StopThread();
    }

#pragma TODO("Tidy db")

    m_Project = project;

    if ( m_Project )
    {
        Path dbPath = m_Project->GetTrackerDB();

        if ( !dbPath.MakePath() )
        {
            throw Helium::Exception( TXT( "Could not create database directory: %s" ), dbPath.Directory().c_str() );
        }

#pragma TODO("Init db")

        if ( restartThread )
        {
            StartThread();
        }
    }
}
Пример #3
0
/// Constructor.
///
/// @param[in] rShaderPath  Path to the shader file being processed.
D3DIncludeHandler::D3DIncludeHandler( const Path& rShaderPath )
{
    m_shaderDirectory.Set( rShaderPath.Directory() );
}