/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
#include "radial-sweep-view-impl.h"
+#include <dali/public-api/rendering/renderer.h>
#include <sstream>
using namespace Dali;
mLayer = Layer::New();
Self().Add(mLayer);
mLayer.SetSize( Stage::GetCurrent().GetSize() );
- mLayer.SetPositionInheritanceMode(USE_PARENT_POSITION);
+ mLayer.SetParentOrigin( ParentOrigin::CENTER );
}
mLayer.Add(actor);
{
mAnim.Stop();
}
- // mLayer.Remove( mStencilActor );
- // mStencilActor.Reset();
- // mMesh.Reset();
- // mMaterial.Reset();
}
void RadialSweepViewImpl::CreateStencil( Radian initialSector )
vertexFormat["aAngleIndex"] = Property::FLOAT;
vertexFormat["aPosition1"] = Property::VECTOR2;
vertexFormat["aPosition2"] = Property::VECTOR2;
- PropertyBuffer vertices = PropertyBuffer::New( vertexFormat, 7u );
- vertices.SetData( vertexData );
+ PropertyBuffer vertices = PropertyBuffer::New( vertexFormat );
+ vertices.SetData( vertexData, 7u );
- unsigned int indexData[15] = { 0,1,2,0,2,3,0,3,4,0,4,5,0,5,6 };
- Property::Map indexFormat;
- indexFormat["indices"] = Property::UNSIGNED_INTEGER;
- PropertyBuffer indices = PropertyBuffer::New( indexFormat, 15u );
- indices.SetData( indexData );
+ unsigned short indexData[15] = { 0,1,2,0,2,3,0,3,4,0,4,5,0,5,6 };
Geometry meshGeometry = Geometry::New();
meshGeometry.AddVertexBuffer( vertices );
- meshGeometry.SetIndexBuffer( indices );
+ meshGeometry.SetIndexBuffer( &indexData[0], sizeof( indexData )/sizeof(indexData[0]) );
- // Create material
+ // Create shader
std::ostringstream vertexShaderStringStream;
vertexShaderStringStream<<VERTEX_SHADER_PREFIX<<VERTEX_SHADER;
Shader shader = Shader::New( vertexShaderStringStream.str(), FRAGMENT_SHADER );
- Material material = Material::New( shader );
// Create renderer
- Renderer renderer = Renderer::New( meshGeometry, material );
+ Renderer renderer = Renderer::New( meshGeometry, shader );
mStencilActor = Actor::New();
mStencilActor.AddRenderer( renderer );
mRotationAngleIndex = mStencilActor.RegisterProperty("uRotationAngle", initialSector.radian);
mStencilActor.SetDrawMode( DrawMode::STENCIL );
- mStencilActor.SetPositionInheritanceMode(USE_PARENT_POSITION);
+ mStencilActor.SetParentOrigin( ParentOrigin::CENTER );
}