Browse Source

Make DEFAULT_VIEWMASK, DEFAULT_LIGHTMASK, DEFAULT_SHADOWMASK, DEFAULT_ZONEMASK inline constexpr | Style

1vanK 3 years ago
parent
commit
c14379c7dd

+ 6 - 6
Source/Urho3D/AngelScript/Generated_GlobalVariables.cpp

@@ -13,7 +13,7 @@ namespace Urho3D
 
 
 void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
 void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
 {
 {
-    // static const float ANIMATION_LOD_BASESCALE | File: ../Graphics/Drawable.h
+    // constexpr float ANIMATION_LOD_BASESCALE | File: ../Graphics/Drawable.h
     engine->RegisterGlobalProperty("const float ANIMATION_LOD_BASESCALE", (void*)&ANIMATION_LOD_BASESCALE);
     engine->RegisterGlobalProperty("const float ANIMATION_LOD_BASESCALE", (void*)&ANIMATION_LOD_BASESCALE);
 
 
     // constexpr i32 BITS_PER_COMPONENT | File: ../GraphicsAPI/GraphicsDefs.h
     // constexpr i32 BITS_PER_COMPONENT | File: ../GraphicsAPI/GraphicsDefs.h
@@ -34,7 +34,7 @@ void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
     // constexpr float DEFAULT_FONT_SIZE | File: ../UI/Text.h
     // constexpr float DEFAULT_FONT_SIZE | File: ../UI/Text.h
     engine->RegisterGlobalProperty("const float DEFAULT_FONT_SIZE", (void*)&DEFAULT_FONT_SIZE);
     engine->RegisterGlobalProperty("const float DEFAULT_FONT_SIZE", (void*)&DEFAULT_FONT_SIZE);
 
 
-    // static const unsigned DEFAULT_LIGHTMASK | File: ../Graphics/Drawable.h
+    // constexpr u32 DEFAULT_LIGHTMASK | File: ../Graphics/Drawable.h
     engine->RegisterGlobalProperty("const uint DEFAULT_LIGHTMASK", (void*)&DEFAULT_LIGHTMASK);
     engine->RegisterGlobalProperty("const uint DEFAULT_LIGHTMASK", (void*)&DEFAULT_LIGHTMASK);
 
 
     // static const float DEFAULT_NEARCLIP | File: ../Graphics/Camera.h
     // static const float DEFAULT_NEARCLIP | File: ../Graphics/Camera.h
@@ -49,13 +49,13 @@ void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
     // static constexpr i8 DEFAULT_RENDER_ORDER | File: ../Graphics/Material.h
     // static constexpr i8 DEFAULT_RENDER_ORDER | File: ../Graphics/Material.h
     engine->RegisterGlobalProperty("const int8 DEFAULT_RENDER_ORDER", (void*)&DEFAULT_RENDER_ORDER);
     engine->RegisterGlobalProperty("const int8 DEFAULT_RENDER_ORDER", (void*)&DEFAULT_RENDER_ORDER);
 
 
-    // static const unsigned DEFAULT_SHADOWMASK | File: ../Graphics/Drawable.h
+    // constexpr u32 DEFAULT_SHADOWMASK | File: ../Graphics/Drawable.h
     engine->RegisterGlobalProperty("const uint DEFAULT_SHADOWMASK", (void*)&DEFAULT_SHADOWMASK);
     engine->RegisterGlobalProperty("const uint DEFAULT_SHADOWMASK", (void*)&DEFAULT_SHADOWMASK);
 
 
-    // static const unsigned DEFAULT_VIEWMASK | File: ../Graphics/Drawable.h
+    // constexpr u32 DEFAULT_VIEWMASK | File: ../Graphics/Drawable.h
     engine->RegisterGlobalProperty("const uint DEFAULT_VIEWMASK", (void*)&DEFAULT_VIEWMASK);
     engine->RegisterGlobalProperty("const uint DEFAULT_VIEWMASK", (void*)&DEFAULT_VIEWMASK);
 
 
-    // static const unsigned DEFAULT_ZONEMASK | File: ../Graphics/Drawable.h
+    // constexpr u32 DEFAULT_ZONEMASK | File: ../Graphics/Drawable.h
     engine->RegisterGlobalProperty("const uint DEFAULT_ZONEMASK", (void*)&DEFAULT_ZONEMASK);
     engine->RegisterGlobalProperty("const uint DEFAULT_ZONEMASK", (void*)&DEFAULT_ZONEMASK);
 
 
     // const Vector3 DOT_SCALE | File: ../GraphicsAPI/GraphicsDefs.h
     // const Vector3 DOT_SCALE | File: ../GraphicsAPI/GraphicsDefs.h
@@ -280,7 +280,7 @@ void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
     // static const int MAX_TEXTURE_QUALITY_LEVELS | File: ../GraphicsAPI/Texture.h
     // static const int MAX_TEXTURE_QUALITY_LEVELS | File: ../GraphicsAPI/Texture.h
     engine->RegisterGlobalProperty("const int MAX_TEXTURE_QUALITY_LEVELS", (void*)&MAX_TEXTURE_QUALITY_LEVELS);
     engine->RegisterGlobalProperty("const int MAX_TEXTURE_QUALITY_LEVELS", (void*)&MAX_TEXTURE_QUALITY_LEVELS);
 
 
-    // static const int MAX_VERTEX_LIGHTS | File: ../Graphics/Drawable.h
+    // constexpr i32 MAX_VERTEX_LIGHTS | File: ../Graphics/Drawable.h
     engine->RegisterGlobalProperty("const int MAX_VERTEX_LIGHTS", (void*)&MAX_VERTEX_LIGHTS);
     engine->RegisterGlobalProperty("const int MAX_VERTEX_LIGHTS", (void*)&MAX_VERTEX_LIGHTS);
 
 
     // constexpr i32 MAX_VERTEX_STREAMS | File: ../GraphicsAPI/GraphicsDefs.h
     // constexpr i32 MAX_VERTEX_STREAMS | File: ../GraphicsAPI/GraphicsDefs.h

+ 1 - 1
Source/Urho3D/Graphics/Camera.cpp

@@ -77,7 +77,7 @@ void Camera::RegisterObject(Context* context)
     URHO3D_ACCESSOR_ATTRIBUTE("Orthographic Size", GetOrthoSize, SetOrthoSizeAttr, float, DEFAULT_ORTHOSIZE, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Orthographic Size", GetOrthoSize, SetOrthoSizeAttr, float, DEFAULT_ORTHOSIZE, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Zoom", GetZoom, SetZoom, float, 1.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Zoom", GetZoom, SetZoom, float, 1.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("LOD Bias", GetLodBias, SetLodBias, float, 1.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("LOD Bias", GetLodBias, SetLodBias, float, 1.0f, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("View Mask", int, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("View Mask", u32, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
     URHO3D_ATTRIBUTE("View Override Flags", unsigned, viewOverrideFlags_.AsInteger(), VO_NONE, AM_DEFAULT);
     URHO3D_ATTRIBUTE("View Override Flags", unsigned, viewOverrideFlags_.AsInteger(), VO_NONE, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Projection Offset", GetProjectionOffset, SetProjectionOffset, Vector2, Vector2::ZERO, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Projection Offset", GetProjectionOffset, SetProjectionOffset, Vector2, Vector2::ZERO, AM_DEFAULT);
     URHO3D_MIXED_ACCESSOR_ATTRIBUTE("Reflection Plane", GetReflectionPlaneAttr, SetReflectionPlaneAttr, Vector4,
     URHO3D_MIXED_ACCESSOR_ATTRIBUTE("Reflection Plane", GetReflectionPlaneAttr, SetReflectionPlaneAttr, Vector4,

+ 4 - 4
Source/Urho3D/Graphics/Drawable.cpp

@@ -75,10 +75,10 @@ Drawable::~Drawable()
 void Drawable::RegisterObject(Context* context)
 void Drawable::RegisterObject(Context* context)
 {
 {
     URHO3D_ATTRIBUTE("Max Lights", int, maxLights_, 0, AM_DEFAULT);
     URHO3D_ATTRIBUTE("Max Lights", int, maxLights_, 0, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("View Mask", int, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Light Mask", int, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Shadow Mask", int, shadowMask_, DEFAULT_SHADOWMASK, AM_DEFAULT);
-    URHO3D_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, unsigned, DEFAULT_ZONEMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("View Mask", u32, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Light Mask", u32, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Shadow Mask", u32, shadowMask_, DEFAULT_SHADOWMASK, AM_DEFAULT);
+    URHO3D_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, u32, DEFAULT_ZONEMASK, AM_DEFAULT);
 }
 }
 
 
 void Drawable::OnSetEnabled()
 void Drawable::OnSetEnabled()

+ 6 - 6
Source/Urho3D/Graphics/Drawable.h

@@ -23,12 +23,12 @@ enum class DrawableTypes : u8
 };
 };
 URHO3D_FLAGS(DrawableTypes);
 URHO3D_FLAGS(DrawableTypes);
 
 
-static const unsigned DEFAULT_VIEWMASK = M_MAX_UNSIGNED;
-static const unsigned DEFAULT_LIGHTMASK = M_MAX_UNSIGNED;
-static const unsigned DEFAULT_SHADOWMASK = M_MAX_UNSIGNED;
-static const unsigned DEFAULT_ZONEMASK = M_MAX_UNSIGNED;
-static const int MAX_VERTEX_LIGHTS = 4;
-static const float ANIMATION_LOD_BASESCALE = 2500.0f;
+inline constexpr u32 DEFAULT_VIEWMASK = M_U32_MASK_ALL_BITS;
+inline constexpr u32 DEFAULT_LIGHTMASK = M_U32_MASK_ALL_BITS;
+inline constexpr u32 DEFAULT_SHADOWMASK = M_U32_MASK_ALL_BITS;
+inline constexpr u32 DEFAULT_ZONEMASK = M_U32_MASK_ALL_BITS;
+inline constexpr i32 MAX_VERTEX_LIGHTS = 4;
+inline constexpr float ANIMATION_LOD_BASESCALE = 2500.0f;
 
 
 class Camera;
 class Camera;
 class File;
 class File;

+ 2 - 2
Source/Urho3D/Graphics/Light.cpp

@@ -141,8 +141,8 @@ void Light::RegisterObject(Context* context)
     URHO3D_ATTRIBUTE_EX("Normal Offset", float, shadowBias_.normalOffset_, ValidateShadowBias, DEFAULT_NORMALOFFSET, AM_DEFAULT);
     URHO3D_ATTRIBUTE_EX("Normal Offset", float, shadowBias_.normalOffset_, ValidateShadowBias, DEFAULT_NORMALOFFSET, AM_DEFAULT);
     URHO3D_ATTRIBUTE("Near/Farclip Ratio", float, shadowNearFarRatio_, DEFAULT_SHADOWNEARFARRATIO, AM_DEFAULT);
     URHO3D_ATTRIBUTE("Near/Farclip Ratio", float, shadowNearFarRatio_, DEFAULT_SHADOWNEARFARRATIO, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Max Extrusion", GetShadowMaxExtrusion, SetShadowMaxExtrusion, float, DEFAULT_SHADOWMAXEXTRUSION, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Max Extrusion", GetShadowMaxExtrusion, SetShadowMaxExtrusion, float, DEFAULT_SHADOWMAXEXTRUSION, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("View Mask", int, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Light Mask", int, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("View Mask", u32, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Light Mask", u32, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
 }
 }
 
 
 void Light::ProcessRayQuery(const RayOctreeQuery& query, Vector<RayQueryResult>& results)
 void Light::ProcessRayQuery(const RayOctreeQuery& query, Vector<RayQueryResult>& results)

+ 4 - 4
Source/Urho3D/Graphics/Terrain.cpp

@@ -122,10 +122,10 @@ void Terrain::RegisterObject(Context* context)
     URHO3D_ACCESSOR_ATTRIBUTE("Shadow Distance", GetShadowDistance, SetShadowDistance, float, 0.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Shadow Distance", GetShadowDistance, SetShadowDistance, float, 0.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("LOD Bias", GetLodBias, SetLodBias, float, 1.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("LOD Bias", GetLodBias, SetLodBias, float, 1.0f, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Max Lights", GetMaxLights, SetMaxLights, unsigned, 0, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Max Lights", GetMaxLights, SetMaxLights, unsigned, 0, AM_DEFAULT);
-    URHO3D_ACCESSOR_ATTRIBUTE("View Mask", GetViewMask, SetViewMask, unsigned, DEFAULT_VIEWMASK, AM_DEFAULT);
-    URHO3D_ACCESSOR_ATTRIBUTE("Light Mask", GetLightMask, SetLightMask, unsigned, DEFAULT_LIGHTMASK, AM_DEFAULT);
-    URHO3D_ACCESSOR_ATTRIBUTE("Shadow Mask", GetShadowMask, SetShadowMask, unsigned, DEFAULT_SHADOWMASK, AM_DEFAULT);
-    URHO3D_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, unsigned, DEFAULT_ZONEMASK, AM_DEFAULT);
+    URHO3D_ACCESSOR_ATTRIBUTE("View Mask", GetViewMask, SetViewMask, u32, DEFAULT_VIEWMASK, AM_DEFAULT);
+    URHO3D_ACCESSOR_ATTRIBUTE("Light Mask", GetLightMask, SetLightMask, u32, DEFAULT_LIGHTMASK, AM_DEFAULT);
+    URHO3D_ACCESSOR_ATTRIBUTE("Shadow Mask", GetShadowMask, SetShadowMask, u32, DEFAULT_SHADOWMASK, AM_DEFAULT);
+    URHO3D_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, u32, DEFAULT_ZONEMASK, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Occlusion LOD level", GetOcclusionLodLevel, SetOcclusionLodLevelAttr, unsigned, M_MAX_UNSIGNED, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Occlusion LOD level", GetOcclusionLodLevel, SetOcclusionLodLevelAttr, unsigned, M_MAX_UNSIGNED, AM_DEFAULT);
 }
 }
 
 

+ 3 - 3
Source/Urho3D/Graphics/Zone.cpp

@@ -66,9 +66,9 @@ void Zone::RegisterObject(Context* context)
     URHO3D_ATTRIBUTE_EX("Priority", int, priority_, MarkNodeDirty, 0, AM_DEFAULT);
     URHO3D_ATTRIBUTE_EX("Priority", int, priority_, MarkNodeDirty, 0, AM_DEFAULT);
     URHO3D_MIXED_ACCESSOR_ATTRIBUTE("Zone Texture", GetZoneTextureAttr, SetZoneTextureAttr, ResourceRef,
     URHO3D_MIXED_ACCESSOR_ATTRIBUTE("Zone Texture", GetZoneTextureAttr, SetZoneTextureAttr, ResourceRef,
         ResourceRef(TextureCube::GetTypeStatic()), AM_DEFAULT);
         ResourceRef(TextureCube::GetTypeStatic()), AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Light Mask", int, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("Shadow Mask", int, shadowMask_, DEFAULT_SHADOWMASK, AM_DEFAULT);
-    URHO3D_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, unsigned, DEFAULT_ZONEMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Light Mask", u32, lightMask_, DEFAULT_LIGHTMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("Shadow Mask", u32, shadowMask_, DEFAULT_SHADOWMASK, AM_DEFAULT);
+    URHO3D_ACCESSOR_ATTRIBUTE("Zone Mask", GetZoneMask, SetZoneMask, u32, DEFAULT_ZONEMASK, AM_DEFAULT);
 }
 }
 
 
 void Zone::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)
 void Zone::DrawDebugGeometry(DebugRenderer* debug, bool depthTest)

+ 1 - 1
Source/Urho3D/Urho2D/Drawable2D.cpp

@@ -40,7 +40,7 @@ void Drawable2D::RegisterObject(Context* context)
 {
 {
     URHO3D_ACCESSOR_ATTRIBUTE("Layer", GetLayer, SetLayer, int, 0, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Layer", GetLayer, SetLayer, int, 0, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Order in Layer", GetOrderInLayer, SetOrderInLayer, int, 0, AM_DEFAULT);
     URHO3D_ACCESSOR_ATTRIBUTE("Order in Layer", GetOrderInLayer, SetOrderInLayer, int, 0, AM_DEFAULT);
-    URHO3D_ATTRIBUTE("View Mask", int, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
+    URHO3D_ATTRIBUTE("View Mask", u32, viewMask_, DEFAULT_VIEWMASK, AM_DEFAULT);
 }
 }
 
 
 void Drawable2D::OnSetEnabled()
 void Drawable2D::OnSetEnabled()