2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
21 #include <dali/public-api/dali-core.h>
22 #include <dali-test-suite-utils.h>
26 #include <mesh-builder.h>
28 void mesh_material_test_startup(void)
30 test_return_value = TET_UNDEF;
33 void mesh_material_test_cleanup(void)
35 test_return_value = TET_PASS;
42 Material ConstructMaterial( const std::string& vertexShader,
43 const std::string& fragmentShader,
46 Shader shader = Shader::New( vertexShader, fragmentShader );
47 Material customMaterial = Material::New(shader);
48 Vector4 color = Color::WHITE;
50 customMaterial.SetProperty(Material::Property::COLOR, color);
51 return customMaterial;
54 void TestBlending( TestApplication& application, Material material, float actorOpacity, BlendingMode::Type blendingMode, bool expectedBlend )
56 // Generate geometry & renderers
57 //Mesh mesh = Mesh::New(meshData);
59 application.SendNotification();
60 application.Render(0);
62 application.SendNotification();
64 Actor actor = Actor::New();
65 Stage::GetCurrent().Add(actor);
67 //material.SetBlendMode(blendingMode);
68 actor.SetOpacity(actorOpacity);
70 TraceCallStack& cullFaceTrace = application.GetGlAbstraction().GetCullFaceTrace();
71 cullFaceTrace.Enable(true);
72 application.SendNotification();
74 //DALI_TEST_EQUALS( BlendEnabled( cullFaceTrace ), expectedBlend, TEST_LOCATION );
77 } // anonymous namespace
83 * Check construction of mesh objects
84 * Check downcast of mesh objects (+ve & -ve)
85 * Check staging of mesh objects
87 * Check staging of some mesh objects but not all
88 * Create geometry with no verts - ensure it asserts
89 * Create an element based geometry with no indices - ensure it asserts
90 * Create a renderer without a material - ensure nothing renders
91 * Create a render with a material, ensure the material can be changed
92 * Create a render with a material&Sampler, ensure the sampler can be changed
93 * Create a render with a material, sampler, ensure the sampler's texture can be changed
94 * Create a render with a material, sampler, ensure that removing the sampler works
97 * 1 Set Material with translucent color, actor color opaque, Set Use image alpha to true
99 * 2 Set material to translucent, set use image alpha to false, set actor opacity to 1.0f
101 * 3 Set material to opaque, set use image alpha to true, set actor opacity to 1.0f
103 * 4 Set material to have image with alpha, set use image alpha to true, set actor opacity to 1.0f
105 * 5 Set material to have image with alpha, set use image alpha to false, set actor opacity to 1.0f
107 * 6 Set material to have image without alpha, set use image alpha to true, set actor opacity to 1.0f
109 * 7 Set material to have framebuffer with alpha, set use image alpha to true, set actor opacity to 1.0f
111 * 8 Set material to have image with alpha, set use image alpha to false, set actor opacity to 0.5f
113 * 9 Set material to have image with no alpha, set material opacity to 0.5, set use image alpha to true, set actor opacity to 1.0f
116 * Check defaults of renderer
118 * Bounding box of geometry?
120 * Check rendered vertex buffer is the right size for the initial property buffer
122 * Check PropertyBuffer set via SetData can be read thru property system
123 * Check PropertyBuffer property setters / getters
124 * Check vertex PropertyBuffer set via properties renders as expected
125 * Check Index propertyBuffer set via properties renders as expected
127 * Check geometry type renders correctly as the matching GL draw call and type
129 * Check attributes change when rendering different actors with different
130 * vertex formats (utc-Dali-Context.cpp)
132 * utc-Dali-Material.cpp
133 * Check material color affects output - see shader uniform
135 * Check material sampler's image load/release policies affect rendering correctly.