Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2019-04-17 07:17:24 +0300
committerCampbell Barton <ideasman42@gmail.com>2019-04-17 07:21:24 +0300
commite12c08e8d170b7ca40f204a5b0423c23a9fbc2c1 (patch)
tree8cf3453d12edb177a218ef8009357518ec6cab6a /source/blender/gpu/GPU_matrix.h
parentb3dabc200a4b0399ec6b81f2ff2730d07b44fcaa (diff)
ClangFormat: apply to source, most of intern
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
Diffstat (limited to 'source/blender/gpu/GPU_matrix.h')
-rw-r--r--source/blender/gpu/GPU_matrix.h146
1 files changed, 83 insertions, 63 deletions
diff --git a/source/blender/gpu/GPU_matrix.h b/source/blender/gpu/GPU_matrix.h
index bd7d4478c6a..24a76c13e01 100644
--- a/source/blender/gpu/GPU_matrix.h
+++ b/source/blender/gpu/GPU_matrix.h
@@ -43,7 +43,6 @@ void GPU_matrix_identity_set(void);
void GPU_matrix_scale_1f(float factor);
-
/* 3D ModelView Matrix */
void GPU_matrix_set(const float m[4][4]);
@@ -53,14 +52,25 @@ void GPU_matrix_translate_3f(float x, float y, float z);
void GPU_matrix_translate_3fv(const float vec[3]);
void GPU_matrix_scale_3f(float x, float y, float z);
void GPU_matrix_scale_3fv(const float vec[3]);
-void GPU_matrix_rotate_3f(float deg, float x, float y, float z); /* axis of rotation should be a unit vector */
-void GPU_matrix_rotate_3fv(float deg, const float axis[3]); /* axis of rotation should be a unit vector */
+void GPU_matrix_rotate_3f(float deg,
+ float x,
+ float y,
+ float z); /* axis of rotation should be a unit vector */
+void GPU_matrix_rotate_3fv(float deg,
+ const float axis[3]); /* axis of rotation should be a unit vector */
void GPU_matrix_rotate_axis(float deg, char axis); /* TODO: enum for axis? */
-void GPU_matrix_look_at(float eyeX, float eyeY, float eyeZ, float centerX, float centerY, float centerZ, float upX, float upY, float upZ);
+void GPU_matrix_look_at(float eyeX,
+ float eyeY,
+ float eyeZ,
+ float centerX,
+ float centerY,
+ float centerZ,
+ float upX,
+ float upY,
+ float upZ);
/* TODO: variant that takes eye[3], center[3], up[3] */
-
/* 2D ModelView Matrix */
void GPU_matrix_translate_2f(float x, float y);
@@ -80,19 +90,27 @@ void GPU_matrix_identity_projection_set(void);
void GPU_matrix_projection_set(const float m[4][4]);
void GPU_matrix_ortho_set(float left, float right, float bottom, float top, float near, float far);
-void GPU_matrix_frustum_set(float left, float right, float bottom, float top, float near, float far);
+void GPU_matrix_frustum_set(
+ float left, float right, float bottom, float top, float near, float far);
void GPU_matrix_perspective_set(float fovy, float aspect, float near, float far);
/* 3D Projection between Window and World Space */
-void GPU_matrix_project(const float world[3], const float model[4][4], const float proj[4][4], const int view[4], float win[3]);
-bool GPU_matrix_unproject(const float win[3], const float model[4][4], const float proj[4][4], const int view[4], float world[3]);
+void GPU_matrix_project(const float world[3],
+ const float model[4][4],
+ const float proj[4][4],
+ const int view[4],
+ float win[3]);
+bool GPU_matrix_unproject(const float win[3],
+ const float model[4][4],
+ const float proj[4][4],
+ const int view[4],
+ float world[3]);
/* 2D Projection Matrix */
void GPU_matrix_ortho_2d_set(float left, float right, float bottom, float top);
-
/* functions to get matrix values */
const float (*GPU_matrix_model_view_get(float m[4][4]))[4];
const float (*GPU_matrix_projection_get(float m[4][4]))[4];
@@ -101,20 +119,17 @@ const float (*GPU_matrix_model_view_projection_get(float m[4][4]))[4];
const float (*GPU_matrix_normal_get(float m[3][3]))[3];
const float (*GPU_matrix_normal_inverse_get(float m[3][3]))[3];
-
/* set uniform values for currently bound shader */
void GPU_matrix_bind(const struct GPUShaderInterface *);
bool GPU_matrix_dirty_get(void); /* since last bind */
-
/* Python API needs to be able to inspect the stack so errors raise exceptions instead of crashing. */
#ifdef USE_GPU_PY_MATRIX_API
int GPU_matrix_stack_level_get_model_view(void);
int GPU_matrix_stack_level_get_projection(void);
/* static assert ensures this doesn't change! */
-#define GPU_PY_MATRIX_STACK_LEN 31
-#endif /* USE_GPU_PY_MATRIX_API */
-
+# define GPU_PY_MATRIX_STACK_LEN 31
+#endif /* USE_GPU_PY_MATRIX_API */
#ifdef __cplusplus
}
@@ -122,61 +137,66 @@ int GPU_matrix_stack_level_get_projection(void);
#ifndef SUPPRESS_GENERIC_MATRIX_API
-#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
-#define _GPU_MAT3_CONST_CAST(x) (_Generic((x), \
- void *: (const float (*)[3])(x), \
- float *: (const float (*)[3])(x), \
- float [9]: (const float (*)[3])(x), \
- float (*)[4]: (const float (*)[3])(x), \
- float [4][4]: (const float (*)[3])(x), \
- const void *: (const float (*)[3])(x), \
- const float *: (const float (*)[3])(x), \
- const float [9]: (const float (*)[3])(x), \
- const float (*)[3]: (const float (*)[3])(x), \
- const float [3][3]: (const float (*)[3])(x)) \
+# if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L)
+# define _GPU_MAT3_CONST_CAST(x) \
+ (_Generic((x), \
+ void *: (const float (*)[3])(x), \
+ float *: (const float (*)[3])(x), \
+ float [9]: (const float (*)[3])(x), \
+ float (*)[4]: (const float (*)[3])(x), \
+ float [4][4]: (const float (*)[3])(x), \
+ const void *: (const float (*)[3])(x), \
+ const float *: (const float (*)[3])(x), \
+ const float [9]: (const float (*)[3])(x), \
+ const float (*)[3]: (const float (*)[3])(x), \
+ const float [3][3]: (const float (*)[3])(x)) \
)
-#define _GPU_MAT3_CAST(x) (_Generic((x), \
- void *: (float (*)[3])(x), \
- float *: (float (*)[3])(x), \
- float [9]: (float (*)[3])(x), \
- float (*)[3]: (float (*)[3])(x), \
- float [3][3]: (float (*)[3])(x)) \
+# define _GPU_MAT3_CAST(x) \
+ (_Generic((x), \
+ void *: (float (*)[3])(x), \
+ float *: (float (*)[3])(x), \
+ float [9]: (float (*)[3])(x), \
+ float (*)[3]: (float (*)[3])(x), \
+ float [3][3]: (float (*)[3])(x)) \
)
-#define _GPU_MAT4_CONST_CAST(x) (_Generic((x), \
- void *: (const float (*)[4])(x), \
- float *: (const float (*)[4])(x), \
- float [16]: (const float (*)[4])(x), \
- float (*)[4]: (const float (*)[4])(x), \
- float [4][4]: (const float (*)[4])(x), \
- const void *: (const float (*)[4])(x), \
- const float *: (const float (*)[4])(x), \
- const float [16]: (const float (*)[4])(x), \
- const float (*)[4]: (const float (*)[4])(x), \
- const float [4][4]: (const float (*)[4])(x)) \
+# define _GPU_MAT4_CONST_CAST(x) \
+ (_Generic((x), \
+ void *: (const float (*)[4])(x), \
+ float *: (const float (*)[4])(x), \
+ float [16]: (const float (*)[4])(x), \
+ float (*)[4]: (const float (*)[4])(x), \
+ float [4][4]: (const float (*)[4])(x), \
+ const void *: (const float (*)[4])(x), \
+ const float *: (const float (*)[4])(x), \
+ const float [16]: (const float (*)[4])(x), \
+ const float (*)[4]: (const float (*)[4])(x), \
+ const float [4][4]: (const float (*)[4])(x)) \
)
-#define _GPU_MAT4_CAST(x) (_Generic((x), \
- void *: (float (*)[4])(x), \
- float *: (float (*)[4])(x), \
- float [16]: (float (*)[4])(x), \
- float (*)[4]: (float (*)[4])(x), \
- float [4][4]: (float (*)[4])(x)) \
+# define _GPU_MAT4_CAST(x) \
+ (_Generic((x), \
+ void *: (float (*)[4])(x), \
+ float *: (float (*)[4])(x), \
+ float [16]: (float (*)[4])(x), \
+ float (*)[4]: (float (*)[4])(x), \
+ float [4][4]: (float (*)[4])(x)) \
)
-#else
-# define _GPU_MAT3_CONST_CAST(x) (const float (*)[3])(x)
-# define _GPU_MAT3_CAST(x) (float (*)[3])(x)
-# define _GPU_MAT4_CONST_CAST(x) (const float (*)[4])(x)
-# define _GPU_MAT4_CAST(x) (float (*)[4])(x)
-#endif /* C11 */
+# else
+# define _GPU_MAT3_CONST_CAST(x) (const float(*)[3])(x)
+# define _GPU_MAT3_CAST(x) (float(*)[3])(x)
+# define _GPU_MAT4_CONST_CAST(x) (const float(*)[4])(x)
+# define _GPU_MAT4_CAST(x) (float(*)[4])(x)
+# endif /* C11 */
/* make matrix inputs generic, to avoid warnings */
-# define GPU_matrix_mul(x) GPU_matrix_mul(_GPU_MAT4_CONST_CAST(x))
-# define GPU_matrix_set(x) GPU_matrix_set(_GPU_MAT4_CONST_CAST(x))
-# define GPU_matrix_projection_set(x) GPU_matrix_projection_set(_GPU_MAT4_CONST_CAST(x))
-# define GPU_matrix_model_view_get(x) GPU_matrix_model_view_get(_GPU_MAT4_CAST(x))
-# define GPU_matrix_projection_get(x) GPU_matrix_projection_get(_GPU_MAT4_CAST(x))
-# define GPU_matrix_model_view_projection_get(x) GPU_matrix_model_view_projection_get(_GPU_MAT4_CAST(x))
-# define GPU_matrix_normal_get(x) GPU_matrix_normal_get(_GPU_MAT3_CAST(x))
-# define GPU_matrix_normal_inverse_get(x) GPU_matrix_normal_inverse_get(_GPU_MAT3_CAST(x))
+# define GPU_matrix_mul(x) GPU_matrix_mul(_GPU_MAT4_CONST_CAST(x))
+# define GPU_matrix_set(x) GPU_matrix_set(_GPU_MAT4_CONST_CAST(x))
+# define GPU_matrix_projection_set(x) GPU_matrix_projection_set(_GPU_MAT4_CONST_CAST(x))
+# define GPU_matrix_model_view_get(x) GPU_matrix_model_view_get(_GPU_MAT4_CAST(x))
+# define GPU_matrix_projection_get(x) GPU_matrix_projection_get(_GPU_MAT4_CAST(x))
+# define GPU_matrix_model_view_projection_get(x) \
+ GPU_matrix_model_view_projection_get(_GPU_MAT4_CAST(x))
+# define GPU_matrix_normal_get(x) GPU_matrix_normal_get(_GPU_MAT3_CAST(x))
+# define GPU_matrix_normal_inverse_get(x) GPU_matrix_normal_inverse_get(_GPU_MAT3_CAST(x))
#endif /* SUPPRESS_GENERIC_MATRIX_API */
#endif /* __GPU_MATRIX_H__ */