X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fmesh-sorting%2Fmesh-sorting-example.cpp;h=35300d5ebcb0be314093d29c00e0d294d3ceaaf1;hb=a832af2813558a32f0a18747f3e6134ff6f6f301;hp=354364ffa3ed24eb417ee733de91faa8b8dfdcaa;hpb=04f03e2a42a470d98264c293a78d5559cc21dbb7;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/mesh-sorting/mesh-sorting-example.cpp b/examples/mesh-sorting/mesh-sorting-example.cpp index 354364f..35300d5 100644 --- a/examples/mesh-sorting/mesh-sorting-example.cpp +++ b/examples/mesh-sorting/mesh-sorting-example.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2017 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,7 +16,6 @@ */ // EXTERNAL INCLUDES -#include #include #include #include @@ -24,22 +23,23 @@ // INTERNAL INCLUDES #include "shared/view.h" +#include "shared/utility.h" using namespace Dali; namespace { -const char* MATERIAL_SAMPLES[] = +const char* IMAGES[] = { - DALI_IMAGE_DIR "people-medium-1.jpg", - DALI_IMAGE_DIR "people-medium-4.jpg", - DALI_IMAGE_DIR "people-medium-11.jpg", - DALI_IMAGE_DIR "people-small-16.jpg", - DALI_IMAGE_DIR "people-medium-15.jpg", - DALI_IMAGE_DIR "people-medium-6.jpg", + DEMO_IMAGE_DIR "people-medium-1.jpg", + DEMO_IMAGE_DIR "people-medium-4.jpg", + DEMO_IMAGE_DIR "people-medium-11.jpg", + DEMO_IMAGE_DIR "people-small-16.jpg", + DEMO_IMAGE_DIR "people-medium-15.jpg", + DEMO_IMAGE_DIR "people-medium-6.jpg", }; -const unsigned int NUMBER_OF_SAMPLES(sizeof(MATERIAL_SAMPLES)/sizeof(const char*)); +const unsigned int NUMBER_OF_SAMPLES(sizeof(IMAGES)/sizeof(const char*)); #define MAKE_SHADER(A)#A @@ -84,38 +84,6 @@ void main() } ); -Geometry CreateGeometry() -{ - // Create vertices - const float halfQuadSize = .5f; - struct TexturedQuadVertex { Vector2 position; Vector2 textureCoordinates; }; - TexturedQuadVertex texturedQuadVertexData[4] = { - { Vector2(-halfQuadSize, -halfQuadSize), Vector2(0.f, 0.f) }, - { Vector2( halfQuadSize, -halfQuadSize), Vector2(1.f, 0.f) }, - { Vector2(-halfQuadSize, halfQuadSize), Vector2(0.f, 1.f) }, - { Vector2( halfQuadSize, halfQuadSize), Vector2(1.f, 1.f) } }; - - Property::Map texturedQuadVertexFormat; - texturedQuadVertexFormat["aPosition"] = Property::VECTOR2; - texturedQuadVertexFormat["aTexCoord"] = Property::VECTOR2; - PropertyBuffer texturedQuadVertices = PropertyBuffer::New( texturedQuadVertexFormat, 4 ); - texturedQuadVertices.SetData(texturedQuadVertexData); - - // Create indices - unsigned int indexData[6] = { 0, 3, 1, 0, 2, 3 }; - Property::Map indexFormat; - indexFormat["indices"] = Property::INTEGER; - PropertyBuffer indices = PropertyBuffer::New( indexFormat, 6 ); - indices.SetData(indexData); - - // Create the geometry object - Geometry texturedQuadGeometry = Geometry::New(); - texturedQuadGeometry.AddVertexBuffer( texturedQuadVertices ); - texturedQuadGeometry.SetIndexBuffer( indices ); - - return texturedQuadGeometry; -} - } // anonymous namespace // This example shows how to use a simple mesh @@ -162,25 +130,26 @@ public: application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); - mGeometry = CreateGeometry(); + mGeometry = DemoHelper::CreateTexturedQuad(); - Material firstMat; + TextureSet firstTextureSet; for( unsigned i=0; i(actor.GetPropertyIndex("index")); @@ -240,16 +209,16 @@ public: mDepthIndices[index] = newDepthIndex; Renderer renderer = actor.GetRendererAt(0); - renderer.SetDepthIndex(newDepthIndex); + renderer.SetProperty( Renderer::Property::DEPTH_INDEX, newDepthIndex); PrintDepths(); } return true; } - bool OnStageTouched( Actor rootLayer, const TouchEvent& event ) + bool OnStageTouched( Actor rootLayer, const TouchData& event ) { - if( event.GetPoint(0).state == TouchPoint::Finished ) + if( event.GetState( 0 ) == PointState::UP ) { switch( mZMode ) { @@ -335,7 +304,7 @@ void RunTest( Application& application ) // Entry point for Linux & SLP applications // -int main( int argc, char **argv ) +int DALI_EXPORT_API main( int argc, char **argv ) { Application application = Application::New( &argc, &argv );