// INTERNAL INCLUDES
#include <dali/integration-api/debug.h>
-#include <dali/internal/render/common/vertex.h>
#include <dali/internal/render/gl-resources/context.h>
#include <dali/internal/common/image-sampler.h>
}
}
-void Texture::MapUV(unsigned int numVerts,Vertex2D *verts, const PixelArea* pixelArea)
-{
- MapUV(numVerts, (float*)(&verts->mU), sizeof(Vertex2D)/sizeof(float), pixelArea);
-}
-
-void Texture::MapUV(unsigned int numVerts, float* verts, unsigned int stride, const PixelArea* pixelArea)
-{
- UvRect uv;
-
- GetTextureCoordinates(uv, pixelArea);
-
- float uScale = fabsf(uv.u2 - uv.u0);
- float vScale = fabsf(uv.v2 - uv.v0);
-
- for (unsigned int i = 0; i < numVerts; ++i)
- {
- verts[0] = uv.u0 + verts[0] * uScale;
- verts[1] = uv.v0 + verts[1] * vScale;
- verts += stride;
- }
-}
-
unsigned int Texture::GetWidth() const
{
return mWidth;
return mHeight;
}
-void Texture::GetTextureCoordinates(UvRect& uv, const PixelArea* pixelArea)
-{
- if( pixelArea == NULL )
- {
- GetDefaultTextureCoordinates(uv);
- return;
- }
-
- // pre-calulate the normalized values
-
- const float uScale = 1.0f / float(mWidth);
- const float vScale = 1.0f / float(mHeight);
- const float x = uScale * float(pixelArea->x);
- const float y = vScale * float(pixelArea->y);
- const float width = uScale * float(pixelArea->width);
- const float height = vScale * float(pixelArea->height);
-
-
- // bottom left
- uv.u0 = x;
- uv.v0 = y;
-
- // top right
- uv.u2 = x + width;
- uv.v2 = y + height;
-
-};
-
-void Texture::GetDefaultTextureCoordinates(UvRect& uv) const
-{
- if ((mWidth == mImageWidth) && (mHeight == mImageHeight))
- {
- // set the uv's to display 0,0 to 1,1
- uv.Reset();
- return;
- }
-
- // the texture co-ordinates go from 0 to 1. But the image is smaller than the
- // texture, so we need to adjust the uv values.
- float uScale = float(mImageWidth) / float(mWidth);
- float vScale = float(mImageHeight) / float(mHeight);
-
- // bottom left
- uv.u0 = 0.0f;
- uv.v0 = 0.0f;
-
- // top right
- uv.u2 = uScale;
- uv.v2 = vScale;
-
-}
-
void Texture::ApplyFilterModeParameter( TextureUnit unit, GLint filterType, FilterMode::Type currentFilterMode, FilterMode::Type newFilterMode, GLint daliDefault, GLint systemDefault )
{
GLint newFilterModeGL = FilterModeToGL( newFilterMode, daliDefault, systemDefault );