Dali 3D User Interface Engine
Functions | Variables
Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp} Namespace Reference

Functions

const char *const RENDERER_TYPE ("rendererType")
 
const char *const RENDERER_TYPE_VALUE ("nPatch")
 
const char *const IMAGE_URL_NAME ("imageUrl")
 
const char *const BORDER_ONLY ("borderOnly")
 
Geometry GenerateGeometry (const Vector< Vector2 > &vertices, const Vector< unsigned int > &indices)
 Creates the geometry formed from the vertices and indices. More...
 
void AddQuadIndices (Vector< unsigned int > &indices, unsigned int rowIdx, unsigned int nextRowIdx)
 Adds the indices to form a quad composed off two triangles where the indices are organised in a grid. More...
 
void AddVertex (Vector< Vector2 > &vertices, unsigned int x, unsigned int y)
 
void RegisterStretchProperties (Material &material, const char *uniformName, const NinePatchImage::StretchRanges &stretchPixels, uint16_t imageExtent)
 

Variables

std::string TEXTURE_UNIFORM_NAME = "sTexture"
 
const char * VERTEX_SHADER
 
const char * VERTEX_SHADER_3X3
 
const char * FRAGMENT_SHADER
 

Function Documentation

void Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::AddQuadIndices ( Vector< unsigned int > &  indices,
unsigned int  rowIdx,
unsigned int  nextRowIdx 
)

Adds the indices to form a quad composed off two triangles where the indices are organised in a grid.

Parameters
[out]indicesThe indices to add to
[in]rowIdxThe row index to start the quad
[in]nextRowIdxThe index to the next row

Definition at line 159 of file npatch-renderer.cpp.

References Dali::Vector< T, IsTrivialType >::PushBack().

Referenced by Dali::Toolkit::Internal::NPatchRenderer::CreateGeometry(), and Dali::Toolkit::Internal::NPatchRenderer::CreateGeometryBorder().

Here is the call graph for this function:

Here is the caller graph for this function:

void Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::AddVertex ( Vector< Vector2 > &  vertices,
unsigned int  x,
unsigned int  y 
)

Definition at line 170 of file npatch-renderer.cpp.

References Dali::Vector< T, IsTrivialType >::PushBack().

Referenced by Dali::Toolkit::Internal::NPatchRenderer::CreateGeometry(), and Dali::Toolkit::Internal::NPatchRenderer::CreateGeometryBorder().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* const Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::BORDER_ONLY ( "borderOnly"  )
Geometry Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::GenerateGeometry ( const Vector< Vector2 > &  vertices,
const Vector< unsigned int > &  indices 
)

Creates the geometry formed from the vertices and indices.

Parameters
[in]verticesThe vertices to generate the geometry from
[in]indicesThe indices to generate the geometry from
Returns
The geometry formed from the vertices and indices

Definition at line 126 of file npatch-renderer.cpp.

References Dali::Geometry::AddVertexBuffer(), Dali::Property::INTEGER, Dali::Property::Map(), Dali::Geometry::New(), Dali::PropertyBuffer::New(), Dali::PropertyBuffer::SetData(), Dali::Geometry::SetIndexBuffer(), Dali::VectorBase::Size(), and Dali::Property::VECTOR2.

Here is the call graph for this function:

const char* const Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::IMAGE_URL_NAME ( "imageUrl"  )
void Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::RegisterStretchProperties ( Material &  material,
const char *  uniformName,
const NinePatchImage::StretchRanges &  stretchPixels,
uint16_t  imageExtent 
)

Definition at line 175 of file npatch-renderer.cpp.

References Dali::Vector< T, IsTrivialType >::Begin(), Dali::Vector< T, IsTrivialType >::End(), and Dali::Handle::RegisterProperty().

Referenced by Dali::Toolkit::Internal::NPatchRenderer::ApplyImageToSampler().

Here is the call graph for this function:

Here is the caller graph for this function:

const char* const Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::RENDERER_TYPE ( "rendererType"  )
const char* const Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::RENDERER_TYPE_VALUE ( "nPatch"  )

Variable Documentation

const char* Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::FRAGMENT_SHADER
Initial value:
varying mediump vec2 vTexCoord;\n
uniform sampler2D sTexture;\n
uniform lowp vec4 uColor;\n
\n
void main()\n
{\n
gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
}\n
)

Definition at line 108 of file npatch-renderer.cpp.

std::string Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::TEXTURE_UNIFORM_NAME = "sTexture"

Definition at line 50 of file npatch-renderer.cpp.

const char* Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::VERTEX_SHADER
Initial value:
attribute mediump vec2 aPosition;\n
varying mediump vec2 vTexCoord;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
uniform mediump vec2 uNinePatchFactorsX[ FACTOR_SIZE_X ];\n
uniform mediump vec2 uNinePatchFactorsY[ FACTOR_SIZE_Y ];\n
\n
void main()\n
{\n
mediump vec2 fixedFactor = vec2( uNinePatchFactorsX[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uNinePatchFactorsY[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].x );\n
mediump vec2 stretch = vec2( uNinePatchFactorsX[ int( ( aPosition.x ) * 0.5 ) ].y, uNinePatchFactorsY[ int( ( aPosition.y ) * 0.5 ) ].y );\n
\n
mediump vec2 fixedTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );\n
mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );\n
\n
mediump vec4 vertexPosition = vec4( ( fixedFactor + ( uSize.xy - fixedTotal ) * stretch / stretchTotal ), 0.0, 1.0 );\n
vertexPosition.xy -= uSize.xy * vec2( 0.5, 0.5 );\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );\n
\n
gl_Position = vertexPosition;\n
}\n
)

Definition at line 52 of file npatch-renderer.cpp.

const char* Dali::Toolkit::Internal::anonymous_namespace{npatch-renderer.cpp}::VERTEX_SHADER_3X3
Initial value:
attribute mediump vec2 aPosition;\n
varying mediump vec2 vTexCoord;\n
uniform mediump mat4 uModelMatrix;\n
uniform mediump mat4 uMvpMatrix;\n
uniform mediump vec3 uSize;\n
uniform mediump vec2 uFixed[ 3 ];\n
uniform mediump vec2 uStretchTotal;\n
\n
void main()\n
{\n
mediump vec2 scale = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
mediump vec2 size = uSize.xy * scale;\n
\n
mediump vec2 fixedFactor = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].y );\n
mediump vec2 stretch = floor( aPosition * 0.5 );\n
mediump vec2 fixedTotal = uFixed[ 2 ];\n
\n
mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );\n
vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
vertexPosition.xy = vertexPosition.xy / scale;\n
\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
vTexCoord = ( fixedFactor + stretch * uStretchTotal ) / ( fixedTotal + uStretchTotal );\n
\n
gl_Position = vertexPosition;\n
}\n
)

Definition at line 78 of file npatch-renderer.cpp.

Dali Docs Home
Read more about Dali