1 | /* graphene-types.h: Shared types |
2 | * |
3 | * SPDX-License-Identifier: MIT |
4 | * |
5 | * Copyright 2014 Emmanuele Bassi |
6 | * |
7 | * Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | * of this software and associated documentation files (the "Software"), to deal |
9 | * in the Software without restriction, including without limitation the rights |
10 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
11 | * copies of the Software, and to permit persons to whom the Software is |
12 | * furnished to do so, subject to the following conditions: |
13 | * |
14 | * The above copyright notice and this permission notice shall be included in |
15 | * all copies or substantial portions of the Software. |
16 | * |
17 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
21 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
22 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
23 | * THE SOFTWARE. |
24 | */ |
25 | |
26 | #pragma once |
27 | |
28 | #if !defined(GRAPHENE_H_INSIDE) && !defined(GRAPHENE_COMPILATION) |
29 | #error "Only graphene.h can be included directly." |
30 | #endif |
31 | |
32 | #include "graphene-config.h" |
33 | #include "graphene-macros.h" |
34 | #include "graphene-version-macros.h" |
35 | |
36 | GRAPHENE_BEGIN_DECLS |
37 | |
38 | /** |
39 | * GRAPHENE_VEC2_LEN: |
40 | * |
41 | * Evaluates to the number of components of a #graphene_vec2_t. |
42 | * |
43 | * This symbol is useful when declaring a C array of floating |
44 | * point values to be used with graphene_vec2_init_from_float() and |
45 | * graphene_vec2_to_float(), e.g. |
46 | * |
47 | * |[ |
48 | * float v[GRAPHENE_VEC2_LEN]; |
49 | * |
50 | * // vec is defined elsewhere |
51 | * graphene_vec2_to_float (&vec, v); |
52 | * |
53 | * for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) |
54 | * fprintf (stdout, "component %d: %g\n", i, v[i]); |
55 | * ]| |
56 | * |
57 | * Since: 1.0 |
58 | */ |
59 | #define GRAPHENE_VEC2_LEN 2 |
60 | |
61 | /** |
62 | * GRAPHENE_VEC3_LEN: |
63 | * |
64 | * Evaluates to the number of components of a #graphene_vec3_t. |
65 | * |
66 | * This symbol is useful when declaring a C array of floating |
67 | * point values to be used with graphene_vec3_init_from_float() and |
68 | * graphene_vec3_to_float(), e.g. |
69 | * |
70 | * |[ |
71 | * float v[GRAPHENE_VEC3_LEN]; |
72 | * |
73 | * // vec is defined elsewhere |
74 | * graphene_vec3_to_float (&vec, v); |
75 | * |
76 | * for (int i = 0; i < GRAPHENE_VEC2_LEN; i++) |
77 | * fprintf (stdout, "component %d: %g\n", i, v[i]); |
78 | * ]| |
79 | * |
80 | * Since: 1.0 |
81 | */ |
82 | #define GRAPHENE_VEC3_LEN 3 |
83 | |
84 | /** |
85 | * GRAPHENE_VEC4_LEN: |
86 | * |
87 | * Evaluates to the number of components of a #graphene_vec4_t. |
88 | * |
89 | * This symbol is useful when declaring a C array of floating |
90 | * point values to be used with graphene_vec4_init_from_float() and |
91 | * graphene_vec4_to_float(), e.g. |
92 | * |
93 | * |[ |
94 | * float v[GRAPHENE_VEC4_LEN]; |
95 | * |
96 | * // vec is defined elsewhere |
97 | * graphene_vec4_to_float (&vec, v); |
98 | * |
99 | * for (int i = 0; i < GRAPHENE_VEC4_LEN; i++) |
100 | * fprintf (stdout, "component %d: %g\n", i, v[i]); |
101 | * ]| |
102 | * |
103 | * Since: 1.0 |
104 | */ |
105 | #define GRAPHENE_VEC4_LEN 4 |
106 | |
107 | typedef struct _graphene_vec2_t graphene_vec2_t; |
108 | typedef struct _graphene_vec3_t graphene_vec3_t; |
109 | typedef struct _graphene_vec4_t graphene_vec4_t; |
110 | |
111 | typedef struct _graphene_matrix_t graphene_matrix_t; |
112 | |
113 | typedef struct _graphene_point_t graphene_point_t; |
114 | typedef struct _graphene_size_t graphene_size_t; |
115 | typedef struct _graphene_rect_t graphene_rect_t; |
116 | |
117 | typedef struct _graphene_point3d_t graphene_point3d_t; |
118 | typedef struct _graphene_quad_t graphene_quad_t; |
119 | typedef struct _graphene_quaternion_t graphene_quaternion_t; |
120 | typedef struct _graphene_euler_t graphene_euler_t; |
121 | |
122 | typedef struct _graphene_plane_t graphene_plane_t; |
123 | typedef struct _graphene_frustum_t graphene_frustum_t; |
124 | typedef struct _graphene_sphere_t graphene_sphere_t; |
125 | typedef struct _graphene_box_t graphene_box_t; |
126 | typedef struct _graphene_triangle_t graphene_triangle_t; |
127 | typedef struct _graphene_ray_t graphene_ray_t; |
128 | |
129 | GRAPHENE_END_DECLS |
130 | |