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}vec4(diffuse, 1.0) * COLOR +vec4(specular, 1.0);The per_fragment_lighting.vert vertex shader is listed in Example 4-22:Example 4-22 per_fragment_lighting.vertuniform mat4 WORLD_VIEW_PROJECTION;uniform mat3 WORLD;uniform vec3 LIGHT_POSITION;uniform vec3 CAMERA_POSITION;attribute vec4 POSITION;attribute vec3 NORMAL;varying vec3 vNormal;varying vec3 vLightVector;varying vec3 vCameraVector;void main(void){gl_Position = WORLD_VIEW_PROJECTION * POSITION;vec3 pos = WORLD * POSITION.xyz;}// No point in normalizing before the fragment shader as the normalization will// be offset by the interpolation anyway.vNormal = WORLD * NORMAL;vLightVector = LIGHT_POSITION - pos;vCameraVector = CAMERA_POSITION - pos;4. Previous examples specified the locations for each vertex. Example 4-23 shows how toload an asset file that contains the information:Example 4-23 Load the asset for the teapot......// Loading sceneSceneAsset* scene = proxy.getSceneAsset("teapot.mba");GeometryAsset* teapot = static_cast(scene->getAsset(Asset::TYPE_GEOMETRY, 0));Example 4-23 is loading a .mba file which enables mesh data to be compressed andconditioned. The COLLADA format source is also present in the data directory asteapot.dae. Using a GeometryAsset and the proxy loader simplifies loading complexshapes.5. Example 4-24 on page 4-19 shows the camera, projection, view, and world setup:ARM DUI 0527A-02a Copyright © 2010 ARM. All rights reserved. 4-18ID070710Non-Confidential - Draft - Beta

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

Saved successfully!

Ooh no, something went wrong!