13.07.2015 Views

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

Mali GPU User Interface Engine Application Development Guide

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Tutorial on Drawing 3D Shapes}else if(attr->name == "far_attenuation_end"){float value;attr->getValue(time, &value);sprintf(buffer, "LIGHT_FAR_ATTENUATION_END[%i]", i);context->setUniform(buffer, value);}...}}}// Set light positionsprintf(buffer, "LIGHT_POSITIONS[%i]", i);context->setUniform(buffer, 3, 1, lightPos.coord);6. Example 4-57 shows the world, view, and project calculation and scene traversal:Example 4-57 Traversing the scene...}mat4 world = mat4::identity();mat4 view = mat4::lookAt( camPos, camTarget, vec3(0.0f, 0.0f, 1.0f) );mat4 proj = mat4::perspective(camFov, camAspect, 1.0f, 1000.0f);mat4 prjViw = proj*view;//context->setUniformMatrix("WORLD", world);//context->setUniformMatrix("PRJ_VIW_WRL", prjViw*world);//context->setUniformMatrix("PROJECTION", 4, 1, proj);traverse(scene->getTree(0), context, prjViw, world, time);}while (context->update());}catch(Exception& e){printf("An exception was thrown:\n%s\n", e.getMessage().getCharString() );}7. Rebuild the project and run it. Figure 4-22 shows the shape:Figure 4-22 The advanced mba shape with tree traversalThe asset contains:• all of the shaders• the environment bitmapsARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-45ID070710Non-Confidential - Draft - Beta

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!