Exemplo n.º 1
0
    void Storage::fixColour (osg::Vec4f& color, int cellX, int cellY, int col, int row)
    {
        if (col == ESM::Land::LAND_SIZE-1)
        {
            ++cellY;
            col = 0;
        }
        if (row == ESM::Land::LAND_SIZE-1)
        {
            ++cellX;
            row = 0;
        }
        ESM::Land* land = getLand(cellX, cellY);
        if (land && land->mDataTypes&ESM::Land::DATA_VCLR)
        {
            color.r() = land->mLandData->mColours[col*ESM::Land::LAND_SIZE*3+row*3] / 255.f;
            color.g() = land->mLandData->mColours[col*ESM::Land::LAND_SIZE*3+row*3+1] / 255.f;
            color.b() = land->mLandData->mColours[col*ESM::Land::LAND_SIZE*3+row*3+2] / 255.f;
        }
        else
        {
            color.r() = 1;
            color.g() = 1;
            color.b() = 1;
        }

    }
Exemplo n.º 2
0
ColorGradient::ColorGradient(osg::Vec4f color,int rank)
{
	float off = (1.0-0.1)/(rank-1);
	colors = new osg::Vec4f[rank];
	for(int i=0;i<rank;i++)
	{
		float f = 1-off*i;
		osg::Vec4f tm(color.r()*f,color.g()*f,color.b()*f,f);
		colors[i] = tm;
	}
}