diff --git a/Source/Urho3D/AngelScript/Generated_Members.h b/Source/Urho3D/AngelScript/Generated_Members.h index 888bc43b228..f77a573299a 100644 --- a/Source/Urho3D/AngelScript/Generated_Members.h +++ b/Source/Urho3D/AngelScript/Generated_Members.h @@ -4022,17 +4022,17 @@ template void RegisterMembers_RenderPathCommand(asIScriptEngine* engin engine->RegisterObjectMethod(className, "const String& GetDepthStencilName() const", AS_METHODPR(T, GetDepthStencilName, () const, const String&), AS_CALL_THISCALL); engine->RegisterObjectMethod(className, "const String& get_depthStencilName() const", AS_METHODPR(T, GetDepthStencilName, () const, const String&), AS_CALL_THISCALL); - // unsigned RenderPathCommand::GetNumOutputs() const - engine->RegisterObjectMethod(className, "uint GetNumOutputs() const", AS_METHODPR(T, GetNumOutputs, () const, unsigned), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "uint get_numOutputs() const", AS_METHODPR(T, GetNumOutputs, () const, unsigned), AS_CALL_THISCALL); + // i32 RenderPathCommand::GetNumOutputs() const + engine->RegisterObjectMethod(className, "int GetNumOutputs() const", AS_METHODPR(T, GetNumOutputs, () const, i32), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "int get_numOutputs() const", AS_METHODPR(T, GetNumOutputs, () const, i32), AS_CALL_THISCALL); - // CubeMapFace RenderPathCommand::GetOutputFace(unsigned index) const - engine->RegisterObjectMethod(className, "CubeMapFace GetOutputFace(uint) const", AS_METHODPR(T, GetOutputFace, (unsigned) const, CubeMapFace), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "CubeMapFace get_outputFaces(uint) const", AS_METHODPR(T, GetOutputFace, (unsigned) const, CubeMapFace), AS_CALL_THISCALL); + // CubeMapFace RenderPathCommand::GetOutputFace(i32 index) const + engine->RegisterObjectMethod(className, "CubeMapFace GetOutputFace(int) const", AS_METHODPR(T, GetOutputFace, (i32) const, CubeMapFace), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "CubeMapFace get_outputFaces(int) const", AS_METHODPR(T, GetOutputFace, (i32) const, CubeMapFace), AS_CALL_THISCALL); - // const String& RenderPathCommand::GetOutputName(unsigned index) const - engine->RegisterObjectMethod(className, "const String& GetOutputName(uint) const", AS_METHODPR(T, GetOutputName, (unsigned) const, const String&), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "const String& get_outputNames(uint) const", AS_METHODPR(T, GetOutputName, (unsigned) const, const String&), AS_CALL_THISCALL); + // const String& RenderPathCommand::GetOutputName(i32 index) const + engine->RegisterObjectMethod(className, "const String& GetOutputName(int) const", AS_METHODPR(T, GetOutputName, (i32) const, const String&), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "const String& get_outputNames(int) const", AS_METHODPR(T, GetOutputName, (i32) const, const String&), AS_CALL_THISCALL); // const Variant& RenderPathCommand::GetShaderParameter(const String& name) const engine->RegisterObjectMethod(className, "const Variant& GetShaderParameter(const String&in) const", AS_METHODPR(T, GetShaderParameter, (const String&) const, const Variant&), AS_CALL_THISCALL); @@ -4052,20 +4052,20 @@ template void RegisterMembers_RenderPathCommand(asIScriptEngine* engin engine->RegisterObjectMethod(className, "void SetDepthStencilName(const String&in)", AS_METHODPR(T, SetDepthStencilName, (const String&), void), AS_CALL_THISCALL); engine->RegisterObjectMethod(className, "void set_depthStencilName(const String&in)", AS_METHODPR(T, SetDepthStencilName, (const String&), void), AS_CALL_THISCALL); - // void RenderPathCommand::SetNumOutputs(unsigned num) - engine->RegisterObjectMethod(className, "void SetNumOutputs(uint)", AS_METHODPR(T, SetNumOutputs, (unsigned), void), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "void set_numOutputs(uint)", AS_METHODPR(T, SetNumOutputs, (unsigned), void), AS_CALL_THISCALL); + // void RenderPathCommand::SetNumOutputs(i32 num) + engine->RegisterObjectMethod(className, "void SetNumOutputs(int)", AS_METHODPR(T, SetNumOutputs, (i32), void), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "void set_numOutputs(int)", AS_METHODPR(T, SetNumOutputs, (i32), void), AS_CALL_THISCALL); - // void RenderPathCommand::SetOutput(unsigned index, const String& name, CubeMapFace face = FACE_POSITIVE_X) - engine->RegisterObjectMethod(className, "void SetOutput(uint, const String&in, CubeMapFace = FACE_POSITIVE_X)", AS_METHODPR(T, SetOutput, (unsigned, const String&, CubeMapFace), void), AS_CALL_THISCALL); + // void RenderPathCommand::SetOutput(i32 index, const String& name, CubeMapFace face = FACE_POSITIVE_X) + engine->RegisterObjectMethod(className, "void SetOutput(int, const String&in, CubeMapFace = FACE_POSITIVE_X)", AS_METHODPR(T, SetOutput, (i32, const String&, CubeMapFace), void), AS_CALL_THISCALL); - // void RenderPathCommand::SetOutputFace(unsigned index, CubeMapFace face) - engine->RegisterObjectMethod(className, "void SetOutputFace(uint, CubeMapFace)", AS_METHODPR(T, SetOutputFace, (unsigned, CubeMapFace), void), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "void set_outputFaces(uint, CubeMapFace)", AS_METHODPR(T, SetOutputFace, (unsigned, CubeMapFace), void), AS_CALL_THISCALL); + // void RenderPathCommand::SetOutputFace(i32 index, CubeMapFace face) + engine->RegisterObjectMethod(className, "void SetOutputFace(int, CubeMapFace)", AS_METHODPR(T, SetOutputFace, (i32, CubeMapFace), void), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "void set_outputFaces(int, CubeMapFace)", AS_METHODPR(T, SetOutputFace, (i32, CubeMapFace), void), AS_CALL_THISCALL); - // void RenderPathCommand::SetOutputName(unsigned index, const String& name) - engine->RegisterObjectMethod(className, "void SetOutputName(uint, const String&in)", AS_METHODPR(T, SetOutputName, (unsigned, const String&), void), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "void set_outputNames(uint, const String&in)", AS_METHODPR(T, SetOutputName, (unsigned, const String&), void), AS_CALL_THISCALL); + // void RenderPathCommand::SetOutputName(i32 index, const String& name) + engine->RegisterObjectMethod(className, "void SetOutputName(int, const String&in)", AS_METHODPR(T, SetOutputName, (i32, const String&), void), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "void set_outputNames(int, const String&in)", AS_METHODPR(T, SetOutputName, (i32, const String&), void), AS_CALL_THISCALL); // void RenderPathCommand::SetShaderParameter(const String& name, const Variant& value) engine->RegisterObjectMethod(className, "void SetShaderParameter(const String&in, const Variant&in)", AS_METHODPR(T, SetShaderParameter, (const String&, const Variant&), void), AS_CALL_THISCALL); @@ -8383,7 +8383,7 @@ template void RegisterMembers_RenderPath(asIScriptEngine* engine, cons { RegisterMembers_RefCounted(engine, className); - // RenderPathCommand* RenderPath::GetCommand(unsigned index) + // RenderPathCommand* RenderPath::GetCommand(i32 index) // Error: type "RenderPathCommand*" can not automatically bind // void RenderPath::AddCommand(const RenderPathCommand& command) @@ -8398,13 +8398,13 @@ template void RegisterMembers_RenderPath(asIScriptEngine* engine, cons // SharedPtr RenderPath::Clone() engine->RegisterObjectMethod(className, "RenderPath@+ Clone()", AS_FUNCTION_OBJFIRST(RenderPath_SharedPtrlesRenderPathgre_Clone_void_template), AS_CALL_CDECL_OBJFIRST); - // unsigned RenderPath::GetNumCommands() const - engine->RegisterObjectMethod(className, "uint GetNumCommands() const", AS_METHODPR(T, GetNumCommands, () const, unsigned), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "uint get_numCommands() const", AS_METHODPR(T, GetNumCommands, () const, unsigned), AS_CALL_THISCALL); + // i32 RenderPath::GetNumCommands() const + engine->RegisterObjectMethod(className, "int GetNumCommands() const", AS_METHODPR(T, GetNumCommands, () const, i32), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "int get_numCommands() const", AS_METHODPR(T, GetNumCommands, () const, i32), AS_CALL_THISCALL); - // unsigned RenderPath::GetNumRenderTargets() const - engine->RegisterObjectMethod(className, "uint GetNumRenderTargets() const", AS_METHODPR(T, GetNumRenderTargets, () const, unsigned), AS_CALL_THISCALL); - engine->RegisterObjectMethod(className, "uint get_numRenderTargets() const", AS_METHODPR(T, GetNumRenderTargets, () const, unsigned), AS_CALL_THISCALL); + // i32 RenderPath::GetNumRenderTargets() const + engine->RegisterObjectMethod(className, "int GetNumRenderTargets() const", AS_METHODPR(T, GetNumRenderTargets, () const, i32), AS_CALL_THISCALL); + engine->RegisterObjectMethod(className, "int get_numRenderTargets() const", AS_METHODPR(T, GetNumRenderTargets, () const, i32), AS_CALL_THISCALL); // const Variant& RenderPath::GetShaderParameter(const String& name) const engine->RegisterObjectMethod(className, "const Variant& GetShaderParameter(const String&in) const", AS_METHODPR(T, GetShaderParameter, (const String&) const, const Variant&), AS_CALL_THISCALL); diff --git a/Source/Urho3D/Graphics/RenderPath.cpp b/Source/Urho3D/Graphics/RenderPath.cpp index 3f75793ed02..31c82fafcf9 100644 --- a/Source/Urho3D/Graphics/RenderPath.cpp +++ b/Source/Urho3D/Graphics/RenderPath.cpp @@ -226,30 +226,34 @@ void RenderPathCommand::RemoveShaderParameter(const String& name) shaderParameters_.Erase(name); } -void RenderPathCommand::SetNumOutputs(unsigned num) +void RenderPathCommand::SetNumOutputs(i32 num) { - num = (unsigned)Clamp((int)num, 1, MAX_RENDERTARGETS); + assert(num >= 0); + num = Clamp(num, 1, MAX_RENDERTARGETS); outputs_.Resize(num); } -void RenderPathCommand::SetOutput(unsigned index, const String& name, CubeMapFace face) +void RenderPathCommand::SetOutput(i32 index, const String& name, CubeMapFace face) { + assert(index >= 0); if (index < outputs_.Size()) outputs_[index] = MakePair(name, face); else if (index == outputs_.Size() && index < MAX_RENDERTARGETS) outputs_.Push(MakePair(name, face)); } -void RenderPathCommand::SetOutputName(unsigned index, const String& name) +void RenderPathCommand::SetOutputName(i32 index, const String& name) { + assert(index >= 0); if (index < outputs_.Size()) outputs_[index].first_ = name; else if (index == outputs_.Size() && index < MAX_RENDERTARGETS) outputs_.Push(MakePair(name, FACE_POSITIVE_X)); } -void RenderPathCommand::SetOutputFace(unsigned index, CubeMapFace face) +void RenderPathCommand::SetOutputFace(i32 index, CubeMapFace face) { + assert(index >= 0); if (index < outputs_.Size()) outputs_[index].second_ = face; else if (index == outputs_.Size() && index < MAX_RENDERTARGETS) @@ -273,13 +277,15 @@ const Variant& RenderPathCommand::GetShaderParameter(const String& name) const return i != shaderParameters_.End() ? i->second_ : Variant::EMPTY; } -const String& RenderPathCommand::GetOutputName(unsigned index) const +const String& RenderPathCommand::GetOutputName(i32 index) const { + assert(index >= 0); return index < outputs_.Size() ? outputs_[index].first_ : String::EMPTY; } -CubeMapFace RenderPathCommand::GetOutputFace(unsigned index) const +CubeMapFace RenderPathCommand::GetOutputFace(i32 index) const { + assert(index >= 0); return index < outputs_.Size() ? outputs_[index].second_ : FACE_POSITIVE_X; } @@ -339,13 +345,13 @@ bool RenderPath::Append(XMLFile* file) void RenderPath::SetEnabled(const String& tag, bool active) { - for (unsigned i = 0; i < renderTargets_.Size(); ++i) + for (i32 i = 0; i < renderTargets_.Size(); ++i) { if (!renderTargets_[i].tag_.Compare(tag, false)) renderTargets_[i].enabled_ = active; } - for (unsigned i = 0; i < commands_.Size(); ++i) + for (i32 i = 0; i < commands_.Size(); ++i) { if (!commands_[i].tag_.Compare(tag, false)) commands_[i].enabled_ = active; @@ -354,13 +360,13 @@ void RenderPath::SetEnabled(const String& tag, bool active) bool RenderPath::IsEnabled(const String& tag) const { - for (unsigned i = 0; i < renderTargets_.Size(); ++i) + for (i32 i = 0; i < renderTargets_.Size(); ++i) { if (!renderTargets_[i].tag_.Compare(tag, false) && renderTargets_[i].enabled_) return true; } - for (unsigned i = 0; i < commands_.Size(); ++i) + for (i32 i = 0; i < commands_.Size(); ++i) { if (!commands_[i].tag_.Compare(tag, false) && commands_[i].enabled_) return true; @@ -371,13 +377,13 @@ bool RenderPath::IsEnabled(const String& tag) const bool RenderPath::IsAdded(const String& tag) const { - for (unsigned i = 0; i < renderTargets_.Size(); ++i) + for (i32 i = 0; i < renderTargets_.Size(); ++i) { if (!renderTargets_[i].tag_.Compare(tag, false)) return true; } - for (unsigned i = 0; i < commands_.Size(); ++i) + for (i32 i = 0; i < commands_.Size(); ++i) { if (!commands_[i].tag_.Compare(tag, false)) return true; @@ -388,13 +394,13 @@ bool RenderPath::IsAdded(const String& tag) const void RenderPath::ToggleEnabled(const String& tag) { - for (unsigned i = 0; i < renderTargets_.Size(); ++i) + for (i32 i = 0; i < renderTargets_.Size(); ++i) { if (!renderTargets_[i].tag_.Compare(tag, false)) renderTargets_[i].enabled_ = !renderTargets_[i].enabled_; } - for (unsigned i = 0; i < commands_.Size(); ++i) + for (i32 i = 0; i < commands_.Size(); ++i) { if (!commands_[i].tag_.Compare(tag, false)) commands_[i].enabled_ = !commands_[i].enabled_; @@ -421,7 +427,7 @@ void RenderPath::RemoveRenderTarget(unsigned index) void RenderPath::RemoveRenderTarget(const String& name) { - for (unsigned i = 0; i < renderTargets_.Size(); ++i) + for (i32 i = 0; i < renderTargets_.Size(); ++i) { if (!renderTargets_[i].name_.Compare(name, false)) { @@ -476,7 +482,7 @@ void RenderPath::SetShaderParameter(const String& name, const Variant& value) { StringHash nameHash(name); - for (unsigned i = 0; i < commands_.Size(); ++i) + for (i32 i = 0; i < commands_.Size(); ++i) { HashMap::Iterator j = commands_[i].shaderParameters_.Find(nameHash); if (j != commands_[i].shaderParameters_.End()) @@ -488,7 +494,7 @@ const Variant& RenderPath::GetShaderParameter(const String& name) const { StringHash nameHash(name); - for (unsigned i = 0; i < commands_.Size(); ++i) + for (i32 i = 0; i < commands_.Size(); ++i) { HashMap::ConstIterator j = commands_[i].shaderParameters_.Find(nameHash); if (j != commands_[i].shaderParameters_.End()) diff --git a/Source/Urho3D/Graphics/RenderPath.h b/Source/Urho3D/Graphics/RenderPath.h index 16a21672d8d..ac18b7b3324 100644 --- a/Source/Urho3D/Graphics/RenderPath.h +++ b/Source/Urho3D/Graphics/RenderPath.h @@ -92,15 +92,15 @@ struct URHO3D_API RenderPathCommand void RemoveShaderParameter(const String& name); /// Set number of output rendertargets. /// @property - void SetNumOutputs(unsigned num); + void SetNumOutputs(i32 num); /// Set output rendertarget name and face index for cube maps. - void SetOutput(unsigned index, const String& name, CubeMapFace face = FACE_POSITIVE_X); + void SetOutput(i32 index, const String& name, CubeMapFace face = FACE_POSITIVE_X); /// Set output rendertarget name. /// @property{set_outputNames} - void SetOutputName(unsigned index, const String& name); + void SetOutputName(i32 index, const String& name); /// Set output rendertarget face index for cube maps. /// @property{set_outputFaces} - void SetOutputFace(unsigned index, CubeMapFace face); + void SetOutputFace(i32 index, CubeMapFace face); /// Set depth-stencil output name. When empty, will assign a depth-stencil buffer automatically. /// @property void SetDepthStencilName(const String& name); @@ -114,14 +114,14 @@ struct URHO3D_API RenderPathCommand /// Return number of output rendertargets. /// @property - unsigned GetNumOutputs() const { return outputs_.Size(); } + i32 GetNumOutputs() const { return outputs_.Size(); } /// Return output rendertarget name. /// @property{get_outputNames} - const String& GetOutputName(unsigned index) const; + const String& GetOutputName(i32 index) const; /// Return output rendertarget face index. /// @property{get_outputFaces} - CubeMapFace GetOutputFace(unsigned index) const; + CubeMapFace GetOutputFace(i32 index) const; /// Return depth-stencil output name. /// @property @@ -232,14 +232,18 @@ class URHO3D_API RenderPath : public RefCounted /// Return number of rendertargets. /// @property - unsigned GetNumRenderTargets() const { return renderTargets_.Size(); } + i32 GetNumRenderTargets() const { return renderTargets_.Size(); } /// Return number of commands. /// @property - unsigned GetNumCommands() const { return commands_.Size(); } + i32 GetNumCommands() const { return commands_.Size(); } /// Return command at index, or null if does not exist. - RenderPathCommand* GetCommand(unsigned index) { return index < commands_.Size() ? &commands_[index] : nullptr; } + RenderPathCommand* GetCommand(i32 index) + { + assert(index >= 0); + return index < commands_.Size() ? &commands_[index] : nullptr; + } /// Return a shader parameter (first appearance in any command). /// @property{get_shaderParameters}