فهرست منبع

View: unsigned to signed

1vanK 3 سال پیش
والد
کامیت
a501df74f3

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

@@ -286,8 +286,8 @@ void ASRegisterGeneratedGlobalVariables(asIScriptEngine* engine)
     // constexpr i32 MAX_VERTEX_STREAMS | File: ../GraphicsAPI/GraphicsDefs.h
     // constexpr i32 MAX_VERTEX_STREAMS | File: ../GraphicsAPI/GraphicsDefs.h
     engine->RegisterGlobalProperty("const int MAX_VERTEX_STREAMS", (void*)&MAX_VERTEX_STREAMS);
     engine->RegisterGlobalProperty("const int MAX_VERTEX_STREAMS", (void*)&MAX_VERTEX_STREAMS);
 
 
-    // static const unsigned MAX_VIEWPORT_TEXTURES | File: ../Graphics/View.h
-    engine->RegisterGlobalProperty("const uint MAX_VIEWPORT_TEXTURES", (void*)&MAX_VIEWPORT_TEXTURES);
+    // constexpr i32 MAX_VIEWPORT_TEXTURES | File: ../Graphics/View.h
+    engine->RegisterGlobalProperty("const int MAX_VIEWPORT_TEXTURES", (void*)&MAX_VIEWPORT_TEXTURES);
 
 
     // const IntVector2 MOUSE_POSITION_OFFSCREEN | File: ../Input/Input.h
     // const IntVector2 MOUSE_POSITION_OFFSCREEN | File: ../Input/Input.h
     engine->RegisterGlobalProperty("const IntVector2 MOUSE_POSITION_OFFSCREEN", (void*)&MOUSE_POSITION_OFFSCREEN);
     engine->RegisterGlobalProperty("const IntVector2 MOUSE_POSITION_OFFSCREEN", (void*)&MOUSE_POSITION_OFFSCREEN);

+ 8 - 8
Source/Urho3D/AngelScript/Generated_Members.h

@@ -2499,9 +2499,9 @@ template <class T> void RegisterMembers_LightQueryResult(asIScriptEngine* engine
     // Error: type "Vector<Drawable*>" can not automatically bind
     // Error: type "Vector<Drawable*>" can not automatically bind
     // Camera* LightQueryResult::shadowCameras_[MAX_LIGHT_SPLITS]
     // Camera* LightQueryResult::shadowCameras_[MAX_LIGHT_SPLITS]
     // Not registered because array
     // Not registered because array
-    // unsigned LightQueryResult::shadowCasterBegin_[MAX_LIGHT_SPLITS]
+    // i32 LightQueryResult::shadowCasterBegin_[MAX_LIGHT_SPLITS]
     // Not registered because array
     // Not registered because array
-    // unsigned LightQueryResult::shadowCasterEnd_[MAX_LIGHT_SPLITS]
+    // i32 LightQueryResult::shadowCasterEnd_[MAX_LIGHT_SPLITS]
     // Not registered because array
     // Not registered because array
     // BoundingBox LightQueryResult::shadowCasterBox_[MAX_LIGHT_SPLITS]
     // BoundingBox LightQueryResult::shadowCasterBox_[MAX_LIGHT_SPLITS]
     // Not registered because array
     // Not registered because array
@@ -2510,8 +2510,8 @@ template <class T> void RegisterMembers_LightQueryResult(asIScriptEngine* engine
     // float LightQueryResult::shadowFarSplits_[MAX_LIGHT_SPLITS]
     // float LightQueryResult::shadowFarSplits_[MAX_LIGHT_SPLITS]
     // Not registered because array
     // Not registered because array
 
 
-    // unsigned LightQueryResult::numSplits_
-    engine->RegisterObjectProperty(className, "uint numSplits", offsetof(T, numSplits_));
+    // i32 LightQueryResult::numSplits_
+    engine->RegisterObjectProperty(className, "int numSplits", offsetof(T, numSplits_));
 
 
     #ifdef REGISTER_MEMBERS_MANUAL_PART_LightQueryResult
     #ifdef REGISTER_MEMBERS_MANUAL_PART_LightQueryResult
         REGISTER_MEMBERS_MANUAL_PART_LightQueryResult();
         REGISTER_MEMBERS_MANUAL_PART_LightQueryResult();
@@ -4282,8 +4282,8 @@ template <class T> void RegisterMembers_ScenePassInfo(asIScriptEngine* engine, c
     // BatchQueue* ScenePassInfo::batchQueue_
     // BatchQueue* ScenePassInfo::batchQueue_
     // Not registered because pointer
     // Not registered because pointer
 
 
-    // unsigned ScenePassInfo::passIndex_
-    engine->RegisterObjectProperty(className, "uint passIndex", offsetof(T, passIndex_));
+    // i32 ScenePassInfo::passIndex_
+    engine->RegisterObjectProperty(className, "int passIndex", offsetof(T, passIndex_));
 
 
     // bool ScenePassInfo::allowInstancing_
     // bool ScenePassInfo::allowInstancing_
     engine->RegisterObjectProperty(className, "bool allowInstancing", offsetof(T, allowInstancing_));
     engine->RegisterObjectProperty(className, "bool allowInstancing", offsetof(T, allowInstancing_));
@@ -12697,8 +12697,8 @@ template <class T> void RegisterMembers_View(asIScriptEngine* engine, const char
     // const Vector<Light*>& View::GetLights() const
     // const Vector<Light*>& View::GetLights() const
     engine->RegisterObjectMethod(className, "Array<Light@>@ GetLights() const", AS_FUNCTION_OBJFIRST(View_constspVectorlesLightstargreamp_GetLights_void_template<View>), AS_CALL_CDECL_OBJFIRST);
     engine->RegisterObjectMethod(className, "Array<Light@>@ GetLights() const", AS_FUNCTION_OBJFIRST(View_constspVectorlesLightstargreamp_GetLights_void_template<View>), AS_CALL_CDECL_OBJFIRST);
 
 
-    // unsigned View::GetNumActiveOccluders() const
-    engine->RegisterObjectMethod(className, "uint GetNumActiveOccluders() const", AS_METHODPR(T, GetNumActiveOccluders, () const, unsigned), AS_CALL_THISCALL);
+    // i32 View::GetNumActiveOccluders() const
+    engine->RegisterObjectMethod(className, "int GetNumActiveOccluders() const", AS_METHODPR(T, GetNumActiveOccluders, () const, i32), AS_CALL_THISCALL);
 
 
     // const Vector<Drawable*>& View::GetOccluders() const
     // const Vector<Drawable*>& View::GetOccluders() const
     engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetOccluders() const", AS_FUNCTION_OBJFIRST(View_constspVectorlesDrawablestargreamp_GetOccluders_void_template<View>), AS_CALL_CDECL_OBJFIRST);
     engine->RegisterObjectMethod(className, "Array<Drawable@>@ GetOccluders() const", AS_FUNCTION_OBJFIRST(View_constspVectorlesDrawablestargreamp_GetOccluders_void_template<View>), AS_CALL_CDECL_OBJFIRST);

+ 32 - 30
Source/Urho3D/Graphics/View.cpp

@@ -266,7 +266,7 @@ View::View(Context* context) :
     renderer_(GetSubsystem<Renderer>())
     renderer_(GetSubsystem<Renderer>())
 {
 {
     // Create octree query and scene results vector for each thread
     // Create octree query and scene results vector for each thread
-    unsigned numThreads = GetSubsystem<WorkQueue>()->GetNumThreads() + 1; // Worker threads + main thread
+    i32 numThreads = GetSubsystem<WorkQueue>()->GetNumThreads() + 1; // Worker threads + main thread
     tempDrawables_.Resize(numThreads);
     tempDrawables_.Resize(numThreads);
     sceneResults_.Resize(numThreads);
     sceneResults_.Resize(numThreads);
 }
 }
@@ -336,7 +336,7 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
     }
     }
 
 
     // Set default passes
     // Set default passes
-    gBufferPassIndex_ = M_MAX_UNSIGNED;
+    gBufferPassIndex_ = NINDEX;
     basePassIndex_ = Technique::GetPassIndex("base");
     basePassIndex_ = Technique::GetPassIndex("base");
     alphaPassIndex_ = Technique::GetPassIndex("alpha");
     alphaPassIndex_ = Technique::GetPassIndex("alpha");
     lightPassIndex_ = Technique::GetPassIndex("light");
     lightPassIndex_ = Technique::GetPassIndex("light");
@@ -409,9 +409,9 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
                 }
                 }
             }
             }
 
 
-            HashMap<unsigned, BatchQueue>::Iterator j = batchQueues_.Find(info.passIndex_);
+            HashMap<i32, BatchQueue>::Iterator j = batchQueues_.Find(info.passIndex_);
             if (j == batchQueues_.End())
             if (j == batchQueues_.End())
-                j = batchQueues_.Insert(Pair<unsigned, BatchQueue>(info.passIndex_, BatchQueue()));
+                j = batchQueues_.Insert(Pair<i32, BatchQueue>(info.passIndex_, BatchQueue()));
             info.batchQueue_ = &j->second_;
             info.batchQueue_ = &j->second_;
             SetQueueShaderDefines(*info.batchQueue_, command);
             SetQueueShaderDefines(*info.batchQueue_, command);
 
 
@@ -477,7 +477,7 @@ bool View::Define(RenderSurface* renderTarget, Viewport* viewport)
     // Set possible quality overrides from the camera
     // Set possible quality overrides from the camera
     // Note that the culling camera is used here (its settings are authoritative) while the render camera
     // Note that the culling camera is used here (its settings are authoritative) while the render camera
     // will be just used for the final view & projection matrices
     // will be just used for the final view & projection matrices
-    unsigned viewOverrideFlags = cullCamera_ ? cullCamera_->GetViewOverrideFlags() : VO_NONE;
+    ViewOverrideFlags viewOverrideFlags = cullCamera_ ? cullCamera_->GetViewOverrideFlags() : VO_NONE;
     if (viewOverrideFlags & VO_LOW_MATERIAL_QUALITY)
     if (viewOverrideFlags & VO_LOW_MATERIAL_QUALITY)
         materialQuality_ = QUALITY_LOW;
         materialQuality_ = QUALITY_LOW;
     if (viewOverrideFlags & VO_DISABLE_SHADOWS)
     if (viewOverrideFlags & VO_DISABLE_SHADOWS)
@@ -517,7 +517,7 @@ void View::Update(const FrameInfo& frame)
     occluders_.Clear();
     occluders_.Clear();
     activeOccluders_ = 0;
     activeOccluders_ = 0;
     vertexLightQueues_.Clear();
     vertexLightQueues_.Clear();
-    for (HashMap<unsigned, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
+    for (HashMap<i32, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
         i->second_.Clear(maxSortedInstances);
         i->second_.Clear(maxSortedInstances);
 
 
     if (hasScenePasses_ && (!cullCamera_ || !octree_))
     if (hasScenePasses_ && (!cullCamera_ || !octree_))
@@ -613,7 +613,7 @@ void View::Render()
             }
             }
 
 
             graphics_->SetRenderTarget(0, currentRenderTarget_);
             graphics_->SetRenderTarget(0, currentRenderTarget_);
-            for (unsigned i = 1; i < MAX_RENDERTARGETS; ++i)
+            for (i32 i = 1; i < MAX_RENDERTARGETS; ++i)
                 graphics_->SetRenderTarget(i, (RenderSurface*)nullptr);
                 graphics_->SetRenderTarget(i, (RenderSurface*)nullptr);
 
 
             // If a custom depth surface was used, use it also for debug rendering
             // If a custom depth surface was used, use it also for debug rendering
@@ -990,8 +990,8 @@ void View::GetLightBatches()
         URHO3D_PROFILE(GetLightBatches);
         URHO3D_PROFILE(GetLightBatches);
 
 
         // Preallocate light queues: per-pixel lights which have lit geometries
         // Preallocate light queues: per-pixel lights which have lit geometries
-        unsigned numLightQueues = 0;
-        unsigned usedLightQueues = 0;
+        i32 numLightQueues = 0;
+        i32 usedLightQueues = 0;
         for (Vector<LightQueryResult>::ConstIterator i = lightQueryResults_.Begin(); i != lightQueryResults_.End(); ++i)
         for (Vector<LightQueryResult>::ConstIterator i = lightQueryResults_.Begin(); i != lightQueryResults_.End(); ++i)
         {
         {
             if (!i->light_->GetPerVertex() && i->litGeometries_.Size())
             if (!i->light_->GetPerVertex() && i->litGeometries_.Size())
@@ -1000,7 +1000,7 @@ void View::GetLightBatches()
 
 
         lightQueues_.Resize(numLightQueues);
         lightQueues_.Resize(numLightQueues);
         maxLightsDrawables_.Clear();
         maxLightsDrawables_.Clear();
-        auto maxSortedInstances = (unsigned)renderer_->GetMaxSortedInstances();
+        i32 maxSortedInstances = renderer_->GetMaxSortedInstances();
 
 
         for (Vector<LightQueryResult>::Iterator i = lightQueryResults_.Begin(); i != lightQueryResults_.End(); ++i)
         for (Vector<LightQueryResult>::Iterator i = lightQueryResults_.Begin(); i != lightQueryResults_.End(); ++i)
         {
         {
@@ -1015,7 +1015,7 @@ void View::GetLightBatches()
             // Per-pixel light
             // Per-pixel light
             if (!light->GetPerVertex())
             if (!light->GetPerVertex())
             {
             {
-                unsigned shadowSplits = query.numSplits_;
+                i32 shadowSplits = query.numSplits_;
 
 
                 // Initialize light queue and store it to the light so that it can be found later
                 // Initialize light queue and store it to the light so that it can be found later
                 LightBatchQueue& lightQueue = lightQueues_[usedLightQueues++];
                 LightBatchQueue& lightQueue = lightQueues_[usedLightQueues++];
@@ -1040,7 +1040,7 @@ void View::GetLightBatches()
                 // Allocate shadow map now
                 // Allocate shadow map now
                 if (shadowSplits > 0)
                 if (shadowSplits > 0)
                 {
                 {
-                    lightQueue.shadowMap_ = renderer_->GetShadowMap(light, cullCamera_, (unsigned)viewSize_.x_, (unsigned)viewSize_.y_);
+                    lightQueue.shadowMap_ = renderer_->GetShadowMap(light, cullCamera_, viewSize_.x_, viewSize_.y_);
                     // If did not manage to get a shadow map, convert the light to unshadowed
                     // If did not manage to get a shadow map, convert the light to unshadowed
                     if (!lightQueue.shadowMap_)
                     if (!lightQueue.shadowMap_)
                         shadowSplits = 0;
                         shadowSplits = 0;
@@ -1048,7 +1048,7 @@ void View::GetLightBatches()
 
 
                 // Setup shadow batch queues
                 // Setup shadow batch queues
                 lightQueue.shadowSplits_.Resize(shadowSplits);
                 lightQueue.shadowSplits_.Resize(shadowSplits);
-                for (unsigned j = 0; j < shadowSplits; ++j)
+                for (i32 j = 0; j < shadowSplits; ++j)
                 {
                 {
                     ShadowBatchQueue& shadowQueue = lightQueue.shadowSplits_[j];
                     ShadowBatchQueue& shadowQueue = lightQueue.shadowSplits_[j];
                     Camera* shadowCamera = query.shadowCameras_[j];
                     Camera* shadowCamera = query.shadowCameras_[j];
@@ -1372,7 +1372,7 @@ void View::GetLitBatches(Drawable* drawable, LightBatchQueue& lightQueue, BatchQ
             continue;
             continue;
 
 
         // Do not create pixel lit forward passes for materials that render into the G-buffer
         // Do not create pixel lit forward passes for materials that render into the G-buffer
-        if (gBufferPassIndex_ != M_MAX_UNSIGNED && tech->HasPass(gBufferPassIndex_))
+        if (gBufferPassIndex_ != NINDEX && tech->HasPass(gBufferPassIndex_))
             continue;
             continue;
 
 
         Batch destBatch(srcBatch);
         Batch destBatch(srcBatch);
@@ -1775,7 +1775,7 @@ bool View::SetTextures(RenderPathCommand& command)
 {
 {
     bool allowDepthWrite = true;
     bool allowDepthWrite = true;
 
 
-    for (unsigned i = 0; i < MAX_TEXTURE_UNITS; ++i)
+    for (i32 i = 0; i < MAX_TEXTURE_UNITS; ++i)
     {
     {
         if (command.textureNames_[i].Empty())
         if (command.textureNames_[i].Empty())
             continue;
             continue;
@@ -1931,7 +1931,7 @@ void View::AllocateScreenBuffers()
     bool hasViewportRead = false;
     bool hasViewportRead = false;
     bool hasPingpong = false;
     bool hasPingpong = false;
     bool needSubstitute = false;
     bool needSubstitute = false;
-    unsigned numViewportTextures = 0;
+    i32 numViewportTextures = 0;
     lastCustomDepthSurface_ = nullptr;
     lastCustomDepthSurface_ = nullptr;
 
 
     // Check for commands with special meaning: has custom depth, renders a scene pass to other than the destination viewport,
     // Check for commands with special meaning: has custom depth, renders a scene pass to other than the destination viewport,
@@ -2028,7 +2028,7 @@ void View::AllocateScreenBuffers()
     bool sRGB = renderTarget_ ? renderTarget_->GetParentTexture()->GetSRGB() : graphics_->GetSRGB();
     bool sRGB = renderTarget_ ? renderTarget_->GetParentTexture()->GetSRGB() : graphics_->GetSRGB();
     substituteRenderTarget_ = needSubstitute ? GetRenderSurfaceFromTexture(renderer_->GetScreenBuffer(viewSize_.x_, viewSize_.y_,
     substituteRenderTarget_ = needSubstitute ? GetRenderSurfaceFromTexture(renderer_->GetScreenBuffer(viewSize_.x_, viewSize_.y_,
         format, 1, false, false, true, sRGB)) : nullptr;
         format, 1, false, false, true, sRGB)) : nullptr;
-    for (unsigned i = 0; i < MAX_VIEWPORT_TEXTURES; ++i)
+    for (i32 i = 0; i < MAX_VIEWPORT_TEXTURES; ++i)
     {
     {
         viewportTextures_[i] = i < numViewportTextures ? renderer_->GetScreenBuffer(viewSize_.x_, viewSize_.y_, format, 1, false,
         viewportTextures_[i] = i < numViewportTextures ? renderer_->GetScreenBuffer(viewSize_.x_, viewSize_.y_, format, 1, false,
             false, true, sRGB) : nullptr;
             false, true, sRGB) : nullptr;
@@ -2093,7 +2093,7 @@ void View::BlitFramebuffer(Texture* source, RenderSurface* destination, bool dep
     graphics_->SetScissorTest(false);
     graphics_->SetScissorTest(false);
     graphics_->SetStencilTest(false);
     graphics_->SetStencilTest(false);
     graphics_->SetRenderTarget(0, destination);
     graphics_->SetRenderTarget(0, destination);
-    for (unsigned i = 1; i < MAX_RENDERTARGETS; ++i)
+    for (i32 i = 1; i < MAX_RENDERTARGETS; ++i)
         graphics_->SetRenderTarget(i, (RenderSurface*)nullptr);
         graphics_->SetRenderTarget(i, (RenderSurface*)nullptr);
     graphics_->SetDepthStencil(GetDepthStencil(destination));
     graphics_->SetDepthStencil(GetDepthStencil(destination));
     graphics_->SetViewport(destRect);
     graphics_->SetViewport(destRect);
@@ -2205,7 +2205,7 @@ void View::UpdateOccluders(Vector<Drawable*>& occluders, Camera* camera)
 
 
 void View::DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occluders)
 void View::DrawOccluders(OcclusionBuffer* buffer, const Vector<Drawable*>& occluders)
 {
 {
-    buffer->SetMaxTriangles((unsigned)maxOccluderTriangles_);
+    buffer->SetMaxTriangles(maxOccluderTriangles_);
     buffer->Clear();
     buffer->Clear();
 
 
     if (!buffer->IsThreaded())
     if (!buffer->IsThreaded())
@@ -2322,7 +2322,7 @@ void View::ProcessLight(LightQueryResult& query, i32 threadIndex)
 
 
     // Process each split for shadow casters
     // Process each split for shadow casters
     query.shadowCasters_.Clear();
     query.shadowCasters_.Clear();
-    for (unsigned i = 0; i < query.numSplits_; ++i)
+    for (i32 i = 0; i < query.numSplits_; ++i)
     {
     {
         Camera* shadowCamera = query.shadowCameras_[i];
         Camera* shadowCamera = query.shadowCameras_[i];
         const Frustum& shadowCameraFrustum = shadowCamera->GetFrustum();
         const Frustum& shadowCameraFrustum = shadowCamera->GetFrustum();
@@ -2355,8 +2355,10 @@ void View::ProcessLight(LightQueryResult& query, i32 threadIndex)
         query.numSplits_ = 0;
         query.numSplits_ = 0;
 }
 }
 
 
-void View::ProcessShadowCasters(LightQueryResult& query, const Vector<Drawable*>& drawables, unsigned splitIndex)
+void View::ProcessShadowCasters(LightQueryResult& query, const Vector<Drawable*>& drawables, i32 splitIndex)
 {
 {
+    assert(splitIndex >= 0);
+
     Light* light = query.light_;
     Light* light = query.light_;
     unsigned lightMask = light->GetLightMask();
     unsigned lightMask = light->GetLightMask();
 
 
@@ -2565,7 +2567,7 @@ void View::SetupShadowCameras(LightQueryResult& query)
                 &Vector3::BACK
                 &Vector3::BACK
             };
             };
 
 
-            for (unsigned i = 0; i < MAX_CUBEMAP_FACES; ++i)
+            for (i32 i = 0; i < MAX_CUBEMAP_FACES; ++i)
             {
             {
                 Camera* shadowCamera = renderer_->GetShadowCamera();
                 Camera* shadowCamera = renderer_->GetShadowCamera();
                 query.shadowCameras_[i] = shadowCamera;
                 query.shadowCameras_[i] = shadowCamera;
@@ -2840,7 +2842,7 @@ void View::CheckMaterialForAuxView(Material* material)
             else if (texture->GetType() == TextureCube::GetTypeStatic())
             else if (texture->GetType() == TextureCube::GetTypeStatic())
             {
             {
                 auto* texCube = static_cast<TextureCube*>(texture);
                 auto* texCube = static_cast<TextureCube*>(texture);
-                for (unsigned j = 0; j < MAX_CUBEMAP_FACES; ++j)
+                for (i32 j = 0; j < MAX_CUBEMAP_FACES; ++j)
                 {
                 {
                     RenderSurface* target = texCube->GetRenderSurface((CubeMapFace)j);
                     RenderSurface* target = texCube->GetRenderSurface((CubeMapFace)j);
                     if (target && target->GetUpdateMode() == SURFACE_UPDATEVISIBLE)
                     if (target && target->GetUpdateMode() == SURFACE_UPDATEVISIBLE)
@@ -2913,9 +2915,9 @@ void View::AddBatchToQueue(BatchQueue& queue, Batch& batch, Technique* tech, boo
         // If batch is static with multiple world transforms and cannot instance, we must push copies of the batch individually
         // If batch is static with multiple world transforms and cannot instance, we must push copies of the batch individually
         if (batch.geometryType_ == GEOM_STATIC && batch.numWorldTransforms_ > 1)
         if (batch.geometryType_ == GEOM_STATIC && batch.numWorldTransforms_ > 1)
         {
         {
-            unsigned numTransforms = batch.numWorldTransforms_;
+            i32 numTransforms = batch.numWorldTransforms_;
             batch.numWorldTransforms_ = 1;
             batch.numWorldTransforms_ = 1;
-            for (unsigned i = 0; i < numTransforms; ++i)
+            for (i32 i = 0; i < numTransforms; ++i)
             {
             {
                 // Move the transform pointer to generate copies of the batch which only refer to 1 world transform
                 // Move the transform pointer to generate copies of the batch which only refer to 1 world transform
                 queue.batches_.Push(batch);
                 queue.batches_.Push(batch);
@@ -2939,9 +2941,9 @@ void View::PrepareInstancingBuffer()
 
 
     URHO3D_PROFILE(PrepareInstancingBuffer);
     URHO3D_PROFILE(PrepareInstancingBuffer);
 
 
-    unsigned totalInstances = 0;
+    i32 totalInstances = 0;
 
 
-    for (HashMap<unsigned, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
+    for (HashMap<i32, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
         totalInstances += i->second_.GetNumInstances();
         totalInstances += i->second_.GetNumInstances();
 
 
     for (Vector<LightBatchQueue>::Iterator i = lightQueues_.Begin(); i != lightQueues_.End(); ++i)
     for (Vector<LightBatchQueue>::Iterator i = lightQueues_.Begin(); i != lightQueues_.End(); ++i)
@@ -2963,7 +2965,7 @@ void View::PrepareInstancingBuffer()
         return;
         return;
 
 
     const i32 stride = instancingBuffer->GetVertexSize();
     const i32 stride = instancingBuffer->GetVertexSize();
-    for (HashMap<unsigned, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
+    for (HashMap<i32, BatchQueue>::Iterator i = batchQueues_.Begin(); i != batchQueues_.End(); ++i)
         i->second_.SetInstancingData(dest, stride, freeIndex);
         i->second_.SetInstancingData(dest, stride, freeIndex);
 
 
     for (Vector<LightBatchQueue>::Iterator i = lightQueues_.Begin(); i != lightQueues_.End(); ++i)
     for (Vector<LightBatchQueue>::Iterator i = lightQueues_.Begin(); i != lightQueues_.End(); ++i)
@@ -3055,7 +3057,7 @@ void View::RenderShadowMap(const LightBatchQueue& queue)
         graphics_->SetDepthStencil(shadowMap);
         graphics_->SetDepthStencil(shadowMap);
         graphics_->SetRenderTarget(0, shadowMap->GetRenderSurface()->GetLinkedRenderTarget());
         graphics_->SetRenderTarget(0, shadowMap->GetRenderSurface()->GetLinkedRenderTarget());
         // Disable other render targets
         // Disable other render targets
-        for (unsigned i = 1; i < MAX_RENDERTARGETS; ++i)
+        for (i32 i = 1; i < MAX_RENDERTARGETS; ++i)
             graphics_->SetRenderTarget(i, (RenderSurface*) nullptr);
             graphics_->SetRenderTarget(i, (RenderSurface*) nullptr);
         graphics_->SetViewport(IntRect(0, 0, shadowMap->GetWidth(), shadowMap->GetHeight()));
         graphics_->SetViewport(IntRect(0, 0, shadowMap->GetWidth(), shadowMap->GetHeight()));
         graphics_->Clear(CLEAR_DEPTH);
         graphics_->Clear(CLEAR_DEPTH);
@@ -3065,7 +3067,7 @@ void View::RenderShadowMap(const LightBatchQueue& queue)
         graphics_->SetColorWrite(true);
         graphics_->SetColorWrite(true);
         graphics_->SetRenderTarget(0, shadowMap);
         graphics_->SetRenderTarget(0, shadowMap);
         // Disable other render targets
         // Disable other render targets
-        for (unsigned i = 1; i < MAX_RENDERTARGETS; ++i)
+        for (i32 i = 1; i < MAX_RENDERTARGETS; ++i)
             graphics_->SetRenderTarget(i, (RenderSurface*) nullptr);
             graphics_->SetRenderTarget(i, (RenderSurface*) nullptr);
         graphics_->SetDepthStencil(renderer_->GetDepthStencil(shadowMap->GetWidth(), shadowMap->GetHeight(),
         graphics_->SetDepthStencil(renderer_->GetDepthStencil(shadowMap->GetWidth(), shadowMap->GetHeight(),
             shadowMap->GetMultiSample(), shadowMap->GetAutoResolve()));
             shadowMap->GetMultiSample(), shadowMap->GetAutoResolve()));

+ 15 - 15
Source/Urho3D/Graphics/View.h

@@ -43,9 +43,9 @@ struct LightQueryResult
     /// Shadow cameras.
     /// Shadow cameras.
     Camera* shadowCameras_[MAX_LIGHT_SPLITS];
     Camera* shadowCameras_[MAX_LIGHT_SPLITS];
     /// Shadow caster start indices.
     /// Shadow caster start indices.
-    unsigned shadowCasterBegin_[MAX_LIGHT_SPLITS];
+    i32 shadowCasterBegin_[MAX_LIGHT_SPLITS];
     /// Shadow caster end indices.
     /// Shadow caster end indices.
-    unsigned shadowCasterEnd_[MAX_LIGHT_SPLITS];
+    i32 shadowCasterEnd_[MAX_LIGHT_SPLITS];
     /// Combined bounding box of shadow casters in light projection space. Only used for focused spot lights.
     /// Combined bounding box of shadow casters in light projection space. Only used for focused spot lights.
     BoundingBox shadowCasterBox_[MAX_LIGHT_SPLITS];
     BoundingBox shadowCasterBox_[MAX_LIGHT_SPLITS];
     /// Shadow camera near splits (directional lights only).
     /// Shadow camera near splits (directional lights only).
@@ -53,14 +53,14 @@ struct LightQueryResult
     /// Shadow camera far splits (directional lights only).
     /// Shadow camera far splits (directional lights only).
     float shadowFarSplits_[MAX_LIGHT_SPLITS];
     float shadowFarSplits_[MAX_LIGHT_SPLITS];
     /// Shadow map split count.
     /// Shadow map split count.
-    unsigned numSplits_;
+    i32 numSplits_;
 };
 };
 
 
 /// Scene render pass info.
 /// Scene render pass info.
 struct ScenePassInfo
 struct ScenePassInfo
 {
 {
     /// Pass index.
     /// Pass index.
-    unsigned passIndex_;
+    i32 passIndex_;
     /// Allow instancing flag.
     /// Allow instancing flag.
     bool allowInstancing_;
     bool allowInstancing_;
     /// Mark to stencil flag.
     /// Mark to stencil flag.
@@ -84,7 +84,7 @@ struct PerThreadSceneResult
     float maxZ_;
     float maxZ_;
 };
 };
 
 
-static const unsigned MAX_VIEWPORT_TEXTURES = 2;
+inline constexpr i32 MAX_VIEWPORT_TEXTURES = 2;
 
 
 /// Internal structure for 3D rendering work. Created for each backbuffer and texture viewport, but not for shadow cameras.
 /// Internal structure for 3D rendering work. Created for each backbuffer and texture viewport, but not for shadow cameras.
 class URHO3D_API View : public Object
 class URHO3D_API View : public Object
@@ -155,7 +155,7 @@ public:
     OcclusionBuffer* GetOcclusionBuffer() const { return occlusionBuffer_; }
     OcclusionBuffer* GetOcclusionBuffer() const { return occlusionBuffer_; }
 
 
     /// Return number of occluders that were actually rendered. Occluders may be rejected if running out of triangles or if behind other occluders.
     /// Return number of occluders that were actually rendered. Occluders may be rejected if running out of triangles or if behind other occluders.
-    unsigned GetNumActiveOccluders() const { return activeOccluders_; }
+    i32 GetNumActiveOccluders() const { return activeOccluders_; }
 
 
     /// Return the source view that was already prepared. Used when viewports specify the same culling camera.
     /// Return the source view that was already prepared. Used when viewports specify the same culling camera.
     View* GetSourceView() const;
     View* GetSourceView() const;
@@ -217,7 +217,7 @@ private:
     /// Query for lit geometries and shadow casters for a light.
     /// Query for lit geometries and shadow casters for a light.
     void ProcessLight(LightQueryResult& query, i32 threadIndex);
     void ProcessLight(LightQueryResult& query, i32 threadIndex);
     /// Process shadow casters' visibilities and build their combined view- or projection-space bounding box.
     /// Process shadow casters' visibilities and build their combined view- or projection-space bounding box.
-    void ProcessShadowCasters(LightQueryResult& query, const Vector<Drawable*>& drawables, unsigned splitIndex);
+    void ProcessShadowCasters(LightQueryResult& query, const Vector<Drawable*>& drawables, i32 splitIndex);
     /// Set up initial shadow camera view(s).
     /// Set up initial shadow camera view(s).
     void SetupShadowCameras(LightQueryResult& query);
     void SetupShadowCameras(LightQueryResult& query);
     /// Set up a directional light shadow camera.
     /// Set up a directional light shadow camera.
@@ -379,7 +379,7 @@ private:
     /// Lights.
     /// Lights.
     Vector<Light*> lights_;
     Vector<Light*> lights_;
     /// Number of active occluders.
     /// Number of active occluders.
-    unsigned activeOccluders_{};
+    i32 activeOccluders_{};
 
 
     /// Drawables that limit their maximum light count.
     /// Drawables that limit their maximum light count.
     HashSet<Drawable*> maxLightsDrawables_;
     HashSet<Drawable*> maxLightsDrawables_;
@@ -394,19 +394,19 @@ private:
     /// Per-vertex light queues.
     /// Per-vertex light queues.
     HashMap<hash64, LightBatchQueue> vertexLightQueues_;
     HashMap<hash64, LightBatchQueue> vertexLightQueues_;
     /// Batch queues by pass index.
     /// Batch queues by pass index.
-    HashMap<unsigned, BatchQueue> batchQueues_;
+    HashMap<i32, BatchQueue> batchQueues_;
     /// Index of the GBuffer pass.
     /// Index of the GBuffer pass.
-    unsigned gBufferPassIndex_{};
+    i32 gBufferPassIndex_{};
     /// Index of the opaque forward base pass.
     /// Index of the opaque forward base pass.
-    unsigned basePassIndex_{};
+    i32 basePassIndex_{};
     /// Index of the alpha pass.
     /// Index of the alpha pass.
-    unsigned alphaPassIndex_{};
+    i32 alphaPassIndex_{};
     /// Index of the forward light pass.
     /// Index of the forward light pass.
-    unsigned lightPassIndex_{};
+    i32 lightPassIndex_{};
     /// Index of the litbase pass.
     /// Index of the litbase pass.
-    unsigned litBasePassIndex_{};
+    i32 litBasePassIndex_{};
     /// Index of the litalpha pass.
     /// Index of the litalpha pass.
-    unsigned litAlphaPassIndex_{};
+    i32 litAlphaPassIndex_{};
     /// Pointer to the light volume command if any.
     /// Pointer to the light volume command if any.
     const RenderPathCommand* lightVolumeCommand_{};
     const RenderPathCommand* lightVolumeCommand_{};
     /// Pointer to the forwardlights command if any.
     /// Pointer to the forwardlights command if any.