NDEVR
API Documentation
VulkanBitflagObject.h
1/*--------------------------------------------------------------------------------------------
2Copyright (c) 2019, NDEVR LLC
3tyler.parke@ndevr.org
4 __ __ ____ _____ __ __ _______
5 | \ | | | __ \ | ___|\ \ / / | __ \
6 | \ | | | | \ \ | |___ \ \ / / | |__) |
7 | . \| | | |__/ / | |___ \ V / | _ /
8 | |\ |_|_____/__|_____|___\_/____| | \ \
9 |__| \__________________________________| \__\
10
11Subject to the terms of the Enterprise+ Agreement, NDEVR hereby grants
12Licensee a limited, non-exclusive, non-transferable, royalty-free license
13(without the right to sublicense) to use the API solely for the purpose of
14Licensee's internal development efforts to develop applications for which
15the API was provided.
16
17The above copyright notice and this permission notice shall be included in all
18copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
21INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
22PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE
23FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
25DEALINGS IN THE SOFTWARE.
26
27Library: Graphics
28File: VulkanBitflagObject
29Included in API: True
30Author(s): Tyler Parke
31 *-----------------------------------------------------------------------------------------**/
32#pragma once
33#include "VulkanDefines.h"
34#include <NDEVR/Geometry.h>
35namespace NDEVR
36{
41 {
53
66
68 : flag{ 0,0,0,0 }
69 {}
70
73 {
74 flag[0] = object.flag[0];
75 flag[1] = object.flag[1];
76 flag[2] = object.flag[2];
77 flag[3] = object.flag[3];
78 }
79
82 void set(const VertexProperty& property, bool value)
83 {
84 flag[0](cast<uint01>(property), value);
85 }
86
88 void setExtra(bool value)
89 {
90 flag[0](7, value);
91 }
92
95 void set(const ModelProperties& property, bool value)
96 {
97 flag[1](cast<uint01>(property), value);
98 }
99
102 [[nodiscard]] bool get(const ModelProperties& property) const
103 {
104 return flag[1][cast<uint01>(property)];
105 }
106
109 void setRenderProperty(RenderProperties property, bool value)
110 {
111 flag[2](cast<uint01>(property), value);
112 }
113
116 void setHasImage(uint01 type, bool has_image)
117 {
118 flag[3](type, has_image);
119 }
120
124 {
125 for (uint01 i = 0; i < 4; i++)
126 flag[i] = object.flag[i];
127 return *this;
128 }
129
132 bool operator==(const VulkanBitflagObject& object) const
133 {
134 return flag[0] == object.flag[0]
135 && flag[1] == object.flag[1]
136 && flag[2] == object.flag[2]
137 && flag[3] == object.flag[3];
138 }
139
142 bool operator!=(const VulkanBitflagObject& object) const
143 {
144 return flag[0] != object.flag[0]
145 || flag[1] != object.flag[1]
146 || flag[2] != object.flag[2]
147 || flag[3] != object.flag[3];
148 }
150 };
151
152}
A bitset that stores 8 bits (elements with only two possible values: 0 or 1, true or false,...
Definition BitFlag.hpp:55
The primary namespace for the NDEVR SDK.
@ type
The type identifier string for this model node.
Definition Model.h:58
VertexProperty
Per-vertex data channels that can be stored in the vertex table to be used by Geometry.
uint8_t uint01
-Defines an alias representing a 1 byte, unsigned integer -Can represent exact integer values 0 throu...
constexpr t_to cast(const Angle< t_from > &value)
Casts an Angle from one backing type to another.
Definition Angle.h:408
void set(const ModelProperties &property, bool value)
Sets a model property flag.
void set(const VertexProperty &property, bool value)
Sets a vertex property flag.
void setHasImage(uint01 type, bool has_image)
Sets whether a specific image type is present.
VulkanBitflagObject()
Default constructor initializing all flags to zero.
void setRenderProperty(RenderProperties property, bool value)
Sets a render property flag.
void setExtra(bool value)
Sets the extra bit in flag[0] bit 7.
BitFlag flag[4]
Array of four BitFlag values: [0]=vertex, [1]=model, [2]=render, [3]=image.
VulkanBitflagObject(const VulkanBitflagObject &object)
Copy constructor.
VulkanBitflagObject & operator=(const VulkanBitflagObject &object)
Copy assignment operator.
bool operator==(const VulkanBitflagObject &object) const
Equality comparison operator.
bool get(const ModelProperties &property) const
Gets the value of a model property flag.
bool operator!=(const VulkanBitflagObject &object) const
Inequality comparison operator.
ModelProperties
Properties describing the state of a model within the 3D scene.
@ e_scale_to_camera
Whether the model should scale based on camera distance.
@ e_3D_focussed
Whether the model is currently focused in the 3D view.
@ e_orient_to_camera
Whether the model should orient itself toward the camera.
@ e_3D_selected
Whether the model is currently selected in the 3D view.
@ e_follow_camera
Whether the model should follow the camera position.
RenderProperties
Properties controlling how geometry is rendered.
@ e_smooth_normals
Whether normals should be interpolated for smooth shading.
@ e_use_linework_model_coord
Whether to use model coordinates for linework.
@ e_use_texture_model_coord
Whether to use model coordinates for texture mapping.
@ e_parity
Whether parity-based culling is enabled.
@ e_use_lighting
Whether lighting calculations should be applied.
@ e_use_custom_color
Whether to use a custom color override.
@ e_wireframe
Whether the object should render as wireframe.