/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
return textureSet;
}
+TextureSet CreateTextureSet( Texture texture )
+{
+ TextureSet textureSet = TextureSet::New();
+ textureSet.SetTexture(0u, texture);
+ return textureSet;
+}
+
PropertyBuffer CreatePropertyBuffer()
{
Property::Map texturedQuadVertexFormat;
#define MESH_BUILDER_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
Shader CreateShader();
TextureSet CreateTextureSet();
TextureSet CreateTextureSet( Image image );
+TextureSet CreateTextureSet( Texture texture );
Geometry CreateQuadGeometry();
PropertyBuffer CreatePropertyBuffer();
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
Actor CreateRenderableActor()
{
- return CreateRenderableActor( Image(), VERTEX_SHADER, FRAGMENT_SHADER );
+ return CreateRenderableActor( Texture(), VERTEX_SHADER, FRAGMENT_SHADER );
+}
+
+Actor CreateRenderableActor( Texture texture )
+{
+ return CreateRenderableActor( texture, VERTEX_SHADER, FRAGMENT_SHADER );
+}
+
+Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader )
+{
+ // Create the geometry
+ Geometry geometry = CreateQuadGeometry();
+
+ // Create Shader
+ Shader shader = Shader::New( vertexShader, fragmentShader );
+
+ // Create renderer from geometry and material
+ Renderer renderer = Renderer::New( geometry, shader );
+
+ // Create actor and set renderer
+ Actor actor = Actor::New();
+ actor.AddRenderer( renderer );
+
+ // If we a texture, then create a texture-set and add to renderer
+ if( texture )
+ {
+ TextureSet textureSet = TextureSet::New();
+ textureSet.SetTexture( 0u, texture );
+ renderer.SetTextures( textureSet );
+
+ // Set actor to the size of the texture if set
+ actor.SetProperty( Actor::Property::SIZE, Vector2( texture.GetWidth(), texture.GetHeight() ) );
+ }
+
+ return actor;
}
Actor CreateRenderableActor( Image texture )
#define DALI_TEST_ACTOR_UTILS_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
class Actor;
class Image;
+class Texture;
/**
* @brief Creates a simple renderable-actor with solid colored quad.
*/
Actor CreateRenderableActor( Image texture, const std::string& vertexShader, const std::string& fragmentShader );
+/**
+ * @brief Creates a renderable-actor with a texture.
+ * @param[in] texture Texture to set.
+ * @return An actor with a renderer.
+ */
+Actor CreateRenderableActor( Texture texture );
+
+/**
+ * @brief Creates a renderable-actor with a texture and custom shaders.
+ * @param[in] texture Texture to set.
+ * @param[in] vertexShader The vertex-shader.
+ * @param[in] fragmentShader The fragment-shader.
+ * @return An actor with a renderer.
+ */
+Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, const std::string& fragmentShader );
+
} // namespace Dali
#endif // DALI_TEST_ACTOR_UTILS_H