Commit 91d540b9bd4a31a4a6d9b876386369ccf81fcb76
1 parent
2d2a5847
Remove ImageActor from Demo
Change-Id: I597a13e0c249bdbd20b33e57ecc55e16fdfa8c77
Showing
1 changed file
with
24 additions
and
9 deletions
examples/new-window/new-window-example.cpp
| ... | ... | @@ -99,6 +99,9 @@ void main()\n |
| 99 | 99 | ); |
| 100 | 100 | |
| 101 | 101 | const char* FRAGMENT_BLEND_SHADER = MAKE_SHADER( |
| 102 | +varying mediump vec2 vTexCoord;\n | |
| 103 | +uniform sampler2D sTexture;\n | |
| 104 | +uniform sampler2D sEffect;\n | |
| 102 | 105 | uniform mediump float alpha;\n |
| 103 | 106 | \n |
| 104 | 107 | void main()\n |
| ... | ... | @@ -265,13 +268,12 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) |
| 265 | 268 | |
| 266 | 269 | Actor colorMeshActor = Actor::New(); |
| 267 | 270 | colorMeshActor.AddRenderer( colorMeshRenderer ); |
| 268 | - colorMeshActor.SetSize( 175.f,175.f ); | |
| 271 | + colorMeshActor.SetSize( 175.f,175.f, 175.f ); | |
| 269 | 272 | colorMeshActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 270 | 273 | colorMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER); |
| 271 | 274 | colorMeshActor.SetPosition(Vector3(0.0f, 50.0f, 0.0f)); |
| 272 | 275 | colorMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS ); |
| 273 | 276 | colorMeshActor.SetName("ColorMeshActor"); |
| 274 | - parentActor.Add( colorMeshActor ); | |
| 275 | 277 | |
| 276 | 278 | // Create a textured mesh |
| 277 | 279 | Image effectImage = ResourceImage::New(EFFECT_IMAGE); |
| ... | ... | @@ -282,13 +284,21 @@ void NewWindowController::AddMeshActor( Actor& parentActor ) |
| 282 | 284 | |
| 283 | 285 | Actor textureMeshActor = Actor::New(); |
| 284 | 286 | textureMeshActor.AddRenderer( textureMeshRenderer ); |
| 285 | - textureMeshActor.SetSize( 175.f,175.f ); | |
| 287 | + textureMeshActor.SetSize( 175.f,175.f, 175.f ); | |
| 286 | 288 | textureMeshActor.SetParentOrigin( ParentOrigin::CENTER ); |
| 287 | 289 | textureMeshActor.SetAnchorPoint(AnchorPoint::TOP_CENTER); |
| 288 | 290 | textureMeshActor.SetPosition(Vector3(0.0f, 200.0f, 0.0f)); |
| 289 | 291 | textureMeshActor.SetOrientation( Degree(75.f), Vector3::XAXIS ); |
| 290 | 292 | textureMeshActor.SetName("TextureMeshActor"); |
| 291 | - parentActor.Add( textureMeshActor ); | |
| 293 | + | |
| 294 | + Layer layer3d = Layer::New(); | |
| 295 | + layer3d.SetParentOrigin( ParentOrigin::CENTER ); | |
| 296 | + layer3d.SetAnchorPoint( AnchorPoint::CENTER ); | |
| 297 | + layer3d.SetBehavior(Layer::LAYER_3D); | |
| 298 | + | |
| 299 | + layer3d.Add( colorMeshActor ); | |
| 300 | + layer3d.Add( textureMeshActor ); | |
| 301 | + parentActor.Add(layer3d); | |
| 292 | 302 | } |
| 293 | 303 | |
| 294 | 304 | void NewWindowController::AddBlendingImageActor( Actor& parentActor ) |
| ... | ... | @@ -305,18 +315,23 @@ void NewWindowController::AddBlendingImageActor( Actor& parentActor ) |
| 305 | 315 | tmpActor.SetScale(0.25f); |
| 306 | 316 | |
| 307 | 317 | // create blending shader effect |
| 308 | - ShaderEffect blendShader = ShaderEffect::New( "", FRAGMENT_BLEND_SHADER ); | |
| 309 | - blendShader.SetEffectImage( fb2 ); | |
| 310 | - blendShader.SetUniform("alpha", 0.5f); | |
| 318 | + Property::Map customShader; | |
| 319 | + customShader[ "fragmentShader" ] = FRAGMENT_BLEND_SHADER; | |
| 320 | + Property::Map map; | |
| 321 | + map[ "shader" ] = customShader; | |
| 311 | 322 | |
| 312 | 323 | Image baseImage = ResourceImage::New(BASE_IMAGE); |
| 313 | - ImageActor blendActor = ImageActor::New( baseImage ); | |
| 324 | + ImageView blendActor = ImageView::New( baseImage ); | |
| 325 | + blendActor.SetProperty( ImageView::Property::IMAGE, map ); | |
| 326 | + blendActor.RegisterProperty( "alpha", 0.5f ); | |
| 327 | + | |
| 314 | 328 | blendActor.SetParentOrigin(ParentOrigin::CENTER_RIGHT); |
| 315 | 329 | blendActor.SetAnchorPoint(AnchorPoint::BOTTOM_RIGHT); |
| 316 | 330 | blendActor.SetPosition(Vector3(0.0f, 100.0f, 0.0f)); |
| 317 | 331 | blendActor.SetSize(140, 140); |
| 318 | - blendActor.SetShaderEffect( blendShader ); | |
| 319 | 332 | parentActor.Add(blendActor); |
| 333 | + | |
| 334 | + blendActor.GetRendererAt(0u).GetMaterial().AddTexture(fb2, "sEffect"); | |
| 320 | 335 | } |
| 321 | 336 | |
| 322 | 337 | void NewWindowController::AddTextLabel( Actor& parentActor ) | ... | ... |