1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU Affero General Public License as
6 // published by the Free Software Foundation, either version 3 of the
7 // License, or (at your option) any later version.
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU Affero General Public License for more details.
14 // You should have received a copy of the GNU Affero General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
20 //#include "nel/3d/material_user.h"
21 #include "nel/misc/geom_ext.h"
22 #include "nel/misc/debug.h"
26 // ***************************************************************************
27 void drawBitmapTiled ( NL3D::UDriver
* /* driver */, float /* x */, float /* y */, float /* width */, float /* height */, uint32
/* windowWidth */, uint32
/* windowHeight */, NL3D::UTextureFile
& /* texture */, uint32
/* textureWidth */, uint32
/* textureHeight */, bool /* blend */, NLMISC::CRGBA
/* col */)
30 // Sorry for this. (Hulud) :)
31 /* nlassert( driver );
33 NL3D::CMaterialUser material;
34 material.setTexture(&texture);
35 material.setColor(col);
36 material.setBlend(blend);
41 quad.V1.set(x+width,y,0);
42 quad.V2.set(x+width,y+height,0);
43 quad.V3.set(x,y+height,0);
45 if ( textureWidth !=0 && textureHeight != 0 )
47 // compute values (control size in pixels / texture size in pixels)
48 const float controlW = windowWidth * width;
49 const float controlH = windowHeight * height;
51 if (controlH > textureHeight)
54 quad.Uv0.V= controlH / textureHeight + 1.0f;
56 quad.Uv1.U= controlW / textureWidth;
57 quad.Uv1.V= quad.Uv0.V;
59 quad.Uv2.U= quad.Uv1.U ;
60 quad.Uv2.V= quad.Uv0.V - float( (int)(quad.Uv0.V) );
63 quad.Uv3.V= quad.Uv2.V;
70 quad.Uv1.U= controlW / textureWidth;
71 quad.Uv1.V= quad.Uv0.V;
73 quad.Uv2.U= quad.Uv1.U ;
74 quad.Uv2.V= 1.0f - controlH / textureHeight ;
77 quad.Uv3.V= quad.Uv2.V;
92 driver->drawQuad(quad, material);*/