X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=examples%2Fpoint-mesh%2Fpoint-mesh-example.cpp;h=126b9d61920b37bcdcf01ff3526f30a1a05fe8f9;hb=2e182925204bf3ef9f2a36cbfbf998e79fbafaf5;hp=ce7a08092eefbd5a499a72c03d9f4caa706e34be;hpb=269f620ad9d5a8c816a03278ce6f65fe7862582e;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 ce7a080..126b9d6 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,11 +16,11 @@ */ // EXTERNAL INCLUDES -#include #include // INTERNAL INCLUDES #include "shared/view.h" +#include "shared/utility.h" using namespace Dali; @@ -82,7 +82,7 @@ Geometry CreateGeometry() // Create vertices struct Vertex { Vector2 position; float hue; }; - unsigned int numSides = 20; + const unsigned int numSides = 20; Vertex polyhedraVertexData[numSides]; float angle=0; float sectorAngle = 2.0f * Math::PI / (float) numSides; @@ -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,22 +152,23 @@ public: // Hide the indicator bar application.GetWindow().ShowIndicator( Dali::Window::INVISIBLE ); - mImage = ResourceImage::New( MATERIAL_SAMPLE ); - Image image = ResourceImage::New( MATERIAL_SAMPLE2 ); + 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.AddTexture(mImage, "sTexture1"); - mMaterial.AddTexture(image, "sTexture2"); + 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 ); - mMeshActor.SetSize(400, 400); + mMeshActor.SetProperty( Actor::Property::SIZE, Vector2(400, 400) ); mMeshActor.RegisterProperty( "uFadeColor", Color::GREEN ); @@ -175,8 +176,8 @@ public: mRenderer.RegisterProperty( "uPointSize", 80.0f ); mRenderer.SetProperty( Renderer::Property::DEPTH_INDEX, 0 ); - mMeshActor.SetParentOrigin( ParentOrigin::CENTER ); - mMeshActor.SetAnchorPoint( AnchorPoint::CENTER ); + mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); + mMeshActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); stage.Add( mMeshActor ); Animation animation = Animation::New(15); @@ -219,10 +220,6 @@ private: Application& mApplication; ///< Application instance Vector3 mStageSize; ///< The size of the stage - Image mImage; - Shader mShader; - Material mMaterial; - Geometry mGeometry; Renderer mRenderer; Actor mMeshActor; Renderer mRenderer2; @@ -230,20 +227,10 @@ private: Timer mChangeImageTimer; }; -void RunTest( Application& application ) +int DALI_EXPORT_API main( int argc, char **argv ) { + Application application = Application::New( &argc, &argv ); ExampleController test( application ); - application.MainLoop(); -} - -// Entry point for Linux & SLP applications -// -int main( int argc, char **argv ) -{ - Application application = Application::New( &argc, &argv ); - - RunTest( application ); - return 0; }