Преглед на файлове

Model, AnimatedModel: unsigned to signed

1vanK преди 3 години
родител
ревизия
d5449fec0b

+ 2 - 2
Source/Samples/34_DynamicGeometry/DynamicGeometry.cpp

@@ -230,8 +230,8 @@ void DynamicGeometry::CreateScene()
         vertexBuffers.Push(vb);
         indexBuffers.Push(ib);
         // Morph ranges could also be not defined. Here we simply define a zero range (no morphing) for the vertex buffer
-        Vector<unsigned> morphRangeStarts;
-        Vector<unsigned> morphRangeCounts;
+        Vector<i32> morphRangeStarts;
+        Vector<i32> morphRangeCounts;
         morphRangeStarts.Push(0);
         morphRangeCounts.Push(0);
         fromScratchModel->SetVertexBuffers(vertexBuffers, morphRangeStarts, morphRangeCounts);

+ 6 - 6
Source/Tools/AssetImporter/AssetImporter.cpp

@@ -189,7 +189,7 @@ unsigned GetMeshIndex(aiMesh* mesh);
 unsigned GetBoneIndex(OutModel& model, const String& boneName);
 aiBone* GetMeshBone(OutModel& model, const String& boneName);
 Matrix3x4 GetOffsetMatrix(OutModel& model, const String& boneName);
-void GetBlendData(OutModel& model, aiMesh* mesh, aiNode* meshNode, Vector<unsigned>& boneMappings, Vector<Vector<unsigned char>>&
+void GetBlendData(OutModel& model, aiMesh* mesh, aiNode* meshNode, Vector<i32>& boneMappings, Vector<Vector<unsigned char>>&
     blendIndices, Vector<Vector<float>>& blendWeights);
 String GetMeshMaterialName(aiMesh* mesh);
 String GetMaterialTextureName(const String& nameIn);
@@ -981,7 +981,7 @@ void BuildAndSaveModel(OutModel& model)
     PrintLine("Writing model " + rootNodeName);
 
     SharedPtr<Model> outModel(new Model(context_));
-    Vector<Vector<unsigned>> allBoneMappings;
+    Vector<Vector<i32>> allBoneMappings;
     BoundingBox box;
 
     unsigned numValidGeometries = 0;
@@ -1101,7 +1101,7 @@ void BuildAndSaveModel(OutModel& model)
         // If there are bones, get blend data
         Vector<Vector<unsigned char>> blendIndices;
         Vector<Vector<float>> blendWeights;
-        Vector<unsigned> boneMappings;
+        Vector<i32> boneMappings;
         if (model.bones_.Size())
             GetBlendData(model, mesh, model.meshNodes_[i], boneMappings, blendIndices, blendWeights);
 
@@ -1142,7 +1142,7 @@ void BuildAndSaveModel(OutModel& model)
     }
 
     // Define the model buffers and bounding box
-    Vector<unsigned> emptyMorphRange;
+    Vector<i32> emptyMorphRange;
     outModel->SetVertexBuffers(vbVector, emptyMorphRange, emptyMorphRange);
     outModel->SetIndexBuffers(ibVector);
     outModel->SetBoundingBox(box);
@@ -2077,7 +2077,7 @@ void CombineLods(const Vector<float>& lodDistances, const Vector<String>& modelN
 
     Vector<SharedPtr<VertexBuffer>> vbVector;
     Vector<SharedPtr<IndexBuffer>> ibVector;
-    Vector<unsigned> emptyMorphRange;
+    Vector<i32> emptyMorphRange;
 
     // Create the final model
     SharedPtr<Model> outModel(new Model(context_));
@@ -2196,7 +2196,7 @@ Matrix3x4 GetOffsetMatrix(OutModel& model, const String& boneName)
     return Matrix3x4::IDENTITY;
 }
 
-void GetBlendData(OutModel& model, aiMesh* mesh, aiNode* meshNode, Vector<unsigned>& boneMappings, Vector<Vector<unsigned char>>&
+void GetBlendData(OutModel& model, aiMesh* mesh, aiNode* meshNode, Vector<i32>& boneMappings, Vector<Vector<unsigned char>>&
     blendIndices, Vector<Vector<float>>& blendWeights)
 {
     blendIndices.Resize(mesh->mNumVertices);

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

@@ -1715,17 +1715,17 @@ template <class T> void RegisterMembers_GeometryDesc(asIScriptEngine* engine, co
     // PrimitiveType GeometryDesc::type_
     engine->RegisterObjectProperty(className, "PrimitiveType type", offsetof(T, type_));
 
-    // unsigned GeometryDesc::vbRef_
-    engine->RegisterObjectProperty(className, "uint vbRef", offsetof(T, vbRef_));
+    // i32 GeometryDesc::vbRef_
+    engine->RegisterObjectProperty(className, "int vbRef", offsetof(T, vbRef_));
 
-    // unsigned GeometryDesc::ibRef_
-    engine->RegisterObjectProperty(className, "uint ibRef", offsetof(T, ibRef_));
+    // i32 GeometryDesc::ibRef_
+    engine->RegisterObjectProperty(className, "int ibRef", offsetof(T, ibRef_));
 
-    // unsigned GeometryDesc::indexStart_
-    engine->RegisterObjectProperty(className, "uint indexStart", offsetof(T, indexStart_));
+    // i32 GeometryDesc::indexStart_
+    engine->RegisterObjectProperty(className, "int indexStart", offsetof(T, indexStart_));
 
-    // unsigned GeometryDesc::indexCount_
-    engine->RegisterObjectProperty(className, "uint indexCount", offsetof(T, indexCount_));
+    // i32 GeometryDesc::indexCount_
+    engine->RegisterObjectProperty(className, "int indexCount", offsetof(T, indexCount_));
 
     #ifdef REGISTER_MEMBERS_MANUAL_PART_GeometryDesc
         REGISTER_MEMBERS_MANUAL_PART_GeometryDesc();
@@ -1836,17 +1836,17 @@ template <class T> void RegisterMembers_HiresTimer(asIScriptEngine* engine, cons
 // struct IndexBufferDesc | File: ../Graphics/Model.h
 template <class T> void RegisterMembers_IndexBufferDesc(asIScriptEngine* engine, const char* className)
 {
-    // SharedArrayPtr<unsigned char> IndexBufferDesc::data_
-    // Error: type "SharedArrayPtr<unsigned char>" can not automatically bind
+    // SharedArrayPtr<byte> IndexBufferDesc::data_
+    // Error: type "SharedArrayPtr<byte>" can not automatically bind
 
-    // unsigned IndexBufferDesc::indexCount_
-    engine->RegisterObjectProperty(className, "uint indexCount", offsetof(T, indexCount_));
+    // i32 IndexBufferDesc::indexCount_
+    engine->RegisterObjectProperty(className, "int indexCount", offsetof(T, indexCount_));
 
-    // unsigned IndexBufferDesc::indexSize_
-    engine->RegisterObjectProperty(className, "uint indexSize", offsetof(T, indexSize_));
+    // i32 IndexBufferDesc::indexSize_
+    engine->RegisterObjectProperty(className, "int indexSize", offsetof(T, indexSize_));
 
-    // unsigned IndexBufferDesc::dataSize_
-    engine->RegisterObjectProperty(className, "uint dataSize", offsetof(T, dataSize_));
+    // i32 IndexBufferDesc::dataSize_
+    engine->RegisterObjectProperty(className, "int dataSize", offsetof(T, dataSize_));
 
     #ifdef REGISTER_MEMBERS_MANUAL_PART_IndexBufferDesc
         REGISTER_MEMBERS_MANUAL_PART_IndexBufferDesc();
@@ -3101,8 +3101,8 @@ template <class T> void RegisterMembers_Matrix4(asIScriptEngine* engine, const c
 // struct ModelMorph | File: ../Graphics/Model.h
 template <class T> void RegisterMembers_ModelMorph(asIScriptEngine* engine, const char* className)
 {
-    // HashMap<unsigned, VertexBufferMorph> ModelMorph::buffers_
-    // Error: type "HashMap<unsigned, VertexBufferMorph>" can not automatically bind
+    // HashMap<i32, VertexBufferMorph> ModelMorph::buffers_
+    // Error: type "HashMap<i32, VertexBufferMorph>" can not automatically bind
 
     // String ModelMorph::name_
     engine->RegisterObjectProperty(className, "String name", offsetof(T, name_));
@@ -6557,14 +6557,14 @@ template <class T> void RegisterMembers_VertexBufferDesc(asIScriptEngine* engine
 {
     // Vector<VertexElement> VertexBufferDesc::vertexElements_
     // Error: type "Vector<VertexElement>" can not automatically bind
-    // SharedArrayPtr<unsigned char> VertexBufferDesc::data_
-    // Error: type "SharedArrayPtr<unsigned char>" can not automatically bind
+    // SharedArrayPtr<byte> VertexBufferDesc::data_
+    // Error: type "SharedArrayPtr<byte>" can not automatically bind
 
-    // unsigned VertexBufferDesc::vertexCount_
-    engine->RegisterObjectProperty(className, "uint vertexCount", offsetof(T, vertexCount_));
+    // i32 VertexBufferDesc::vertexCount_
+    engine->RegisterObjectProperty(className, "int vertexCount", offsetof(T, vertexCount_));
 
-    // unsigned VertexBufferDesc::dataSize_
-    engine->RegisterObjectProperty(className, "uint dataSize", offsetof(T, dataSize_));
+    // i32 VertexBufferDesc::dataSize_
+    engine->RegisterObjectProperty(className, "int dataSize", offsetof(T, dataSize_));
 
     #ifdef REGISTER_MEMBERS_MANUAL_PART_VertexBufferDesc
         REGISTER_MEMBERS_MANUAL_PART_VertexBufferDesc();
@@ -6574,17 +6574,17 @@ template <class T> void RegisterMembers_VertexBufferDesc(asIScriptEngine* engine
 // struct VertexBufferMorph | File: ../Graphics/Model.h
 template <class T> void RegisterMembers_VertexBufferMorph(asIScriptEngine* engine, const char* className)
 {
-    // SharedArrayPtr<unsigned char> VertexBufferMorph::morphData_
-    // Error: type "SharedArrayPtr<unsigned char>" can not automatically bind
+    // SharedArrayPtr<byte> VertexBufferMorph::morphData_
+    // Error: type "SharedArrayPtr<byte>" can not automatically bind
 
     // VertexElements VertexBufferMorph::elementMask_
     engine->RegisterObjectProperty(className, "VertexElements elementMask", offsetof(T, elementMask_));
 
-    // unsigned VertexBufferMorph::vertexCount_
-    engine->RegisterObjectProperty(className, "uint vertexCount", offsetof(T, vertexCount_));
+    // i32 VertexBufferMorph::vertexCount_
+    engine->RegisterObjectProperty(className, "int vertexCount", offsetof(T, vertexCount_));
 
-    // unsigned VertexBufferMorph::dataSize_
-    engine->RegisterObjectProperty(className, "uint dataSize", offsetof(T, dataSize_));
+    // i32 VertexBufferMorph::dataSize_
+    engine->RegisterObjectProperty(className, "int dataSize", offsetof(T, dataSize_));
 
     #ifdef REGISTER_MEMBERS_MANUAL_PART_VertexBufferMorph
         REGISTER_MEMBERS_MANUAL_PART_VertexBufferMorph();
@@ -15362,12 +15362,12 @@ template <class T> void Model_void_SetMorphs_constspVectorlesModelMorphgreamp_te
     _ptr->SetMorphs(morphs);
 }
 
-// bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<unsigned>& morphRangeStarts, const Vector<unsigned>& morphRangeCounts)
-template <class T> bool Model_bool_SetVertexBuffers_constspVectorlesSharedPtrlesVertexBuffergregreamp_constspVectorlesunsignedgreamp_constspVectorlesunsignedgreamp_template(T* _ptr, CScriptArray* buffers_conv, CScriptArray* morphRangeStarts_conv, CScriptArray* morphRangeCounts_conv)
+// bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<i32>& morphRangeStarts, const Vector<i32>& morphRangeCounts)
+template <class T> bool Model_bool_SetVertexBuffers_constspVectorlesSharedPtrlesVertexBuffergregreamp_constspVectorlesi32greamp_constspVectorlesi32greamp_template(T* _ptr, CScriptArray* buffers_conv, CScriptArray* morphRangeStarts_conv, CScriptArray* morphRangeCounts_conv)
 {
     Vector<SharedPtr<VertexBuffer>> buffers = HandleArrayToVector<VertexBuffer>(buffers_conv);
-    Vector<unsigned> morphRangeStarts = ArrayToVector<unsigned>(morphRangeStarts_conv);
-    Vector<unsigned> morphRangeCounts = ArrayToVector<unsigned>(morphRangeCounts_conv);
+    Vector<i32> morphRangeStarts = ArrayToVector<i32>(morphRangeStarts_conv);
+    Vector<i32> morphRangeCounts = ArrayToVector<i32>(morphRangeCounts_conv);
     bool result = _ptr->SetVertexBuffers(buffers, morphRangeStarts, morphRangeCounts);
     return result;
 }
@@ -15379,16 +15379,16 @@ template <class T> void RegisterMembers_Model(asIScriptEngine* engine, const cha
 
     // const Vector<Vector<SharedPtr<Geometry>>>& Model::GetGeometries() const
     // Error: type "const Vector<Vector<SharedPtr<Geometry>>>&" can not automatically bind
-    // const Vector<Vector<unsigned>>& Model::GetGeometryBoneMappings() const
-    // Error: type "const Vector<Vector<unsigned>>&" can not automatically bind
-    // const ModelMorph* Model::GetMorph(unsigned index) const
+    // const Vector<Vector<i32>>& Model::GetGeometryBoneMappings() const
+    // Error: type "const Vector<Vector<i32>>&" can not automatically bind
+    // const ModelMorph* Model::GetMorph(i32 index) const
     // Error: type "const ModelMorph*" can not automatically bind
     // const ModelMorph* Model::GetMorph(const String& name) const
     // Error: type "const ModelMorph*" can not automatically bind
     // const ModelMorph* Model::GetMorph(StringHash nameHash) const
     // Error: type "const ModelMorph*" can not automatically bind
-    // void Model::SetGeometryBoneMappings(const Vector<Vector<unsigned>>& geometryBoneMappings)
-    // Error: type "const Vector<Vector<unsigned>>&" can not automatically bind
+    // void Model::SetGeometryBoneMappings(const Vector<Vector<i32>>& geometryBoneMappings)
+    // Error: type "const Vector<Vector<i32>>&" can not automatically bind
 
     // SharedPtr<Model> Model::Clone(const String& cloneName = String::EMPTY) const
     engine->RegisterObjectMethod(className, "Model@+ Clone(const String&in = String::EMPTY) const", AS_FUNCTION_OBJFIRST(Model_SharedPtrlesModelgre_Clone_constspStringamp_template<Model>), AS_CALL_CDECL_OBJFIRST);
@@ -15397,8 +15397,8 @@ template <class T> void RegisterMembers_Model(asIScriptEngine* engine, const cha
     engine->RegisterObjectMethod(className, "const BoundingBox& GetBoundingBox() const", AS_METHODPR(T, GetBoundingBox, () const, const BoundingBox&), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "const BoundingBox& get_boundingBox() const", AS_METHODPR(T, GetBoundingBox, () const, const BoundingBox&), AS_CALL_THISCALL);
 
-    // Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
-    engine->RegisterObjectMethod(className, "Geometry@+ GetGeometry(uint, uint) const", AS_METHODPR(T, GetGeometry, (unsigned, unsigned) const, Geometry*), AS_CALL_THISCALL);
+    // Geometry* Model::GetGeometry(i32 index, i32 lodLevel) const
+    engine->RegisterObjectMethod(className, "Geometry@+ GetGeometry(int, int) const", AS_METHODPR(T, GetGeometry, (i32, i32) const, Geometry*), AS_CALL_THISCALL);
 
     // const Vector3& Model::GetGeometryCenter(i32 index) const
     engine->RegisterObjectMethod(className, "const Vector3& GetGeometryCenter(int) const", AS_METHODPR(T, GetGeometryCenter, (i32) const, const Vector3&), AS_CALL_THISCALL);
@@ -15410,26 +15410,26 @@ template <class T> void RegisterMembers_Model(asIScriptEngine* engine, const cha
     // const Vector<SharedPtr<IndexBuffer>>& Model::GetIndexBuffers() const
     engine->RegisterObjectMethod(className, "Array<IndexBuffer@>@ GetIndexBuffers() const", AS_FUNCTION_OBJFIRST(Model_constspVectorlesSharedPtrlesIndexBuffergregreamp_GetIndexBuffers_void_template<Model>), AS_CALL_CDECL_OBJFIRST);
 
-    // unsigned Model::GetMorphRangeCount(unsigned bufferIndex) const
-    engine->RegisterObjectMethod(className, "uint GetMorphRangeCount(uint) const", AS_METHODPR(T, GetMorphRangeCount, (unsigned) const, unsigned), AS_CALL_THISCALL);
+    // i32 Model::GetMorphRangeCount(i32 bufferIndex) const
+    engine->RegisterObjectMethod(className, "int GetMorphRangeCount(int) const", AS_METHODPR(T, GetMorphRangeCount, (i32) const, i32), AS_CALL_THISCALL);
 
-    // unsigned Model::GetMorphRangeStart(unsigned bufferIndex) const
-    engine->RegisterObjectMethod(className, "uint GetMorphRangeStart(uint) const", AS_METHODPR(T, GetMorphRangeStart, (unsigned) const, unsigned), AS_CALL_THISCALL);
+    // i32 Model::GetMorphRangeStart(i32 bufferIndex) const
+    engine->RegisterObjectMethod(className, "int GetMorphRangeStart(int) const", AS_METHODPR(T, GetMorphRangeStart, (i32) const, i32), AS_CALL_THISCALL);
 
     // const Vector<ModelMorph>& Model::GetMorphs() const
     engine->RegisterObjectMethod(className, "Array<ModelMorph>@ GetMorphs() const", AS_FUNCTION_OBJFIRST(Model_constspVectorlesModelMorphgreamp_GetMorphs_void_template<Model>), AS_CALL_CDECL_OBJFIRST);
 
-    // unsigned Model::GetNumGeometries() const
-    engine->RegisterObjectMethod(className, "uint GetNumGeometries() const", AS_METHODPR(T, GetNumGeometries, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numGeometries() const", AS_METHODPR(T, GetNumGeometries, () const, unsigned), AS_CALL_THISCALL);
+    // i32 Model::GetNumGeometries() const
+    engine->RegisterObjectMethod(className, "int GetNumGeometries() const", AS_METHODPR(T, GetNumGeometries, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numGeometries() const", AS_METHODPR(T, GetNumGeometries, () const, i32), AS_CALL_THISCALL);
 
-    // unsigned Model::GetNumGeometryLodLevels(unsigned index) const
-    engine->RegisterObjectMethod(className, "uint GetNumGeometryLodLevels(uint) const", AS_METHODPR(T, GetNumGeometryLodLevels, (unsigned) const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numGeometryLodLevels(uint) const", AS_METHODPR(T, GetNumGeometryLodLevels, (unsigned) const, unsigned), AS_CALL_THISCALL);
+    // i32 Model::GetNumGeometryLodLevels(i32 index) const
+    engine->RegisterObjectMethod(className, "int GetNumGeometryLodLevels(int) const", AS_METHODPR(T, GetNumGeometryLodLevels, (i32) const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numGeometryLodLevels(int) const", AS_METHODPR(T, GetNumGeometryLodLevels, (i32) const, i32), AS_CALL_THISCALL);
 
-    // unsigned Model::GetNumMorphs() const
-    engine->RegisterObjectMethod(className, "uint GetNumMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, unsigned), AS_CALL_THISCALL);
+    // i32 Model::GetNumMorphs() const
+    engine->RegisterObjectMethod(className, "int GetNumMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, i32), AS_CALL_THISCALL);
 
     // Skeleton& Model::GetSkeleton()
     engine->RegisterObjectMethod(className, "Skeleton& GetSkeleton()", AS_METHODPR(T, GetSkeleton, (), Skeleton&), AS_CALL_THISCALL);
@@ -15442,12 +15442,12 @@ template <class T> void RegisterMembers_Model(asIScriptEngine* engine, const cha
     engine->RegisterObjectMethod(className, "void SetBoundingBox(const BoundingBox&in)", AS_METHODPR(T, SetBoundingBox, (const BoundingBox&), void), AS_CALL_THISCALL);
     engine->RegisterObjectMethod(className, "void set_boundingBox(const BoundingBox&in)", AS_METHODPR(T, SetBoundingBox, (const BoundingBox&), void), AS_CALL_THISCALL);
 
-    // bool Model::SetGeometry(unsigned index, unsigned lodLevel, Geometry* geometry)
-    engine->RegisterObjectMethod(className, "bool SetGeometry(uint, uint, Geometry@+)", AS_METHODPR(T, SetGeometry, (unsigned, unsigned, Geometry*), bool), AS_CALL_THISCALL);
+    // bool Model::SetGeometry(i32 index, i32 lodLevel, Geometry* geometry)
+    engine->RegisterObjectMethod(className, "bool SetGeometry(int, int, Geometry@+)", AS_METHODPR(T, SetGeometry, (i32, i32, Geometry*), bool), AS_CALL_THISCALL);
 
-    // bool Model::SetGeometryCenter(unsigned index, const Vector3& center)
-    engine->RegisterObjectMethod(className, "bool SetGeometryCenter(uint, const Vector3&in)", AS_METHODPR(T, SetGeometryCenter, (unsigned, const Vector3&), bool), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "bool set_geometryCenters(uint, const Vector3&in)", AS_METHODPR(T, SetGeometryCenter, (unsigned, const Vector3&), bool), AS_CALL_THISCALL);
+    // bool Model::SetGeometryCenter(i32 index, const Vector3& center)
+    engine->RegisterObjectMethod(className, "bool SetGeometryCenter(int, const Vector3&in)", AS_METHODPR(T, SetGeometryCenter, (i32, const Vector3&), bool), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "bool set_geometryCenters(int, const Vector3&in)", AS_METHODPR(T, SetGeometryCenter, (i32, const Vector3&), bool), AS_CALL_THISCALL);
 
     // bool Model::SetIndexBuffers(const Vector<SharedPtr<IndexBuffer>>& buffers)
     engine->RegisterObjectMethod(className, "bool SetIndexBuffers(Array<IndexBuffer@>@+)", AS_FUNCTION_OBJFIRST(Model_bool_SetIndexBuffers_constspVectorlesSharedPtrlesIndexBuffergregreamp_template<Model>), AS_CALL_CDECL_OBJFIRST);
@@ -15455,19 +15455,19 @@ template <class T> void RegisterMembers_Model(asIScriptEngine* engine, const cha
     // void Model::SetMorphs(const Vector<ModelMorph>& morphs)
     engine->RegisterObjectMethod(className, "void SetMorphs(Array<ModelMorph>@+)", AS_FUNCTION_OBJFIRST(Model_void_SetMorphs_constspVectorlesModelMorphgreamp_template<Model>), AS_CALL_CDECL_OBJFIRST);
 
-    // void Model::SetNumGeometries(unsigned num)
-    engine->RegisterObjectMethod(className, "void SetNumGeometries(uint)", AS_METHODPR(T, SetNumGeometries, (unsigned), void), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "void set_numGeometries(uint)", AS_METHODPR(T, SetNumGeometries, (unsigned), void), AS_CALL_THISCALL);
+    // void Model::SetNumGeometries(i32 num)
+    engine->RegisterObjectMethod(className, "void SetNumGeometries(int)", AS_METHODPR(T, SetNumGeometries, (i32), void), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "void set_numGeometries(int)", AS_METHODPR(T, SetNumGeometries, (i32), void), AS_CALL_THISCALL);
 
-    // bool Model::SetNumGeometryLodLevels(unsigned index, unsigned num)
-    engine->RegisterObjectMethod(className, "bool SetNumGeometryLodLevels(uint, uint)", AS_METHODPR(T, SetNumGeometryLodLevels, (unsigned, unsigned), bool), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "bool set_numGeometryLodLevels(uint, uint)", AS_METHODPR(T, SetNumGeometryLodLevels, (unsigned, unsigned), bool), AS_CALL_THISCALL);
+    // bool Model::SetNumGeometryLodLevels(i32 index, i32 num)
+    engine->RegisterObjectMethod(className, "bool SetNumGeometryLodLevels(int, int)", AS_METHODPR(T, SetNumGeometryLodLevels, (i32, i32), bool), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "bool set_numGeometryLodLevels(int, int)", AS_METHODPR(T, SetNumGeometryLodLevels, (i32, i32), bool), AS_CALL_THISCALL);
 
     // void Model::SetSkeleton(const Skeleton& skeleton)
     engine->RegisterObjectMethod(className, "void SetSkeleton(const Skeleton&in)", AS_METHODPR(T, SetSkeleton, (const Skeleton&), void), AS_CALL_THISCALL);
 
-    // bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<unsigned>& morphRangeStarts, const Vector<unsigned>& morphRangeCounts)
-    engine->RegisterObjectMethod(className, "bool SetVertexBuffers(Array<VertexBuffer@>@+, Array<uint>@+, Array<uint>@+)", AS_FUNCTION_OBJFIRST(Model_bool_SetVertexBuffers_constspVectorlesSharedPtrlesVertexBuffergregreamp_constspVectorlesunsignedgreamp_constspVectorlesunsignedgreamp_template<Model>), AS_CALL_CDECL_OBJFIRST);
+    // bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<i32>& morphRangeStarts, const Vector<i32>& morphRangeCounts)
+    engine->RegisterObjectMethod(className, "bool SetVertexBuffers(Array<VertexBuffer@>@+, Array<int>@+, Array<int>@+)", AS_FUNCTION_OBJFIRST(Model_bool_SetVertexBuffers_constspVectorlesSharedPtrlesVertexBuffergregreamp_constspVectorlesi32greamp_constspVectorlesi32greamp_template<Model>), AS_CALL_CDECL_OBJFIRST);
 
     // static void Model::RegisterObject(Context* context)
     // Not registered because have @nobind mark
@@ -25028,8 +25028,8 @@ template <class T> void RegisterMembers_AnimatedModel(asIScriptEngine* engine, c
     // Error: type "VariantVector" can not automatically bind
     // VariantVector AnimatedModel::GetBonesEnabledAttr() const
     // Error: type "VariantVector" can not automatically bind
-    // const Vector<Vector<unsigned>>& AnimatedModel::GetGeometryBoneMappings() const
-    // Error: type "const Vector<Vector<unsigned>>&" can not automatically bind
+    // const Vector<Vector<i32>>& AnimatedModel::GetGeometryBoneMappings() const
+    // Error: type "const Vector<Vector<i32>>&" can not automatically bind
     // const Vector<Vector<Matrix3x4>>& AnimatedModel::GetGeometrySkinMatrices() const
     // Error: type "const Vector<Vector<Matrix3x4>>&" can not automatically bind
     // void AnimatedModel::SetAnimationStatesAttr(const VariantVector& value)
@@ -25057,8 +25057,8 @@ template <class T> void RegisterMembers_AnimatedModel(asIScriptEngine* engine, c
     // AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) const
     engine->RegisterObjectMethod(className, "AnimationState@+ GetAnimationState(StringHash) const", AS_METHODPR(T, GetAnimationState, (StringHash) const, AnimationState*), AS_CALL_THISCALL);
 
-    // AnimationState* AnimatedModel::GetAnimationState(unsigned index) const
-    engine->RegisterObjectMethod(className, "AnimationState@+ GetAnimationState(uint) const", AS_METHODPR(T, GetAnimationState, (unsigned) const, AnimationState*), AS_CALL_THISCALL);
+    // AnimationState* AnimatedModel::GetAnimationState(i32 index) const
+    engine->RegisterObjectMethod(className, "AnimationState@+ GetAnimationState(int) const", AS_METHODPR(T, GetAnimationState, (i32) const, AnimationState*), AS_CALL_THISCALL);
 
     // const Vector<SharedPtr<AnimationState>>& AnimatedModel::GetAnimationStates() const
     engine->RegisterObjectMethod(className, "Array<AnimationState@>@ GetAnimationStates() const", AS_FUNCTION_OBJFIRST(AnimatedModel_constspVectorlesSharedPtrlesAnimationStategregreamp_GetAnimationStates_void_template<AnimatedModel>), AS_CALL_CDECL_OBJFIRST);
@@ -25072,8 +25072,8 @@ template <class T> void RegisterMembers_AnimatedModel(asIScriptEngine* engine, c
     // const Vector<SharedPtr<VertexBuffer>>& AnimatedModel::GetMorphVertexBuffers() const
     engine->RegisterObjectMethod(className, "Array<VertexBuffer@>@ GetMorphVertexBuffers() const", AS_FUNCTION_OBJFIRST(AnimatedModel_constspVectorlesSharedPtrlesVertexBuffergregreamp_GetMorphVertexBuffers_void_template<AnimatedModel>), AS_CALL_CDECL_OBJFIRST);
 
-    // float AnimatedModel::GetMorphWeight(unsigned index) const
-    engine->RegisterObjectMethod(className, "float GetMorphWeight(uint) const", AS_METHODPR(T, GetMorphWeight, (unsigned) const, float), AS_CALL_THISCALL);
+    // float AnimatedModel::GetMorphWeight(i32 index) const
+    engine->RegisterObjectMethod(className, "float GetMorphWeight(int) const", AS_METHODPR(T, GetMorphWeight, (i32) const, float), AS_CALL_THISCALL);
 
     // float AnimatedModel::GetMorphWeight(const String& name) const
     engine->RegisterObjectMethod(className, "float GetMorphWeight(const String&in) const", AS_METHODPR(T, GetMorphWeight, (const String&) const, float), AS_CALL_THISCALL);
@@ -25082,13 +25082,13 @@ template <class T> void RegisterMembers_AnimatedModel(asIScriptEngine* engine, c
     // float AnimatedModel::GetMorphWeight(StringHash nameHash) const
     engine->RegisterObjectMethod(className, "float GetMorphWeight(StringHash) const", AS_METHODPR(T, GetMorphWeight, (StringHash) const, float), AS_CALL_THISCALL);
 
-    // unsigned AnimatedModel::GetNumAnimationStates() const
-    engine->RegisterObjectMethod(className, "uint GetNumAnimationStates() const", AS_METHODPR(T, GetNumAnimationStates, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numAnimationStates() const", AS_METHODPR(T, GetNumAnimationStates, () const, unsigned), AS_CALL_THISCALL);
+    // i32 AnimatedModel::GetNumAnimationStates() const
+    engine->RegisterObjectMethod(className, "int GetNumAnimationStates() const", AS_METHODPR(T, GetNumAnimationStates, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numAnimationStates() const", AS_METHODPR(T, GetNumAnimationStates, () const, i32), AS_CALL_THISCALL);
 
-    // unsigned AnimatedModel::GetNumMorphs() const
-    engine->RegisterObjectMethod(className, "uint GetNumMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, unsigned), AS_CALL_THISCALL);
-    engine->RegisterObjectMethod(className, "uint get_numMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, unsigned), AS_CALL_THISCALL);
+    // i32 AnimatedModel::GetNumMorphs() const
+    engine->RegisterObjectMethod(className, "int GetNumMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, i32), AS_CALL_THISCALL);
+    engine->RegisterObjectMethod(className, "int get_numMorphs() const", AS_METHODPR(T, GetNumMorphs, () const, i32), AS_CALL_THISCALL);
 
     // Skeleton& AnimatedModel::GetSkeleton()
     engine->RegisterObjectMethod(className, "Skeleton& GetSkeleton()", AS_METHODPR(T, GetSkeleton, (), Skeleton&), AS_CALL_THISCALL);
@@ -25116,8 +25116,8 @@ template <class T> void RegisterMembers_AnimatedModel(asIScriptEngine* engine, c
     // void AnimatedModel::RemoveAnimationState(AnimationState* state)
     engine->RegisterObjectMethod(className, "void RemoveAnimationState(AnimationState@+)", AS_METHODPR(T, RemoveAnimationState, (AnimationState*), void), AS_CALL_THISCALL);
 
-    // void AnimatedModel::RemoveAnimationState(unsigned index)
-    engine->RegisterObjectMethod(className, "void RemoveAnimationState(uint)", AS_METHODPR(T, RemoveAnimationState, (unsigned), void), AS_CALL_THISCALL);
+    // void AnimatedModel::RemoveAnimationState(i32 index)
+    engine->RegisterObjectMethod(className, "void RemoveAnimationState(int)", AS_METHODPR(T, RemoveAnimationState, (i32), void), AS_CALL_THISCALL);
 
     // void AnimatedModel::ResetMorphWeights()
     engine->RegisterObjectMethod(className, "void ResetMorphWeights()", AS_METHODPR(T, ResetMorphWeights, (), void), AS_CALL_THISCALL);
@@ -25132,8 +25132,8 @@ template <class T> void RegisterMembers_AnimatedModel(asIScriptEngine* engine, c
     // void AnimatedModel::SetMorphsAttr(const Vector<byte>& value)
     engine->RegisterObjectMethod(className, "void SetMorphsAttr(Array<byte>@+)", AS_FUNCTION_OBJFIRST(AnimatedModel_void_SetMorphsAttr_constspVectorlesbytegreamp_template<AnimatedModel>), AS_CALL_CDECL_OBJFIRST);
 
-    // void AnimatedModel::SetMorphWeight(unsigned index, float weight)
-    engine->RegisterObjectMethod(className, "void SetMorphWeight(uint, float)", AS_METHODPR(T, SetMorphWeight, (unsigned, float), void), AS_CALL_THISCALL);
+    // void AnimatedModel::SetMorphWeight(i32 index, float weight)
+    engine->RegisterObjectMethod(className, "void SetMorphWeight(int, float)", AS_METHODPR(T, SetMorphWeight, (i32, float), void), AS_CALL_THISCALL);
 
     // void AnimatedModel::SetMorphWeight(const String& name, float weight)
     engine->RegisterObjectMethod(className, "void SetMorphWeight(const String&in, float)", AS_METHODPR(T, SetMorphWeight, (const String&, float), void), AS_CALL_THISCALL);

+ 21 - 11
Source/Urho3D/Graphics/AnimatedModel.cpp

@@ -344,7 +344,7 @@ void AnimatedModel::SetModel(Model* model, bool createBones)
         }
 
         // Copy geometry bone mappings
-        const Vector<Vector<unsigned>>& geometryBoneMappings = model->GetGeometryBoneMappings();
+        const Vector<Vector<i32>>& geometryBoneMappings = model->GetGeometryBoneMappings();
         geometryBoneMappings_.Clear();
         geometryBoneMappings_.Reserve(geometryBoneMappings.Size());
         for (unsigned i = 0; i < geometryBoneMappings.Size(); ++i)
@@ -363,7 +363,7 @@ void AnimatedModel::SetModel(Model* model, bool createBones)
             newMorph.nameHash_ = morphs[i].nameHash_;
             newMorph.weight_ = 0.0f;
             newMorph.buffers_ = morphs[i].buffers_;
-            for (HashMap<unsigned, VertexBufferMorph>::ConstIterator j = morphs[i].buffers_.Begin();
+            for (HashMap<i32, VertexBufferMorph>::ConstIterator j = morphs[i].buffers_.Begin();
                  j != morphs[i].buffers_.End(); ++j)
                 morphElementMask_ |= j->second_.elementMask_;
             morphs_.Push(newMorph);
@@ -501,8 +501,10 @@ void AnimatedModel::RemoveAnimationState(AnimationState* state)
     }
 }
 
-void AnimatedModel::RemoveAnimationState(unsigned index)
+void AnimatedModel::RemoveAnimationState(i32 index)
 {
+    assert(index >= 0);
+
     if (index < animationStates_.Size())
     {
         animationStates_.Erase(index);
@@ -532,8 +534,10 @@ void AnimatedModel::SetUpdateInvisible(bool enable)
 }
 
 
-void AnimatedModel::SetMorphWeight(unsigned index, float weight)
+void AnimatedModel::SetMorphWeight(i32 index, float weight)
 {
+    assert(index >= 0);
+
     if (index >= morphs_.Size())
         return;
 
@@ -610,8 +614,9 @@ void AnimatedModel::ResetMorphWeights()
     MarkNetworkUpdate();
 }
 
-float AnimatedModel::GetMorphWeight(unsigned index) const
+float AnimatedModel::GetMorphWeight(i32 index) const
 {
+    assert(index >= 0);
     return index < morphs_.Size() ? morphs_[index].weight_ : 0.0f;
 }
 
@@ -669,8 +674,9 @@ AnimationState* AnimatedModel::GetAnimationState(StringHash animationNameHash) c
     return nullptr;
 }
 
-AnimationState* AnimatedModel::GetAnimationState(unsigned index) const
+AnimationState* AnimatedModel::GetAnimationState(i32 index) const
 {
+    assert(index >= 0);
     return index < animationStates_.Size() ? animationStates_[index].Get() : nullptr;
 }
 
@@ -1161,9 +1167,11 @@ void AnimatedModel::CloneGeometries()
     MarkMorphsDirty();
 }
 
-void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData, unsigned vertexCount, VertexBuffer* destBuffer,
+void AnimatedModel::CopyMorphVertices(void* destVertexData, void* srcVertexData, i32 vertexCount, VertexBuffer* destBuffer,
     VertexBuffer* srcBuffer)
 {
+    assert(vertexCount >= 0);
+
     VertexElements mask = destBuffer->GetElementMask() & srcBuffer->GetElementMask();
     unsigned normalOffset = srcBuffer->GetElementOffset(SEM_NORMAL);
     unsigned tangentOffset = srcBuffer->GetElementOffset(SEM_TANGENT);
@@ -1351,7 +1359,7 @@ void AnimatedModel::UpdateMorphs()
                     {
                         if (morphs_[j].weight_ != 0.0f)
                         {
-                            HashMap<unsigned, VertexBufferMorph>::Iterator k = morphs_[j].buffers_.Find(i);
+                            HashMap<i32, VertexBufferMorph>::Iterator k = morphs_[j].buffers_.Find(i);
                             if (k != morphs_[j].buffers_.End())
                                 ApplyMorph(buffer, dest, morphStart, k->second_, morphs_[j].weight_);
                         }
@@ -1366,17 +1374,19 @@ void AnimatedModel::UpdateMorphs()
     morphsDirty_ = false;
 }
 
-void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, unsigned morphRangeStart, const VertexBufferMorph& morph,
+void AnimatedModel::ApplyMorph(VertexBuffer* buffer, void* destVertexData, i32 morphRangeStart, const VertexBufferMorph& morph,
     float weight)
 {
+    assert(morphRangeStart >= 0);
+
     const VertexElements elementMask = morph.elementMask_ & buffer->GetElementMask();
     unsigned vertexCount = morph.vertexCount_;
     unsigned normalOffset = buffer->GetElementOffset(SEM_NORMAL);
     unsigned tangentOffset = buffer->GetElementOffset(SEM_TANGENT);
     unsigned vertexSize = buffer->GetVertexSize();
 
-    unsigned char* srcData = morph.morphData_;
-    auto* destData = (unsigned char*)destVertexData;
+    byte* srcData = morph.morphData_;
+    byte* destData = (byte*)destVertexData;
 
     while (vertexCount--)
     {

+ 10 - 10
Source/Urho3D/Graphics/AnimatedModel.h

@@ -63,7 +63,7 @@ public:
     /// Remove an animation by AnimationState pointer.
     void RemoveAnimationState(AnimationState* state);
     /// Remove an animation by index.
-    void RemoveAnimationState(unsigned index);
+    void RemoveAnimationState(i32 index);
     /// Remove all animations.
     void RemoveAllAnimationStates();
     /// Set animation LOD bias.
@@ -73,7 +73,7 @@ public:
     /// @property
     void SetUpdateInvisible(bool enable);
     /// Set vertex morph weight by index.
-    void SetMorphWeight(unsigned index, float weight);
+    void SetMorphWeight(i32 index, float weight);
     /// Set vertex morph weight by name.
     /// @property{set_morphWeights}
     void SetMorphWeight(const String& name, float weight);
@@ -93,7 +93,7 @@ public:
 
     /// Return number of animation states.
     /// @property
-    unsigned GetNumAnimationStates() const { return animationStates_.Size(); }
+    i32 GetNumAnimationStates() const { return animationStates_.Size(); }
 
     /// Return animation state by animation pointer.
     AnimationState* GetAnimationState(Animation* animation) const;
@@ -103,7 +103,7 @@ public:
     /// Return animation state by animation name hash.
     AnimationState* GetAnimationState(StringHash animationNameHash) const;
     /// Return animation state by index.
-    AnimationState* GetAnimationState(unsigned index) const;
+    AnimationState* GetAnimationState(i32 index) const;
 
     /// Return animation LOD bias.
     /// @property
@@ -121,10 +121,10 @@ public:
 
     /// Return number of vertex morphs.
     /// @property
-    unsigned GetNumMorphs() const { return morphs_.Size(); }
+    i32 GetNumMorphs() const { return morphs_.Size(); }
 
     /// Return vertex morph weight by index.
-    float GetMorphWeight(unsigned index) const;
+    float GetMorphWeight(i32 index) const;
     /// Return vertex morph weight by name.
     /// @property{get_morphWeights}
     float GetMorphWeight(const String& name) const;
@@ -152,7 +152,7 @@ public:
     const Vector<byte>& GetMorphsAttr() const;
 
     /// Return per-geometry bone mappings.
-    const Vector<Vector<unsigned>>& GetGeometryBoneMappings() const { return geometryBoneMappings_; }
+    const Vector<Vector<i32>>& GetGeometryBoneMappings() const { return geometryBoneMappings_; }
 
     /// Return per-geometry skin matrices. If empty, uses global skinning.
     const Vector<Vector<Matrix3x4>>& GetGeometrySkinMatrices() const { return geometrySkinMatrices_; }
@@ -188,7 +188,7 @@ private:
     /// Clone geometries for vertex morphing.
     void CloneGeometries();
     /// Copy morph vertices.
-    void CopyMorphVertices(void* destVertexData, void* srcVertexData, unsigned vertexCount, VertexBuffer* destBuffer, VertexBuffer* srcBuffer);
+    void CopyMorphVertices(void* destVertexData, void* srcVertexData, i32 vertexCount, VertexBuffer* destBuffer, VertexBuffer* srcBuffer);
     /// Recalculate animations. Called from Update().
     void UpdateAnimation(const FrameInfo& frame);
     /// Recalculate skinning.
@@ -197,7 +197,7 @@ private:
     void UpdateMorphs();
     /// Apply a vertex morph.
     void ApplyMorph
-        (VertexBuffer* buffer, void* destVertexData, unsigned morphRangeStart, const VertexBufferMorph& morph, float weight);
+        (VertexBuffer* buffer, void* destVertexData, i32 morphRangeStart, const VertexBufferMorph& morph, float weight);
     /// Handle model reload finished.
     void HandleModelReloadFinished(StringHash eventType, VariantMap& eventData);
 
@@ -212,7 +212,7 @@ private:
     /// Skinning matrices.
     Vector<Matrix3x4> skinMatrices_;
     /// Mapping of subgeometry bone indices, used if more bones than skinning shader can manage.
-    Vector<Vector<unsigned>> geometryBoneMappings_;
+    Vector<Vector<i32>> geometryBoneMappings_;
     /// Subgeometry skinning matrices, used if more bones than skinning shader can manage.
     Vector<Vector<Matrix3x4>> geometrySkinMatrices_;
     /// Subgeometry skinning matrix pointers, if more bones than skinning shader can manage.

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

@@ -870,7 +870,7 @@ bool DecalSet::GetBones(Drawable* target, unsigned batchIndex, const float* blen
 
     // Check whether target is using global or per-geometry skinning
     const Vector<Vector<Matrix3x4>>& geometrySkinMatrices = animatedModel->GetGeometrySkinMatrices();
-    const Vector<Vector<unsigned>>& geometryBoneMappings = animatedModel->GetGeometryBoneMappings();
+    const Vector<Vector<i32>>& geometryBoneMappings = animatedModel->GetGeometryBoneMappings();
 
     for (unsigned i = 0; i < 4; ++i)
     {

+ 36 - 19
Source/Urho3D/Graphics/Model.cpp

@@ -116,7 +116,7 @@ bool Model::BeginLoad(Deserializer& source)
         // Prepare vertex buffer data to be uploaded during EndLoad()
         if (async)
         {
-            desc.data_ = new unsigned char[desc.dataSize_];
+            desc.data_ = new byte[desc.dataSize_];
             source.Read(desc.data_.Get(), desc.dataSize_);
         }
         else
@@ -151,7 +151,7 @@ bool Model::BeginLoad(Deserializer& source)
             loadIBData_[i].indexCount_ = indexCount;
             loadIBData_[i].indexSize_ = indexSize;
             loadIBData_[i].dataSize_ = indexCount * indexSize;
-            loadIBData_[i].data_ = new unsigned char[loadIBData_[i].dataSize_];
+            loadIBData_[i].data_ = new byte[loadIBData_[i].dataSize_];
             source.Read(loadIBData_[i].data_.Get(), loadIBData_[i].dataSize_);
         }
         else
@@ -179,7 +179,7 @@ bool Model::BeginLoad(Deserializer& source)
     {
         // Read bone mappings
         unsigned boneMappingCount = source.ReadU32();
-        Vector<unsigned> boneMapping(boneMappingCount);
+        Vector<i32> boneMapping(boneMappingCount);
         for (unsigned j = 0; j < boneMappingCount; ++j)
             boneMapping[j] = source.ReadU32();
         geometryBoneMappings_.Push(boneMapping);
@@ -263,7 +263,7 @@ bool Model::BeginLoad(Deserializer& source)
             if (!!(newBuffer.elementMask_ & VertexElements::Tangent))
                 vertexSize += sizeof(Vector3);
             newBuffer.dataSize_ = newBuffer.vertexCount_ * vertexSize;
-            newBuffer.morphData_ = new unsigned char[newBuffer.dataSize_];
+            newBuffer.morphData_ = new byte[newBuffer.dataSize_];
 
             source.Read(&newBuffer.morphData_[0], newBuffer.vertexCount_ * vertexSize);
 
@@ -412,7 +412,7 @@ bool Model::Save(Serializer& dest) const
         dest.WriteU32(morphs_[i].buffers_.Size());
 
         // Write morph vertex buffers
-        for (HashMap<unsigned, VertexBufferMorph>::ConstIterator j = morphs_[i].buffers_.Begin();
+        for (HashMap<i32, VertexBufferMorph>::ConstIterator j = morphs_[i].buffers_.Begin();
              j != morphs_[i].buffers_.End(); ++j)
         {
             dest.WriteU32(j->first_);
@@ -470,8 +470,8 @@ void Model::SetBoundingBox(const BoundingBox& box)
     boundingBox_ = box;
 }
 
-bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<unsigned>& morphRangeStarts,
-    const Vector<unsigned>& morphRangeCounts)
+bool Model::SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<i32>& morphRangeStarts,
+    const Vector<i32>& morphRangeCounts)
 {
     for (unsigned i = 0; i < buffers.Size(); ++i)
     {
@@ -521,8 +521,10 @@ bool Model::SetIndexBuffers(const Vector<SharedPtr<IndexBuffer>>& buffers)
     return true;
 }
 
-void Model::SetNumGeometries(unsigned num)
+void Model::SetNumGeometries(i32 num)
 {
+    assert(num >= 0);
+
     geometries_.Resize(num);
     geometryBoneMappings_.Resize(num);
     geometryCenters_.Resize(num);
@@ -535,8 +537,11 @@ void Model::SetNumGeometries(unsigned num)
     }
 }
 
-bool Model::SetNumGeometryLodLevels(unsigned index, unsigned num)
+bool Model::SetNumGeometryLodLevels(i32 index, i32 num)
 {
+    assert(index >= 0);
+    assert(num >= 0);
+
     if (index >= geometries_.Size())
     {
         URHO3D_LOGERROR("Geometry index out of bounds");
@@ -552,8 +557,11 @@ bool Model::SetNumGeometryLodLevels(unsigned index, unsigned num)
     return true;
 }
 
-bool Model::SetGeometry(unsigned index, unsigned lodLevel, Geometry* geometry)
+bool Model::SetGeometry(i32 index, i32 lodLevel, Geometry* geometry)
 {
+    assert(index >= 0);
+    assert(lodLevel >= 0);
+
     if (index >= geometries_.Size())
     {
         URHO3D_LOGERROR("Geometry index out of bounds");
@@ -569,8 +577,10 @@ bool Model::SetGeometry(unsigned index, unsigned lodLevel, Geometry* geometry)
     return true;
 }
 
-bool Model::SetGeometryCenter(unsigned index, const Vector3& center)
+bool Model::SetGeometryCenter(i32 index, const Vector3& center)
 {
+    assert(index >= 0);
+
     if (index >= geometryCenters_.Size())
     {
         URHO3D_LOGERROR("Geometry index out of bounds");
@@ -586,7 +596,7 @@ void Model::SetSkeleton(const Skeleton& skeleton)
     skeleton_ = skeleton;
 }
 
-void Model::SetGeometryBoneMappings(const Vector<Vector<unsigned>>& geometryBoneMappings)
+void Model::SetGeometryBoneMappings(const Vector<Vector<i32>>& geometryBoneMappings)
 {
     geometryBoneMappings_ = geometryBoneMappings;
 }
@@ -698,12 +708,12 @@ SharedPtr<Model> Model::Clone(const String& cloneName) const
     for (Vector<ModelMorph>::Iterator i = ret->morphs_.Begin(); i != ret->morphs_.End(); ++i)
     {
         ModelMorph& morph = *i;
-        for (HashMap<unsigned, VertexBufferMorph>::Iterator j = morph.buffers_.Begin(); j != morph.buffers_.End(); ++j)
+        for (HashMap<i32, VertexBufferMorph>::Iterator j = morph.buffers_.Begin(); j != morph.buffers_.End(); ++j)
         {
             VertexBufferMorph& vbMorph = j->second_;
             if (vbMorph.dataSize_)
             {
-                SharedArrayPtr<unsigned char> cloneData(new unsigned char[vbMorph.dataSize_]);
+                SharedArrayPtr<byte> cloneData(new byte[vbMorph.dataSize_]);
                 memcpy(cloneData.Get(), vbMorph.morphData_.Get(), vbMorph.dataSize_);
                 vbMorph.morphData_ = cloneData;
             }
@@ -715,13 +725,17 @@ SharedPtr<Model> Model::Clone(const String& cloneName) const
     return ret;
 }
 
-unsigned Model::GetNumGeometryLodLevels(unsigned index) const
+i32 Model::GetNumGeometryLodLevels(i32 index) const
 {
+    assert(index >= 0);
     return index < geometries_.Size() ? geometries_[index].Size() : 0;
 }
 
-Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
+Geometry* Model::GetGeometry(i32 index, i32 lodLevel) const
 {
+    assert(index >= 0);
+    assert(lodLevel >= 0);
+
     if (index >= geometries_.Size() || geometries_[index].Empty())
         return nullptr;
 
@@ -731,8 +745,9 @@ Geometry* Model::GetGeometry(unsigned index, unsigned lodLevel) const
     return geometries_[index][lodLevel];
 }
 
-const ModelMorph* Model::GetMorph(unsigned index) const
+const ModelMorph* Model::GetMorph(i32 index) const
 {
+    assert(index >= 0);
     return index < morphs_.Size() ? &morphs_[index] : nullptr;
 }
 
@@ -752,13 +767,15 @@ const ModelMorph* Model::GetMorph(StringHash nameHash) const
     return nullptr;
 }
 
-unsigned Model::GetMorphRangeStart(unsigned bufferIndex) const
+i32 Model::GetMorphRangeStart(i32 bufferIndex) const
 {
+    assert(bufferIndex >= 0);
     return bufferIndex < vertexBuffers_.Size() ? morphRangeStarts_[bufferIndex] : 0;
 }
 
-unsigned Model::GetMorphRangeCount(unsigned bufferIndex) const
+i32 Model::GetMorphRangeCount(i32 bufferIndex) const
 {
+    assert(bufferIndex >= 0);
     return bufferIndex < vertexBuffers_.Size() ? morphRangeCounts_[bufferIndex] : 0;
 }
 

+ 33 - 33
Source/Urho3D/Graphics/Model.h

@@ -24,11 +24,11 @@ struct VertexBufferMorph
     /// Vertex elements.
     VertexElements elementMask_;
     /// Number of vertices.
-    unsigned vertexCount_;
+    i32 vertexCount_;
     /// Morphed vertices data size as bytes.
-    unsigned dataSize_;
+    i32 dataSize_;
     /// Morphed vertices. Stored packed as <index, data> pairs.
-    SharedArrayPtr<unsigned char> morphData_;
+    SharedArrayPtr<byte> morphData_;
 };
 
 /// Definition of a model's vertex morph.
@@ -41,33 +41,33 @@ struct ModelMorph
     /// Current morph weight.
     float weight_;
     /// Morph data per vertex buffer.
-    HashMap<unsigned, VertexBufferMorph> buffers_;
+    HashMap<i32, VertexBufferMorph> buffers_;
 };
 
 /// Description of vertex buffer data for asynchronous loading.
 struct VertexBufferDesc
 {
     /// Vertex count.
-    unsigned vertexCount_;
+    i32 vertexCount_;
     /// Vertex declaration.
     Vector<VertexElement> vertexElements_;
     /// Vertex data size.
-    unsigned dataSize_;
+    i32 dataSize_;
     /// Vertex data.
-    SharedArrayPtr<unsigned char> data_;
+    SharedArrayPtr<byte> data_;
 };
 
 /// Description of index buffer data for asynchronous loading.
 struct IndexBufferDesc
 {
     /// Index count.
-    unsigned indexCount_;
+    i32 indexCount_;
     /// Index size.
-    unsigned indexSize_;
+    i32 indexSize_;
     /// Index data size.
-    unsigned dataSize_;
+    i32 dataSize_;
     /// Index data.
-    SharedArrayPtr<unsigned char> data_;
+    SharedArrayPtr<byte> data_;
 };
 
 /// Description of a geometry for asynchronous loading.
@@ -76,13 +76,13 @@ struct GeometryDesc
     /// Primitive type.
     PrimitiveType type_;
     /// Vertex buffer ref.
-    unsigned vbRef_;
+    i32 vbRef_;
     /// Index buffer ref.
-    unsigned ibRef_;
+    i32 ibRef_;
     /// Index start.
-    unsigned indexStart_;
+    i32 indexStart_;
     /// Index count.
-    unsigned indexCount_;
+    i32 indexCount_;
 };
 
 /// 3D model resource.
@@ -110,25 +110,25 @@ public:
     /// @property
     void SetBoundingBox(const BoundingBox& box);
     /// Set vertex buffers and their morph ranges.
-    bool SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<unsigned>& morphRangeStarts,
-        const Vector<unsigned>& morphRangeCounts);
+    bool SetVertexBuffers(const Vector<SharedPtr<VertexBuffer>>& buffers, const Vector<i32>& morphRangeStarts,
+        const Vector<i32>& morphRangeCounts);
     /// Set index buffers.
     bool SetIndexBuffers(const Vector<SharedPtr<IndexBuffer>>& buffers);
     /// Set number of geometries.
     /// @property
-    void SetNumGeometries(unsigned num);
+    void SetNumGeometries(i32 num);
     /// Set number of LOD levels in a geometry.
     /// @property
-    bool SetNumGeometryLodLevels(unsigned index, unsigned num);
+    bool SetNumGeometryLodLevels(i32 index, i32 num);
     /// Set geometry.
-    bool SetGeometry(unsigned index, unsigned lodLevel, Geometry* geometry);
+    bool SetGeometry(i32 index, i32 lodLevel, Geometry* geometry);
     /// Set geometry center.
     /// @property{set_geometryCenters}
-    bool SetGeometryCenter(unsigned index, const Vector3& center);
+    bool SetGeometryCenter(i32 index, const Vector3& center);
     /// Set skeleton.
     void SetSkeleton(const Skeleton& skeleton);
     /// Set bone mappings when model has more bones than the skinning shader can handle.
-    void SetGeometryBoneMappings(const Vector<Vector<unsigned>>& geometryBoneMappings);
+    void SetGeometryBoneMappings(const Vector<Vector<i32>>& geometryBoneMappings);
     /// Set vertex morphs.
     void SetMorphs(const Vector<ModelMorph>& morphs);
     /// Clone the model. The geometry data is deep-copied and can be modified in the clone without affecting the original.
@@ -150,11 +150,11 @@ public:
 
     /// Return number of geometries.
     /// @property
-    unsigned GetNumGeometries() const { return geometries_.Size(); }
+    i32 GetNumGeometries() const { return geometries_.Size(); }
 
     /// Return number of LOD levels in geometry.
     /// @property
-    unsigned GetNumGeometryLodLevels(unsigned index) const;
+    i32 GetNumGeometryLodLevels(i32 index) const;
 
     /// Return geometry pointers.
     const Vector<Vector<SharedPtr<Geometry>>>& GetGeometries() const { return geometries_; }
@@ -163,7 +163,7 @@ public:
     const Vector<Vector3>& GetGeometryCenters() const { return geometryCenters_; }
 
     /// Return geometry by index and LOD level. The LOD level is clamped if out of range.
-    Geometry* GetGeometry(unsigned index, unsigned lodLevel) const;
+    Geometry* GetGeometry(i32 index, i32 lodLevel) const;
 
     /// Return geometry center by index.
     /// @property{get_geometryCenters}
@@ -174,25 +174,25 @@ public:
     }
 
     /// Return geometery bone mappings.
-    const Vector<Vector<unsigned>>& GetGeometryBoneMappings() const { return geometryBoneMappings_; }
+    const Vector<Vector<i32>>& GetGeometryBoneMappings() const { return geometryBoneMappings_; }
 
     /// Return vertex morphs.
     const Vector<ModelMorph>& GetMorphs() const { return morphs_; }
 
     /// Return number of vertex morphs.
     /// @property
-    unsigned GetNumMorphs() const { return morphs_.Size(); }
+    i32 GetNumMorphs() const { return morphs_.Size(); }
 
     /// Return vertex morph by index.
-    const ModelMorph* GetMorph(unsigned index) const;
+    const ModelMorph* GetMorph(i32 index) const;
     /// Return vertex morph by name.
     const ModelMorph* GetMorph(const String& name) const;
     /// Return vertex morph by name hash.
     const ModelMorph* GetMorph(StringHash nameHash) const;
     /// Return vertex buffer morph range start.
-    unsigned GetMorphRangeStart(unsigned bufferIndex) const;
+    i32 GetMorphRangeStart(i32 bufferIndex) const;
     /// Return vertex buffer morph range vertex count.
-    unsigned GetMorphRangeCount(unsigned bufferIndex) const;
+    i32 GetMorphRangeCount(i32 bufferIndex) const;
 
 private:
     /// Bounding box.
@@ -206,15 +206,15 @@ private:
     /// Geometries.
     Vector<Vector<SharedPtr<Geometry>>> geometries_;
     /// Geometry bone mappings.
-    Vector<Vector<unsigned>> geometryBoneMappings_;
+    Vector<Vector<i32>> geometryBoneMappings_;
     /// Geometry centers.
     Vector<Vector3> geometryCenters_;
     /// Vertex morphs.
     Vector<ModelMorph> morphs_;
     /// Vertex buffer morph range start.
-    Vector<unsigned> morphRangeStarts_;
+    Vector<i32> morphRangeStarts_;
     /// Vertex buffer morph range vertex count.
-    Vector<unsigned> morphRangeCounts_;
+    Vector<i32> morphRangeCounts_;
     /// Vertex buffer data for asynchronous loading.
     Vector<VertexBufferDesc> loadVBData_;
     /// Index buffer data for asynchronous loading.