Commit 1b371342 authored by nadro's avatar nadro

- revert rotation patch from rev4478. Texture Matrix will be default solution...

- revert rotation patch from rev4478. Texture Matrix will be default solution for manipulate 2d image drawing.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@4480 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 45a8e00f
...@@ -827,11 +827,10 @@ namespace video ...@@ -827,11 +827,10 @@ namespace video
alpha component is used: If alpha is other than 255, the image alpha component is used: If alpha is other than 255, the image
will be transparent. will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of \param useAlphaChannelOfTexture: If true, the alpha channel of
the texture is used to draw the image. the texture is used to draw the image.*/
\param rotation Rotation of the image. */
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f) =0; SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false) =0;
//! Draws a set of 2d images, using a color and the alpha channel of the texture. //! Draws a set of 2d images, using a color and the alpha channel of the texture.
/** The images are drawn beginning at pos and concatenated in /** The images are drawn beginning at pos and concatenated in
...@@ -852,8 +851,7 @@ namespace video ...@@ -852,8 +851,7 @@ namespace video
Note that the alpha component is used. If alpha is other than Note that the alpha component is used. If alpha is other than
255, the image will be transparent. 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of \param useAlphaChannelOfTexture: If true, the alpha channel of
the texture is used to draw the image. the texture is used to draw the image. */
\param rotation Rotation of the image. */
virtual void draw2DImageBatch(const video::ITexture* texture, virtual void draw2DImageBatch(const video::ITexture* texture,
const core::position2d<s32>& pos, const core::position2d<s32>& pos,
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
...@@ -861,8 +859,7 @@ namespace video ...@@ -861,8 +859,7 @@ namespace video
s32 kerningWidth=0, s32 kerningWidth=0,
const core::rect<s32>* clipRect=0, const core::rect<s32>* clipRect=0,
SColor color=SColor(255,255,255,255), SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false, bool useAlphaChannelOfTexture=false) =0;
f32 rotation = 0.f) =0;
//! Draws a set of 2d images, using a color and the alpha channel of the texture. //! Draws a set of 2d images, using a color and the alpha channel of the texture.
/** All drawings are clipped against clipRect (if != 0). /** All drawings are clipped against clipRect (if != 0).
...@@ -879,15 +876,13 @@ namespace video ...@@ -879,15 +876,13 @@ namespace video
Note that the alpha component is used. If alpha is other than Note that the alpha component is used. If alpha is other than
255, the image will be transparent. 255, the image will be transparent.
\param useAlphaChannelOfTexture: If true, the alpha channel of \param useAlphaChannelOfTexture: If true, the alpha channel of
the texture is used to draw the image. the texture is used to draw the image. */
\param rotation Rotation of the image. */
virtual void draw2DImageBatch(const video::ITexture* texture, virtual void draw2DImageBatch(const video::ITexture* texture,
const core::array<core::position2d<s32> >& positions, const core::array<core::position2d<s32> >& positions,
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect=0, const core::rect<s32>* clipRect=0,
SColor color=SColor(255,255,255,255), SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false, bool useAlphaChannelOfTexture=false) =0;
f32 rotation = 0.f) =0;
//! Draws a part of the texture into the rectangle. Note that colors must be an array of 4 colors if used. //! Draws a part of the texture into the rectangle. Note that colors must be an array of 4 colors if used.
/** Suggested and first implemented by zola. /** Suggested and first implemented by zola.
...@@ -898,11 +893,10 @@ namespace video ...@@ -898,11 +893,10 @@ namespace video
\param colors Array of 4 colors denoting the color values of \param colors Array of 4 colors denoting the color values of
the corners of the destRect the corners of the destRect
\param useAlphaChannelOfTexture True if alpha channel will be \param useAlphaChannelOfTexture True if alpha channel will be
blended. blended. */
\param rotation Rotation of the image. */
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect =0,
const video::SColor * const colors=0, bool useAlphaChannelOfTexture=false, f32 rotation = 0.f) =0; const video::SColor * const colors=0, bool useAlphaChannelOfTexture=false) =0;
//! Draws a 2d rectangle. //! Draws a 2d rectangle.
/** \param color Color of the rectangle to draw. The alpha /** \param color Color of the rectangle to draw. The alpha
......
...@@ -1009,7 +1009,7 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture, ...@@ -1009,7 +1009,7 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture, f32 rotation) bool useAlphaChannelOfTexture)
{ {
if (!texture) if (!texture)
return; return;
...@@ -1112,34 +1112,21 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture, ...@@ -1112,34 +1112,21 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture,
setRenderStates2DMode(color.getAlpha()<255, true, useAlphaChannelOfTexture); setRenderStates2DMode(color.getAlpha()<255, true, useAlphaChannelOfTexture);
core::vector2df fpos[4];
fpos[0] = core::vector2df((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y);
fpos[1] = core::vector2df((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y);
fpos[2] = core::vector2df((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y);
fpos[3] = core::vector2df((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y);
if(rotation > 0.f)
{
if(rotation > 360.0f)
rotation = fmodf(rotation, 360.f);
core::vector2d<s32> rcenter = poss.getCenter();
for (u32 i = 0; i < 4; ++i)
fpos[i].rotateBy(rotation, core::vector2df(rcenter.X, rcenter.Y));
}
S3DVertex vtx[4]; S3DVertex vtx[4];
vtx[0] = S3DVertex(fpos[0].X, fpos[0].Y, 0.0f, vtx[0] = S3DVertex((f32)poss.UpperLeftCorner.X,
(f32)poss.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y); tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y);
vtx[1] = S3DVertex(fpos[1].X, fpos[1].Y, 0.0f, vtx[1] = S3DVertex((f32)poss.LowerRightCorner.X,
(f32)poss.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y); tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
vtx[2] = S3DVertex(fpos[2].X, fpos[2].Y, 0.0f, vtx[2] = S3DVertex((f32)poss.LowerRightCorner.X,
(f32)poss.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y); tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
vtx[3] = S3DVertex(fpos[3].X, fpos[3].Y, 0.0f, vtx[3] = S3DVertex((f32)poss.UpperLeftCorner.X,
(f32)poss.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y); tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
...@@ -1157,8 +1144,7 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture, ...@@ -1157,8 +1144,7 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, const video::SColor* const colors,
bool useAlphaChannelOfTexture, bool useAlphaChannelOfTexture)
f32 rotation)
{ {
if(!texture) if(!texture)
return; return;
...@@ -1202,34 +1188,17 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture, ...@@ -1202,34 +1188,17 @@ void CD3D8Driver::draw2DImage(const video::ITexture* texture,
const video::SColor* const useColor = colors ? colors : temp; const video::SColor* const useColor = colors ? colors : temp;
core::vector2df fpos[4];
fpos[0] = core::vector2df((f32)clippedRect.UpperLeftCorner.X, (f32)clippedRect.UpperLeftCorner.Y);
fpos[1] = core::vector2df((f32)clippedRect.LowerRightCorner.X, (f32)clippedRect.UpperLeftCorner.Y);
fpos[2] = core::vector2df((f32)clippedRect.LowerRightCorner.X, (f32)clippedRect.LowerRightCorner.Y);
fpos[3] = core::vector2df((f32)clippedRect.UpperLeftCorner.X, (f32)clippedRect.LowerRightCorner.Y);
if(rotation > 0.f)
{
if(rotation > 360.0f)
rotation = fmodf(rotation, 360.f);
core::vector2d<s32> rcenter = clippedRect.getCenter();
for (u32 i = 0; i < 4; ++i)
fpos[i].rotateBy(rotation, core::vector2df(rcenter.X, rcenter.Y));
}
S3DVertex vtx[4]; // clock wise S3DVertex vtx[4]; // clock wise
vtx[0] = S3DVertex(fpos[0].X, fpos[0].Y, 0.0f, vtx[0] = S3DVertex((f32)clippedRect.UpperLeftCorner.X, (f32)clippedRect.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[0], 0.0f, 0.0f, 0.0f, useColor[0],
tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y); tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y);
vtx[1] = S3DVertex(fpos[1].X, fpos[1].Y, 0.0f, vtx[1] = S3DVertex((f32)clippedRect.LowerRightCorner.X, (f32)clippedRect.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[3], 0.0f, 0.0f, 0.0f, useColor[3],
tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y); tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
vtx[2] = S3DVertex(fpos[2].X, fpos[2].Y, 0.0f, vtx[2] = S3DVertex((f32)clippedRect.LowerRightCorner.X, (f32)clippedRect.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[2], 0.0f, 0.0f, 0.0f, useColor[2],
tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y); tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
vtx[3] = S3DVertex(fpos[3].X, fpos[3].Y, 0.0f, vtx[3] = S3DVertex((f32)clippedRect.UpperLeftCorner.X, (f32)clippedRect.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[1], 0.0f, 0.0f, 0.0f, useColor[1],
tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y); tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
......
...@@ -81,12 +81,12 @@ namespace video ...@@ -81,12 +81,12 @@ namespace video
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false);
//!Draws an 2d rectangle with a gradient. //!Draws an 2d rectangle with a gradient.
virtual void draw2DRectangle(const core::rect<s32>& pos, virtual void draw2DRectangle(const core::rect<s32>& pos,
......
...@@ -1577,8 +1577,7 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture, ...@@ -1577,8 +1577,7 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, const video::SColor* const colors,
bool useAlphaChannelOfTexture, bool useAlphaChannelOfTexture)
f32 rotation)
{ {
if(!texture) if(!texture)
return; return;
...@@ -1602,34 +1601,17 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture, ...@@ -1602,34 +1601,17 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
const video::SColor* const useColor = colors ? colors : temp; const video::SColor* const useColor = colors ? colors : temp;
core::vector2df fpos[4];
fpos[0] = core::vector2df((f32)destRect.UpperLeftCorner.X, (f32)destRect.UpperLeftCorner.Y);
fpos[1] = core::vector2df((f32)destRect.LowerRightCorner.X, (f32)destRect.UpperLeftCorner.Y);
fpos[2] = core::vector2df((f32)destRect.LowerRightCorner.X, (f32)destRect.LowerRightCorner.Y);
fpos[3] = core::vector2df((f32)destRect.UpperLeftCorner.X, (f32)destRect.LowerRightCorner.Y);
if(rotation > 0.f)
{
if(rotation > 360.0f)
rotation = fmodf(rotation, 360.f);
core::vector2d<s32> rcenter = destRect.getCenter();
for (u32 i = 0; i < 4; ++i)
fpos[i].rotateBy(rotation, core::vector2df(rcenter.X, rcenter.Y));
}
S3DVertex vtx[4]; // clock wise S3DVertex vtx[4]; // clock wise
vtx[0] = S3DVertex(fpos[0].X, fpos[0].Y, 0.0f, vtx[0] = S3DVertex((f32)destRect.UpperLeftCorner.X, (f32)destRect.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[0], 0.0f, 0.0f, 0.0f, useColor[0],
tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y); tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y);
vtx[1] = S3DVertex(fpos[1].X, fpos[1].Y, 0.0f, vtx[1] = S3DVertex((f32)destRect.LowerRightCorner.X, (f32)destRect.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[3], 0.0f, 0.0f, 0.0f, useColor[3],
tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y); tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
vtx[2] = S3DVertex(fpos[2].X, fpos[2].Y, 0.0f, vtx[2] = S3DVertex((f32)destRect.LowerRightCorner.X, (f32)destRect.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[2], 0.0f, 0.0f, 0.0f, useColor[2],
tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y); tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
vtx[3] = S3DVertex(fpos[3].X, fpos[3].Y, 0.0f, vtx[3] = S3DVertex((f32)destRect.UpperLeftCorner.X, (f32)destRect.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, useColor[1], 0.0f, 0.0f, 0.0f, useColor[1],
tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y); tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
...@@ -1667,8 +1649,7 @@ void CD3D9Driver::draw2DImageBatch(const video::ITexture* texture, ...@@ -1667,8 +1649,7 @@ void CD3D9Driver::draw2DImageBatch(const video::ITexture* texture,
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect, const core::rect<s32>* clipRect,
SColor color, SColor color,
bool useAlphaChannelOfTexture, bool useAlphaChannelOfTexture)
f32 rotation)
{ {
if (!texture) if (!texture)
return; return;
...@@ -1776,33 +1757,16 @@ void CD3D9Driver::draw2DImageBatch(const video::ITexture* texture, ...@@ -1776,33 +1757,16 @@ void CD3D9Driver::draw2DImageBatch(const video::ITexture* texture,
const core::rect<s32> poss(targetPos, sourceSize); const core::rect<s32> poss(targetPos, sourceSize);
core::vector2df fpos[4]; vtx.push_back(S3DVertex((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y, 0.0f,
fpos[0] = core::vector2df((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y);
fpos[1] = core::vector2df((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y);
fpos[2] = core::vector2df((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y);
fpos[3] = core::vector2df((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y);
if(rotation > 0.f)
{
if(rotation > 360.0f)
rotation = fmodf(rotation, 360.f);
core::vector2d<s32> rcenter = poss.getCenter();
for (u32 i = 0; i < 4; ++i)
fpos[i].rotateBy(rotation, core::vector2df(rcenter.X, rcenter.Y));
}
vtx.push_back(S3DVertex(fpos[0].X, fpos[0].Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y)); tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y));
vtx.push_back(S3DVertex(fpos[1].X, fpos[1].Y, 0.0f, vtx.push_back(S3DVertex((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y)); tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y));
vtx.push_back(S3DVertex(fpos[2].X, fpos[2].Y, 0.0f, vtx.push_back(S3DVertex((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y)); tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y));
vtx.push_back(S3DVertex(fpos[3].X, fpos[3].Y, 0.0f, vtx.push_back(S3DVertex((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y)); tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y));
...@@ -1832,7 +1796,7 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture, ...@@ -1832,7 +1796,7 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
const core::position2d<s32>& pos, const core::position2d<s32>& pos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture, f32 rotation) bool useAlphaChannelOfTexture)
{ {
if (!texture) if (!texture)
return; return;
...@@ -1936,34 +1900,17 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture, ...@@ -1936,34 +1900,17 @@ void CD3D9Driver::draw2DImage(const video::ITexture* texture,
setRenderStates2DMode(color.getAlpha()<255, true, useAlphaChannelOfTexture); setRenderStates2DMode(color.getAlpha()<255, true, useAlphaChannelOfTexture);
core::vector2df fpos[4];
fpos[0] = core::vector2df((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y);
fpos[1] = core::vector2df((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y);
fpos[2] = core::vector2df((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y);
fpos[3] = core::vector2df((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y);
if(rotation > 0.f)
{
if(rotation > 360.0f)
rotation = fmodf(rotation, 360.f);
core::vector2d<s32> rcenter = poss.getCenter();
for (u32 i = 0; i < 4; ++i)
fpos[i].rotateBy(rotation, core::vector2df(rcenter.X, rcenter.Y));
}
S3DVertex vtx[4]; S3DVertex vtx[4];
vtx[0] = S3DVertex(fpos[0].X, fpos[0].Y, 0.0f, vtx[0] = S3DVertex((f32)poss.UpperLeftCorner.X, (f32)poss.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y); tcoords.UpperLeftCorner.X, tcoords.UpperLeftCorner.Y);
vtx[1] = S3DVertex(fpos[1].X, fpos[1].Y, 0.0f, vtx[1] = S3DVertex((f32)poss.LowerRightCorner.X, (f32)poss.UpperLeftCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y); tcoords.LowerRightCorner.X, tcoords.UpperLeftCorner.Y);
vtx[2] = S3DVertex(fpos[2].X, fpos[2].Y, 0.0f, vtx[2] = S3DVertex((f32)poss.LowerRightCorner.X, (f32)poss.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y); tcoords.LowerRightCorner.X, tcoords.LowerRightCorner.Y);
vtx[3] = S3DVertex(fpos[3].X, fpos[3].Y, 0.0f, vtx[3] = S3DVertex((f32)poss.UpperLeftCorner.X, (f32)poss.LowerRightCorner.Y, 0.0f,
0.0f, 0.0f, 0.0f, color, 0.0f, 0.0f, 0.0f, color,
tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y); tcoords.UpperLeftCorner.X, tcoords.LowerRightCorner.Y);
......
...@@ -163,12 +163,12 @@ namespace video ...@@ -163,12 +163,12 @@ namespace video
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false);
//! Draws a set of 2d images, using a color and the alpha channel of the texture. //! Draws a set of 2d images, using a color and the alpha channel of the texture.
virtual void draw2DImageBatch(const video::ITexture* texture, virtual void draw2DImageBatch(const video::ITexture* texture,
...@@ -176,8 +176,7 @@ namespace video ...@@ -176,8 +176,7 @@ namespace video
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect=0, const core::rect<s32>* clipRect=0,
SColor color=SColor(255,255,255,255), SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false, bool useAlphaChannelOfTexture=false);
f32 rotation = 0.f);
//!Draws an 2d rectangle with a gradient. //!Draws an 2d rectangle with a gradient.
virtual void draw2DRectangle(const core::rect<s32>& pos, virtual void draw2DRectangle(const core::rect<s32>& pos,
......
...@@ -736,15 +736,14 @@ void CNullDriver::draw2DImageBatch(const video::ITexture* texture, ...@@ -736,15 +736,14 @@ void CNullDriver::draw2DImageBatch(const video::ITexture* texture,
const core::array<s32>& indices, const core::array<s32>& indices,
s32 kerningWidth, s32 kerningWidth,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture, bool useAlphaChannelOfTexture)
f32 rotation)
{ {
core::position2d<s32> target(pos); core::position2d<s32> target(pos);
for (u32 i=0; i<indices.size(); ++i) for (u32 i=0; i<indices.size(); ++i)
{ {
draw2DImage(texture, target, sourceRects[indices[i]], draw2DImage(texture, target, sourceRects[indices[i]],
clipRect, color, useAlphaChannelOfTexture, rotation); clipRect, color, useAlphaChannelOfTexture);
target.X += sourceRects[indices[i]].getWidth(); target.X += sourceRects[indices[i]].getWidth();
target.X += kerningWidth; target.X += kerningWidth;
} }
...@@ -757,15 +756,14 @@ void CNullDriver::draw2DImageBatch(const video::ITexture* texture, ...@@ -757,15 +756,14 @@ void CNullDriver::draw2DImageBatch(const video::ITexture* texture,
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect, const core::rect<s32>* clipRect,
SColor color, SColor color,
bool useAlphaChannelOfTexture, bool useAlphaChannelOfTexture)
f32 rotation)
{ {
const irr::u32 drawCount = core::min_<u32>(positions.size(), sourceRects.size()); const irr::u32 drawCount = core::min_<u32>(positions.size(), sourceRects.size());
for (u32 i=0; i<drawCount; ++i) for (u32 i=0; i<drawCount; ++i)
{ {
draw2DImage(texture, positions[i], sourceRects[i], draw2DImage(texture, positions[i], sourceRects[i],
clipRect, color, useAlphaChannelOfTexture, rotation); clipRect, color, useAlphaChannelOfTexture);
} }
} }
...@@ -773,12 +771,12 @@ void CNullDriver::draw2DImageBatch(const video::ITexture* texture, ...@@ -773,12 +771,12 @@ void CNullDriver::draw2DImageBatch(const video::ITexture* texture,
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture, f32 rotation) const video::SColor* const colors, bool useAlphaChannelOfTexture)
{ {
if (destRect.isValid()) if (destRect.isValid())
draw2DImage(texture, core::position2d<s32>(destRect.UpperLeftCorner), draw2DImage(texture, core::position2d<s32>(destRect.UpperLeftCorner),
sourceRect, clipRect, colors?colors[0]:video::SColor(0xffffffff), sourceRect, clipRect, colors?colors[0]:video::SColor(0xffffffff),
useAlphaChannelOfTexture, rotation); useAlphaChannelOfTexture);
} }
...@@ -786,7 +784,7 @@ void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s ...@@ -786,7 +784,7 @@ void CNullDriver::draw2DImage(const video::ITexture* texture, const core::rect<s
void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, void CNullDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture, f32 rotation) bool useAlphaChannelOfTexture)
{ {
} }
......
...@@ -167,8 +167,7 @@ namespace video ...@@ -167,8 +167,7 @@ namespace video
s32 kerningWidth = 0, s32 kerningWidth = 0,
const core::rect<s32>* clipRect = 0, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false, bool useAlphaChannelOfTexture=false);
f32 rotation = 0.f);
//! Draws a set of 2d images, using a color and the alpha channel of the texture. //! Draws a set of 2d images, using a color and the alpha channel of the texture.
/** All drawings are clipped against clipRect (if != 0). /** All drawings are clipped against clipRect (if != 0).
...@@ -191,18 +190,17 @@ namespace video ...@@ -191,18 +190,17 @@ namespace video
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect=0, const core::rect<s32>* clipRect=0,
SColor color=SColor(255,255,255,255), SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false, bool useAlphaChannelOfTexture=false);
f32 rotation = 0.f);
//! Draws a 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! Draws a 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false);
//! Draws a 2d rectangle //! Draws a 2d rectangle
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, const core::rect<s32>* clip = 0); virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, const core::rect<s32>* clip = 0);
......
This diff is collapsed.
...@@ -158,13 +158,12 @@ namespace video ...@@ -158,13 +158,12 @@ namespace video
const core::array<core::rect<s32> >& sourceRects, const core::array<core::rect<s32> >& sourceRects,
const core::rect<s32>* clipRect, const core::rect<s32>* clipRect,
SColor color, SColor color,
bool useAlphaChannelOfTexture, bool useAlphaChannelOfTexture);
f32 rotation = 0.f);
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! draws a set of 2d images, using a color and the alpha //! draws a set of 2d images, using a color and the alpha
/** channel of the texture if desired. The images are drawn /** channel of the texture if desired. The images are drawn
...@@ -188,13 +187,12 @@ namespace video ...@@ -188,13 +187,12 @@ namespace video
const core::array<s32>& indices, const core::array<s32>& indices,
const core::rect<s32>* clipRect=0, const core::rect<s32>* clipRect=0,
SColor color=SColor(255,255,255,255), SColor color=SColor(255,255,255,255),
bool useAlphaChannelOfTexture=false, bool useAlphaChannelOfTexture=false);
f32 rotation = 0.f);
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false);
//! draw an 2d rectangle //! draw an 2d rectangle
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
...@@ -288,7 +286,7 @@ namespace video ...@@ -288,7 +286,7 @@ namespace video
//! Can be called by an IMaterialRenderer to make its work easier. //! Can be called by an IMaterialRenderer to make its work easier.
virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial, virtual void setBasicRenderStates(const SMaterial& material, const SMaterial& lastmaterial,
bool resetAllRenderstates, bool fixedPipeline); bool resetAllRenderstates, bool fixedPipeline);
//! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call. //! Compare in SMaterial doesn't check texture parameters, so we should call this on each OnRender call.
virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline); virtual void setTextureRenderStates(const SMaterial& material, bool resetAllRenderstates, bool fixedPipeline);
...@@ -419,10 +417,10 @@ namespace video ...@@ -419,10 +417,10 @@ namespace video
//! Get ZBuffer bits. //! Get ZBuffer bits.
GLenum getZBufferBits() const; GLenum getZBufferBits() const;
//! Get current material. //! Get current material.
const SMaterial& getCurrentMaterial() const; const SMaterial& getCurrentMaterial() const;
//! Get bridge calls. //! Get bridge calls.
COpenGLCallBridge* getBridgeCalls() const; COpenGLCallBridge* getBridgeCalls() const;
...@@ -475,8 +473,8 @@ namespace video ...@@ -475,8 +473,8 @@ namespace video
//! helper function doing the actual rendering. //! helper function doing the actual rendering.
void renderArray(const void* indexList, u32 primitiveCount, void renderArray(const void* indexList, u32 primitiveCount,
scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType); scene::E_PRIMITIVE_TYPE pType, E_INDEX_TYPE iType);
// Bridge calls. // Bridge calls.
COpenGLCallBridge* BridgeCalls; COpenGLCallBridge* BridgeCalls;
core::stringw Name; core::stringw Name;
...@@ -631,10 +629,10 @@ namespace video ...@@ -631,10 +629,10 @@ namespace video
E_DEVICE_TYPE DeviceType; E_DEVICE_TYPE DeviceType;
}; };
//! This bridge between Irlicht pseudo OpenGL calls //! This bridge between Irlicht pseudo OpenGL calls
//! and true OpenGL calls. //! and true OpenGL calls.
class COpenGLCallBridge class COpenGLCallBridge
{ {
public: public:
...@@ -661,7 +659,7 @@ namespace video ...@@ -661,7 +659,7 @@ namespace video
void setCullFaceFunc(GLenum mode); void setCullFaceFunc(GLenum mode);
void setCullFace(bool enable); void setCullFace(bool enable);
// Depth calls. // Depth calls.
void setDepthFunc(GLenum mode); void setDepthFunc(GLenum mode);
...@@ -669,19 +667,19 @@ namespace video ...@@ -669,19 +667,19 @@ namespace video
void setDepthMask(bool enable); void setDepthMask(bool enable);
void setDepthTest(bool enable); void setDepthTest(bool enable);
// Matrix calls. // Matrix calls.
void setMatrixMode(GLenum mode); void setMatrixMode(GLenum mode);
// Texture calls. // Texture calls.
void setActiveTexture(GLenum texture); void setActiveTexture(GLenum texture);
void setClientActiveTexture(GLenum texture); void setClientActiveTexture(GLenum texture);
void setTexture(u32 stage, bool fixedPipeline); void setTexture(u32 stage, bool fixedPipeline);
private: private:
COpenGLDriver* Driver; COpenGLDriver* Driver;
...@@ -700,13 +698,13 @@ namespace video ...@@ -700,13 +698,13 @@ namespace video
GLenum CullFaceMode; GLenum CullFaceMode;
bool CullFace; bool CullFace;
GLenum DepthFunc; GLenum DepthFunc;
bool DepthMask; bool DepthMask;
bool DepthTest; bool DepthTest;
GLenum MatrixMode; GLenum MatrixMode;
GLenum ActiveTexture; GLenum ActiveTexture;
GLenum ClientActiveTexture; GLenum ClientActiveTexture;
......
...@@ -795,7 +795,7 @@ const core::dimension2d<u32>& CSoftwareDriver::getCurrentRenderTargetSize() cons ...@@ -795,7 +795,7 @@ const core::dimension2d<u32>& CSoftwareDriver::getCurrentRenderTargetSize() cons
void CSoftwareDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, void CSoftwareDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture, f32 rotation) bool useAlphaChannelOfTexture)
{ {
if (texture) if (texture)
{ {
......
...@@ -67,7 +67,7 @@ namespace video ...@@ -67,7 +67,7 @@ namespace video
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! draw an 2d rectangle //! draw an 2d rectangle
virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos, virtual void draw2DRectangle(SColor color, const core::rect<s32>& pos,
......
...@@ -2191,7 +2191,7 @@ void CBurningVideoDriver::lightVertex ( s4DVertex *dest, u32 vertexargb ) ...@@ -2191,7 +2191,7 @@ void CBurningVideoDriver::lightVertex ( s4DVertex *dest, u32 vertexargb )
void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>& sourceRect,
const core::rect<s32>* clipRect, SColor color, const core::rect<s32>* clipRect, SColor color,
bool useAlphaChannelOfTexture, f32 rotation) bool useAlphaChannelOfTexture)
{ {
if (texture) if (texture)
{ {
...@@ -2229,7 +2229,7 @@ void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core ...@@ -2229,7 +2229,7 @@ void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, void CBurningVideoDriver::draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect,
const video::SColor* const colors, bool useAlphaChannelOfTexture, f32 rotation) const video::SColor* const colors, bool useAlphaChannelOfTexture)
{ {
if (texture) if (texture)
{ {
......
...@@ -87,12 +87,12 @@ namespace video ...@@ -87,12 +87,12 @@ namespace video
//! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted. //! draws an 2d image, using a color (if color is other then Color(255,255,255,255)) and the alpha channel of the texture if wanted.
virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos, virtual void draw2DImage(const video::ITexture* texture, const core::position2d<s32>& destPos,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); SColor color=SColor(255,255,255,255), bool useAlphaChannelOfTexture=false);
//! Draws a part of the texture into the rectangle. //! Draws a part of the texture into the rectangle.
virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect, virtual void draw2DImage(const video::ITexture* texture, const core::rect<s32>& destRect,
const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0, const core::rect<s32>& sourceRect, const core::rect<s32>* clipRect = 0,
const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false, f32 rotation = 0.f); const video::SColor* const colors=0, bool useAlphaChannelOfTexture=false);
//! Draws a 3d line. //! Draws a 3d line.
virtual void draw3DLine(const core::vector3df& start, virtual void draw3DLine(const core::vector3df& start,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment