Exemple #1
0
Sky::Sky( DBCFile::Iterator data )
{
	pos = Vec3D( data->getFloat( LightDB::PositionX ) / skymul, data->getFloat( LightDB::PositionY ) / skymul, data->getFloat( LightDB::PositionZ ) / skymul );
	r1 = data->getFloat( LightDB::RadiusInner ) / skymul;
	r2 = data->getFloat( LightDB::RadiusOuter ) / skymul;
	//gLog( "New sky (%i) at (%f,%f,%f) with (%f > %f).\n", data->getInt( LightDB::ID ), pos.x, pos.y, pos.z, r1, r2 );

	for (int i=0; i<36; i++) 
		mmin[i] = -2;

	global = ( pos.x == 0.0f && pos.y == 0.0f && pos.z == 0.0f );

	int FirstId = data->getInt( LightDB::DataIDs ) * 18;

	for( int i = 0; i < 18; i++ ) 
	{
		try {
			DBCFile::Record rec = gLightIntBandDB.getByID( FirstId + i );
			int entries = rec.getInt( LightIntBandDB::Entries );

			if ( entries == 0 ) 
				mmin[i] = -1;
			else 
			{
				mmin[i] = rec.getInt( LightIntBandDB::Times );
				for( int l = 0; l < entries; l++ ) 
				{
					SkyColor sc( rec.getInt( LightIntBandDB::Times + l ), rec.getInt( LightIntBandDB::Values + l ) );
					colorRows[i].push_back( sc );
				}
			}
		} catch (LightIntBandDB::NotFound) {
		}
	}
}
Exemple #2
0
Sky::Sky(DBCFile::Iterator data)
{
    pos = Vec3D(data->getFloat(LightDB::PositionX) / skymul, data->getFloat(LightDB::PositionY) / skymul, data->getFloat(LightDB::PositionZ) / skymul);
    r1 = data->getFloat(LightDB::RadiusInner) / skymul;
    r2 = data->getFloat(LightDB::RadiusOuter) / skymul;

    for (int i = 0; i<36; ++i)
        mmin[i] = -2;

    global = (pos.x == 0.0f && pos.y == 0.0f && pos.z == 0.0f);

    int FirstId = data->getInt(LightDB::DataIDs) * 18 - 17; // cromons light fix ;) Thanks

    for (int i = 0; i < 18; ++i)
    {
        try
        {
            DBCFile::Record rec = gLightIntBandDB.getByID(FirstId + i);
            int entries = rec.getInt(LightIntBandDB::Entries);

            if (entries == 0)
                mmin[i] = -1;
            else
            {
                mmin[i] = rec.getInt(LightIntBandDB::Times);
                for (int l = 0; l < entries; l++)
                {
                    SkyColor sc(rec.getInt(LightIntBandDB::Times + l), rec.getInt(LightIntBandDB::Values + l));
                    colorRows[i].push_back(sc);
                }
            }
        }
        catch (...)
        {
            LogError << "When trying to intialize sky " << data->getInt(LightDB::ID) << ", there was an error with getting an entry in a DBC (" << i << "). Sorry." << std::endl;
            DBCFile::Record rec = gLightIntBandDB.getByID(i);
            int entries = rec.getInt(LightIntBandDB::Entries);

            if (entries == 0)
                mmin[i] = -1;
            else
            {
                mmin[i] = rec.getInt(LightIntBandDB::Times);
                for (int l = 0; l < entries; l++)
                {
                    SkyColor sc(rec.getInt(LightIntBandDB::Times + l), rec.getInt(LightIntBandDB::Values + l));
                    colorRows[i].push_back(sc);
                }
            }
        }
    }



    /*
    unsigned int SKYFOG = data->getInt( LightDB::DataIDs );
    unsigned int ID = data->getInt( LightDB::ID );
    DBCFile::Record rec = gLightParamsDB.getByID( SKYFOG );
    unsigned int skybox = rec.getInt( LightParamsDB::skybox);


    if ( skybox == 0 )
    alt_sky=NULL;
    else{
    DBCFile::Record rec = gLightSkyboxDB.getByID(skybox);
    std::string skyname= rec.getString(LightSkyboxDB::filename);
    alt_sky=new Model(skyname); // if this is ever uncommented, use ModelManager::
    Log << "Loaded sky " << skyname << std::endl;
    }

    */

}