X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fpoint-mesh%2Fpoint-mesh-example.cpp;h=747f07f3b6469588e1027b03e7f80a562f3c5f42;hb=a832af2813558a32f0a18747f3e6134ff6f6f301;hp=ec982597b9c9db8ff30eb4574472e05422a358bd;hpb=b73149dfa1530bab210be84de4c69cbe6f2e0d14;p=platform%2Fcore%2Fuifw%2Fdali-demo.git diff --git a/examples/point-mesh/point-mesh-example.cpp b/examples/point-mesh/point-mesh-example.cpp index ec98259..747f07f 100644 --- a/examples/point-mesh/point-mesh-example.cpp +++ b/examples/point-mesh/point-mesh-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,18 +16,18 @@ */ // EXTERNAL INCLUDES -#include #include // INTERNAL INCLUDES #include "shared/view.h" +#include "shared/utility.h" using namespace Dali; namespace { -const char* MATERIAL_SAMPLE( DALI_IMAGE_DIR "gallery-small-48.jpg" ); -const char* MATERIAL_SAMPLE2( DALI_IMAGE_DIR "gallery-medium-19.jpg" ); +const char* MATERIAL_SAMPLE( DEMO_IMAGE_DIR "gallery-small-48.jpg" ); +const char* MATERIAL_SAMPLE2( DEMO_IMAGE_DIR "gallery-medium-19.jpg" ); #define MAKE_SHADER(A)#A @@ -98,13 +98,13 @@ Geometry CreateGeometry() Property::Map polyhedraVertexFormat; polyhedraVertexFormat["aPosition"] = Property::VECTOR2; polyhedraVertexFormat["aHue"] = Property::FLOAT; - PropertyBuffer polyhedraVertices = PropertyBuffer::New( polyhedraVertexFormat, numSides ); - polyhedraVertices.SetData(polyhedraVertexData); + PropertyBuffer polyhedraVertices = PropertyBuffer::New( polyhedraVertexFormat ); + polyhedraVertices.SetData( polyhedraVertexData, numSides ); // Create the geometry object Geometry polyhedraGeometry = Geometry::New(); polyhedraGeometry.AddVertexBuffer( polyhedraVertices ); - polyhedraGeometry.SetGeometryType( Geometry::POINTS ); + polyhedraGeometry.SetType( Geometry::POINTS ); return polyhedraGeometry; } @@ -152,20 +152,19 @@ public: // Hide the indicator bar application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); - mImage = ResourceImage::New( MATERIAL_SAMPLE ); - Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); - mSampler1 = Sampler::New(mImage, "sTexture1"); - mSampler2 = Sampler::New(image, "sTexture2"); + Texture texture0 = DemoHelper::LoadTexture( MATERIAL_SAMPLE ); + Texture texture1 = DemoHelper::LoadTexture( MATERIAL_SAMPLE2 ); - mShader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); + Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); - mMaterial = Material::New( mShader ); - mMaterial.AddSampler( mSampler1 ); - mMaterial.AddSampler( mSampler2 ); + TextureSet textureSet = TextureSet::New(); + textureSet.SetTexture( 0u, texture0 ); + textureSet.SetTexture( 1u, texture1 ); - mGeometry = CreateGeometry(); + Geometry geometry = CreateGeometry(); - mRenderer = Renderer::New( mGeometry, mMaterial ); + mRenderer = Renderer::New( geometry, shader ); + mRenderer.SetTextures( textureSet ); mMeshActor = Actor::New(); mMeshActor.AddRenderer( mRenderer ); @@ -175,7 +174,7 @@ public: mRenderer.RegisterProperty( "uFadeColor", Color::MAGENTA ); mRenderer.RegisterProperty( "uPointSize", 80.0f ); - mRenderer.SetDepthIndex(0); + mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 ); mMeshActor.SetParentOrigin( ParentOrigin::CENTER ); mMeshActor.SetAnchorPoint( AnchorPoint::CENTER ); @@ -191,7 +190,7 @@ public: animation.SetLooping(true); animation.Play(); - stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f));; + stage.SetBackgroundColor(Vector4(0.0f, 0.2f, 0.2f, 1.0f)); } /** @@ -221,12 +220,6 @@ private: Application& mApplication; ///< Application instance Vector3 mStageSize; ///< The size of the stage - Image mImage; - Sampler mSampler1; - Sampler mSampler2; - Shader mShader; - Material mMaterial; - Geometry mGeometry; Renderer mRenderer; Actor mMeshActor; Renderer mRenderer2; @@ -243,7 +236,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 );