*/
// CLASS HEADER
-#include "mesh-renderer.h"
+#include "mesh-visual.h"
// EXTERNAL INCLUDES
#include <dali/integration-api/debug.h>
#include <fstream>
//INTERNAL INCLUDES
-#include <dali-toolkit/internal/controls/renderers/renderer-string-constants.h>
-#include <dali-toolkit/internal/controls/renderers/control-renderer-data-impl.h>
+#include <dali-toolkit/internal/controls/renderers/visual-string-constants.h>
+#include <dali-toolkit/internal/controls/renderers/visual-data-impl.h>
namespace Dali
{
} // namespace
-MeshRenderer::MeshRenderer( RendererFactoryCache& factoryCache )
-: ControlRenderer( factoryCache ),
+MeshVisual::MeshVisual( VisualFactoryCache& factoryCache )
+: Visual( factoryCache ),
mShaderType( ALL_TEXTURES ),
mUseTexture( true ),
mUseMipmapping( true ),
{
}
-MeshRenderer::~MeshRenderer()
+MeshVisual::~MeshVisual()
{
}
-void MeshRenderer::DoInitialize( Actor& actor, const Property::Map& propertyMap )
+void MeshVisual::DoInitialize( Actor& actor, const Property::Map& propertyMap )
{
Property::Value* objectUrl = propertyMap.Find( OBJECT_URL );
if( !objectUrl || !objectUrl->Get( mObjectUrl ) )
{
- DALI_LOG_ERROR( "Fail to provide object URL to the MeshRenderer object.\n" );
+ DALI_LOG_ERROR( "Fail to provide object URL to the MeshVisual object.\n" );
}
Property::Value* materialUrl = propertyMap.Find( MATERIAL_URL );
}
else
{
- DALI_LOG_ERROR( "Unknown shader type provided to the MeshRenderer object.\n");
+ DALI_LOG_ERROR( "Unknown shader type provided to the MeshVisual object.\n");
}
}
}
}
}
-void MeshRenderer::SetSize( const Vector2& size )
+void MeshVisual::SetSize( const Vector2& size )
{
- ControlRenderer::SetSize( size );
+ Visual::SetSize( size );
// ToDo: renderer responds to the size change
}
-void MeshRenderer::SetClipRect( const Rect<int>& clipRect )
+void MeshVisual::SetClipRect( const Rect<int>& clipRect )
{
- ControlRenderer::SetClipRect( clipRect );
+ Visual::SetClipRect( clipRect );
//ToDo: renderer responds to the clipRect change
}
-void MeshRenderer::SetOffset( const Vector2& offset )
+void MeshVisual::SetOffset( const Vector2& offset )
{
//ToDo: renderer applies the offset
}
-void MeshRenderer::DoSetOnStage( Actor& actor )
+void MeshVisual::DoSetOnStage( Actor& actor )
{
InitializeRenderer();
}
-void MeshRenderer::DoCreatePropertyMap( Property::Map& map ) const
+void MeshVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
map.Insert( RENDERER_TYPE, MESH_RENDERER );
map.Insert( LIGHT_POSITION_UNIFORM_NAME, mLightPosition );
}
-void MeshRenderer::InitializeRenderer()
+void MeshVisual::InitializeRenderer()
{
//Try to load the geometry from the file.
if( !LoadGeometry() )
mImpl->mRenderer.SetProperty( Renderer::Property::DEPTH_WRITE_MODE, DepthWriteMode::ON );
}
-void MeshRenderer::SupplyEmptyGeometry()
+void MeshVisual::SupplyEmptyGeometry()
{
mGeometry = Geometry::New();
mShader = Shader::New( SIMPLE_VERTEX_SHADER, SIMPLE_FRAGMENT_SHADER );
DALI_LOG_ERROR( "Initialisation error in mesh renderer.\n" );
}
-void MeshRenderer::UpdateShaderUniforms()
+void MeshVisual::UpdateShaderUniforms()
{
Stage stage = Stage::GetCurrent();
float width = stage.GetSize().width;
mShader.RegisterProperty( OBJECT_MATRIX_UNIFORM_NAME, scaleMatrix );
}
-void MeshRenderer::CreateShader()
+void MeshVisual::CreateShader()
{
if( mShaderType == ALL_TEXTURES )
{
UpdateShaderUniforms();
}
-bool MeshRenderer::CreateGeometry()
+bool MeshVisual::CreateGeometry()
{
//Determine if we need to use a simpler shader to handle the provided data
if( !mUseTexture || !mObjLoader.IsDiffuseMapPresent() )
return false;
}
-bool MeshRenderer::LoadGeometry()
+bool MeshVisual::LoadGeometry()
{
std::streampos fileSize;
Dali::Vector<char> fileContent;
return false;
}
-bool MeshRenderer::LoadMaterial()
+bool MeshVisual::LoadMaterial()
{
std::streampos fileSize;
Dali::Vector<char> fileContent;
return false;
}
-bool MeshRenderer::LoadTextures()
+bool MeshVisual::LoadTextures()
{
mTextureSet = TextureSet::New();