Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 The Android Open Source Project |
| 3 | * |
| 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 |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 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. |
| 15 | */ |
| 16 | |
| 17 | #ifndef ANDROID_UI_VERTEX_H |
| 18 | #define ANDROID_UI_VERTEX_H |
| 19 | |
| 20 | namespace android { |
| 21 | namespace uirenderer { |
| 22 | |
| 23 | /** |
| 24 | * Simple structure to describe a vertex with a position. |
| 25 | * This is used to draw filled rectangles without a texture. |
| 26 | */ |
| 27 | struct SimpleVertex { |
| 28 | float position[2]; |
| 29 | }; // struct SimpleVertex |
| 30 | |
| 31 | /** |
| 32 | * Simple structure to describe a vertex with a position and a texture. |
| 33 | */ |
| 34 | struct TextureVertex { |
| 35 | float position[2]; |
| 36 | float texture[2]; |
| 37 | |
| 38 | static inline void set(TextureVertex* vertex, float x, float y, float u, float v) { |
| 39 | vertex[0].position[0] = x; |
| 40 | vertex[0].position[1] = y; |
| 41 | vertex[0].texture[0] = u; |
| 42 | vertex[0].texture[1] = v; |
| 43 | } |
Romain Guy | 82ba814 | 2010-07-09 13:25:56 -0700 | [diff] [blame^] | 44 | |
| 45 | static inline void setUV(TextureVertex* vertex, float u, float v) { |
| 46 | vertex[0].texture[0] = u; |
| 47 | vertex[0].texture[1] = v; |
| 48 | } |
Romain Guy | f7f9355 | 2010-07-08 19:17:03 -0700 | [diff] [blame] | 49 | }; // struct TextureVertex |
| 50 | |
| 51 | }; // namespace uirenderer |
| 52 | }; // namespace android |
| 53 | |
| 54 | #endif // ANDROID_UI_VERTEX_H |