Visual Computing Library  devel
Loading...
Searching...
No Matches
camera.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_RENDER_CONCEPTS_CAMERA_H
24#define VCL_RENDER_CONCEPTS_CAMERA_H
25
26#include <vclib/space/core.h>
27#include <vclib/base.h>
28
29namespace vcl {
30
31template<typename T>
32concept CameraConcept = requires (
33 T&& obj,
34 typename RemoveRef<T>::ScalarType s,
35 typename RemoveRef<T>::ScalarType& sR,
36 typename RemoveRef<T>::ProjectionMode pm,
37 typename RemoveRef<T>::ProjectionMode& pmR) {
38 // inner types
39 typename RemoveRef<T>::ScalarType;
40 typename RemoveRef<T>::PointType;
41 typename RemoveRef<T>::MatrixType;
42 typename RemoveRef<T>::ProjectionMode;
43
44 // constructors
45 RemoveRef<T>();
46
47 { obj.center() } -> Point3Concept;
48 { obj.eye() } -> Point3Concept;
49 { obj.up() } -> Point3Concept;
50 { obj.fieldOfView() } -> std::convertible_to<decltype(s)>;
51 { obj.projectionMode() } -> std::convertible_to<decltype(pm)>;
52 { obj.verticalHeight() } -> std::convertible_to<decltype(s)>;
53 { obj.aspectRatio() } -> std::convertible_to<decltype(s)>;
54 { obj.nearPlane() } -> std::convertible_to<decltype(s)>;
55 { obj.farPlane() } -> std::convertible_to<decltype(s)>;
56 { obj.viewMatrix() } -> Matrix44Concept;
57 { obj.projectionMatrix() } -> Matrix44Concept;
58
59 // non const requirements
60 requires IsConst<T> || requires {
61 { obj.reset() } -> std::same_as<void>;
62 { obj.fieldOfView() } -> std::same_as<decltype(sR)>;
63 { obj.projectionMode() } -> std::same_as<decltype(pmR)>;
64 { obj.setFieldOfViewAdaptingEyeDistance(s) } -> std::same_as<void>;
65 { obj.verticalHeight() } -> std::same_as<decltype(sR)>;
66 { obj.aspectRatio() } -> std::same_as<decltype(sR)>;
67 { obj.nearPlane() } -> std::same_as<decltype(sR)>;
68 { obj.farPlane() } -> std::same_as<decltype(sR)>;
69 };
70};
71
72} // namespace vcl
73
74#endif // VCL_RENDER_CONCEPTS_CAMERA_H
Definition camera.h:32
The IsConst concept is satisfied if T satisfies one of the following conditions:
Definition const_correctness.h:43
Concept for 4x4 matrices.
Definition matrix.h:62
A concept representing a 3D Point.
Definition point.h:871