Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
SceneNodeFwd.h
Go to the documentation of this file.
1/*
2 Copyright (c) 2018 DIVIDE-Studio
3 Copyright (c) 2009 Ionut Cava
4
5 This file is part of DIVIDE Framework.
6
7 Permission is hereby granted, free of charge, to any person obtaining a copy
8 of this software
9 and associated documentation files (the "Software"), to deal in the Software
10 without restriction,
11 including without limitation the rights to use, copy, modify, merge, publish,
12 distribute, sublicense,
13 and/or sell copies of the Software, and to permit persons to whom the
14 Software is furnished to do so,
15 subject to the following conditions:
16
17 The above copyright notice and this permission notice shall be included in
18 all copies or substantial portions of the Software.
19
20 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 IMPLIED,
22 INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23 PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25 DAMAGES OR OTHER LIABILITY,
26 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27 IN CONNECTION WITH THE SOFTWARE
28 OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30 */
31
32#pragma once
33#ifndef DVD_SCENE_NODE_FWD_H_
34#define DVD_SCENE_NODE_FWD_H_
35
37
38namespace Divide {
39
41 enum class NodeUsageContext : U8 {
42 NODE_DYNAMIC = 0,
44 };
45
47 enum class SceneNodeType : U16 {
60 COUNT
61 };
62
63 namespace Names {
64 extern const char* sceneNodeType[to_base(SceneNodeType::COUNT) + 1u];
65 };
66
68
69 struct SGNRayResult {
72 bool inside = false;
73 const char* name = nullptr;
74 };
75
77 {
79 vec2<F32> _range = { 0.f, 1.f };
80 const SceneNodeType* _ignoredTypes = nullptr;
83 };
84
85 [[nodiscard]] FORCE_INLINE constexpr bool IsPrimitive( const SceneNodeType type ) noexcept
86 {
87 return type == SceneNodeType::TYPE_BOX_3D ||
90 }
91
92 [[nodiscard]] FORCE_INLINE constexpr bool IsMesh( const SceneNodeType type ) noexcept
93 {
94 return type == SceneNodeType::TYPE_MESH ||
96 }
97
98 [[nodiscard]] FORCE_INLINE constexpr bool Is3DObject( const SceneNodeType type ) noexcept
99 {
100 return IsPrimitive(type) ||
101 IsMesh(type) ||
103 }
104
105 [[nodiscard]] FORCE_INLINE constexpr bool IsTransformNode( const SceneNodeType nodeType ) noexcept
106 {
107 return nodeType == SceneNodeType::TYPE_TRANSFORM || nodeType == SceneNodeType::TYPE_MESH;
108 }
109
110 template<typename T>
112
113 #define DEFINE_NODE_TYPE_OVERLOAD(Name, Enum) \
114 class Name; \
115 template<> \
116 constexpr SceneNodeType GetSceneNodeType<Name>() { return Enum; } \
117
118 #define DEFINE_NODE_TYPE_INHERIT(Name, Enum, Base) \
119
120 #define DEFINE_NODE_TYPE(Name, Enum) \
121 DEFINE_NODE_TYPE_OVERLOAD(Name, Enum) \
122 class Name final : public SceneNode
123
124 #define DEFINE_NODE_BASE_TYPE(Name, Enum) \
125 DEFINE_NODE_TYPE_OVERLOAD(Name, Enum) \
126 class Name : public SceneNode
127
128 #define DEFINE_3D_OBJECT_TYPE(Name, Enum) \
129 DEFINE_NODE_TYPE_OVERLOAD(Name, Enum) \
130 class Name final : public Object3D
131
132}; //namespace Divide
133
134#endif //DVD_SCENE_NODE_FWD_H_
#define FWD_DECLARE_MANAGED_CLASS(T)
#define FORCE_INLINE
const char * sceneNodeType[to_base(SceneNodeType::COUNT)+1u]
Definition: SceneNode.cpp:21
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
FORCE_INLINE constexpr bool IsTransformNode(const SceneNodeType nodeType) noexcept
Definition: SceneNodeFwd.h:105
NodeUsageContext
Usage context affects lighting, navigation, physics, etc.
Definition: SceneNodeFwd.h:41
constexpr SceneNodeType GetSceneNodeType()
Definition: SceneNodeFwd.h:111
FORCE_INLINE constexpr bool IsPrimitive(const SceneNodeType type) noexcept
Definition: SceneNodeFwd.h:85
uint8_t U8
SceneNodeType
ToDo: Move particle emitter to components (it will make them way more dynamic) - Ionut.
Definition: SceneNodeFwd.h:47
FORCE_INLINE constexpr bool IsMesh(const SceneNodeType type) noexcept
Definition: SceneNodeFwd.h:92
constexpr F32 F32_MAX
uint16_t U16
FORCE_INLINE constexpr bool Is3DObject(const SceneNodeType type) noexcept
Definition: SceneNodeFwd.h:98
int64_t I64
constexpr auto to_base(const Type value) -> Type
const SceneNodeType * _ignoredTypes
Definition: SceneNodeFwd.h:80
const char * name
Definition: SceneNodeFwd.h:73