Fix css style order when using external css files
[ryzomcore.git] / ryzom / client / src / graphic.cpp
blob3faf0283341c2fda9d7505733019034f9de5b36a
1 // Ryzom - MMORPG Framework <http://dev.ryzom.com/projects/ryzom/>
2 // Copyright (C) 2010 Winch Gate Property Limited
3 //
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.
8 //
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/>.
17 #include "stdpch.h"
20 //#include "nel/3d/material_user.h"
21 #include "nel/misc/geom_ext.h"
22 #include "nel/misc/debug.h"
23 #include "graphic.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);
38 NLMISC::CQuadUV quad;
40 quad.V0.set(x,y,0);
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)
53 quad.Uv0.U= 0.f;
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) );
62 quad.Uv3.U= 0.f;
63 quad.Uv3.V= quad.Uv2.V;
65 else
67 quad.Uv0.U= 0.0f;
68 quad.Uv0.V= 1.0f;
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 ;
76 quad.Uv3.U= 0.f;
77 quad.Uv3.V= quad.Uv2.V;
80 else
82 quad.Uv0.U= 0.f;
83 quad.Uv0.V= 1.f;
84 quad.Uv1.U= 1.f;
85 quad.Uv1.V= 1.f;
86 quad.Uv2.U= 1.f;
87 quad.Uv2.V= 0.f;
88 quad.Uv3.U= 0.f;
89 quad.Uv3.V= 0.f;
92 driver->drawQuad(quad, material);*/