-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[concepts] Add TexCoordIndexedConcept
- Loading branch information
1 parent
a9ca363
commit 28549eb
Showing
7 changed files
with
143 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/***************************************************************************** | ||
* VCLib * | ||
* Visual Computing Library * | ||
* * | ||
* Copyright(C) 2021-2025 * | ||
* Visual Computing Lab * | ||
* ISTI - Italian National Research Council * | ||
* * | ||
* All rights reserved. * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the Mozilla Public License Version 2.0 as published * | ||
* by the Mozilla Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* Mozilla Public License Version 2.0 * | ||
* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * | ||
****************************************************************************/ | ||
|
||
#ifndef TEX_COORD_INDEXED_H | ||
#define TEX_COORD_INDEXED_H | ||
|
||
#include <vclib/space.h> | ||
|
||
void texCoordIndexedStaticAsserts() | ||
{ | ||
using namespace vcl; | ||
|
||
// TexCoord concept | ||
static_assert( | ||
TexCoordIndexedConcept<TexCoordIndexedf>, | ||
"TexCoordIndexedf does not satisfy the TexCoordIndexedConcept"); | ||
static_assert( | ||
TexCoordIndexedConcept<const TexCoordIndexedf>, | ||
"const TexCoordIndexedf does not satisfy the TexCoordIndexedConcept"); | ||
static_assert( | ||
TexCoordIndexedConcept<TexCoordIndexedf&>, | ||
"TexCoordIndexedf& does not satisfy the TexCoordIndexedConcept"); | ||
static_assert( | ||
TexCoordIndexedConcept<const TexCoordIndexedf&>, | ||
"const TexCoordIndexedf& does not satisfy the TexCoordIndexedConcept"); | ||
static_assert( | ||
TexCoordIndexedConcept<TexCoordIndexedf&&>, | ||
"TexCoordIndexedf&& does not satisfy the TexCoordIndexedConcept"); | ||
} | ||
|
||
#endif // TEX_COORD_INDEXED_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
vclib/core/include/vclib/concepts/space/tex_coord_indexed.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/***************************************************************************** | ||
* VCLib * | ||
* Visual Computing Library * | ||
* * | ||
* Copyright(C) 2021-2025 * | ||
* Visual Computing Lab * | ||
* ISTI - Italian National Research Council * | ||
* * | ||
* All rights reserved. * | ||
* * | ||
* This program is free software; you can redistribute it and/or modify * | ||
* it under the terms of the Mozilla Public License Version 2.0 as published * | ||
* by the Mozilla Foundation; either version 2 of the License, or * | ||
* (at your option) any later version. * | ||
* * | ||
* This program is distributed in the hope that it will be useful, * | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of * | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * | ||
* Mozilla Public License Version 2.0 * | ||
* (https://www.mozilla.org/en-US/MPL/2.0/) for more details. * | ||
****************************************************************************/ | ||
|
||
#ifndef VCL_CONCEPTS_SPACE_TEX_COORD_INDEXED_H | ||
#define VCL_CONCEPTS_SPACE_TEX_COORD_INDEXED_H | ||
|
||
#include "tex_coord.h" | ||
|
||
namespace vcl { | ||
|
||
/** | ||
* @brief A concept representing a Texture Coordinate with an index. | ||
* | ||
* @tparam T: The type to be tested for conformity to the TexCoordIndexedConcept. | ||
*/ | ||
template<typename T> | ||
concept TexCoordIndexedConcept = | ||
TexCoordConcept<T> && requires ( | ||
T&& obj, | ||
ushort u, | ||
ushort& uR, | ||
typename RemoveRef<T>::ScalarType s) { | ||
typename RemoveRef<T>::ScalarType; | ||
|
||
RemoveRef<T>(); | ||
RemoveRef<T>(s, s, u); | ||
|
||
{ obj.index() } -> std::convertible_to<decltype(u)>; | ||
|
||
{ obj <=> obj } -> std::convertible_to<std::partial_ordering>; | ||
|
||
// non const requirements | ||
requires IsConst<T> || requires { | ||
{ obj.index() } -> std::same_as<decltype(uR)>; | ||
{ obj.set(s, s, u) } -> std::same_as<void>; | ||
}; | ||
}; | ||
|
||
} // namespace vcl | ||
|
||
#endif // VCL_CONCEPTS_SPACE_TEX_COORD_INDEXED_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters