/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
// EXTERNAL INCLUDES
#include <dali/dali.h>
#include <dali-toolkit/dali-toolkit.h>
-#include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
+#include <dali/integration-api/debug.h>
+#include <dali/devel-api/adaptor-framework/file-loader.h>
-#include <fstream>
#include <sstream>
#include <limits>
+#include <cctype>
// INTERNAL INCLUDES
#include "shared/view.h"
// Add a button to change background. (right of toolbar)
mChangeTextureButton = Toolkit::PushButton::New();
- mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON );
- mChangeTextureButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON_SELECTED );
+ mChangeTextureButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON );
+ mChangeTextureButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_TEXTURE_ICON_SELECTED );
mChangeTextureButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeTexture );
toolBar.AddControl( mChangeTextureButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
DemoHelper::DEFAULT_MODE_SWITCH_PADDING );
// Add a button to change mesh pattern. ( left of bar )
mChangeMeshButton = Toolkit::PushButton::New();
- mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON );
- mChangeMeshButton.SetProperty( Toolkit::DevelButton::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON_SELECTED );
+ mChangeMeshButton.SetProperty( Toolkit::Button::Property::UNSELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON );
+ mChangeMeshButton.SetProperty( Toolkit::Button::Property::SELECTED_BACKGROUND_VISUAL, CHANGE_MESH_ICON_SELECTED );
mChangeMeshButton.ClickedSignal().Connect( this, &RefractionEffectExample::OnChangeMesh );
toolBar.AddControl( mChangeMeshButton,
DemoHelper::DEFAULT_VIEW_STYLE.mToolBarButtonPercentage,
mMeshActor = Actor::New();
mMeshActor.AddRenderer( mRenderer );
- mMeshActor.SetSize( stageSize );
- mMeshActor.SetParentOrigin(ParentOrigin::CENTER);
+ mMeshActor.SetProperty( Actor::Property::SIZE, stageSize );
+ mMeshActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER);
mContent.Add( mMeshActor );
// Connect the callback to the touch signal on the mesh actor
std::vector<Vector3>& vertexPositions,
Vector<unsigned int>& faceIndices)
{
- std::ifstream ifs( objFileName.c_str(), std::ios::in );
+ std::streampos bufferSize = 0;
+ Dali::Vector<char> fileBuffer;
+ if( !Dali::FileLoader::ReadFile( objFileName, bufferSize, fileBuffer, Dali::FileLoader::FileType::TEXT ) )
+ {
+ DALI_LOG_WARNING( "file open failed for: \"%s\"", objFileName.c_str() );
+ return;
+ }
+
+ std::stringstream iss( &fileBuffer[0], std::ios::in );
boundingBox.Resize( 6 );
boundingBox[0]=boundingBox[2]=boundingBox[4] = std::numeric_limits<float>::max();
boundingBox[1]=boundingBox[3]=boundingBox[5] = -std::numeric_limits<float>::max();
std::string line;
- while( std::getline( ifs, line ) )
+ while( std::getline( iss, line ) )
{
if( line[0] == 'v' && std::isspace(line[1])) // vertex
{
}
std::istringstream iss(line.substr(2), std::istringstream::in);
- unsigned int indices[ numOfInt ];
+ Dali::Vector<unsigned int> indices;
+ indices.Resize(numOfInt);
unsigned int i=0;
while( iss >> indices[i++] && i < numOfInt);
unsigned int step = (i+1) / 3;
faceIndices.PushBack( indices[2*step]-1 );
}
}
-
- ifs.close();
}
void ShapeResizeAndTexureCoordinateCalculation( const Vector<float>& boundingBox,