Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Commit

Permalink
RenderPath: unsigned to signed
Browse files Browse the repository at this point in the history
Related: #2940
  • Loading branch information
1vanK committed Jun 2, 2022
1 parent 7a82c2f commit 5702384
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 55 deletions.
54 changes: 27 additions & 27 deletions Source/Urho3D/AngelScript/Generated_Members.h
Original file line number Diff line number Diff line change
Expand Up @@ -4022,17 +4022,17 @@ template <class T> 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);
Expand All @@ -4052,20 +4052,20 @@ template <class T> 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);
Expand Down Expand Up @@ -8383,7 +8383,7 @@ template <class T> void RegisterMembers_RenderPath(asIScriptEngine* engine, cons
{
RegisterMembers_RefCounted<T>(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)
Expand All @@ -8398,13 +8398,13 @@ template <class T> void RegisterMembers_RenderPath(asIScriptEngine* engine, cons
// SharedPtr<RenderPath> RenderPath::Clone()
engine->RegisterObjectMethod(className, "RenderPath@+ Clone()", AS_FUNCTION_OBJFIRST(RenderPath_SharedPtrlesRenderPathgre_Clone_void_template<RenderPath>), 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);
Expand Down
42 changes: 24 additions & 18 deletions Source/Urho3D/Graphics/RenderPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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;
}

Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand All @@ -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_;
Expand All @@ -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))
{
Expand Down Expand Up @@ -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<StringHash, Variant>::Iterator j = commands_[i].shaderParameters_.Find(nameHash);
if (j != commands_[i].shaderParameters_.End())
Expand All @@ -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<StringHash, Variant>::ConstIterator j = commands_[i].shaderParameters_.Find(nameHash);
if (j != commands_[i].shaderParameters_.End())
Expand Down
24 changes: 14 additions & 10 deletions Source/Urho3D/Graphics/RenderPath.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down Expand Up @@ -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}
Expand Down

0 comments on commit 5702384

Please sign in to comment.