67 #ifndef _graphicsproceduralrotationzoommodifier_cpp
68 #define _graphicsproceduralrotationzoommodifier_cpp
70 #include "Graphics/Procedural/Texture/rotationzoommodifier.h"
72 #include "MathTools/mathtools.h"
81 RotationCenter(0.5,0.5),
102 Real HalfWidth =
static_cast<Real>(Width) * 0.5;
103 Real HalfHeight =
static_cast<Real>(Height) * 0.5;
104 Real XSin = RotSin * -HalfWidth;
105 Real XCos = RotCos * -HalfWidth;
106 Real YSin = RotSin * -HalfHeight;
107 Real YCos = RotCos * -HalfHeight;
120 ColourValue Texel = Buffer.
GetPixel( vt % Height, ut % Width ) * ( 1.0 - uf ) * ( 1.0 - vf );
121 Texel += Buffer.
GetPixel( vt % Height, ( ut + 1 ) % Width ) * uf * ( 1.0 - vf );
122 Texel += Buffer.
GetPixel( ( vt + 1 ) % Height, ut % Width ) * ( 1.0 - uf ) * vf;
123 Texel += Buffer.
GetPixel( ( vt + 1 ) % Height, ( ut + 1 ) % Width ) * uf * vf;
125 Texel.RedChannel = std::min(
Real(1.0),Texel.RedChannel);
126 Texel.GreenChannel = std::min(
Real(1.0),Texel.GreenChannel);
127 Texel.BlueChannel = std::min(
Real(1.0),Texel.BlueChannel);
128 Texel.AlphaChannel = std::min(
Real(1.0),Texel.AlphaChannel);
131 TexU += RotCos * fZoomX;
132 TexV += RotSin * fZoomY;
142 {
return "RotationZoomModifier"; }
166 { this->
Rotation = Rot;
return *
this; }
virtual String GetName() const
Gets the name of this modifier.
ColourChannelType & GetPixel(const Whole X, const Whole Y, const UInt16 Component)
Gets access to the pixel at the specified position in this buffer. the X or Y location go beyond the ...
RotationZoomModifier & SetRotationCenterX(const Real X)
Sets the relative X position on the texture the rotation is to occur around.
virtual void Modify(TextureBuffer &Buffer)
Alters the generated pixels in a TextureBuffer.
Whole GetWidth() const
Get the pixel width of this texture.
int Integer
A datatype used to represent any integer close to.
A modifier that will apply a rotation to the image and optionally zoom in on it.
This is a simple class for holding 4 reals representing the colour any give object or lightsource can...
RotationZoomModifier & SetRotationCenter(const Vector2 &Center)
Sets the relative position on the texture the rotation is to occur around.
RotationZoomModifier & SetRotationCenterY(const Real Y)
Sets the relative Y position on the texture the rotation is to occur around.
float Real
A Datatype used to represent a real floating point number.
RotationZoomModifier()
Blank constructor.
RotationZoomModifier & SetZoomFactorX(const Real X)
Sets the zoom to be applied to the texture on the X axis after rotation.
Real Y
Coordinate on the Y vector.
Real X
Coordinate on the X vector.
This is used to represent a point on a 2 dimentional area, such as a screen.
virtual ~RotationZoomModifier()
Class destructor.
Real Rotation
The amount of rotation to apply in radians.
Vector2 ZoomFactor
The amount of zoom to apply on both axes.
Vector2 RotationCenter
The center position for the rotation to be applied.
A convenience buffer that stores pixel colour values of a texture to be generated.
The bulk of the engine components go in this namspace.
unsigned long Whole
Whole is an unsigned integer, it will be at least 32bits in size.
Whole GetHeight() const
Get the pixel height of this texture.
void SetPixel(const Whole X, const Whole Y, const ColourValue &Colour)
Set colour of a specified pixel using a ColourValue. the X or Y location go beyond the set size of th...
RotationZoomModifier & SetZoomFactor(const Vector2 &Zoom)
Sets the zoom to be applied to the texture after rotation.
RotationZoomModifier & SetRotation(const Real Rot)
Sets the rotation to be applied.
std::string String
A datatype used to a series of characters.
void SetData(const TextureBuffer &Other)
Copies image data from another buffer into this buffer.
RotationZoomModifier & SetZoomFactorY(const Real Y)
Sets the zoom to be applied to the texture on the Y axis after rotation.