| 133 | } |
| 134 | |
| 135 | Color32 StaticModel::GetVertexColor(int32 lodIndex, int32 meshIndex, int32 vertexIndex) const |
| 136 | { |
| 137 | if (Model && !Model->WaitForLoaded() && _vertexColorsCount == Model->GetLODsCount()) |
| 138 | { |
| 139 | if (lodIndex < 0 || lodIndex >= Model->GetLODsCount()) |
| 140 | { |
| 141 | LOG(Warning, "Specified model LOD index {0} was out of range.", lodIndex); |
| 142 | return Color32::Black; |
| 143 | } |
| 144 | |
| 145 | int32 index = 0; |
| 146 | const ModelLOD& lod = Model->LODs[lodIndex]; |
| 147 | auto& vertexColorsData = _vertexColorsData[lodIndex]; |
| 148 | if (vertexColorsData.Count() != lod.GetVertexCount()) |
| 149 | return Color32::Black; |
| 150 | for (int32 i = 0; i < lod.Meshes.Count(); i++) |
| 151 | { |
| 152 | const Mesh& mesh = lod.Meshes[i]; |
| 153 | if (i == meshIndex) |
| 154 | { |
| 155 | if (vertexIndex < 0 || vertexIndex >= mesh.GetVertexCount()) |
| 156 | { |
| 157 | LOG(Warning, "Specified vertex index {3} was out of range. LOD{0} mesh {1} has {2}.", lodIndex, meshIndex, mesh.GetVertexCount(), vertexIndex); |
| 158 | return Color32::Black; |
| 159 | } |
| 160 | index += vertexIndex; |
| 161 | return _vertexColorsData[lodIndex][index]; |
| 162 | } |
| 163 | index += mesh.GetVertexCount(); |
| 164 | } |
| 165 | |
| 166 | LOG(Warning, "Specified model mesh index was out of range. LOD{0} mesh {1}.", lodIndex, meshIndex); |
| 167 | } |
| 168 | |
| 169 | return Color32::Black; |
| 170 | } |
| 171 | |
| 172 | void StaticModel::SetVertexColor(int32 lodIndex, int32 meshIndex, int32 vertexIndex, const Color32& color) |
| 173 | { |
no test coverage detected