Cleanup: Remove using keyword for std::string in pbvh draw
Typically it's considered questionable to add `using` for `std` types and functions. With just a few more characters, the type is always familiar.
This commit is contained in:
@@ -68,8 +68,6 @@ using blender::ushort3;
|
||||
using blender::ushort4;
|
||||
using blender::Vector;
|
||||
|
||||
using string = std::string;
|
||||
|
||||
static bool valid_pbvh_attr(int type)
|
||||
{
|
||||
switch (type) {
|
||||
@@ -89,11 +87,11 @@ static bool valid_pbvh_attr(int type)
|
||||
struct PBVHVbo {
|
||||
uint64_t type;
|
||||
eAttrDomain domain;
|
||||
string name;
|
||||
std::string name;
|
||||
GPUVertBuf *vert_buf = nullptr;
|
||||
string key;
|
||||
std::string key;
|
||||
|
||||
PBVHVbo(eAttrDomain _domain, uint64_t _type, string _name)
|
||||
PBVHVbo(eAttrDomain _domain, uint64_t _type, std::string _name)
|
||||
: type(_type), domain(_domain), name(_name)
|
||||
{
|
||||
}
|
||||
@@ -103,20 +101,20 @@ struct PBVHVbo {
|
||||
GPU_vertbuf_clear(vert_buf);
|
||||
}
|
||||
|
||||
string build_key()
|
||||
std::string build_key()
|
||||
{
|
||||
char buf[512];
|
||||
|
||||
SNPRINTF(buf, "%d:%d:%s", int(type), int(domain), name.c_str());
|
||||
|
||||
key = string(buf);
|
||||
key = std::string(buf);
|
||||
return key;
|
||||
}
|
||||
};
|
||||
|
||||
struct PBVHBatch {
|
||||
Vector<int> vbos;
|
||||
string key;
|
||||
std::string key;
|
||||
GPUBatch *tris = nullptr, *lines = nullptr;
|
||||
int tris_count = 0, lines_count = 0;
|
||||
/* Coarse multi-resolution, will use full-sized VBOs only index buffer changes. */
|
||||
@@ -138,7 +136,7 @@ struct PBVHBatch {
|
||||
std::sort(vbos.begin(), vbos.end(), cmp(master_vbos));
|
||||
}
|
||||
|
||||
string build_key(Vector<PBVHVbo> &master_vbos)
|
||||
std::string build_key(Vector<PBVHVbo> &master_vbos)
|
||||
{
|
||||
key = "";
|
||||
|
||||
@@ -172,7 +170,7 @@ static const CustomData *get_cdata(eAttrDomain domain, const PBVH_GPU_Args &args
|
||||
|
||||
struct PBVHBatches {
|
||||
Vector<PBVHVbo> vbos;
|
||||
Map<string, PBVHBatch> batches;
|
||||
Map<std::string, PBVHBatch> batches;
|
||||
GPUIndexBuf *tri_index = nullptr;
|
||||
GPUIndexBuf *lines_index = nullptr;
|
||||
int faces_count = 0; /* Used by PBVH_BMESH and PBVH_GRIDS */
|
||||
@@ -252,9 +250,9 @@ struct PBVHBatches {
|
||||
GPU_INDEXBUF_DISCARD_SAFE(lines_index_coarse);
|
||||
}
|
||||
|
||||
string build_key(PBVHAttrReq *attrs, int attrs_num, bool do_coarse_grids)
|
||||
std::string build_key(PBVHAttrReq *attrs, int attrs_num, bool do_coarse_grids)
|
||||
{
|
||||
string key;
|
||||
std::string key;
|
||||
PBVHBatch batch;
|
||||
Vector<PBVHVbo> vbos;
|
||||
|
||||
@@ -265,7 +263,7 @@ struct PBVHBatches {
|
||||
continue;
|
||||
}
|
||||
|
||||
PBVHVbo vbo(attr->domain, attr->type, string(attr->name));
|
||||
PBVHVbo vbo(attr->domain, attr->type, std::string(attr->name));
|
||||
vbo.build_key();
|
||||
|
||||
vbos.append(vbo);
|
||||
@@ -277,7 +275,7 @@ struct PBVHBatches {
|
||||
return batch.key;
|
||||
}
|
||||
|
||||
bool has_vbo(eAttrDomain domain, int type, string name)
|
||||
bool has_vbo(eAttrDomain domain, int type, std::string name)
|
||||
{
|
||||
for (PBVHVbo &vbo : vbos) {
|
||||
if (vbo.domain == domain && vbo.type == type && vbo.name == name) {
|
||||
@@ -299,7 +297,7 @@ struct PBVHBatches {
|
||||
return -1;
|
||||
}
|
||||
|
||||
PBVHVbo *get_vbo(eAttrDomain domain, int type, string name)
|
||||
PBVHVbo *get_vbo(eAttrDomain domain, int type, std::string name)
|
||||
{
|
||||
for (PBVHVbo &vbo : vbos) {
|
||||
if (vbo.domain == domain && vbo.type == type && vbo.name == name) {
|
||||
@@ -852,7 +850,10 @@ struct PBVHBatches {
|
||||
}
|
||||
}
|
||||
|
||||
void create_vbo(eAttrDomain domain, const uint32_t type, string name, const PBVH_GPU_Args &args)
|
||||
void create_vbo(eAttrDomain domain,
|
||||
const uint32_t type,
|
||||
std::string name,
|
||||
const PBVH_GPU_Args &args)
|
||||
{
|
||||
PBVHVbo vbo(domain, type, name);
|
||||
GPUVertFormat format;
|
||||
|
||||
Reference in New Issue
Block a user